@mateosuarezdev/react-ui 1.0.9 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +168 -152
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),d=require("react"),be=require("react-dom"),Ve=require("clsx"),Xe=require("tailwind-merge"),qe=require("@mateosuarezdev/atoms"),D=require("react-hook-form"),P=require("@hookform/resolvers"),z=require("lucide-react"),de=require("framer-motion"),p=(...e)=>Xe.twMerge(Ve.clsx(e));function H(e,n=100){let r=null,t=null;return function(...a){const l=Date.now();r===null||l-r>=n?(e.apply(this,a),r=l):(t&&clearTimeout(t),t=setTimeout(()=>{e.apply(this,a),r=Date.now()},n-(l-r)))}}function Ue(e,n=500){let r=null;return function(...t){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,t),r=null},n)}}function pe(e){if(!e)return"";const r=e.trim().replace(/\s+/g," ").split(" ");return r.length===0||r[0]===""?"":r.length===1?r[0].charAt(0).toUpperCase():(r[0].charAt(0)+r[1].charAt(0)).toUpperCase()}function xe(e){e.focus();const n=e.value.length;e.setSelectionRange(n,n)}function ge(e){return e.replace(/\s/g,"")}function Pe(e){return e.toLowerCase().split(" ").map(a=>{if(a.length===0)return a;const l=[...a][0],s=a.slice(l.length);return l.toUpperCase()+s}).join(" ")}function se(e){return e===null?"":e}function G(e){return ge(e)===""?null:e}function Ze(e,n,r={}){const t={...r};return Object.keys(n).forEach(a=>{if(n[a]===!0&&a in e){const l=a;t[l]=e[l]}}),t}class Ye{constructor(){this.container=null,this.previouslyFocusedElement=null}enable(){this.container&&(this.previouslyFocusedElement=document.activeElement,this.container.addEventListener("keydown",this.trapFocus.bind(this)),document.addEventListener("click",this.handleClickOutside.bind(this)))}disable(){this.container&&(this.container.removeEventListener("keydown",this.trapFocus.bind(this)),document.removeEventListener("click",this.handleClickOutside.bind(this)),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}setContainer(n){this.disable(),this.container=n,this.enable()}trapFocus(n){const r=this.container?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r)return;const t=r[0],a=r[r.length-1];n.key==="Tab"&&(n.shiftKey&&document.activeElement===t?(n.preventDefault(),a.focus()):!n.shiftKey&&document.activeElement===a&&(n.preventDefault(),t.focus()))}handleClickOutside(n){this.container&&!this.container.contains(n.target)&&(n.preventDefault(),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}}const q=e=>{const n=e.scrollWidth>e.clientWidth,r=e.scrollHeight>e.clientHeight,t=Math.max(0,e.scrollWidth-e.clientWidth),a=Math.max(0,e.scrollHeight-e.clientHeight);return{horizontal:n,vertical:r,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,canScrollLeft:e.scrollLeft>10,canScrollRight:e.scrollLeft<t-10,canScrollUp:e.scrollTop>0,canScrollDown:e.scrollTop<a,scrollPercentageX:n&&t>0?e.scrollLeft/t*100:0,scrollPercentageY:r&&a>0?e.scrollTop/a*100:0}},Ge=({onOverflow:e,trackScroll:n=!1,withObserver:r=!1,enabled:t=!0,deps:a=[]}={})=>{const l=d.useRef(null);return d.useEffect(()=>{if(!l.current||!t)return;let s=!1;const i=H(()=>{if(l.current){const x=q(l.current);e?.(x)}}),c=q(l.current);s=c.horizontal||c.vertical,e?.(c),window.addEventListener("resize",i);let f=null;r&&(f=new ResizeObserver(i),l.current&&f.observe(l.current));let h=null;return n&&s&&(h=l.current,h.addEventListener("scroll",i)),()=>{window.removeEventListener("resize",i),f&&f.disconnect(),h&&s&&h.removeEventListener("scroll",i)}},[t,...a]),{ref:l}},Je=({trackScroll:e=!1,withObserver:n=!1,enabled:r=!0,deps:t=[]}={})=>{const a=d.useRef(null),[l,s]=d.useState(null);return d.useEffect(()=>{if(!a.current||!r)return;let o=!1;const c=H(()=>{if(a.current){const b=q(a.current);s(b)}}),f=q(a.current);o=f.horizontal||f.vertical,s(f),window.addEventListener("resize",c);let h=null;n&&(h=new ResizeObserver(c),a.current&&h.observe(a.current));let x=null;return e&&o&&(x=a.current,x.addEventListener("scroll",c)),()=>{window.removeEventListener("resize",c),h&&h.disconnect(),x&&o&&x.removeEventListener("scroll",c)}},[r,...t]),{ref:a,overflowInfo:l}},te={xs:"w-8 h-8",sm:"w-10 h-10 text-lg",md:"w-14 h-14 text-xl",lg:"h-20 w-20 text-2xl",xl:"h-24 w-24 text-2xl"},He=({src:e,name:n,size:r="md",className:t})=>e?u.jsx("img",{alt:"avatar",src:e,className:p("rounded-full bg-base-3",te[r])}):n?u.jsx("p",{className:p("rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center",te[r],t),children:pe(n)}):u.jsx("div",{className:p("rounded-full text-2xl font-medium flex items-center justify-center","bg-base-2 dark-theme:bg-base-3 border border-base-4","lg:hover:bg-base-3 max-lg:active:bg-base-4 transition-colors",te[r],t),children:u.jsxs(Ne,{size:r==="xs"?16:r==="sm"?20:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),u.jsx("circle",{cx:"12",cy:"7",r:"4"})]})});function Qe({className:e,children:n,animate:r=!1,...t}){return u.jsx("div",{className:p("flex -space-x-3 rtl:space-x-reverse",e),...t,children:n})}function We(e){return d.useSyncExternalStore(n=>e.subscribe(n),()=>e.get(),()=>e.get())}const ne=qe.atom(!0);let re=!1;const he=H(()=>{ne.set(window.innerWidth>1024)});typeof window<"u"&&(re&&(window.removeEventListener("resize",he),re=!1),window.addEventListener("resize",he),re=!0);const ve=()=>(d.useEffect(()=>{ne.set(window.innerWidth>1024)},[]),We(ne));function we(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}const ye=(e=!0,n)=>{const r=ve(),t=d.useRef(null),a=d.useCallback(l=>{if(!e||r)return;const s=t.current;if(!s)return;const o=s.getBoundingClientRect(),i=Math.max(o.width,o.height),c=l.clientX-o.left-i/2,f=l.clientY-o.top-i/2,h=document.createElement("span");h.classList.add("ripple-wrapper");const x=document.createElement("span");x.classList.add("ripple"),x.style.backgroundColor=n?"var(--ripple-contrast)":"var(--ripple-main)",x.style.width=`${i}px`,x.style.height=`${i}px`,x.style.left=`${c}px`,x.style.top=`${f}px`,h.appendChild(x);const b=s.getElementsByClassName("ripple-wrapper");if(b?.length)for(const g of b)g.remove();s.appendChild(h),setTimeout(()=>{h.remove()},700)},[e,r,n]);return{ref:t,ripple:a,styles:{position:"relative"}}},je=({scrollerId:e,align:n="start",side:r="bottom",offset:t=8,collisionPadding:a=8,avoidCollisions:l=!0,closeOnScroll:s=!0,onOpen:o,onClose:i}={})=>{const[c,f]=d.useState(!1),[h,x]=d.useState({width:192,height:300}),b=d.useRef(null),g=d.useRef(null),v=d.useRef({left:0,right:0,top:0,bottom:0,x:0,y:0,width:0,height:0}),w=d.useRef(null),N=d.useId(),E=d.useCallback(C=>{const O=C??v.current;if(!O)return{x:0,top:0,bottom:void 0};const L=h.width,T=h.height;return ke({triggerRect:O,popoverWidth:L,popoverHeight:T,align:n,side:r,offset:t,collisionPadding:a,avoidCollisions:l})},[v.current,h,n,r]);d.useEffect(()=>{if(!c||!e||(w.current=document.getElementById(e),!w.current))return;c&&F();const C=()=>{w.current&&(f(!1),o?.(),w.current.removeEventListener("scroll",C))};return s&&w.current.addEventListener("scroll",C,{passive:!0}),()=>{w.current&&w.current.removeEventListener("scroll",C)}},[c,e]);const F=()=>{g.current&&x({width:g.current.offsetWidth,height:g.current.offsetHeight})},S=d.useCallback(()=>{if(!b.current)return;const C=b.current.getBoundingClientRect();v.current={left:C.left,right:C.right,top:C.top,bottom:C.bottom,x:C.x,y:C.y,width:C.width,height:C.height},f(O=>(O?i?.():o?.(),!O))},[]),A=d.useCallback(()=>{f(!1),i?.()},[]);return{triggerRef:b,triggerProps:{id:N,"aria-expanded":c,"aria-haspopup":!0},popoverRef:g,getPopoverPosition:E,open:c,toggle:S,close:A}},ke=({triggerRect:e,popoverWidth:n,popoverHeight:r,align:t="start",side:a="bottom",offset:l=4,collisionPadding:s=8,avoidCollisions:o=!0})=>{const i={width:window.innerWidth,height:window.innerHeight};let c=0,f=0;if(o){if(a==="right"){const b=e.right+l,g=e.left-n-l,v=Math.max(0,b+n-(i.width-s)),w=Math.max(0,s-g);v<=w?(c=b,v>0&&(c=i.width-n-s)):(c=g,w>0&&(c=s)),f=e.top,f+r>i.height-s&&(f=i.height-r-s),f<s&&(f=s)}else if(a==="left"){const b=e.left-n-l,g=e.right+l,v=Math.max(0,s-b),w=Math.max(0,g+n-(i.width-s));v<=w?(c=b,v>0&&(c=s)):(c=g,w>0&&(c=i.width-n-s)),f=e.top,f+r>i.height-s&&(f=i.height-r-s),f<s&&(f=s)}else if(a==="bottom"){const b=i.height-e.bottom,g=e.top;b>=r+l?f=e.bottom+l:g>=r+l?f=e.top-r-l:(f=e.bottom+l,f=Math.min(f,i.height-r-s));const v=i.width-e.left,w=e.right;if(t==="start")c=e.left,c+n>i.width-s&&(w>=n?c=e.right-n:c=i.width-n-s);else if(t==="end")c=e.right-n,c<s&&(v>=n?c=e.left:c=s);else{const N=e.left+e.width/2-n/2;N>=s&&N+n<=i.width-s?c=N:N<s?c=s:c=i.width-n-s}}else{const b=e.top,g=i.height-e.bottom;b>=r+l?f=e.top-r-l:g>=r+l?f=e.bottom+l:(f=e.top-r-l,f=Math.max(s,f));const v=i.width-e.left,w=e.right;if(t==="start")c=e.left,c+n>i.width-s&&(w>=n?c=e.right-n:c=i.width-n-s);else if(t==="end")c=e.right-n,c<s&&(v>=n?c=e.left:c=s);else{const N=e.left+e.width/2-n/2;N>=s&&N+n<=i.width-s?c=N:N<s?c=s:c=i.width-n-s}}c=Math.max(s,Math.min(c,i.width-n-s)),f=Math.max(s,Math.min(f,i.height-r-s))}else a==="right"?(c=e.right+l,f=e.top):a==="left"?(c=e.left-n-l,f=e.top):a==="bottom"?f=e.bottom+l:f=e.top-r-l,(a==="top"||a==="bottom")&&(t==="start"?c=e.left:t==="end"?c=e.right-n:c=e.left+e.width/2-n/2);let h,x;return f+r<=e.top?x=window.innerHeight-(f+r):h=f,{x:c,top:h,bottom:x}};function et(e){const n=d.useRef(null);return d.useEffect(()=>{const r=t=>{n.current&&!n.current.contains(t.target)&&e()};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e]),n}function tt(e,n={}){const{enabled:r=!0,events:t=["mousedown","touchstart"],excludeRefs:a=[]}=n,l=d.useRef(null);return d.useEffect(()=>{if(!r)return;const s=o=>{const i=o.target;l.current?.contains(i)||a.some(f=>f.current?.contains(i))||e()};return t.forEach(o=>{document.addEventListener(o,s)}),()=>{t.forEach(o=>{document.removeEventListener(o,s)})}},[e,r,t,a]),l}function Ce(e,n,r=!0){d.useEffect(()=>{if(!r)return;const t=a=>{e.current&&!e.current.contains(a.target)&&n(a)};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[e,n,r])}const rt="relative shrink-0 select-none transition outline-none duration-200 ease-out focus:ring-border-brand-light flex items-center justify-center cursor-pointer",nt={xs:"text-xs px-1 gap-x-0.5 py-1",sm:"text-sm px-2.5 gap-x-1 py-1.5",mdsm:"text-sm px-3 gap-x-1.5 py-2.5",md:"text-base px-4 gap-x-1.5 py-2.5",lg:"text-base px-4 gap-x-1.5 py-3.5",picker:"text-base px-2 py-2 gap-x-1.5",iconXs:"text-xs p-1",iconSm:"text-sm p-2",iconMd:"text-base p-3",iconLg:"text-base p-4"},st={all:"focus:ring-1",desktop:"lg:focus:ring-1",mobile:"focus:ring-1 lg:focus-ring-0",none:""},ot={light:"font-light",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},lt={none:"rounded-none",1:"rounded-1",2:"rounded-2",3:"rounded-3",4:"rounded-4",5:"rounded-5",6:"rounded-6",7:"rounded-7",8:"rounded-8",9:"rounded-9",10:"rounded-10",11:"rounded-11",12:"rounded-12",full:"rounded-full"},at={transparent:"text-base-12 lg:hover:bg-base-4 focus:ring-base-6",transparentinactive:"text-base-11 lg:hover:bg-base-4",brand:"bg-brand text-brand-text lg:hover:bg-brand-hover focus:ring-base-6 border border-transparent",accent:"bg-accent text-accent-text lg:hover:bg-accent-hover",contrast:"bg-base-12 text-base-1 lg:hover:bg-base-11 focus:ring-base-6",solid:"bg-base-3 dark-theme:bg-base-3 lg:hover:bg-base-4 border border-base-4 focus:ring-base-5",solidhybrid:"border border-base-5 dark-theme:border-base-4 dark-theme:bg-base-3 lg:hover:bg-base-4 focus:ring-base-6",outline:"border border-base-6 lg:hover:bg-base-3 focus:ring-base-6",info:"bg-blue-3 text-blue-9 lg:hover:bg-blue-4 lg:active:bg-blue-5 focus:ring-blue-9 border border-transparent",success:"bg-green-4 text-green-9 lg:hover:bg-green-5 lg:active:bg-green-6 focus:ring-green-9 border border-transparent",warning:"bg-yellow-4 text-yellow-9 lg:hover:bg-yellow-5 lg:active:bg-yellow-6 focus:ring-yellow-9 border border-transparent",danger:"bg-red-4 text-red-9 lg:hover:bg-red-5 focus:ring-red-9 border border-transparent",dangersolid:"bg-red-9 text-base-1 dark-theme:text-base-12 lg:hover:bg-red-8 focus:ring-base-6 border border-transparent",disabled:"bg-base-3 text-base-11 border border-transparent"},it={enabled:"",disabled:"opacity-75",loading:""},J=d.forwardRef(({color:e="transparent",size:n="mdsm",fontWeight:r="normal",rounded:t="6",state:a="enabled",onClick:l,className:s,children:o,withRipple:i=!0,contrastRipple:c,showFocus:f="desktop",withDisabledDelay:h=!1,type:x="button",...b},g)=>{const[v,w]=d.useState(!1),N=A=>{a==="enabled"&&(h?(w(!0),l&&l(A),setTimeout(()=>w(!1),1e3)):l&&l(A))},{ref:E,ripple:F}=ye(i,e==="contrast"||c),S=we(E,g);return u.jsx("button",{ref:S,type:x,disabled:b.disabled?b.disabled:a==="disabled"||a==="loading",onMouseDown:F,onClick:A=>v?null:N(A),className:p(rt,nt[n],ot[r],lt[t],st[f],at[e],it[a],b.disabled&&"opacity-50",s),...b,children:o})});J.displayName="Button";const ct=({className:e})=>u.jsx("div",{className:p("w-full h-px bg-base-4",e)}),Ne=({children:e,size:n=24,strokeWidth:r=2,viewBox:t="0 0 24 24",className:a,...l})=>u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:t,className:a,...l,children:e}),Ee=({loading:e=!0,wrapperClassName:n,spinnerClassName:r})=>u.jsx("div",{className:p("flex justify-center",n),children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",className:p({"animate-spin":e},r),children:u.jsx("path",{fill:"currentColor",d:"M10 3a7 7 0 0 0-7 7a.5.5 0 0 1-1 0a8 8 0 1 1 8 8a.5.5 0 0 1 0-1a7 7 0 1 0 0-14Z"})})}),Se=({children:e,node:n})=>be.createPortal(e,n??document.body);function Ae(e,n,r){function t(o,i){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(e),n(o,i);for(const f in s.prototype)f in o||Object.defineProperty(o,f,{value:s.prototype[f].bind(o)});o._zod.constr=s,o._zod.def=i}const a=r?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function s(o){var i;const c=r?.Parent?new l:this;t(c,o),(i=c._zod).deferred??(i.deferred=[]);for(const f of c._zod.deferred)f();return c}return Object.defineProperty(s,"init",{value:t}),Object.defineProperty(s,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class ut extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ft={};function Fe(e){return ft}function dt(e,n){return typeof n=="bigint"?n.toString():n}const Oe=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Z(e){return typeof e=="string"?e:e?.message}function $e(e,n,r){const t={...e,path:e.path??[]};if(!e.message){const a=Z(e.inst?._zod.def?.error?.(e))??Z(n?.error?.(e))??Z(r.customError?.(e))??Z(r.localeError?.(e))??"Invalid input";t.message=a}return delete t.inst,delete t.continue,n?.reportInput||delete t.input,t}const Ie=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(n,dt,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ht=Ae("$ZodError",Ie),Me=Ae("$ZodError",Ie,{Parent:Error}),mt=e=>(n,r,t,a)=>{const l=t?Object.assign(t,{async:!1}):{async:!1},s=n._zod.run({value:r,issues:[]},l);if(s instanceof Promise)throw new ut;if(s.issues.length){const o=new(a?.Err??e)(s.issues.map(i=>$e(i,l,Fe())));throw Oe(o,a?.callee),o}return s.value},bt=mt(Me),pt=e=>async(n,r,t,a)=>{const l=t?Object.assign(t,{async:!0}):{async:!0};let s=n._zod.run({value:r,issues:[]},l);if(s instanceof Promise&&(s=await s),s.issues.length){const o=new(a?.Err??e)(s.issues.map(i=>$e(i,l,Fe())));throw Oe(o,a?.callee),o}return s.value},xt=pt(Me);function me(e,n){try{var r=e()}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}function gt(e,n){for(var r={};e.length;){var t=e[0],a=t.code,l=t.message,s=t.path.join(".");if(!r[s])if("unionErrors"in t){var o=t.unionErrors[0].errors[0];r[s]={message:o.message,type:o.code}}else r[s]={message:l,type:a};if("unionErrors"in t&&t.unionErrors.forEach(function(f){return f.errors.forEach(function(h){return e.push(h)})}),n){var i=r[s].types,c=i&&i[t.code];r[s]=D.appendErrors(s,n,r,a,c?[].concat(c,t.message):t.message)}e.shift()}return r}function vt(e,n){for(var r={};e.length;){var t=e[0],a=t.code,l=t.message,s=t.path.join(".");if(!r[s])if(t.code==="invalid_union"&&t.errors.length>0){var o=t.errors[0][0];r[s]={message:o.message,type:o.code}}else r[s]={message:l,type:a};if(t.code==="invalid_union"&&t.errors.forEach(function(f){return f.forEach(function(h){return e.push(h)})}),n){var i=r[s].types,c=i&&i[t.code];r[s]=D.appendErrors(s,n,r,a,c?[].concat(c,t.message):t.message)}e.shift()}return r}function wt(e,n,r){if(r===void 0&&(r={}),(function(t){return"_def"in t&&typeof t._def=="object"&&"typeName"in t._def})(e))return function(t,a,l){try{return Promise.resolve(me(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](t,n)).then(function(s){return l.shouldUseNativeValidation&&P.validateFieldsNatively({},l),{errors:{},values:r.raw?Object.assign({},t):s}})},function(s){if((function(o){return Array.isArray(o?.issues)})(s))return{values:{},errors:P.toNestErrors(gt(s.errors,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw s}))}catch(s){return Promise.reject(s)}};if((function(t){return"_zod"in t&&typeof t._zod=="object"})(e))return function(t,a,l){try{return Promise.resolve(me(function(){return Promise.resolve((r.mode==="sync"?bt:xt)(e,t,n)).then(function(s){return l.shouldUseNativeValidation&&P.validateFieldsNatively({},l),{errors:{},values:r.raw?Object.assign({},t):s}})},function(s){if((function(o){return o instanceof ht})(s))return{values:{},errors:P.toNestErrors(vt(s.issues,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}function yt({methods:e,onSubmit:n,onError:r,children:t,logErrors:a,className:l}){return u.jsx(D.FormProvider,{...e,children:u.jsx("form",{className:p("mt-4 lg:mt-8 grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-8 relative",l),onSubmit:e.handleSubmit(s=>n(s),s=>{a&&console.log(s),r?.(s)}),children:t})})}function jt(e,n){return D.useForm({resolver:wt(e),defaultValues:n})}const Y={unchecked:"bg-base-3 lg:hover:bg-base-4",checked:"bg-brand lg:hover:bg-brand-hover text-brand-text",uncheckedDisabled:"bg-base-3 border-base-4",checkedDisabled:"bg-base-3 border-base-4 text-base-10"},ze=d.forwardRef(({checked:e=!1,onCheckedChange:n,disabled:r=!1,required:t=!1,name:a,value:l,id:s,className:o="",size:i="sm",...c},f)=>{const h=()=>{r||n?.(e==="indeterminate"?!0:!e)},x=v=>{(v.key===" "||v.key==="Enter")&&(v.preventDefault(),h())},b={xs:"h-3.5 w-3.5",sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},g={xs:24,sm:12,md:14,lg:16};return u.jsxs(u.Fragment,{children:[u.jsxs("button",{ref:f,type:"button",role:"checkbox","aria-checked":e==="indeterminate"?"mixed":e,"aria-required":t,disabled:r,onClick:h,onKeyDown:x,className:p("inline-flex items-center justify-center rounded-2 border border-base-4 transition-all duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-base-5",b[i],r&&"cursor-not-allowed opacity-75",!r&&"cursor-pointer",e?r?Y.checkedDisabled:Y.checked:r?Y.uncheckedDisabled:Y.unchecked,typeof o=="function"?o(e):o),...c,children:[e===!0&&u.jsx(z.Check,{size:g[i],className:"stroke-current"}),e==="indeterminate"&&u.jsx(z.Minus,{size:g[i],className:"stroke-current"})]}),u.jsx("input",{type:"checkbox",name:a,value:l,checked:e===!0,onChange:()=>{},disabled:r,required:t,id:s,className:"sr-only",tabIndex:-1})]})});ze.displayName="Checkbox";const kt={solid:"bg-base-3 border border-base-4 drop-shadow-sm dark-theme:drop-shadow-none",outline:"border border-base-6"},Ct={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},oe=d.forwardRef(({label:e,description:n,labelPosition:r="default",color:t="solid",focusColor:a="brand",placeholder:l,valid:s,error:o,errorMessage:i,isPrice:c,prefix:f,wrapperClassName:h,containerClassName:x,className:b,type:g="text",value:v,...w},N)=>{const E=d.useRef(null),F=d.useRef(!1),[S,A]=d.useState(!1),[C,O]=d.useState(!1),L=g==="password",T=L&&S?"text":c?"number":g,V=v!==""&&v!==null&&v!==void 0;return d.useEffect(()=>{if(!F.current){F.current=!0;return}E.current&&xe(E.current)},[S,E]),u.jsxs("div",{className:p("relative",h),children:[e&&r==="default"&&u.jsx("label",{className:p("font-medium ml-0.5 text-xs",o&&"text-red-9"),children:e}),u.jsxs("div",{className:p("rounded-6 transition cursor-text relative",kt[t],{"pt-[22px] pb-1.5":r==="floating",[Ct[a]]:!o&&C,"bg-red-4 text-red-9":!!o,"ring-1 ring-red-9":!!o&&C},x),children:[e&&r==="floating"&&u.jsx("label",{className:p("absolute transition-all duration-200 pointer-events-none","text-sm top-[18px] font-semibold left-3",{"text-xs top-2.5":C||V||l,"text-red-9":!!o}),children:e}),c&&u.jsx(z.DollarSign,{size:16,className:p("absolute top-1/2 -translate-y-1/2 left-3",o?"text-red-9":"text-base-11")}),f&&u.jsx("p",{className:"text-sm text-base-11 absolute top-1/2 -translate-y-1/2 left-3",children:f}),u.jsx("input",{ref:_=>{N&&(typeof N=="function"?N(_):N.current=_),E.current=_},type:T,className:p("w-full bg-transparent focus:outline-none","placeholder:text-sm text-sm placeholder:text-base-11",c||f?"pl-9":"pl-3",{"py-2.5":r==="default","mt-1.5":r==="floating","pr-10":s,"text-red-9 placeholder:text-red-9":!!o},b),value:v,placeholder:l,onFocus:()=>O(!0),onBlur:()=>O(!1),...w})]}),s?u.jsx(z.CheckIcon,{size:20,className:`absolute top-1/2 -translate-y-1/2 text-green-500 ${L?"right-10":"right-3"}`}):null,L&&u.jsx("button",{type:"button",className:p(r==="floating"?"absolute right-3 top-1/2 -translate-y-1/2":"absolute right-3 top-10"),onClick:()=>{A(!S)},children:S?u.jsx(z.EyeOffIcon,{size:20,className:p(o?"text-red-9":"text-base-11")}):u.jsx(z.Eye,{size:20,className:p(o?"text-red-9":"text-base-11")})}),i?u.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:i}):n?u.jsx("p",{className:"text-xs text-base-11 mt-1 ml-0.5",children:n}):null]})});oe.displayName="Input";const Nt=({name:e,customRead:n,customSet:r,withNullSet:t=!0,...a})=>{const{control:l}=D.useFormContext(),s=d.useCallback(i=>n?n(i):i===null?se(i):i,[n]),o=d.useCallback(i=>r?t&&i===null?G(i):r(i):i===null?G(i):i,[r]);return l?u.jsx(D.Controller,{name:e,control:l,render:({field:i,fieldState:c})=>u.jsx(oe,{value:s(i.value),onChange:f=>i.onChange(o(f.target.value)),error:!!c.error,errorMessage:c.error?.message,ref:i.ref,...a})}):(console.error(`Form control is missing for field: ${e}`),u.jsxs("p",{children:["Form control missing for field: ",e]}))},Et={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},le=d.forwardRef(({label:e,labelPosition:n="default",placeholder:r,error:t,focusColor:a="brand",className:l,value:s,rows:o=3,...i},c)=>{const[f,h]=d.useState(!1),x=s!==""&&s!==null&&s!==void 0;return u.jsxs("div",{className:"relative",children:[n==="default"?u.jsx("label",{className:p("top-[18px] font-medium ml-0.5 text-xs",t&&"text-red-9"),children:e}):null,u.jsxs("div",{className:p(n==="default"?"p-0":"pt-5 pb-2",{"bg-red-4 text-red-9":!!t}),children:[n==="floating"&&u.jsx("label",{className:p("absolute transition-all duration-200 pointer-events-none","text-sm top-2.5 font-semibold left-2.5",{"text-xs top-2.5":f||x||r,"text-red-9":!!t}),children:e}),u.jsx("textarea",{ref:c,className:p(!t&&f&&Et[a],"bg-base-3 border border-base-4 light-theme:drop-shadow-sm rounded-6 w-full focus:outline-none customscrollbarnohide","placeholder:text-base-11 text-sm","resize-none",n==="default"?"p-3":"mt-1",{"text-red-9 placeholder:text-red-9":!!t},l),value:s,placeholder:r,onFocus:()=>h(!0),onBlur:()=>h(!1),rows:o,...i})]})]})});le.displayName="TextArea";const St=({name:e,customRead:n,customSet:r,...t})=>{const{control:a}=D.useFormContext(),l=d.useCallback(o=>n?n(o):o===null?se(o):o,[n]),s=d.useCallback(o=>r?r(o):o===null?G(o):o,[r]);return a?u.jsx(D.Controller,{name:e,control:a,render:({field:o,fieldState:i})=>u.jsxs("div",{children:[u.jsx(le,{value:l(o.value),onChange:c=>o.onChange(s(c.target.value)),error:!!i.error,ref:o.ref,...t}),i.error?u.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:i.error.message}):null]})}):(console.error(`Form control is missing for field: ${e}`),u.jsxs("p",{children:["Form control missing for field: ",e]}))},De=({label:e,variant:n="default",color:r="solid",tags:t,onChange:a,valid:l,error:s,placeholder:o="Add a tag...",maxTags:i,validateTag:c})=>{const[f,h]=d.useState(""),[x,b]=d.useState(!1),[g,v]=d.useState(null),w=d.useRef(null),N=d.useRef(null),E=d.useRef([]),F=t.length>0,S=d.useRef(`taginput-${Math.random().toString(36).substr(2,9)}`).current,A=d.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,C=d.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current;d.useEffect(()=>{E.current=E.current.slice(0,t.length)},[t.length]);const O=j=>{if(j.key==="Enter"&&f.trim()){j.preventDefault();const k=f.trim();if(i&&t.length>=i){v(`Maximum of ${i} tags allowed`);return}if(t.includes(k)){v("Tag already exists");return}if(c){const M=c(k);if(typeof M=="string"){v(M);return}else if(M===!1){v("Invalid tag");return}}a([...t,k]),h(""),v(null),I(`Added tag ${k}`)}else if(j.key==="Backspace"&&!f&&t.length>0){const k=t[t.length-1];a(t.slice(0,-1)),I(`Removed tag ${k}`)}else j.key==="ArrowLeft"&&f===""&&t.length>0&&E.current[t.length-1]&&E.current[t.length-1]?.focus()},L=(j,k)=>{if(j.key==="Backspace"||j.key==="Delete"){j.preventDefault();const M=t[k],X=[...t];X.splice(k,1),a(X),setTimeout(()=>{w.current&&w.current.focus()},0),I(`Removed tag ${M}`)}else j.key==="ArrowRight"?(j.preventDefault(),k<t.length-1?E.current[k+1]?.focus():w.current?.focus()):j.key==="ArrowLeft"&&(j.preventDefault(),k>0&&E.current[k-1]?.focus())},T=(j,k)=>{a(t.filter(M=>M!==j)),setTimeout(()=>{k<t.length-1?E.current[k]?.focus():k>0?E.current[k-1]?.focus():w.current?.focus()},0),I(`Removed tag ${j}`)},V=j=>{h(j.target.value),v(null)},_=()=>{w.current&&w.current.focus()},I=j=>{console.log(`Accessibility announcement: ${j}`)};return u.jsxs("div",{children:[u.jsxs("div",{className:"relative",ref:N,children:[n==="default"?u.jsxs("label",{id:A,htmlFor:S,className:p("text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":x||F||o,"text-red-9":!!s}),children:[e," ",i&&`(${t.length}/${i})`]}):null,u.jsxs("div",{className:p("rounded-6 px-2 transition cursor-text pr-10",{"bg-base-3":r==="solid","border border-uielborder focus:border-transparent":r==="outline","py-3":n==="default","pt-5 pb-2":n==="floating","ring-2 ring-branduielborder":x,"text-red-9":s||g,"ring-2 ring-red-6":(s||g)&&x}),onClick:_,role:"group","aria-labelledby":A,"aria-describedby":s||g?C:void 0,children:[n==="floating"?u.jsxs("label",{id:A,htmlFor:S,className:p("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":x||F||o,"text-red-9":!!s}),children:[e," ",i&&`(${t.length}/${i})`]}):null,u.jsxs("div",{className:p("flex flex-wrap gap-1 items-center",{"mt-2.5":n==="floating"}),children:[t.map((j,k)=>u.jsxs("div",{ref:M=>{E.current[k]=M},className:p("line-clamp-1 text-brand rounded-full px-2 text-sm flex items-center",{"bg-brandfadedbg text-brand":!s&&!g,"bg-red-4 text-red-9":s||g}),tabIndex:0,role:"button","aria-label":`${j}, press delete or backspace to remove`,onKeyDown:M=>L(M,k),children:[j,u.jsx("button",{type:"button",className:"ml-1 text-brand hover:text-brandhover shrink-0",onClick:()=>T(j,k),"aria-label":`Remove ${j} tag`,children:"x"})]},`${j}-${k}`)),u.jsx("input",{id:S,ref:w,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm placeholder:text-secondarytext",value:f,onChange:V,onKeyDown:O,onFocus:()=>b(!0),onBlur:()=>b(!1),enterKeyHint:"enter",autoComplete:"off",placeholder:t.length>0?"":o,style:{width:`${Math.max(60,f.length*8)}px`},"aria-describedby":s||g?C:void 0,"aria-invalid":!!(s||g)})]})]}),l&&u.jsx("span",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:u.jsx(z.CheckIcon,{})})]}),(s||g)&&u.jsx("p",{id:C,className:"text-red-500 text-xs mt-1","aria-live":"assertive",children:s||g}),u.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:t.length>0?`Current tags: ${t.join(", ")}`:"No tags added yet"})]})},At=({name:e,...n})=>{const{control:r}=D.useFormContext();return r?u.jsx(D.Controller,{name:e,control:r,render:({field:t,fieldState:a})=>u.jsx(De,{tags:t.value,onChange:l=>t.onChange(l),error:a.error?.message,...n})}):(console.error(`Form control is missing for field: ${e}`),u.jsxs("p",{children:["Form control missing for field: ",e]}))},Le=({label:e,labelPosition:n="default",options:r,selectedValues:t,onChange:a,idExtractor:l,labelExtractor:s,customSetter:o,valid:i,error:c,placeholder:f="Select options...",maxSelections:h,searchable:x=!1,disabled:b=!1,className:g})=>{const[v,w]=d.useState(""),[N,E]=d.useState(!1),[F,S]=d.useState(-1),A=d.useRef(null),C=d.useRef(null),O=d.useRef([]),{triggerRef:L,triggerProps:T,popoverRef:V,getPopoverPosition:_,open:I,toggle:j,close:k}=je({align:"start",side:"top",avoidCollisions:!1,onOpen:()=>{E(!0),x&&A.current&&setTimeout(()=>A.current?.focus(),10)},onClose:()=>{E(!1),w(""),S(-1)}}),M=d.useRef(`multiselect-${Math.random().toString(36).substr(2,9)}`).current,X=d.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,ae=d.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current,Q=d.useRef(`listbox-${Math.random().toString(36).substr(2,9)}`).current,R=o?t.map(m=>r.find($=>l($)===m||l($)===l(m))).filter(Boolean):t,W=R.length>0,K=x?r.filter(m=>s(m).toLowerCase().includes(v.toLowerCase())):r;d.useEffect(()=>{O.current=O.current.slice(0,K.length)},[K.length]);const ie=m=>o?t.some(y=>y===l(m)||l(y)===l(m)):t.some(y=>l(y)===l(m)),ce=m=>{if(!b)if(ie(m)){let y;if(o){const $=l(m);y=t.filter(B=>B!==$&&l(B)!==$)}else y=t.filter($=>l($)!==l(m));a(y),U(`Removed ${s(m)}`)}else{if(h&&R.length>=h){U(`Maximum of ${h} selections allowed`);return}let y;o?y=[...t,o(m)]:y=[...t,m],a(y),U(`Added ${s(m)}`)}},ue=m=>{if(b)return;let y;if(o){const $=l(m);y=t.filter(B=>B!==$&&l(B)!==$)}else y=t.filter($=>l($)!==l(m));a(y),U(`Removed ${s(m)}`)},fe=m=>{if(!b)switch(m.key){case"Enter":m.preventDefault(),I?F>=0&&ce(K[F]):j();break;case"Escape":m.preventDefault(),k();break;case"ArrowDown":if(m.preventDefault(),!I)j();else{const y=F>=K.length-1?0:F+1;S(y),O.current[y]?.scrollIntoView({block:"nearest"})}break;case"ArrowUp":if(m.preventDefault(),I){const y=F<=0?K.length-1:F-1;S(y),O.current[y]?.scrollIntoView({block:"nearest"})}break;case"Backspace":if(x&&v===""&&R.length>0){const y=R[R.length-1];ue(y)}break}},_e=m=>{w(m.target.value),S(-1)},Ke=()=>{b||(x&&A.current&&A.current.focus(),j())},U=m=>{console.log(`Accessibility announcement: ${m}`)};Ce(V,m=>{!L.current||!I||!m.target||L.current.contains(m.target)||k()});const ee=_();return u.jsxs("div",{className:p("relative",g),children:[u.jsxs("div",{className:"relative",ref:C,children:[n==="default"&&u.jsx("label",{className:p("top-[18px] font-medium ml-0.5 text-xs",c&&"text-red-9"),children:e}),u.jsxs("div",{ref:L,...T,className:p("relative rounded-6 px-2 transition cursor-pointer pr-10 min-h-[48px]","border border-base-4 light-theme:drop-shadow-sm dark-theme:bg-base-3",{"py-3":n==="default","pt-5 pb-2":n==="floating","ring-1 ring-brand":I||N,"text-red-9":c,"ring-2 ring-red-6":c&&(I||N),"opacity-60 cursor-not-allowed":b}),onClick:Ke,role:"combobox","aria-expanded":I,"aria-haspopup":"listbox","aria-owns":Q,"aria-labelledby":X,"aria-describedby":c?ae:void 0,onKeyDown:fe,tabIndex:b?-1:0,children:[n==="floating"&&u.jsxs("label",{id:X,htmlFor:M,className:p("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":N||W,"text-red-9":!!c}),children:[e," ",h&&`(${t.length}/${h})`]}),u.jsxs("div",{className:p("flex flex-wrap gap-2 items-center",{"mt-2.5":n==="floating"}),children:[R.map(m=>u.jsxs("div",{className:p("border border-base-4 dark-theme:border-base-5 dark-theme:bg-base-4 rounded-full px-2 py-1 text-sm flex items-center gap-1",{"bg-red-4 text-red-9":c}),children:[u.jsx("span",{className:"line-clamp-1",children:s(m)}),!b&&u.jsx("button",{type:"button",className:"hover:bg-brand/20 rounded-full p-0.5 transition-colors",onClick:y=>{y.stopPropagation(),ue(m)},"aria-label":`Remove ${s(m)}`,children:u.jsx(z.XIcon,{size:12})})]},l(m))),x&&u.jsx("input",{ref:A,id:M,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",value:v,onChange:_e,onKeyDown:fe,placeholder:W?"":f,disabled:b,"aria-autocomplete":"list","aria-controls":Q,autoComplete:"off"}),!x&&!W&&u.jsx("span",{className:"text-secondarytext text-sm flex-grow",children:f})]}),u.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[i&&u.jsx(z.CheckIcon,{size:16,className:"text-green-600"}),u.jsx(z.ChevronDownIcon,{size:16,className:p("transition-transform text-base-11",{"rotate-180":I})})]})]})]}),u.jsx(de.AnimatePresence,{children:I&&u.jsx(Se,{children:u.jsx(de.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:V,style:{position:"fixed",left:ee.x,top:ee.top,bottom:ee.bottom,width:C.current?.offsetWidth??200},className:p("bg-base-1 dark-theme:bg-base-3 border border-base-4","rounded-6 shadow-lg max-h-[300px] overflow-y-auto z-50","customscrollbarnohide"),role:"listbox",id:Q,"aria-labelledby":X,children:K.length===0?u.jsx("div",{className:"px-3 py-2 text-sm text-secondarytext",children:v?"No results found":"No options available"}):K.map((m,y)=>{const $=ie(m),B=y===F;return u.jsxs("div",{ref:Be=>{O.current[y]=Be},className:p("px-3 py-2 text-sm cursor-pointer flex items-center justify-between","first:rounded-t-6 last:rounded-b-6",{"bg-base-3 dark-theme:bg-base-4":B,"bg-brandfadedbg text-brand":$}),onClick:()=>ce(m),role:"option","aria-selected":$,onMouseEnter:()=>S(y),children:[u.jsx("span",{children:s(m)}),$&&u.jsx(z.CheckIcon,{size:16})]},l(m))})})})}),c&&u.jsx("p",{id:ae,className:"text-red-9 text-xs mt-1","aria-live":"assertive",children:c}),u.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:R.length>0?`Selected: ${R.map(s).join(", ")}`:"No selections"})]})},Ft=({name:e,...n})=>{const{control:r}=D.useFormContext();return r?u.jsx(D.Controller,{name:e,control:r,render:({field:t,fieldState:a})=>u.jsx(Le,{selectedValues:t.value||[],onChange:l=>t.onChange(l),error:a.error?.message,...n})}):(console.error(`Form control is missing for field: ${e}`),u.jsxs("p",{children:["Form control missing for field: ",e]}))},Ot=({isEditable:e,isDeletable:n=!0,createUpdateLoading:r,deleteLoading:t,onDelete:a,onDeleteConfirm:l,addText:s="Añadir",updateText:o="Actualizar",deleteText:i="Eliminar",className:c})=>{const[f,h]=d.useState(!1);return u.jsxs("div",{className:`w-full grid grid-cols-2 gap-4 col-span-full ${c}`,children:[e&&n?u.jsxs(J,{color:"dangersolid",state:t?"loading":r?"disabled":"enabled",onClick:()=>{l?f?a?.():h(!0):a?.()},children:[u.jsx(z.X,{size:18}),l&&f?"Confirmar":i]}):null,u.jsxs(J,{color:"brand",className:p(e&&n?"":"col-span-2"),state:r?"loading":t?"disabled":"enabled",type:"submit",children:[r?u.jsx(Ee,{}):e?u.jsx(z.Check,{size:18}):u.jsx(z.Plus,{size:18}),e?o:s]})]})};function $t({checked:e,onCheckedChange:n,disabled:r=!1,name:t,required:a,className:l=""}){const s=d.useId(),o=()=>{r||n(!e)};return u.jsxs("button",{id:s,type:"button",role:"switch","aria-checked":e,"aria-required":a,"data-state":e?"checked":"unchecked",disabled:r,onClick:o,className:p(`relative inline-flex h-[28px] w-[48px] items-center rounded-full
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),d=require("react"),be=require("react-dom"),Ve=require("clsx"),Xe=require("tailwind-merge"),qe=require("@mateosuarezdev/atoms"),z=require("react-hook-form"),P=require("@hookform/resolvers"),M=require("lucide-react"),de=require("framer-motion"),p=(...e)=>Xe.twMerge(Ve.clsx(e));function H(e,n=100){let r=null,t=null;return function(...a){const l=Date.now();r===null||l-r>=n?(e.apply(this,a),r=l):(t&&clearTimeout(t),t=setTimeout(()=>{e.apply(this,a),r=Date.now()},n-(l-r)))}}function Ue(e,n=500){let r=null;return function(...t){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,t),r=null},n)}}function pe(e){if(!e)return"";const r=e.trim().replace(/\s+/g," ").split(" ");return r.length===0||r[0]===""?"":r.length===1?r[0].charAt(0).toUpperCase():(r[0].charAt(0)+r[1].charAt(0)).toUpperCase()}function xe(e){e.focus();const n=e.value.length;e.setSelectionRange(n,n)}function ge(e){return e.replace(/\s/g,"")}function Pe(e){return e.toLowerCase().split(" ").map(a=>{if(a.length===0)return a;const l=[...a][0],s=a.slice(l.length);return l.toUpperCase()+s}).join(" ")}function se(e){return e===null?"":e}function G(e){return ge(e)===""?null:e}function Ze(e,n,r={}){const t={...r};return Object.keys(n).forEach(a=>{if(n[a]===!0&&a in e){const l=a;t[l]=e[l]}}),t}class Ye{constructor(){this.container=null,this.previouslyFocusedElement=null}enable(){this.container&&(this.previouslyFocusedElement=document.activeElement,this.container.addEventListener("keydown",this.trapFocus.bind(this)),document.addEventListener("click",this.handleClickOutside.bind(this)))}disable(){this.container&&(this.container.removeEventListener("keydown",this.trapFocus.bind(this)),document.removeEventListener("click",this.handleClickOutside.bind(this)),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}setContainer(n){this.disable(),this.container=n,this.enable()}trapFocus(n){const r=this.container?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r)return;const t=r[0],a=r[r.length-1];n.key==="Tab"&&(n.shiftKey&&document.activeElement===t?(n.preventDefault(),a.focus()):!n.shiftKey&&document.activeElement===a&&(n.preventDefault(),t.focus()))}handleClickOutside(n){this.container&&!this.container.contains(n.target)&&(n.preventDefault(),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}}const q=e=>{const n=e.scrollWidth>e.clientWidth,r=e.scrollHeight>e.clientHeight,t=Math.max(0,e.scrollWidth-e.clientWidth),a=Math.max(0,e.scrollHeight-e.clientHeight);return{horizontal:n,vertical:r,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,canScrollLeft:e.scrollLeft>10,canScrollRight:e.scrollLeft<t-10,canScrollUp:e.scrollTop>0,canScrollDown:e.scrollTop<a,scrollPercentageX:n&&t>0?e.scrollLeft/t*100:0,scrollPercentageY:r&&a>0?e.scrollTop/a*100:0}},Ge=({onOverflow:e,trackScroll:n=!1,withObserver:r=!1,enabled:t=!0,deps:a=[]}={})=>{const l=d.useRef(null);return d.useEffect(()=>{if(!l.current||!t)return;let s=!1;const i=H(()=>{if(l.current){const x=q(l.current);e?.(x)}}),c=q(l.current);s=c.horizontal||c.vertical,e?.(c),window.addEventListener("resize",i);let f=null;r&&(f=new ResizeObserver(i),l.current&&f.observe(l.current));let h=null;return n&&s&&(h=l.current,h.addEventListener("scroll",i)),()=>{window.removeEventListener("resize",i),f&&f.disconnect(),h&&s&&h.removeEventListener("scroll",i)}},[t,...a]),{ref:l}},Je=({trackScroll:e=!1,withObserver:n=!1,enabled:r=!0,deps:t=[]}={})=>{const a=d.useRef(null),[l,s]=d.useState(null);return d.useEffect(()=>{if(!a.current||!r)return;let o=!1;const c=H(()=>{if(a.current){const b=q(a.current);s(b)}}),f=q(a.current);o=f.horizontal||f.vertical,s(f),window.addEventListener("resize",c);let h=null;n&&(h=new ResizeObserver(c),a.current&&h.observe(a.current));let x=null;return e&&o&&(x=a.current,x.addEventListener("scroll",c)),()=>{window.removeEventListener("resize",c),h&&h.disconnect(),x&&o&&x.removeEventListener("scroll",c)}},[r,...t]),{ref:a,overflowInfo:l}},te={xs:"w-8 h-8",sm:"w-10 h-10 text-lg",md:"w-14 h-14 text-xl",lg:"h-20 w-20 text-2xl",xl:"h-24 w-24 text-2xl"},He=({src:e,name:n,size:r="md",className:t})=>e?u.jsx("img",{alt:"avatar",src:e,className:p("rounded-full bg-base-3",te[r])}):n?u.jsx("p",{className:p("rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center",te[r],t),children:pe(n)}):u.jsx("div",{className:p("rounded-full text-2xl font-medium flex items-center justify-center","bg-base-2 dark-theme:bg-base-3 border border-base-4","lg:hover:bg-base-3 max-lg:active:bg-base-4 transition-colors",te[r],t),children:u.jsxs(Ee,{size:r==="xs"?16:r==="sm"?20:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),u.jsx("circle",{cx:"12",cy:"7",r:"4"})]})});function Qe({className:e,children:n,animate:r=!1,...t}){return u.jsx("div",{className:p("flex -space-x-3 rtl:space-x-reverse",e),...t,children:n})}function We(e){return d.useSyncExternalStore(n=>e.subscribe(n),()=>e.get(),()=>e.get())}const ne=qe.atom(!0);let re=!1;const he=H(()=>{ne.set(window.innerWidth>1024)});typeof window<"u"&&(re&&(window.removeEventListener("resize",he),re=!1),window.addEventListener("resize",he),re=!0);const ve=()=>(d.useEffect(()=>{ne.set(window.innerWidth>1024)},[]),We(ne));function we(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}const ye=(e=!0,n)=>{const r=ve(),t=d.useRef(null),a=d.useCallback(l=>{if(!e||r)return;const s=t.current;if(!s)return;const o=s.getBoundingClientRect(),i=Math.max(o.width,o.height),c=l.clientX-o.left-i/2,f=l.clientY-o.top-i/2,h=document.createElement("span");h.classList.add("ripple-wrapper");const x=document.createElement("span");x.classList.add("ripple"),x.style.backgroundColor=n?"var(--ripple-contrast)":"var(--ripple-main)",x.style.width=`${i}px`,x.style.height=`${i}px`,x.style.left=`${c}px`,x.style.top=`${f}px`,h.appendChild(x);const b=s.getElementsByClassName("ripple-wrapper");if(b?.length)for(const g of b)g.remove();s.appendChild(h),setTimeout(()=>{h.remove()},700)},[e,r,n]);return{ref:t,ripple:a,styles:{position:"relative"}}},je=({scrollerId:e,align:n="start",side:r="bottom",offset:t=8,collisionPadding:a=8,avoidCollisions:l=!0,closeOnScroll:s=!0,onOpen:o,onClose:i}={})=>{const[c,f]=d.useState(!1),[h,x]=d.useState({width:192,height:300}),b=d.useRef(null),g=d.useRef(null),v=d.useRef({left:0,right:0,top:0,bottom:0,x:0,y:0,width:0,height:0}),w=d.useRef(null),E=d.useId(),N=d.useCallback(C=>{const O=C??v.current;if(!O)return{x:0,top:0,bottom:void 0};const D=h.width,T=h.height;return ke({triggerRect:O,popoverWidth:D,popoverHeight:T,align:n,side:r,offset:t,collisionPadding:a,avoidCollisions:l})},[v.current,h,n,r]);d.useEffect(()=>{if(!c||!e||(w.current=document.getElementById(e),!w.current))return;c&&F();const C=()=>{w.current&&(f(!1),o?.(),w.current.removeEventListener("scroll",C))};return s&&w.current.addEventListener("scroll",C,{passive:!0}),()=>{w.current&&w.current.removeEventListener("scroll",C)}},[c,e]);const F=()=>{g.current&&x({width:g.current.offsetWidth,height:g.current.offsetHeight})},S=d.useCallback(()=>{if(!b.current)return;const C=b.current.getBoundingClientRect();v.current={left:C.left,right:C.right,top:C.top,bottom:C.bottom,x:C.x,y:C.y,width:C.width,height:C.height},f(O=>(O?i?.():o?.(),!O))},[]),A=d.useCallback(()=>{f(!1),i?.()},[]);return{triggerRef:b,triggerProps:{id:E,"aria-expanded":c,"aria-haspopup":!0},popoverRef:g,getPopoverPosition:N,open:c,toggle:S,close:A}},ke=({triggerRect:e,popoverWidth:n,popoverHeight:r,align:t="start",side:a="bottom",offset:l=4,collisionPadding:s=8,avoidCollisions:o=!0})=>{const i={width:window.innerWidth,height:window.innerHeight};let c=0,f=0;if(o){if(a==="right"){const b=e.right+l,g=e.left-n-l,v=Math.max(0,b+n-(i.width-s)),w=Math.max(0,s-g);v<=w?(c=b,v>0&&(c=i.width-n-s)):(c=g,w>0&&(c=s)),f=e.top,f+r>i.height-s&&(f=i.height-r-s),f<s&&(f=s)}else if(a==="left"){const b=e.left-n-l,g=e.right+l,v=Math.max(0,s-b),w=Math.max(0,g+n-(i.width-s));v<=w?(c=b,v>0&&(c=s)):(c=g,w>0&&(c=i.width-n-s)),f=e.top,f+r>i.height-s&&(f=i.height-r-s),f<s&&(f=s)}else if(a==="bottom"){const b=i.height-e.bottom,g=e.top;b>=r+l?f=e.bottom+l:g>=r+l?f=e.top-r-l:(f=e.bottom+l,f=Math.min(f,i.height-r-s));const v=i.width-e.left,w=e.right;if(t==="start")c=e.left,c+n>i.width-s&&(w>=n?c=e.right-n:c=i.width-n-s);else if(t==="end")c=e.right-n,c<s&&(v>=n?c=e.left:c=s);else{const E=e.left+e.width/2-n/2;E>=s&&E+n<=i.width-s?c=E:E<s?c=s:c=i.width-n-s}}else{const b=e.top,g=i.height-e.bottom;b>=r+l?f=e.top-r-l:g>=r+l?f=e.bottom+l:(f=e.top-r-l,f=Math.max(s,f));const v=i.width-e.left,w=e.right;if(t==="start")c=e.left,c+n>i.width-s&&(w>=n?c=e.right-n:c=i.width-n-s);else if(t==="end")c=e.right-n,c<s&&(v>=n?c=e.left:c=s);else{const E=e.left+e.width/2-n/2;E>=s&&E+n<=i.width-s?c=E:E<s?c=s:c=i.width-n-s}}c=Math.max(s,Math.min(c,i.width-n-s)),f=Math.max(s,Math.min(f,i.height-r-s))}else a==="right"?(c=e.right+l,f=e.top):a==="left"?(c=e.left-n-l,f=e.top):a==="bottom"?f=e.bottom+l:f=e.top-r-l,(a==="top"||a==="bottom")&&(t==="start"?c=e.left:t==="end"?c=e.right-n:c=e.left+e.width/2-n/2);let h,x;return f+r<=e.top?x=window.innerHeight-(f+r):h=f,{x:c,top:h,bottom:x}};function et(e){const n=d.useRef(null);return d.useEffect(()=>{const r=t=>{n.current&&!n.current.contains(t.target)&&e()};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e]),n}function tt(e,n={}){const{enabled:r=!0,events:t=["mousedown","touchstart"],excludeRefs:a=[]}=n,l=d.useRef(null);return d.useEffect(()=>{if(!r)return;const s=o=>{const i=o.target;l.current?.contains(i)||a.some(f=>f.current?.contains(i))||e()};return t.forEach(o=>{document.addEventListener(o,s)}),()=>{t.forEach(o=>{document.removeEventListener(o,s)})}},[e,r,t,a]),l}function Ce(e,n,r=!0){d.useEffect(()=>{if(!r)return;const t=a=>{e.current&&!e.current.contains(a.target)&&n(a)};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[e,n,r])}function rt(e,{target:n=window,event:r="keydown",enabled:t}={}){const a=d.useRef(e);d.useEffect(()=>{a.current=e},[e]),d.useEffect(()=>{if(!t)return;const l=s=>{const o=s.key,i=a.current[o];i&&i(s)};return n.addEventListener(r,l),()=>{n.removeEventListener(r,l)}},[n,r,t])}const nt="relative shrink-0 select-none transition outline-none duration-200 ease-out focus:ring-border-brand-light flex items-center justify-center cursor-pointer",st={xs:"text-xs px-1 gap-x-0.5 py-1",sm:"text-sm px-2.5 gap-x-1 py-1.5",mdsm:"text-sm px-3 gap-x-1.5 py-2.5",md:"text-base px-4 gap-x-1.5 py-2.5",lg:"text-base px-4 gap-x-1.5 py-3.5",picker:"text-base px-2 py-2 gap-x-1.5",iconXs:"text-xs p-1",iconSm:"text-sm p-2",iconMd:"text-base p-3",iconLg:"text-base p-4"},ot={all:"focus:ring-1",desktop:"lg:focus:ring-1",mobile:"focus:ring-1 lg:focus-ring-0",none:""},lt={light:"font-light",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},at={none:"rounded-none",1:"rounded-1",2:"rounded-2",3:"rounded-3",4:"rounded-4",5:"rounded-5",6:"rounded-6",7:"rounded-7",8:"rounded-8",9:"rounded-9",10:"rounded-10",11:"rounded-11",12:"rounded-12",full:"rounded-full"},it={transparent:"text-base-12 lg:hover:bg-base-4 focus:ring-base-6",transparentinactive:"text-base-11 lg:hover:bg-base-4",brand:"bg-brand text-brand-text lg:hover:bg-brand-hover focus:ring-base-6 border border-transparent",accent:"bg-accent text-accent-text lg:hover:bg-accent-hover",contrast:"bg-base-12 text-base-1 lg:hover:bg-base-11 focus:ring-base-6",solid:"bg-base-3 dark-theme:bg-base-3 lg:hover:bg-base-4 border border-base-4 focus:ring-base-5",solidhybrid:"border border-base-5 dark-theme:border-base-4 dark-theme:bg-base-3 lg:hover:bg-base-4 focus:ring-base-6",outline:"border border-base-6 lg:hover:bg-base-3 focus:ring-base-6",info:"bg-blue-3 text-blue-9 lg:hover:bg-blue-4 lg:active:bg-blue-5 focus:ring-blue-9 border border-transparent",success:"bg-green-4 text-green-9 lg:hover:bg-green-5 lg:active:bg-green-6 focus:ring-green-9 border border-transparent",warning:"bg-yellow-4 text-yellow-9 lg:hover:bg-yellow-5 lg:active:bg-yellow-6 focus:ring-yellow-9 border border-transparent",danger:"bg-red-4 text-red-9 lg:hover:bg-red-5 focus:ring-red-9 border border-transparent",dangersolid:"bg-red-9 text-base-1 dark-theme:text-base-12 lg:hover:bg-red-8 focus:ring-base-6 border border-transparent",disabled:"bg-base-3 text-base-11 border border-transparent"},ct={enabled:"",disabled:"opacity-75",loading:""},J=d.forwardRef(({color:e="transparent",size:n="mdsm",fontWeight:r="normal",rounded:t="6",state:a="enabled",onClick:l,className:s,children:o,withRipple:i=!0,contrastRipple:c,showFocus:f="desktop",withDisabledDelay:h=!1,type:x="button",...b},g)=>{const[v,w]=d.useState(!1),E=A=>{a==="enabled"&&(h?(w(!0),l&&l(A),setTimeout(()=>w(!1),1e3)):l&&l(A))},{ref:N,ripple:F}=ye(i,e==="contrast"||c),S=we(N,g);return u.jsx("button",{ref:S,type:x,disabled:b.disabled?b.disabled:a==="disabled"||a==="loading",onMouseDown:F,onClick:A=>v?null:E(A),className:p(nt,st[n],lt[r],at[t],ot[f],it[e],ct[a],b.disabled&&"opacity-50",s),...b,children:o})});J.displayName="Button";const ut=({className:e})=>u.jsx("div",{className:p("w-full h-px bg-base-4",e)}),Ee=({children:e,size:n=24,strokeWidth:r=2,viewBox:t="0 0 24 24",className:a,...l})=>u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:t,className:a,...l,children:e}),Ne=({loading:e=!0,wrapperClassName:n,spinnerClassName:r})=>u.jsx("div",{className:p("flex justify-center",n),children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",className:p({"animate-spin":e},r),children:u.jsx("path",{fill:"currentColor",d:"M10 3a7 7 0 0 0-7 7a.5.5 0 0 1-1 0a8 8 0 1 1 8 8a.5.5 0 0 1 0-1a7 7 0 1 0 0-14Z"})})}),Se=({children:e,node:n})=>be.createPortal(e,n??document.body);function Ae(e,n,r){function t(o,i){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(e),n(o,i);for(const f in s.prototype)f in o||Object.defineProperty(o,f,{value:s.prototype[f].bind(o)});o._zod.constr=s,o._zod.def=i}const a=r?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function s(o){var i;const c=r?.Parent?new l:this;t(c,o),(i=c._zod).deferred??(i.deferred=[]);for(const f of c._zod.deferred)f();return c}return Object.defineProperty(s,"init",{value:t}),Object.defineProperty(s,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class ft extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const dt={};function Fe(e){return dt}function ht(e,n){return typeof n=="bigint"?n.toString():n}const Oe=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Z(e){return typeof e=="string"?e:e?.message}function $e(e,n,r){const t={...e,path:e.path??[]};if(!e.message){const a=Z(e.inst?._zod.def?.error?.(e))??Z(n?.error?.(e))??Z(r.customError?.(e))??Z(r.localeError?.(e))??"Invalid input";t.message=a}return delete t.inst,delete t.continue,n?.reportInput||delete t.input,t}const Ie=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(n,ht,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},mt=Ae("$ZodError",Ie),Le=Ae("$ZodError",Ie,{Parent:Error}),bt=e=>(n,r,t,a)=>{const l=t?Object.assign(t,{async:!1}):{async:!1},s=n._zod.run({value:r,issues:[]},l);if(s instanceof Promise)throw new ft;if(s.issues.length){const o=new(a?.Err??e)(s.issues.map(i=>$e(i,l,Fe())));throw Oe(o,a?.callee),o}return s.value},pt=bt(Le),xt=e=>async(n,r,t,a)=>{const l=t?Object.assign(t,{async:!0}):{async:!0};let s=n._zod.run({value:r,issues:[]},l);if(s instanceof Promise&&(s=await s),s.issues.length){const o=new(a?.Err??e)(s.issues.map(i=>$e(i,l,Fe())));throw Oe(o,a?.callee),o}return s.value},gt=xt(Le);function me(e,n){try{var r=e()}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}function vt(e,n){for(var r={};e.length;){var t=e[0],a=t.code,l=t.message,s=t.path.join(".");if(!r[s])if("unionErrors"in t){var o=t.unionErrors[0].errors[0];r[s]={message:o.message,type:o.code}}else r[s]={message:l,type:a};if("unionErrors"in t&&t.unionErrors.forEach(function(f){return f.errors.forEach(function(h){return e.push(h)})}),n){var i=r[s].types,c=i&&i[t.code];r[s]=z.appendErrors(s,n,r,a,c?[].concat(c,t.message):t.message)}e.shift()}return r}function wt(e,n){for(var r={};e.length;){var t=e[0],a=t.code,l=t.message,s=t.path.join(".");if(!r[s])if(t.code==="invalid_union"&&t.errors.length>0){var o=t.errors[0][0];r[s]={message:o.message,type:o.code}}else r[s]={message:l,type:a};if(t.code==="invalid_union"&&t.errors.forEach(function(f){return f.forEach(function(h){return e.push(h)})}),n){var i=r[s].types,c=i&&i[t.code];r[s]=z.appendErrors(s,n,r,a,c?[].concat(c,t.message):t.message)}e.shift()}return r}function yt(e,n,r){if(r===void 0&&(r={}),(function(t){return"_def"in t&&typeof t._def=="object"&&"typeName"in t._def})(e))return function(t,a,l){try{return Promise.resolve(me(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](t,n)).then(function(s){return l.shouldUseNativeValidation&&P.validateFieldsNatively({},l),{errors:{},values:r.raw?Object.assign({},t):s}})},function(s){if((function(o){return Array.isArray(o?.issues)})(s))return{values:{},errors:P.toNestErrors(vt(s.errors,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw s}))}catch(s){return Promise.reject(s)}};if((function(t){return"_zod"in t&&typeof t._zod=="object"})(e))return function(t,a,l){try{return Promise.resolve(me(function(){return Promise.resolve((r.mode==="sync"?pt:gt)(e,t,n)).then(function(s){return l.shouldUseNativeValidation&&P.validateFieldsNatively({},l),{errors:{},values:r.raw?Object.assign({},t):s}})},function(s){if((function(o){return o instanceof mt})(s))return{values:{},errors:P.toNestErrors(wt(s.issues,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}function jt({methods:e,onSubmit:n,onError:r,children:t,logErrors:a,className:l}){return u.jsx(z.FormProvider,{...e,children:u.jsx("form",{className:p("mt-4 lg:mt-8 grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-8 relative",l),onSubmit:e.handleSubmit(s=>n(s,e),s=>{a&&console.log(s),r?.(s)}),children:t})})}function kt(e,n){return z.useForm({resolver:yt(e),defaultValues:n})}const Y={unchecked:"bg-base-3 lg:hover:bg-base-4",checked:"bg-brand lg:hover:bg-brand-hover text-brand-text",uncheckedDisabled:"bg-base-3 border-base-4",checkedDisabled:"bg-base-3 border-base-4 text-base-10"},Me=d.forwardRef(({checked:e=!1,onCheckedChange:n,disabled:r=!1,required:t=!1,name:a,value:l,id:s,className:o="",size:i="sm",...c},f)=>{const h=()=>{r||n?.(e==="indeterminate"?!0:!e)},x=v=>{(v.key===" "||v.key==="Enter")&&(v.preventDefault(),h())},b={xs:"h-3.5 w-3.5",sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},g={xs:24,sm:12,md:14,lg:16};return u.jsxs(u.Fragment,{children:[u.jsxs("button",{ref:f,type:"button",role:"checkbox","aria-checked":e==="indeterminate"?"mixed":e,"aria-required":t,disabled:r,onClick:h,onKeyDown:x,className:p("inline-flex items-center justify-center rounded-2 border border-base-4 transition-all duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-base-5",b[i],r&&"cursor-not-allowed opacity-75",!r&&"cursor-pointer",e?r?Y.checkedDisabled:Y.checked:r?Y.uncheckedDisabled:Y.unchecked,typeof o=="function"?o(e):o),...c,children:[e===!0&&u.jsx(M.Check,{size:g[i],className:"stroke-current"}),e==="indeterminate"&&u.jsx(M.Minus,{size:g[i],className:"stroke-current"})]}),u.jsx("input",{type:"checkbox",name:a,value:l,checked:e===!0,onChange:()=>{},disabled:r,required:t,id:s,className:"sr-only",tabIndex:-1})]})});Me.displayName="Checkbox";const Ct={solid:"bg-base-3 border border-base-4 drop-shadow-sm dark-theme:drop-shadow-none",outline:"border border-base-6"},Et={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},oe=d.forwardRef(({label:e,description:n,labelPosition:r="default",color:t="solid",focusColor:a="brand",placeholder:l,valid:s,error:o,errorMessage:i,isPrice:c,prefix:f,wrapperClassName:h,containerClassName:x,className:b,type:g="text",value:v,...w},E)=>{const N=d.useRef(null),F=d.useRef(!1),[S,A]=d.useState(!1),[C,O]=d.useState(!1),D=g==="password",T=D&&S?"text":c?"number":g,V=v!==""&&v!==null&&v!==void 0;return d.useEffect(()=>{if(!F.current){F.current=!0;return}N.current&&xe(N.current)},[S,N]),u.jsxs("div",{className:p("relative",h),children:[e&&r==="default"&&u.jsx("label",{className:p("font-medium ml-0.5 text-xs",o&&"text-red-9"),children:e}),u.jsxs("div",{className:p("rounded-6 transition cursor-text relative",Ct[t],{"pt-[22px] pb-1.5":r==="floating",[Et[a]]:!o&&C,"bg-red-4 text-red-9":!!o,"ring-1 ring-red-9":!!o&&C},x),children:[e&&r==="floating"&&u.jsx("label",{className:p("absolute transition-all duration-200 pointer-events-none","text-sm top-[18px] font-semibold left-3",{"text-xs top-2.5":C||V||l,"text-red-9":!!o}),children:e}),c&&u.jsx(M.DollarSign,{size:16,className:p("absolute top-1/2 -translate-y-1/2 left-3",o?"text-red-9":"text-base-11")}),f&&u.jsx("p",{className:"text-sm text-base-11 absolute top-1/2 -translate-y-1/2 left-3",children:f}),u.jsx("input",{ref:_=>{E&&(typeof E=="function"?E(_):E.current=_),N.current=_},type:T,className:p("w-full bg-transparent focus:outline-none","placeholder:text-sm text-sm placeholder:text-base-11",c||f?"pl-9":"pl-3",{"py-2.5":r==="default","mt-1.5":r==="floating","pr-10":s,"text-red-9 placeholder:text-red-9":!!o},b),value:v,placeholder:l,onFocus:()=>O(!0),onBlur:()=>O(!1),...w})]}),s?u.jsx(M.CheckIcon,{size:20,className:`absolute top-1/2 -translate-y-1/2 text-green-500 ${D?"right-10":"right-3"}`}):null,D&&u.jsx("button",{type:"button",className:p(r==="floating"?"absolute right-3 top-1/2 -translate-y-1/2":"absolute right-3 top-10"),onClick:()=>{A(!S)},children:S?u.jsx(M.EyeOffIcon,{size:20,className:p(o?"text-red-9":"text-base-11")}):u.jsx(M.Eye,{size:20,className:p(o?"text-red-9":"text-base-11")})}),i?u.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:i}):n?u.jsx("p",{className:"text-xs text-base-11 mt-1 ml-0.5",children:n}):null]})});oe.displayName="Input";const Nt=({name:e,customRead:n,customSet:r,withNullSet:t=!0,...a})=>{const{control:l}=z.useFormContext(),s=d.useCallback(i=>n?n(i):i===null?se(i):i,[n]),o=d.useCallback(i=>r?t&&i===null?G(i):r(i):i===null?G(i):i,[r]);return l?u.jsx(z.Controller,{name:e,control:l,render:({field:i,fieldState:c})=>u.jsx(oe,{value:s(i.value),onChange:f=>i.onChange(o(f.target.value)),error:!!c.error,errorMessage:c.error?.message,ref:i.ref,...a})}):(console.error(`Form control is missing for field: ${e}`),u.jsxs("p",{children:["Form control missing for field: ",e]}))},St={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},le=d.forwardRef(({label:e,labelPosition:n="default",placeholder:r,error:t,focusColor:a="brand",className:l,value:s,rows:o=3,...i},c)=>{const[f,h]=d.useState(!1),x=s!==""&&s!==null&&s!==void 0;return u.jsxs("div",{className:"relative",children:[n==="default"?u.jsx("label",{className:p("top-[18px] font-medium ml-0.5 text-xs",t&&"text-red-9"),children:e}):null,u.jsxs("div",{className:p(n==="default"?"p-0":"pt-5 pb-2",{"bg-red-4 text-red-9":!!t}),children:[n==="floating"&&u.jsx("label",{className:p("absolute transition-all duration-200 pointer-events-none","text-sm top-2.5 font-semibold left-2.5",{"text-xs top-2.5":f||x||r,"text-red-9":!!t}),children:e}),u.jsx("textarea",{ref:c,className:p(!t&&f&&St[a],"bg-base-3 border border-base-4 light-theme:drop-shadow-sm rounded-6 w-full focus:outline-none customscrollbarnohide","placeholder:text-base-11 text-sm","resize-none",n==="default"?"p-3":"mt-1",{"text-red-9 placeholder:text-red-9":!!t},l),value:s,placeholder:r,onFocus:()=>h(!0),onBlur:()=>h(!1),rows:o,...i})]})]})});le.displayName="TextArea";const At=({name:e,customRead:n,customSet:r,...t})=>{const{control:a}=z.useFormContext(),l=d.useCallback(o=>n?n(o):o===null?se(o):o,[n]),s=d.useCallback(o=>r?r(o):o===null?G(o):o,[r]);return a?u.jsx(z.Controller,{name:e,control:a,render:({field:o,fieldState:i})=>u.jsxs("div",{children:[u.jsx(le,{value:l(o.value),onChange:c=>o.onChange(s(c.target.value)),error:!!i.error,ref:o.ref,...t}),i.error?u.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:i.error.message}):null]})}):(console.error(`Form control is missing for field: ${e}`),u.jsxs("p",{children:["Form control missing for field: ",e]}))},ze=({label:e,variant:n="default",color:r="solid",tags:t,onChange:a,valid:l,error:s,placeholder:o="Add a tag...",maxTags:i,validateTag:c})=>{const[f,h]=d.useState(""),[x,b]=d.useState(!1),[g,v]=d.useState(null),w=d.useRef(null),E=d.useRef(null),N=d.useRef([]),F=t.length>0,S=d.useRef(`taginput-${Math.random().toString(36).substr(2,9)}`).current,A=d.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,C=d.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current;d.useEffect(()=>{N.current=N.current.slice(0,t.length)},[t.length]);const O=j=>{if(j.key==="Enter"&&f.trim()){j.preventDefault();const k=f.trim();if(i&&t.length>=i){v(`Maximum of ${i} tags allowed`);return}if(t.includes(k)){v("Tag already exists");return}if(c){const L=c(k);if(typeof L=="string"){v(L);return}else if(L===!1){v("Invalid tag");return}}a([...t,k]),h(""),v(null),I(`Added tag ${k}`)}else if(j.key==="Backspace"&&!f&&t.length>0){const k=t[t.length-1];a(t.slice(0,-1)),I(`Removed tag ${k}`)}else j.key==="ArrowLeft"&&f===""&&t.length>0&&N.current[t.length-1]&&N.current[t.length-1]?.focus()},D=(j,k)=>{if(j.key==="Backspace"||j.key==="Delete"){j.preventDefault();const L=t[k],X=[...t];X.splice(k,1),a(X),setTimeout(()=>{w.current&&w.current.focus()},0),I(`Removed tag ${L}`)}else j.key==="ArrowRight"?(j.preventDefault(),k<t.length-1?N.current[k+1]?.focus():w.current?.focus()):j.key==="ArrowLeft"&&(j.preventDefault(),k>0&&N.current[k-1]?.focus())},T=(j,k)=>{a(t.filter(L=>L!==j)),setTimeout(()=>{k<t.length-1?N.current[k]?.focus():k>0?N.current[k-1]?.focus():w.current?.focus()},0),I(`Removed tag ${j}`)},V=j=>{h(j.target.value),v(null)},_=()=>{w.current&&w.current.focus()},I=j=>{console.log(`Accessibility announcement: ${j}`)};return u.jsxs("div",{children:[u.jsxs("div",{className:"relative",ref:E,children:[n==="default"?u.jsxs("label",{id:A,htmlFor:S,className:p("text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":x||F||o,"text-red-9":!!s}),children:[e," ",i&&`(${t.length}/${i})`]}):null,u.jsxs("div",{className:p("rounded-6 px-2 transition cursor-text pr-10",{"bg-base-3":r==="solid","border border-uielborder focus:border-transparent":r==="outline","py-3":n==="default","pt-5 pb-2":n==="floating","ring-2 ring-branduielborder":x,"text-red-9":s||g,"ring-2 ring-red-6":(s||g)&&x}),onClick:_,role:"group","aria-labelledby":A,"aria-describedby":s||g?C:void 0,children:[n==="floating"?u.jsxs("label",{id:A,htmlFor:S,className:p("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":x||F||o,"text-red-9":!!s}),children:[e," ",i&&`(${t.length}/${i})`]}):null,u.jsxs("div",{className:p("flex flex-wrap gap-1 items-center",{"mt-2.5":n==="floating"}),children:[t.map((j,k)=>u.jsxs("div",{ref:L=>{N.current[k]=L},className:p("line-clamp-1 text-brand rounded-full px-2 text-sm flex items-center",{"bg-brandfadedbg text-brand":!s&&!g,"bg-red-4 text-red-9":s||g}),tabIndex:0,role:"button","aria-label":`${j}, press delete or backspace to remove`,onKeyDown:L=>D(L,k),children:[j,u.jsx("button",{type:"button",className:"ml-1 text-brand hover:text-brandhover shrink-0",onClick:()=>T(j,k),"aria-label":`Remove ${j} tag`,children:"x"})]},`${j}-${k}`)),u.jsx("input",{id:S,ref:w,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm placeholder:text-secondarytext",value:f,onChange:V,onKeyDown:O,onFocus:()=>b(!0),onBlur:()=>b(!1),enterKeyHint:"enter",autoComplete:"off",placeholder:t.length>0?"":o,style:{width:`${Math.max(60,f.length*8)}px`},"aria-describedby":s||g?C:void 0,"aria-invalid":!!(s||g)})]})]}),l&&u.jsx("span",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:u.jsx(M.CheckIcon,{})})]}),(s||g)&&u.jsx("p",{id:C,className:"text-red-500 text-xs mt-1","aria-live":"assertive",children:s||g}),u.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:t.length>0?`Current tags: ${t.join(", ")}`:"No tags added yet"})]})},Ft=({name:e,...n})=>{const{control:r}=z.useFormContext();return r?u.jsx(z.Controller,{name:e,control:r,render:({field:t,fieldState:a})=>u.jsx(ze,{tags:t.value,onChange:l=>t.onChange(l),error:a.error?.message,...n})}):(console.error(`Form control is missing for field: ${e}`),u.jsxs("p",{children:["Form control missing for field: ",e]}))},De=({label:e,labelPosition:n="default",options:r,selectedValues:t,onChange:a,idExtractor:l,labelExtractor:s,customSetter:o,valid:i,error:c,placeholder:f="Select options...",maxSelections:h,searchable:x=!1,disabled:b=!1,className:g})=>{const[v,w]=d.useState(""),[E,N]=d.useState(!1),[F,S]=d.useState(-1),A=d.useRef(null),C=d.useRef(null),O=d.useRef([]),{triggerRef:D,triggerProps:T,popoverRef:V,getPopoverPosition:_,open:I,toggle:j,close:k}=je({align:"start",side:"top",avoidCollisions:!1,onOpen:()=>{N(!0),x&&A.current&&setTimeout(()=>A.current?.focus(),10)},onClose:()=>{N(!1),w(""),S(-1)}}),L=d.useRef(`multiselect-${Math.random().toString(36).substr(2,9)}`).current,X=d.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,ae=d.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current,Q=d.useRef(`listbox-${Math.random().toString(36).substr(2,9)}`).current,R=o?t.map(m=>r.find($=>l($)===m||l($)===l(m))).filter(Boolean):t,W=R.length>0,K=x?r.filter(m=>s(m).toLowerCase().includes(v.toLowerCase())):r;d.useEffect(()=>{O.current=O.current.slice(0,K.length)},[K.length]);const ie=m=>o?t.some(y=>y===l(m)||l(y)===l(m)):t.some(y=>l(y)===l(m)),ce=m=>{if(!b)if(ie(m)){let y;if(o){const $=l(m);y=t.filter(B=>B!==$&&l(B)!==$)}else y=t.filter($=>l($)!==l(m));a(y),U(`Removed ${s(m)}`)}else{if(h&&R.length>=h){U(`Maximum of ${h} selections allowed`);return}let y;o?y=[...t,o(m)]:y=[...t,m],a(y),U(`Added ${s(m)}`)}},ue=m=>{if(b)return;let y;if(o){const $=l(m);y=t.filter(B=>B!==$&&l(B)!==$)}else y=t.filter($=>l($)!==l(m));a(y),U(`Removed ${s(m)}`)},fe=m=>{if(!b)switch(m.key){case"Enter":m.preventDefault(),I?F>=0&&ce(K[F]):j();break;case"Escape":m.preventDefault(),k();break;case"ArrowDown":if(m.preventDefault(),!I)j();else{const y=F>=K.length-1?0:F+1;S(y),O.current[y]?.scrollIntoView({block:"nearest"})}break;case"ArrowUp":if(m.preventDefault(),I){const y=F<=0?K.length-1:F-1;S(y),O.current[y]?.scrollIntoView({block:"nearest"})}break;case"Backspace":if(x&&v===""&&R.length>0){const y=R[R.length-1];ue(y)}break}},_e=m=>{w(m.target.value),S(-1)},Ke=()=>{b||(x&&A.current&&A.current.focus(),j())},U=m=>{console.log(`Accessibility announcement: ${m}`)};Ce(V,m=>{!D.current||!I||!m.target||D.current.contains(m.target)||k()});const ee=_();return u.jsxs("div",{className:p("relative",g),children:[u.jsxs("div",{className:"relative",ref:C,children:[n==="default"&&u.jsx("label",{className:p("top-[18px] font-medium ml-0.5 text-xs",c&&"text-red-9"),children:e}),u.jsxs("div",{ref:D,...T,className:p("relative rounded-6 px-2 transition cursor-pointer pr-10 min-h-[48px]","border border-base-4 light-theme:drop-shadow-sm dark-theme:bg-base-3",{"py-3":n==="default","pt-5 pb-2":n==="floating","ring-1 ring-brand":I||E,"text-red-9":c,"ring-2 ring-red-6":c&&(I||E),"opacity-60 cursor-not-allowed":b}),onClick:Ke,role:"combobox","aria-expanded":I,"aria-haspopup":"listbox","aria-owns":Q,"aria-labelledby":X,"aria-describedby":c?ae:void 0,onKeyDown:fe,tabIndex:b?-1:0,children:[n==="floating"&&u.jsxs("label",{id:X,htmlFor:L,className:p("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":E||W,"text-red-9":!!c}),children:[e," ",h&&`(${t.length}/${h})`]}),u.jsxs("div",{className:p("flex flex-wrap gap-2 items-center",{"mt-2.5":n==="floating"}),children:[R.map(m=>u.jsxs("div",{className:p("border border-base-4 dark-theme:border-base-5 dark-theme:bg-base-4 rounded-full px-2 py-1 text-sm flex items-center gap-1",{"bg-red-4 text-red-9":c}),children:[u.jsx("span",{className:"line-clamp-1",children:s(m)}),!b&&u.jsx("button",{type:"button",className:"hover:bg-brand/20 rounded-full p-0.5 transition-colors",onClick:y=>{y.stopPropagation(),ue(m)},"aria-label":`Remove ${s(m)}`,children:u.jsx(M.XIcon,{size:12})})]},l(m))),x&&u.jsx("input",{ref:A,id:L,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",value:v,onChange:_e,onKeyDown:fe,placeholder:W?"":f,disabled:b,"aria-autocomplete":"list","aria-controls":Q,autoComplete:"off"}),!x&&!W&&u.jsx("span",{className:"text-secondarytext text-sm flex-grow",children:f})]}),u.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[i&&u.jsx(M.CheckIcon,{size:16,className:"text-green-600"}),u.jsx(M.ChevronDownIcon,{size:16,className:p("transition-transform text-base-11",{"rotate-180":I})})]})]})]}),u.jsx(de.AnimatePresence,{children:I&&u.jsx(Se,{children:u.jsx(de.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:V,style:{position:"fixed",left:ee.x,top:ee.top,bottom:ee.bottom,width:C.current?.offsetWidth??200},className:p("bg-base-1 dark-theme:bg-base-3 border border-base-4","rounded-6 shadow-lg max-h-[300px] overflow-y-auto z-50","customscrollbarnohide"),role:"listbox",id:Q,"aria-labelledby":X,children:K.length===0?u.jsx("div",{className:"px-3 py-2 text-sm text-secondarytext",children:v?"No results found":"No options available"}):K.map((m,y)=>{const $=ie(m),B=y===F;return u.jsxs("div",{ref:Be=>{O.current[y]=Be},className:p("px-3 py-2 text-sm cursor-pointer flex items-center justify-between","first:rounded-t-6 last:rounded-b-6",{"bg-base-3 dark-theme:bg-base-4":B,"bg-brandfadedbg text-brand":$}),onClick:()=>ce(m),role:"option","aria-selected":$,onMouseEnter:()=>S(y),children:[u.jsx("span",{children:s(m)}),$&&u.jsx(M.CheckIcon,{size:16})]},l(m))})})})}),c&&u.jsx("p",{id:ae,className:"text-red-9 text-xs mt-1","aria-live":"assertive",children:c}),u.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:R.length>0?`Selected: ${R.map(s).join(", ")}`:"No selections"})]})},Ot=({name:e,...n})=>{const{control:r}=z.useFormContext();return r?u.jsx(z.Controller,{name:e,control:r,render:({field:t,fieldState:a})=>u.jsx(De,{selectedValues:t.value||[],onChange:l=>t.onChange(l),error:a.error?.message,...n})}):(console.error(`Form control is missing for field: ${e}`),u.jsxs("p",{children:["Form control missing for field: ",e]}))},$t=({isEditable:e,isDeletable:n=!0,createUpdateLoading:r,deleteLoading:t,onDelete:a,onDeleteConfirm:l,addText:s="Añadir",updateText:o="Actualizar",deleteText:i="Eliminar",className:c})=>{const[f,h]=d.useState(!1);return u.jsxs("div",{className:`w-full grid grid-cols-2 gap-4 col-span-full ${c}`,children:[e&&n?u.jsxs(J,{color:"dangersolid",state:t?"loading":r?"disabled":"enabled",onClick:()=>{l?f?a?.():h(!0):a?.()},children:[u.jsx(M.X,{size:18}),l&&f?"Confirmar":i]}):null,u.jsxs(J,{color:"brand",className:p(e&&n?"":"col-span-2"),state:r?"loading":t?"disabled":"enabled",type:"submit",children:[r?u.jsx(Ne,{}):e?u.jsx(M.Check,{size:18}):u.jsx(M.Plus,{size:18}),e?o:s]})]})};function It({checked:e,onCheckedChange:n,disabled:r=!1,name:t,required:a,className:l=""}){const s=d.useId(),o=()=>{r||n(!e)};return u.jsxs("button",{id:s,type:"button",role:"switch","aria-checked":e,"aria-required":a,"data-state":e?"checked":"unchecked",disabled:r,onClick:o,className:p(`relative inline-flex h-[28px] w-[48px] items-center rounded-full
|
|
2
2
|
transition-colors duration-200 ease-in-out
|
|
3
3
|
focus-visible:outline-none focus-visible:ring-1
|
|
4
4
|
focus-visible:ring-base-6`,e?"bg-brand":"bg-base-3",r?"opacity-50 cursor-not-allowed":"cursor-pointer",l),children:[u.jsx("span",{className:p(`inline-block h-6 w-6 transform rounded-full
|
|
5
5
|
transition-transform duration-200 ease-in-out
|
|
6
|
-
shadow`,e?"bg-brand-text translate-x-[22px]":"bg-base-1 dark-theme:bg-base-12 translate-x-[2px]")}),t&&u.jsx("input",{type:"checkbox",name:t,checked:e,required:a,disabled:r,onChange:()=>{},tabIndex:-1,"aria-hidden":"true",className:"sr-only"})]})}const Re=d.createContext(null),
|
|
6
|
+
shadow`,e?"bg-brand-text translate-x-[22px]":"bg-base-1 dark-theme:bg-base-12 translate-x-[2px]")}),t&&u.jsx("input",{type:"checkbox",name:t,checked:e,required:a,disabled:r,onChange:()=>{},tabIndex:-1,"aria-hidden":"true",className:"sr-only"})]})}const Re=d.createContext(null),Lt=({children:e,value:n})=>u.jsx(Re.Provider,{value:n,children:e}),Mt=()=>{const e=d.useContext(Re);if(!e)throw new Error("useAliveScope must be wrapped within AliveScopeProvider");return e},zt=({children:e})=>{const[n,r]=d.useState({}),t=d.useRef({}),a=d.useRef({}),l=(o,i,c)=>{if(!n[o]){const f=document.createElement("div");return o&&(f.id=o),c&&(f.className=c),r(h=>({...h,[o]:{children:i,element:f}})),t.current[o]=[],a.current[o]=[],t.current&&t.current[o]&&t.current[o].forEach(h=>h(o)),f}return t.current&&t.current[o]&&t.current[o].forEach(f=>f(o)),n[o].element},s=o=>{r(i=>{const c={...i};return delete c[o],c}),a.current&&a.current[o]&&a.current[o].forEach(i=>i(o))};return u.jsxs(Lt,{value:{getPortalElement:l,dropPortalElement:s},children:[e,Object.entries(n).map(([o,{children:i,element:c}])=>u.jsx(Rt,{id:o,onMountCallbacks:t,onDropCallbacks:a,children:i,element:c},o))]})},Te=d.createContext(null),Dt=({children:e,value:n})=>u.jsx(Te.Provider,{value:n,children:e}),Rt=d.memo(({id:e,onMountCallbacks:n,onDropCallbacks:r,children:t,element:a})=>{const l=(o,i={runOnFirstMount:!1})=>{d.useEffect(()=>{const c=()=>{if(document.getElementById(e))o(e);else{const h=new MutationObserver((x,b)=>{document.getElementById(e)&&(o(e),b.disconnect())});return h.observe(document.body,{childList:!0,subtree:!0}),()=>h.disconnect()}};return i?.runOnFirstMount&&c(),n.current[e].push(c),()=>{n.current[e]=n.current[e].filter(f=>f!==c)}},[])},s=o=>{d.useEffect(()=>(r.current[e].push(o),()=>{r.current[e]=r.current[e].filter(i=>i!==o)}),[])};return u.jsx(Dt,{value:{keepAliveId:e,onKeepAliveMount:l,onKeepAliveDrop:s},children:be.createPortal(t,a,e)})}),Tt=()=>{const e=d.useContext(Te);if(!e)throw new Error("useKeepAlive must be used within KeepAliveProvider");return e},_t=({aliveKey:e,children:n,enabled:r=!0,...t})=>{const a=d.useRef(null),{getPortalElement:l}=Mt();return d.useEffect(()=>{const s=l(e,n,t.className);return r&&a.current&&a.current.replaceWith(s),()=>{}},[e,n,r,t]),u.jsx("div",{...t,ref:a,children:n})};exports.AliveScope=zt;exports.Avatar=He;exports.AvatarsGroup=Qe;exports.Button=J;exports.Checkbox=Me;exports.FocusTrap=Ye;exports.Form=jt;exports.FormInput=Nt;exports.FormMultiSelect=Ot;exports.FormSubmit=$t;exports.FormTags=Ft;exports.FormTextArea=At;exports.Icon=Ee;exports.Input=oe;exports.KeepAlive=_t;exports.MultiSelect=De;exports.Portal=Se;exports.Separator=ut;exports.Spinner=Ne;exports.Switch=It;exports.Tags=ze;exports.TextArea=le;exports.calculatePopoverPosition=ke;exports.checkOverflow=q;exports.cn=p;exports.debounce=Ue;exports.extractDirtyData=Ze;exports.generateInitials=pe;exports.nullRead=se;exports.nullSet=G;exports.removeWhitespaces=ge;exports.setFocusEnd=xe;exports.throttle=H;exports.toTitleCase=Pe;exports.useClickAway=et;exports.useClickAwayAdvanced=tt;exports.useClickAwayWithRef=Ce;exports.useKeepAlive=Tt;exports.useKeyListener=rt;exports.useLargeScreen=ve;exports.useMergedRef=we;exports.useMethods=kt;exports.useOverflow=Ge;exports.useOverflowState=Je;exports.usePopover=je;exports.useRipple=ye;
|
|
7
7
|
//# sourceMappingURL=index.cjs.map
|