@mateosuarezdev/react-ui 1.0.0 → 1.0.3

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 CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),o=require("react"),h=require("react-dom"),a=o.createContext(null),P=({children:e,value:r})=>f.jsx(a.Provider,{value:r,children:e}),K=()=>{const e=o.useContext(a);if(!e)throw new Error("useAliveScope must be wrapped within AliveScopeProvider");return e},S=({children:e})=>{const[r,l]=o.useState({}),n=o.useRef({}),c=o.useRef({}),p=(t,u,s)=>{if(!r[t]){const i=document.createElement("div");return t&&(i.id=t),s&&(i.className=s),l(v=>({...v,[t]:{children:u,element:i}})),n.current[t]=[],c.current[t]=[],n.current&&n.current[t]&&n.current[t].forEach(v=>v(t)),i}return n.current&&n.current[t]&&n.current[t].forEach(i=>i(t)),r[t].element},m=t=>{l(u=>{const s={...u};return delete s[t],s}),c.current&&c.current[t]&&c.current[t].forEach(u=>u(t))};return f.jsxs(P,{value:{getPortalElement:p,dropPortalElement:m},children:[e,Object.entries(r).map(([t,{children:u,element:s}])=>f.jsx(j,{id:t,onMountCallbacks:n,onDropCallbacks:c,children:u,element:s},t))]})},A=o.createContext(null),x=({children:e,value:r})=>f.jsx(A.Provider,{value:r,children:e}),j=o.memo(({id:e,onMountCallbacks:r,onDropCallbacks:l,children:n,element:c})=>{const p=(t,u={runOnFirstMount:!1})=>{o.useEffect(()=>{const s=()=>{if(document.getElementById(e))t(e);else{const v=new MutationObserver((b,E)=>{document.getElementById(e)&&(t(e),E.disconnect())});return v.observe(document.body,{childList:!0,subtree:!0}),()=>v.disconnect()}};return u?.runOnFirstMount&&s(),r.current[e].push(s),()=>{r.current[e]=r.current[e].filter(i=>i!==s)}},[])},m=t=>{o.useEffect(()=>(l.current[e].push(t),()=>{l.current[e]=l.current[e].filter(u=>u!==t)}),[])};return f.jsx(x,{value:{keepAliveId:e,onKeepAliveMount:p,onKeepAliveDrop:m},children:h.createPortal(n,c,e)})}),w=()=>{const e=o.useContext(A);if(!e)throw new Error("useKeepAlive must be used within KeepAliveProvider");return e},C=({aliveKey:e,children:r,enabled:l=!0,...n})=>{const c=o.useRef(null),{getPortalElement:p}=K();return o.useEffect(()=>{const m=p(e,r,n.className);return l&&c.current&&c.current.replaceWith(m),()=>{}},[e,r,l,n]),f.jsx("div",{...n,ref:c})};exports.AliveScope=S;exports.KeepAlive=C;exports.KeepAliveContext=A;exports.KeepAliveProvider=x;exports.useKeepAlive=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),D=require("clsx"),I=require("tailwind-merge"),c=require("react"),T=require("react-dom"),W=require("@mateosuarezdev/atoms"),j=({children:e,size:r=24,strokeWidth:t=2,viewBox:s="0 0 24 24",className:o,...l})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:s,className:o,...l,children:e}),m=(...e)=>I.twMerge(D.clsx(e));function E(e,r=100){let t=null,s=null;return function(...o){const l=Date.now();t===null||l-t>=r?(e.apply(this,o),t=l):(s&&clearTimeout(s),s=setTimeout(()=>{e.apply(this,o),t=Date.now()},r-(l-t)))}}function q(e,r=500){let t=null;return function(...s){t&&clearTimeout(t),t=setTimeout(()=>{e.apply(this,s),t=null},r)}}function k(e){if(!e)return"";const t=e.trim().replace(/\s+/g," ").split(" ");return t.length===0||t[0]===""?"":t.length===1?t[0].charAt(0).toUpperCase():(t[0].charAt(0)+t[1].charAt(0)).toUpperCase()}const v={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"},O=({src:e,name:r,size:t="md",className:s})=>e?i.jsx("img",{alt:"avatar",src:e,className:m("rounded-full bg-base-3",v[t])}):r?i.jsx("p",{className:m("rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center",v[t],s),children:k(r)}):i.jsx("div",{className:m("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",v[t],s),children:i.jsxs(j,{size:t==="xs"?16:t==="sm"?20:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),i.jsx("circle",{cx:"12",cy:"7",r:"4"})]})});function $({className:e,children:r,animate:t=!1,...s}){return i.jsx("div",{className:m("flex -space-x-3 rtl:space-x-reverse",e),...s,children:r})}function X(e){return c.useSyncExternalStore(r=>e.subscribe(r),()=>e.get(),()=>e.get())}const y=W.atom(!0);let w=!1;const S=E(()=>{y.set(window.innerWidth>1024)});typeof window<"u"&&(w&&(window.removeEventListener("resize",S),w=!1),window.addEventListener("resize",S),w=!0);const z=()=>(c.useEffect(()=>{y.set(window.innerWidth>1024)},[]),X(y));function F(...e){return r=>{e.forEach(t=>{typeof t=="function"?t(r):t!=null&&(t.current=r)})}}const G=(e=!0,r)=>{const t=z(),s=c.useRef(null),o=c.useCallback(l=>{if(!e||t)return;const p=s.current;if(!p)return;const n=p.getBoundingClientRect(),a=Math.max(n.width,n.height),u=l.clientX-n.left-a/2,d=l.clientY-n.top-a/2,b=document.createElement("span");b.classList.add("ripple-wrapper");const g=document.createElement("span");g.classList.add("ripple"),g.style.backgroundColor=r?"var(--ripple-contrast)":"var(--ripple-main)",g.style.width=`${a}px`,g.style.height=`${a}px`,g.style.left=`${u}px`,g.style.top=`${d}px`,b.appendChild(g);const f=p.getElementsByClassName("ripple-wrapper");if(f?.length)for(const x of f)x.remove();p.appendChild(b),setTimeout(()=>{b.remove()},700)},[e,t,r]);return{ref:s,ripple:o,styles:{position:"relative"}}},U="relative shrink-0 select-none transition outline-none duration-200 ease-out focus:ring-border-brand-light flex items-center justify-center",Y={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"},H={all:"focus:ring-1",desktop:"lg:focus:ring-1",mobile:"focus:ring-1 lg:focus-ring-0",none:""},_={light:"font-light",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},J={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"},Q={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"},V={enabled:"",disabled:"opacity-75",loading:""},C=c.forwardRef(({color:e="transparent",size:r="mdsm",fontWeight:t="normal",rounded:s="6",state:o="enabled",onClick:l,className:p,children:n,withRipple:a=!0,contrastRipple:u,showFocus:d="desktop",withDisabledDelay:b=!1,type:g="button",...f},x)=>{const[N,A]=c.useState(!1),P=h=>{o==="enabled"&&(b?(A(!0),l&&l(h),setTimeout(()=>A(!1),1e3)):l&&l(h))},{ref:K,ripple:L}=G(a,e==="contrast"||u),B=F(K,x);return i.jsx("button",{ref:B,type:g,disabled:f.disabled?f.disabled:o==="disabled"||o==="loading",onMouseDown:L,onClick:h=>N?null:P(h),className:m(U,Y[r],_[t],J[s],H[d],Q[e],V[o],f.disabled&&"opacity-50",p),...f,children:n})});C.displayName="Button";const Z=({className:e})=>i.jsx("div",{className:m("w-full h-px bg-base-4",e)}),R=c.createContext(null),ee=({children:e,value:r})=>i.jsx(R.Provider,{value:r,children:e}),te=()=>{const e=c.useContext(R);if(!e)throw new Error("useAliveScope must be wrapped within AliveScopeProvider");return e},re=({children:e})=>{const[r,t]=c.useState({}),s=c.useRef({}),o=c.useRef({}),l=(n,a,u)=>{if(!r[n]){const d=document.createElement("div");return n&&(d.id=n),u&&(d.className=u),t(b=>({...b,[n]:{children:a,element:d}})),s.current[n]=[],o.current[n]=[],s.current&&s.current[n]&&s.current[n].forEach(b=>b(n)),d}return s.current&&s.current[n]&&s.current[n].forEach(d=>d(n)),r[n].element},p=n=>{t(a=>{const u={...a};return delete u[n],u}),o.current&&o.current[n]&&o.current[n].forEach(a=>a(n))};return i.jsxs(ee,{value:{getPortalElement:l,dropPortalElement:p},children:[e,Object.entries(r).map(([n,{children:a,element:u}])=>i.jsx(se,{id:n,onMountCallbacks:s,onDropCallbacks:o,children:a,element:u},n))]})},M=c.createContext(null),ne=({children:e,value:r})=>i.jsx(M.Provider,{value:r,children:e}),se=c.memo(({id:e,onMountCallbacks:r,onDropCallbacks:t,children:s,element:o})=>{const l=(n,a={runOnFirstMount:!1})=>{c.useEffect(()=>{const u=()=>{if(document.getElementById(e))n(e);else{const b=new MutationObserver((g,f)=>{document.getElementById(e)&&(n(e),f.disconnect())});return b.observe(document.body,{childList:!0,subtree:!0}),()=>b.disconnect()}};return a?.runOnFirstMount&&u(),r.current[e].push(u),()=>{r.current[e]=r.current[e].filter(d=>d!==u)}},[])},p=n=>{c.useEffect(()=>(t.current[e].push(n),()=>{t.current[e]=t.current[e].filter(a=>a!==n)}),[])};return i.jsx(ne,{value:{keepAliveId:e,onKeepAliveMount:l,onKeepAliveDrop:p},children:T.createPortal(s,o,e)})}),oe=()=>{const e=c.useContext(M);if(!e)throw new Error("useKeepAlive must be used within KeepAliveProvider");return e},le=({aliveKey:e,children:r,enabled:t=!0,...s})=>{const o=c.useRef(null),{getPortalElement:l}=te();return c.useEffect(()=>{const p=l(e,r,s.className);return t&&o.current&&o.current.replaceWith(p),()=>{}},[e,r,t,s]),i.jsx("div",{...s,ref:o})};exports.AliveScope=re;exports.Avatar=O;exports.AvatarsGroup=$;exports.Button=C;exports.Icon=j;exports.KeepAlive=le;exports.Separator=Z;exports.cn=m;exports.debounce=q;exports.generateInitials=k;exports.throttle=E;exports.useKeepAlive=oe;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/components/keep-alive.tsx"],"sourcesContent":["import {\n createContext,\n memo,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\n//============================\n// #region AliveScope\n//============================\ntype AliveScopeContextType = {\n getPortalElement: (\n id: string,\n children: React.ReactNode,\n className?: string\n ) => HTMLElement;\n dropPortalElement: (id: string) => void;\n};\n\nconst AliveScopeContext = createContext<AliveScopeContextType | null>(null);\n\nconst AliveScopeProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: AliveScopeContextType;\n}) => {\n return (\n <AliveScopeContext.Provider value={value}>\n {children}\n </AliveScopeContext.Provider>\n );\n};\n\nconst useAliveScope = () => {\n const context = useContext(AliveScopeContext);\n\n if (!context)\n throw new Error(\"useAliveScope must be wrapped within AliveScopeProvider\");\n\n return context;\n};\n\ntype AliveScopeProps = {\n children?: React.ReactNode;\n};\n\nconst AliveScope: React.FC<AliveScopeProps> = ({ children }) => {\n const [nodes, setNodes] = useState<{\n [id: string]: { children: React.ReactNode; element: HTMLElement };\n }>({});\n\n const onMountCallbacks = useRef<{ [id: string]: ((id: string) => void)[] }>(\n {}\n );\n const onDropCallbacks = useRef<{ [id: string]: ((id: string) => void)[] }>(\n {}\n );\n\n const getPortalElement = (\n id: string,\n children: React.ReactNode,\n className?: string\n ) => {\n if (!nodes[id]) {\n const element = document.createElement(\"div\");\n if (id) {\n element.id = id;\n }\n if (className) {\n element.className = className;\n }\n setNodes((prevNodes) => ({\n ...prevNodes,\n [id]: { children, element },\n }));\n onMountCallbacks.current[id] = [];\n onDropCallbacks.current[id] = [];\n if (onMountCallbacks.current && onMountCallbacks.current[id]) {\n onMountCallbacks.current[id].forEach((callback) => callback(id));\n }\n return element;\n }\n if (onMountCallbacks.current && onMountCallbacks.current[id]) {\n onMountCallbacks.current[id].forEach((callback) => callback(id));\n }\n return nodes[id].element;\n };\n\n const dropPortalElement = (id: string) => {\n setNodes((prevNodes) => {\n const copy = { ...prevNodes };\n delete copy[id];\n return copy;\n });\n //console.log(\"dropped\", id);\n if (onDropCallbacks.current && onDropCallbacks.current[id]) {\n onDropCallbacks.current[id].forEach((callback) => callback(id));\n }\n };\n\n return (\n <AliveScopeProvider\n value={{\n getPortalElement,\n dropPortalElement,\n }}\n >\n {children}\n {Object.entries(nodes).map(([id, { children, element }]) => (\n <Component\n key={id}\n id={id}\n onMountCallbacks={onMountCallbacks}\n onDropCallbacks={onDropCallbacks}\n children={children}\n element={element}\n />\n ))}\n </AliveScopeProvider>\n );\n};\n//============================\n// #endregion AliveScope\n//============================\n\n//============================\n// #region KeepAlive\n//============================\ntype KeepAliveContextType = {\n keepAliveId: string;\n onKeepAliveMount: (\n callback: (id: string) => void,\n options?: { runOnFirstMount?: boolean }\n ) => void;\n onKeepAliveDrop: (callback: (id: string) => void) => void;\n};\n\nexport const KeepAliveContext = createContext<KeepAliveContextType | null>(\n null\n);\n\nexport const KeepAliveProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: KeepAliveContextType;\n}) => {\n return (\n <KeepAliveContext.Provider value={value}>\n {children}\n </KeepAliveContext.Provider>\n );\n};\n\nconst Component = memo<{\n id: string;\n onMountCallbacks: React.MutableRefObject<{\n [id: string]: ((id: string) => void)[];\n }>;\n onDropCallbacks: React.MutableRefObject<{\n [id: string]: ((id: string) => void)[];\n }>;\n children: React.ReactNode;\n element: HTMLElement;\n}>(({ id, onMountCallbacks, onDropCallbacks, children, element }) => {\n const onKeepAliveMount = (\n callback: (id: string) => void,\n options: { runOnFirstMount?: boolean } = { runOnFirstMount: false }\n ) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n const runCallback = () => {\n const el = document.getElementById(id);\n if (el) {\n callback(id);\n } else {\n // If element is not found, use MutationObserver to wait for it\n const observer = new MutationObserver((_mutations, obs) => {\n const el = document.getElementById(id);\n if (el) {\n callback(id);\n obs.disconnect(); // Stop observing once element is found\n }\n });\n\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n\n // Cleanup function to disconnect the observer if component unmounts\n return () => observer.disconnect();\n }\n };\n\n if (options?.runOnFirstMount) {\n runCallback();\n }\n\n onMountCallbacks.current[id].push(runCallback);\n return () => {\n onMountCallbacks.current[id] = onMountCallbacks.current[id].filter(\n (cb) => cb !== runCallback\n );\n };\n }, []);\n };\n\n const onKeepAliveDrop = (callback: (id: string) => void) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n onDropCallbacks.current[id].push(callback);\n return () => {\n onDropCallbacks.current[id] = onDropCallbacks.current[id].filter(\n (cb) => cb !== callback\n );\n };\n }, []);\n };\n\n return (\n <KeepAliveProvider\n value={{ keepAliveId: id, onKeepAliveMount, onKeepAliveDrop }}\n >\n {createPortal(children, element, id)}\n </KeepAliveProvider>\n );\n});\n\nconst useKeepAlive = () => {\n const context = useContext(KeepAliveContext);\n\n if (!context)\n throw new Error(\"useKeepAlive must be used within KeepAliveProvider\");\n\n return context;\n};\n\ntype KeepAliveProps = React.HTMLAttributes<HTMLDivElement> & {\n aliveKey: string;\n children: React.ReactNode;\n enabled?: boolean;\n};\n\nconst KeepAlive: React.FC<KeepAliveProps> = ({\n aliveKey,\n children,\n enabled = true,\n ...others\n}) => {\n const keepAliveRef = useRef<HTMLDivElement | null>(null);\n const { getPortalElement } = useAliveScope();\n\n useEffect(() => {\n const element = getPortalElement(aliveKey, children, others.className);\n\n if (enabled) {\n if (keepAliveRef.current) {\n keepAliveRef.current.replaceWith(element);\n }\n }\n\n return () => {\n //TODO\n //callUnmountCallbacks(aliveKey)\n };\n }, [aliveKey, children, enabled, others]);\n\n return <div {...others} ref={keepAliveRef} />;\n};\n//============================\n// #endregion KeepAlive\n//============================\n\nexport { AliveScope, KeepAlive, useKeepAlive };\n"],"names":["AliveScopeContext","createContext","AliveScopeProvider","children","value","jsx","useAliveScope","context","useContext","AliveScope","nodes","setNodes","useState","onMountCallbacks","useRef","onDropCallbacks","getPortalElement","id","className","element","prevNodes","callback","dropPortalElement","copy","jsxs","Component","KeepAliveContext","KeepAliveProvider","memo","onKeepAliveMount","options","useEffect","runCallback","observer","_mutations","obs","cb","onKeepAliveDrop","createPortal","useKeepAlive","KeepAlive","aliveKey","enabled","others","keepAliveRef"],"mappings":"+JAsBMA,EAAoBC,EAAAA,cAA4C,IAAI,EAEpEC,EAAqB,CAAC,CAC1B,SAAAC,EACA,MAAAC,CACF,IAKIC,EAAAA,IAACL,EAAkB,SAAlB,CA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CACP,EAEMK,EAAmBhB,GAAmC,CAE1DU,EAAAA,UAAU,KACRhB,EAAgB,QAAQE,CAAE,EAAE,KAAKI,CAAQ,EAClC,IAAM,CACXN,EAAgB,QAAQE,CAAE,EAAIF,EAAgB,QAAQE,CAAE,EAAE,OACvDmB,GAAOA,IAAOf,CAAA,CAEnB,GACC,CAAA,CAAE,CACP,EAEA,OACEhB,EAAAA,IAACsB,EAAA,CACC,MAAO,CAAE,YAAaV,EAAI,iBAAAY,EAAkB,gBAAAQ,CAAA,EAE3C,SAAAC,EAAAA,aAAanC,EAAUgB,EAASF,CAAE,CAAA,CAAA,CAGzC,CAAC,EAEKsB,EAAe,IAAM,CACzB,MAAMhC,EAAUC,EAAAA,WAAWkB,CAAgB,EAE3C,GAAI,CAACnB,EACH,MAAM,IAAI,MAAM,oDAAoD,EAEtE,OAAOA,CACT,EAQMiC,EAAsC,CAAC,CAC3C,SAAAC,EACA,SAAAtC,EACA,QAAAuC,EAAU,GACV,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAe9B,EAAAA,OAA8B,IAAI,EACjD,CAAE,iBAAAE,CAAA,EAAqBV,EAAA,EAE7ByB,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMZ,EAAUH,EAAiByB,EAAUtC,EAAUwC,EAAO,SAAS,EAErE,OAAID,GACEE,EAAa,SACfA,EAAa,QAAQ,YAAYzB,CAAO,EAIrC,IAAM,CAGb,CACF,EAAG,CAACsB,EAAUtC,EAAUuC,EAASC,CAAM,CAAC,EAEjCtC,EAAAA,IAAC,MAAA,CAAK,GAAGsC,EAAQ,IAAKC,EAAc,CAC7C"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/icons/index.tsx","../src/utils/index.ts","../src/components/Avatar.tsx","../src/components/AvatarsGroup.tsx","../../../node_modules/@mateosuarezdev/atoms/dist/react.js","../src/hooks/use-large-screen.tsx","../src/hooks/use-merged-ref.tsx","../src/hooks/use-ripple.tsx","../src/components/Button.tsx","../src/components/Separator.tsx","../src/components/KeepAlive.tsx"],"sourcesContent":["/**\r\n * Props for the base Icon component that provides a consistent SVG wrapper.\r\n */\r\ninterface IconProps extends React.SVGProps<SVGSVGElement> {\r\n /** Width and height of the icon in pixels (default: 24) */\r\n size?: number | string;\r\n /** Stroke width for outlined icons (default: 2) */\r\n strokeWidth?: number;\r\n /** SVG viewBox attribute defining the coordinate system (default: \"0 0 24 24\") */\r\n viewBox?: \"0 0 24 24\" | \"0 0 48 48\" | \"0 0 512 512\";\r\n /** CSS class names for styling */\r\n className?: string;\r\n /** SVG elements (paths, circles, etc.) that define the icon shape */\r\n children?: React.ReactNode;\r\n}\r\n\r\n/**\r\n * Base Icon component that provides a consistent SVG wrapper for creating custom icons.\r\n * Handles common SVG properties while allowing full customization through standard SVG props.\r\n *\r\n * @example\r\n * // Creating a reusable icon component\r\n * export const CustomIcon = ({ size, className, ...props }: IndividualIconProps) => {\r\n * return (\r\n * <Icon size={size} className={className} fill=\"currentColor\" {...props}>\r\n * <path d=\"M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z\" />\r\n * </Icon>\r\n * );\r\n * };\r\n *\r\n * @example\r\n * // Creating a custom icon\r\n * <Icon size={32} strokeWidth={1.5}>\r\n * <path d=\"M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z\" />\r\n * </Icon>\r\n *\r\n * @example\r\n * // Using with custom viewBox for different icon sets\r\n * <Icon viewBox=\"0 0 512 512\" size={48}>\r\n * <circle cx=\"256\" cy=\"256\" r=\"200\" />\r\n * </Icon>\r\n */\r\nexport const Icon: React.FC<IconProps> = ({\r\n children,\r\n size = 24,\r\n strokeWidth = 2,\r\n viewBox = \"0 0 24 24\",\r\n className,\r\n ...props\r\n}) => {\r\n return (\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width={size}\r\n height={size}\r\n viewBox={viewBox}\r\n className={className}\r\n {...props}\r\n >\r\n {children}\r\n </svg>\r\n );\r\n};\r\n\r\n// Define props for individual icons\r\nexport type IndividualIconProps = Omit<IconProps, \"children\">;\r\n","import { clsx, type ClassValue } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\n//Custom ClassName\r\nexport type { ClassValue };\r\n\r\n/**Tailwind Merge + Clsx */\r\nexport const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));\r\n\r\n/**\r\n * Creates a throttled function that only invokes func at most once per every limit milliseconds.\r\n * The first call executes immediately, subsequent calls are rate-limited, and the last call\r\n * during rapid firing is guaranteed to execute with the most recent arguments.\r\n *\r\n * @param func - The function to throttle\r\n * @param limit - The number of milliseconds to throttle invocations to (default: 100)\r\n * @returns A throttled version of the function\r\n *\r\n * @example\r\n * const handleScroll = throttle(() => {\r\n * console.log('Scrolled!');\r\n * }, 200);\r\n *\r\n * window.addEventListener('scroll', handleScroll);\r\n */\r\nexport function throttle<T extends (...args: any[]) => any>(\r\n func: T,\r\n limit: number = 100\r\n): (...args: Parameters<T>) => void {\r\n let lastRan: number | null = null;\r\n let timeout: ReturnType<typeof setTimeout> | null = null;\r\n\r\n return function (this: any, ...args: Parameters<T>) {\r\n const now = Date.now();\r\n\r\n if (lastRan === null || now - lastRan >= limit) {\r\n func.apply(this, args);\r\n lastRan = now;\r\n } else {\r\n if (timeout) clearTimeout(timeout);\r\n timeout = setTimeout(() => {\r\n func.apply(this, args);\r\n lastRan = Date.now();\r\n }, limit - (now - lastRan));\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Creates a debounced function that delays invoking func until after delay milliseconds\r\n * have elapsed since the last time the debounced function was invoked. Each call resets\r\n * the timer, ensuring func only executes after activity has stopped.\r\n *\r\n * @param func - The function to debounce\r\n * @param delay - The number of milliseconds to delay (default: 300)\r\n * @returns A debounced version of the function\r\n *\r\n * @example\r\n * const handleSearch = debounce((query) => {\r\n * fetchResults(query);\r\n * }, 300);\r\n *\r\n * input.addEventListener('input', (e) => handleSearch(e.target.value));\r\n */\r\nexport function debounce<T extends (...args: any[]) => any>(\r\n func: T,\r\n delay: number = 500\r\n): (...args: Parameters<T>) => void {\r\n let timeout: ReturnType<typeof setTimeout> | null = null;\r\n\r\n return function (this: any, ...args: Parameters<T>) {\r\n if (timeout) clearTimeout(timeout);\r\n\r\n timeout = setTimeout(() => {\r\n func.apply(this, args);\r\n timeout = null;\r\n }, delay);\r\n };\r\n}\r\n\r\nexport function generateInitials(name: string) {\r\n if (!name) return \"\";\r\n\r\n // Trim and remove extra spaces\r\n const trimmedName = name.trim().replace(/\\s+/g, \" \");\r\n\r\n // Split by space to get words\r\n const words = trimmedName.split(\" \");\r\n\r\n // If no words (empty string), return empty\r\n if (words.length === 0 || words[0] === \"\") {\r\n return \"\";\r\n }\r\n\r\n // If only one word, return first letter\r\n if (words.length === 1) {\r\n return words[0].charAt(0).toUpperCase();\r\n }\r\n\r\n // If two or more words, return first letter of first two words\r\n return (words[0].charAt(0) + words[1].charAt(0)).toUpperCase();\r\n}\r\n","import { Icon } from \"../icons\";\r\nimport { cn } from \"../utils\";\r\nimport { generateInitials } from \"../utils\";\r\n\r\nconst sizes = {\r\n xs: \"w-8 h-8\",\r\n sm: \"w-10 h-10 text-lg\",\r\n md: \"w-14 h-14 text-xl\",\r\n lg: \"h-20 w-20 text-2xl\",\r\n xl: \"h-24 w-24 text-2xl\",\r\n};\r\n\r\nconst Avatar = ({\r\n src,\r\n name,\r\n size = \"md\",\r\n className,\r\n}: {\r\n src?: string;\r\n name?: string;\r\n size?: keyof typeof sizes;\r\n className?: string;\r\n}) => {\r\n if (src) {\r\n return (\r\n <img\r\n alt=\"avatar\"\r\n src={src}\r\n className={cn(\"rounded-full bg-base-3\", sizes[size])}\r\n />\r\n );\r\n }\r\n\r\n if (name) {\r\n return (\r\n <p\r\n className={cn(\r\n \"rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center\",\r\n sizes[size],\r\n className\r\n )}\r\n >\r\n {generateInitials(name)}\r\n </p>\r\n );\r\n }\r\n\r\n return (\r\n <div\r\n className={cn(\r\n \"rounded-full text-2xl font-medium flex items-center justify-center\",\r\n \"bg-base-2 dark-theme:bg-base-3 border border-base-4\",\r\n \"lg:hover:bg-base-3 max-lg:active:bg-base-4 transition-colors\",\r\n sizes[size],\r\n className\r\n )}\r\n >\r\n <Icon\r\n size={size === \"xs\" ? 16 : size === \"sm\" ? 20 : 24}\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n strokeWidth={2}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n >\r\n <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" />\r\n <circle cx=\"12\" cy=\"7\" r=\"4\" />\r\n </Icon>\r\n </div>\r\n );\r\n};\r\n\r\nexport { Avatar };\r\n","import { ComponentPropsWithoutRef } from \"react\";\r\nimport { cn } from \"../utils\";\r\n\r\nfunction AvatarsGroup({\r\n className,\r\n children,\r\n animate = false,\r\n ...props\r\n}: ComponentPropsWithoutRef<\"div\"> & { animate?: boolean }) {\r\n return (\r\n <div\r\n className={cn(\"flex -space-x-3 rtl:space-x-reverse\", className)}\r\n {...props}\r\n >\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\nexport { AvatarsGroup };\r\n","import { useSyncExternalStore as s, useCallback as o, useRef as i, useEffect as l } from \"react\";\nimport { computed as p, effect as b } from \"./index.js\";\nfunction A(e) {\n const t = s(\n (u) => e.subscribe(u),\n () => e.get(),\n () => e.get()\n ), r = o(\n (u) => {\n e.set(u);\n },\n [e]\n );\n return [t, r];\n}\nfunction f(e) {\n return s(\n (t) => e.subscribe(t),\n () => e.get(),\n () => e.get()\n );\n}\nfunction d(e) {\n return o(\n (t) => {\n e.set(t);\n },\n [e]\n );\n}\nfunction E(e) {\n const t = i(null);\n return t.current || (t.current = p(e)), f(t.current);\n}\nfunction S(e) {\n l(() => b(e), []);\n}\nfunction h(e, ...t) {\n const r = t.length > 0 ? t : Object.keys(e), u = {};\n return r.forEach((c) => {\n const n = e[c];\n n && typeof n == \"object\" && \"get\" in n ? u[c] = f(n) : u[c] = n;\n }), u;\n}\nexport {\n A as useAtom,\n S as useAtomEffect,\n f as useAtomValue,\n E as useComputed,\n d as useSetAtom,\n h as useStore\n};\n//# sourceMappingURL=react.js.map\n","import { throttle } from \"../utils\";\r\nimport { useEffect } from \"react\";\r\nimport { atom } from \"@mateosuarezdev/atoms\";\r\nimport { useAtomValue } from \"@mateosuarezdev/atoms/react\";\r\n\r\n/**\r\n * Standard breakpoints for responsive design.\r\n */\r\n// export const mediaQueries = {\r\n// sm: 640,\r\n// md: 768,\r\n// lg: 1024,\r\n// xl: 1280,\r\n// \"2xl\": 1536,\r\n// };\r\n\r\n/**\r\n * Observable state tracking whether the screen is larger than the 'lg' breakpoint.\r\n * Default to true on server (assumes desktop), update on client.\r\n */\r\n// const largeObservable = observable(\r\n// typeof window !== \"undefined\" ? window.innerWidth > mediaQueries.lg : true\r\n// );\r\nconst largeAtom = atom(true);\r\n\r\nlet listening = false;\r\n\r\n/**\r\n * Throttled resize handler to update screen size state.\r\n * Only updates the observable when the viewport crosses the large screen threshold.\r\n * Throttled to improve performance by limiting update frequency.\r\n */\r\nconst handleResize = throttle(() => {\r\n largeAtom.set(window.innerWidth > 1024);\r\n}); // Throttle to once per 100ms\r\n\r\n// Only set up listeners on client\r\nif (typeof window !== \"undefined\") {\r\n if (listening) {\r\n window.removeEventListener(\"resize\", handleResize);\r\n listening = false;\r\n }\r\n\r\n // Attach resize listener to update state when window is resized\r\n window.addEventListener(\"resize\", handleResize);\r\n listening = true;\r\n}\r\n\r\n/**\r\n * Custom hook that returns whether the current viewport is larger than the 'lg' breakpoint.\r\n *\r\n * @example\r\n * function MyComponent() {\r\n * const lg = useLargeScreen();\r\n *\r\n * return (\r\n * <div>\r\n * {lg\r\n * ? <DesktopLayout />\r\n * : <MobileLayout />\r\n * }\r\n * </div>\r\n * );\r\n * }\r\n *\r\n * @returns {boolean} True if the current viewport width is larger than the 'lg' breakpoint\r\n */\r\nconst useLargeScreen = (): boolean => {\r\n useEffect(() => {\r\n largeAtom.set(window.innerWidth > 1024);\r\n }, []);\r\n return useAtomValue(largeAtom);\r\n};\r\n\r\nexport { useLargeScreen };\r\n","function useMergedRef<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\r\n return (value) => {\r\n refs.forEach((ref) => {\r\n if (typeof ref === \"function\") {\r\n ref(value);\r\n } else if (ref != null) {\r\n (ref as React.MutableRefObject<T | null>).current = value;\r\n }\r\n });\r\n };\r\n}\r\n\r\nexport { useMergedRef };\r\n","import { CSSProperties, useCallback, useRef } from \"react\";\r\nimport { useLargeScreen } from \"./use-large-screen\";\r\n\r\n// new ripple uses a wrapper so the parent doesn't need overflow-hidden\r\nconst useRipple = <T extends HTMLElement>(\r\n enabled: boolean = true,\r\n contrastRipple?: boolean\r\n) => {\r\n const lg = useLargeScreen();\r\n const ref = useRef<T>(null);\r\n\r\n const ripple = useCallback(\r\n (event: React.MouseEvent<T>) => {\r\n if (!enabled || lg) return;\r\n\r\n const button = ref.current;\r\n if (!button) return;\r\n\r\n // Get button's position and dimensions\r\n const buttonRect = button.getBoundingClientRect();\r\n const rippleSize = Math.max(buttonRect.width, buttonRect.height);\r\n const offsetX = event.clientX - buttonRect.left - rippleSize / 2;\r\n const offsetY = event.clientY - buttonRect.top - rippleSize / 2;\r\n\r\n // Create the ripple wrapper (this element holds the ripple)\r\n const rippleWrapper = document.createElement(\"span\");\r\n rippleWrapper.classList.add(\"ripple-wrapper\");\r\n\r\n // Create the ripple element (circle)\r\n const rippleEl = document.createElement(\"span\");\r\n rippleEl.classList.add(\"ripple\");\r\n rippleEl.style.backgroundColor = contrastRipple\r\n ? \"var(--ripple-contrast)\"\r\n : \"var(--ripple-main)\";\r\n\r\n // Set the position and size of the ripple\r\n rippleEl.style.width = `${rippleSize}px`;\r\n rippleEl.style.height = `${rippleSize}px`;\r\n rippleEl.style.left = `${offsetX}px`;\r\n rippleEl.style.top = `${offsetY}px`;\r\n\r\n rippleWrapper.appendChild(rippleEl);\r\n\r\n const ripples = button.getElementsByClassName(\"ripple-wrapper\");\r\n if (ripples?.length) {\r\n for (const ripple of ripples) {\r\n ripple.remove();\r\n }\r\n }\r\n\r\n // Append the ripple wrapper to the button\r\n button.appendChild(rippleWrapper);\r\n\r\n // Remove the ripple wrapper after animation\r\n setTimeout(() => {\r\n rippleWrapper.remove();\r\n }, 700); // Match the animation duration\r\n },\r\n [enabled, lg, contrastRipple]\r\n );\r\n\r\n return {\r\n ref,\r\n ripple,\r\n styles: {\r\n position: \"relative\",\r\n } as CSSProperties,\r\n };\r\n};\r\n\r\nexport { useRipple };\r\n\r\n// ios like fade effect\r\n// const useRipple = (enabled = true, contrastRipple?: boolean) => {\r\n// const lg = useLargeScreen();\r\n// const ref = useRef<HTMLElement>(null);\r\n\r\n// const ripple = useCallback(\r\n// (event: React.MouseEvent<HTMLElement>) => {\r\n// if (!enabled || lg) return;\r\n\r\n// const rippleEl = document.createElement(\"span\");\r\n// rippleEl.classList.add(\"simple-ripple\");\r\n// rippleEl.style.backgroundColor = contrastRipple\r\n// ? \"var(--ripple-contrast)\"\r\n// : \"var(--ripple-main)\";\r\n\r\n// const target = ref.current;\r\n// if (!target) return;\r\n\r\n// target.appendChild(rippleEl);\r\n\r\n// // Remove after animation\r\n// setTimeout(() => {\r\n// rippleEl.remove();\r\n// }, 400); // Match animation duration\r\n// },\r\n// [enabled, lg, contrastRipple]\r\n// );\r\n\r\n// return { ref, ripple };\r\n// };\r\n\r\n// export default useRipple;\r\n\r\n// old ripple requires parent with overflow-hidden\r\n// const useRipple = (enabled: boolean = true, contrastRipple?: boolean) => {\r\n// const lg = useLargeScreen();\r\n// const ref = useRef<HTMLElement>(null);\r\n// const ripple = useCallback(\r\n// (event: React.MouseEvent<HTMLElement, MouseEvent>) => {\r\n// if (!lg && enabled) {\r\n// const rippleContainer = event.currentTarget.getBoundingClientRect();\r\n// const circle = document.createElement(\"span\");\r\n// const diameter = Math.max(\r\n// rippleContainer.width,\r\n// rippleContainer.height\r\n// );\r\n// const radius = diameter / 2;\r\n\r\n// circle.style.width = circle.style.height = `${diameter}px`;\r\n// circle.style.left = `${\r\n// event.clientX - (rippleContainer.left + radius)\r\n// }px`;\r\n// circle.style.top = `${\r\n// event.clientY - (rippleContainer.top + radius)\r\n// }px`;\r\n// circle.style.backgroundColor = `${\r\n// contrastRipple ? \"var(--ripple-contrast)\" : \"var(--ripple-main)\"\r\n// }`;\r\n// circle.style.pointerEvents = \"none\";\r\n// circle.classList.add(\"ripple\");\r\n\r\n// const ripples = ref.current?.getElementsByClassName(\"ripple\");\r\n// if (ripples?.length) {\r\n// for (const ripple of ripples) {\r\n// ripple.remove();\r\n// }\r\n// }\r\n\r\n// ref.current?.appendChild(circle);\r\n\r\n// (async () => {\r\n// //await sleep(750);\r\n// setTimeout(\r\n// () => ref.current?.getElementsByClassName(\"ripple\")[0]?.remove(),\r\n// 750\r\n// );\r\n// })();\r\n// }\r\n// },\r\n// [contrastRipple, lg, enabled]\r\n// );\r\n\r\n// return {\r\n// ref: ref,\r\n// ripple: ripple,\r\n// classNames: \"relative overflow-hidden inline-block\",\r\n// };\r\n// };\r\n\r\n// export default useRipple;\r\n","import { forwardRef, useState, ForwardedRef } from \"react\";\r\nimport { cn } from \"../utils\";\r\nimport { useMergedRef } from \"../hooks\";\r\nimport { useRipple } from \"../hooks/use-ripple\";\r\n\r\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\r\n color?: keyof typeof colorStyles;\r\n size?: keyof typeof sizeStyles;\r\n fontWeight?: keyof typeof fontWeightStyles;\r\n rounded?: keyof typeof borderRadiusStyles;\r\n state?: \"enabled\" | \"disabled\" | \"loading\";\r\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\r\n className?: string;\r\n withRipple?: boolean;\r\n contrastRipple?: boolean;\r\n showFocus?: \"all\" | \"desktop\" | \"mobile\" | \"none\";\r\n withDisabledDelay?: boolean;\r\n type?: \"button\" | \"submit\" | \"reset\";\r\n children?: React.ReactNode;\r\n};\r\n\r\n// Base button styles that apply to all variants\r\nconst baseStyles =\r\n \"relative shrink-0 select-none transition outline-none duration-200 ease-out focus:ring-border-brand-light flex items-center justify-center\"; //was pl-1.5 and rounded-lg\r\n\r\nconst sizeStyles = {\r\n xs: \"text-xs px-1 gap-x-0.5 py-1\",\r\n sm: \"text-sm px-2.5 gap-x-1 py-1.5\",\r\n mdsm: \"text-sm px-3 gap-x-1.5 py-2.5\",\r\n md: \"text-base px-4 gap-x-1.5 py-2.5\",\r\n lg: \"text-base px-4 gap-x-1.5 py-3.5\",\r\n picker: \"text-base px-2 py-2 gap-x-1.5\",\r\n iconXs: \"text-xs p-1\",\r\n iconSm: \"text-sm p-2\",\r\n iconMd: \"text-base p-3\",\r\n iconLg: \"text-base p-4\",\r\n};\r\n\r\n// Focus styles based on showFocus prop\r\nconst focusStyles = {\r\n all: \"focus:ring-1\",\r\n desktop: \"lg:focus:ring-1\",\r\n mobile: \"focus:ring-1 lg:focus-ring-0\",\r\n none: \"\",\r\n};\r\n\r\nconst fontWeightStyles = {\r\n light: \"font-light\",\r\n normal: \"font-normal\",\r\n medium: \"font-medium\",\r\n semibold: \"font-semibold\",\r\n bold: \"font-bold\",\r\n};\r\n\r\nconst borderRadiusStyles = {\r\n none: \"rounded-none\",\r\n \"1\": \"rounded-1\",\r\n \"2\": \"rounded-2\",\r\n \"3\": \"rounded-3\",\r\n \"4\": \"rounded-4\",\r\n \"5\": \"rounded-5\",\r\n \"6\": \"rounded-6\",\r\n \"7\": \"rounded-7\",\r\n \"8\": \"rounded-8\",\r\n \"9\": \"rounded-9\",\r\n \"10\": \"rounded-10\",\r\n \"11\": \"rounded-11\",\r\n \"12\": \"rounded-12\",\r\n full: \"rounded-full\",\r\n};\r\n\r\n// Color variant styles\r\nconst colorStyles = {\r\n transparent: \"text-base-12 lg:hover:bg-base-4 focus:ring-base-6\",\r\n transparentinactive: \"text-base-11 lg:hover:bg-base-4\",\r\n brand:\r\n \"bg-brand text-brand-text lg:hover:bg-brand-hover focus:ring-base-6 border border-transparent\",\r\n accent: \"bg-accent text-accent-text lg:hover:bg-accent-hover\",\r\n contrast: \"bg-base-12 text-base-1 lg:hover:bg-base-11 focus:ring-base-6\",\r\n solid:\r\n \"bg-base-3 dark-theme:bg-base-3 lg:hover:bg-base-4 border border-base-4 focus:ring-base-5\",\r\n solidhybrid:\r\n \"border border-base-5 dark-theme:border-base-4 dark-theme:bg-base-3 lg:hover:bg-base-4 focus:ring-base-6\",\r\n outline: \"border border-base-6 lg:hover:bg-base-3 focus:ring-base-6\",\r\n info: \"bg-blue-3 text-blue-9 lg:hover:bg-blue-4 lg:active:bg-blue-5 focus:ring-blue-9 border border-transparent\",\r\n success:\r\n \"bg-green-4 text-green-9 lg:hover:bg-green-5 lg:active:bg-green-6 focus:ring-green-9 border border-transparent\",\r\n warning:\r\n \"bg-yellow-4 text-yellow-9 lg:hover:bg-yellow-5 lg:active:bg-yellow-6 focus:ring-yellow-9 border border-transparent\",\r\n danger:\r\n \"bg-red-4 text-red-9 lg:hover:bg-red-5 focus:ring-red-9 border border-transparent\",\r\n dangersolid:\r\n \"bg-red-9 text-base-1 dark-theme:text-base-12 lg:hover:bg-red-8 focus:ring-base-6 border border-transparent\",\r\n disabled: \"bg-base-3 text-base-11 border border-transparent\",\r\n};\r\n\r\n// State based styles\r\nconst stateStyles = {\r\n enabled: \"\",\r\n disabled: \"opacity-75\",\r\n loading: \"\",\r\n};\r\n\r\nconst Button = forwardRef(\r\n (\r\n {\r\n color = \"transparent\",\r\n size = \"mdsm\",\r\n fontWeight = \"normal\",\r\n rounded = \"6\",\r\n state = \"enabled\",\r\n onClick,\r\n className,\r\n children,\r\n withRipple = true,\r\n contrastRipple,\r\n showFocus = \"desktop\",\r\n withDisabledDelay = false,\r\n type = \"button\",\r\n ...others\r\n }: ButtonProps,\r\n forwardedRef: ForwardedRef<HTMLButtonElement>\r\n ) => {\r\n const [disabledDelay, setDisabledDelay] = useState(false);\r\n\r\n const handleClick = (\r\n e: React.MouseEvent<HTMLButtonElement, MouseEvent>\r\n ) => {\r\n if (state === \"enabled\") {\r\n if (withDisabledDelay) {\r\n setDisabledDelay(true);\r\n onClick && onClick(e);\r\n setTimeout(() => setDisabledDelay(false), 1000);\r\n } else {\r\n onClick && onClick(e);\r\n }\r\n }\r\n };\r\n\r\n const { ref: rippleRef, ripple } = useRipple(\r\n withRipple,\r\n color === \"contrast\" || contrastRipple\r\n );\r\n\r\n // Merge the ripple ref with forwarded ref\r\n const ref = useMergedRef(rippleRef, forwardedRef);\r\n\r\n return (\r\n <button\r\n ref={ref}\r\n type={type}\r\n disabled={\r\n others.disabled\r\n ? others.disabled\r\n : state === \"disabled\" || state === \"loading\"\r\n }\r\n onMouseDown={ripple}\r\n onClick={(e) => (!disabledDelay ? handleClick(e) : null)}\r\n className={cn(\r\n baseStyles,\r\n sizeStyles[size],\r\n fontWeightStyles[fontWeight],\r\n borderRadiusStyles[rounded],\r\n focusStyles[showFocus],\r\n colorStyles[color],\r\n stateStyles[state],\r\n others.disabled && \"opacity-50\",\r\n className\r\n )}\r\n {...others}\r\n >\r\n {children}\r\n </button>\r\n );\r\n }\r\n);\r\n\r\nButton.displayName = \"Button\";\r\n\r\nexport { Button };\r\n","import { cn } from \"../utils\";\r\n\r\nconst Separator = ({ className }: { className?: string }) => {\r\n return <div className={cn(\"w-full h-px bg-base-4\", className)} />;\r\n};\r\n\r\nexport { Separator };\r\n","import {\n createContext,\n memo,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\n//============================\n// #region AliveScope\n//============================\ntype AliveScopeContextType = {\n getPortalElement: (\n id: string,\n children: React.ReactNode,\n className?: string\n ) => HTMLElement;\n dropPortalElement: (id: string) => void;\n};\n\nconst AliveScopeContext = createContext<AliveScopeContextType | null>(null);\n\nconst AliveScopeProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: AliveScopeContextType;\n}) => {\n return (\n <AliveScopeContext.Provider value={value}>\n {children}\n </AliveScopeContext.Provider>\n );\n};\n\nconst useAliveScope = () => {\n const context = useContext(AliveScopeContext);\n\n if (!context)\n throw new Error(\"useAliveScope must be wrapped within AliveScopeProvider\");\n\n return context;\n};\n\ntype AliveScopeProps = {\n children?: React.ReactNode;\n};\n\nconst AliveScope: React.FC<AliveScopeProps> = ({ children }) => {\n const [nodes, setNodes] = useState<{\n [id: string]: { children: React.ReactNode; element: HTMLElement };\n }>({});\n\n const onMountCallbacks = useRef<{ [id: string]: ((id: string) => void)[] }>(\n {}\n );\n const onDropCallbacks = useRef<{ [id: string]: ((id: string) => void)[] }>(\n {}\n );\n\n const getPortalElement = (\n id: string,\n children: React.ReactNode,\n className?: string\n ) => {\n if (!nodes[id]) {\n const element = document.createElement(\"div\");\n if (id) {\n element.id = id;\n }\n if (className) {\n element.className = className;\n }\n setNodes((prevNodes) => ({\n ...prevNodes,\n [id]: { children, element },\n }));\n onMountCallbacks.current[id] = [];\n onDropCallbacks.current[id] = [];\n if (onMountCallbacks.current && onMountCallbacks.current[id]) {\n onMountCallbacks.current[id].forEach((callback) => callback(id));\n }\n return element;\n }\n if (onMountCallbacks.current && onMountCallbacks.current[id]) {\n onMountCallbacks.current[id].forEach((callback) => callback(id));\n }\n return nodes[id].element;\n };\n\n const dropPortalElement = (id: string) => {\n setNodes((prevNodes) => {\n const copy = { ...prevNodes };\n delete copy[id];\n return copy;\n });\n //console.log(\"dropped\", id);\n if (onDropCallbacks.current && onDropCallbacks.current[id]) {\n onDropCallbacks.current[id].forEach((callback) => callback(id));\n }\n };\n\n return (\n <AliveScopeProvider\n value={{\n getPortalElement,\n dropPortalElement,\n }}\n >\n {children}\n {Object.entries(nodes).map(([id, { children, element }]) => (\n <Component\n key={id}\n id={id}\n onMountCallbacks={onMountCallbacks}\n onDropCallbacks={onDropCallbacks}\n children={children}\n element={element}\n />\n ))}\n </AliveScopeProvider>\n );\n};\n//============================\n// #endregion AliveScope\n//============================\n\n//============================\n// #region KeepAlive\n//============================\ntype KeepAliveContextType = {\n keepAliveId: string;\n onKeepAliveMount: (\n callback: (id: string) => void,\n options?: { runOnFirstMount?: boolean }\n ) => void;\n onKeepAliveDrop: (callback: (id: string) => void) => void;\n};\n\nexport const KeepAliveContext = createContext<KeepAliveContextType | null>(\n null\n);\n\nexport const KeepAliveProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: KeepAliveContextType;\n}) => {\n return (\n <KeepAliveContext.Provider value={value}>\n {children}\n </KeepAliveContext.Provider>\n );\n};\n\nconst Component = memo<{\n id: string;\n onMountCallbacks: React.MutableRefObject<{\n [id: string]: ((id: string) => void)[];\n }>;\n onDropCallbacks: React.MutableRefObject<{\n [id: string]: ((id: string) => void)[];\n }>;\n children: React.ReactNode;\n element: HTMLElement;\n}>(({ id, onMountCallbacks, onDropCallbacks, children, element }) => {\n const onKeepAliveMount = (\n callback: (id: string) => void,\n options: { runOnFirstMount?: boolean } = { runOnFirstMount: false }\n ) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n const runCallback = () => {\n const el = document.getElementById(id);\n if (el) {\n callback(id);\n } else {\n // If element is not found, use MutationObserver to wait for it\n const observer = new MutationObserver((_mutations, obs) => {\n const el = document.getElementById(id);\n if (el) {\n callback(id);\n obs.disconnect(); // Stop observing once element is found\n }\n });\n\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n\n // Cleanup function to disconnect the observer if component unmounts\n return () => observer.disconnect();\n }\n };\n\n if (options?.runOnFirstMount) {\n runCallback();\n }\n\n onMountCallbacks.current[id].push(runCallback);\n return () => {\n onMountCallbacks.current[id] = onMountCallbacks.current[id].filter(\n (cb) => cb !== runCallback\n );\n };\n }, []);\n };\n\n const onKeepAliveDrop = (callback: (id: string) => void) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n onDropCallbacks.current[id].push(callback);\n return () => {\n onDropCallbacks.current[id] = onDropCallbacks.current[id].filter(\n (cb) => cb !== callback\n );\n };\n }, []);\n };\n\n return (\n <KeepAliveProvider\n value={{ keepAliveId: id, onKeepAliveMount, onKeepAliveDrop }}\n >\n {createPortal(children, element, id)}\n </KeepAliveProvider>\n );\n});\n\nconst useKeepAlive = () => {\n const context = useContext(KeepAliveContext);\n\n if (!context)\n throw new Error(\"useKeepAlive must be used within KeepAliveProvider\");\n\n return context;\n};\n\ntype KeepAliveProps = React.HTMLAttributes<HTMLDivElement> & {\n aliveKey: string;\n children: React.ReactNode;\n enabled?: boolean;\n};\n\nconst KeepAlive: React.FC<KeepAliveProps> = ({\n aliveKey,\n children,\n enabled = true,\n ...others\n}) => {\n const keepAliveRef = useRef<HTMLDivElement | null>(null);\n const { getPortalElement } = useAliveScope();\n\n useEffect(() => {\n const element = getPortalElement(aliveKey, children, others.className);\n\n if (enabled) {\n if (keepAliveRef.current) {\n keepAliveRef.current.replaceWith(element);\n }\n }\n\n return () => {\n //TODO\n //callUnmountCallbacks(aliveKey)\n };\n }, [aliveKey, children, enabled, others]);\n\n return <div {...others} ref={keepAliveRef} />;\n};\n//============================\n// #endregion KeepAlive\n//============================\n\nexport { AliveScope, KeepAlive, useKeepAlive };\n"],"names":["Icon","children","size","strokeWidth","viewBox","className","props","jsx","cn","inputs","twMerge","clsx","throttle","func","limit","lastRan","timeout","args","now","debounce","delay","generateInitials","name","words","sizes","Avatar","src","jsxs","AvatarsGroup","animate","f","s","t","largeAtom","atom","listening","handleResize","useLargeScreen","useEffect","useAtomValue","useMergedRef","refs","value","ref","useRipple","enabled","contrastRipple","lg","useRef","ripple","useCallback","event","button","buttonRect","rippleSize","offsetX","offsetY","rippleWrapper","rippleEl","ripples","baseStyles","sizeStyles","focusStyles","fontWeightStyles","borderRadiusStyles","colorStyles","stateStyles","Button","forwardRef","color","fontWeight","rounded","state","onClick","withRipple","showFocus","withDisabledDelay","type","others","forwardedRef","disabledDelay","setDisabledDelay","useState","handleClick","e","rippleRef","Separator","AliveScopeContext","createContext","AliveScopeProvider","useAliveScope","context","useContext","AliveScope","nodes","setNodes","onMountCallbacks","onDropCallbacks","getPortalElement","id","element","prevNodes","callback","dropPortalElement","copy","Component","KeepAliveContext","KeepAliveProvider","memo","onKeepAliveMount","options","runCallback","observer","_mutations","obs","cb","onKeepAliveDrop","createPortal","useKeepAlive","KeepAlive","aliveKey","keepAliveRef"],"mappings":"gPA0CaA,EAA4B,CAAC,CACxC,SAAAC,EACA,KAAAC,EAAO,GACP,YAAAC,EAAc,EACd,QAAAC,EAAU,YACV,UAAAC,EACA,GAAGC,CACL,IAEIC,EAAAA,IAAC,MAAA,CACC,MAAM,6BACN,MAAOL,EACP,OAAQA,EACR,QAAAE,EACA,UAAAC,EACC,GAAGC,EAEH,SAAAL,CAAA,CAAA,ECpDMO,EAAK,IAAIC,IAAyBC,EAAAA,QAAQC,EAAAA,KAAKF,CAAM,CAAC,EAkB5D,SAASG,EACdC,EACAC,EAAgB,IACkB,CAClC,IAAIC,EAAyB,KACzBC,EAAgD,KAEpD,OAAO,YAAwBC,EAAqB,CAClD,MAAMC,EAAM,KAAK,IAAA,EAEbH,IAAY,MAAQG,EAAMH,GAAWD,GACvCD,EAAK,MAAM,KAAMI,CAAI,EACrBF,EAAUG,IAENF,gBAAsBA,CAAO,EACjCA,EAAU,WAAW,IAAM,CACzBH,EAAK,MAAM,KAAMI,CAAI,EACrBF,EAAU,KAAK,IAAA,CACjB,EAAGD,GAASI,EAAMH,EAAQ,EAE9B,CACF,CAkBO,SAASI,EACdN,EACAO,EAAgB,IACkB,CAClC,IAAIJ,EAAgD,KAEpD,OAAO,YAAwBC,EAAqB,CAC9CD,gBAAsBA,CAAO,EAEjCA,EAAU,WAAW,IAAM,CACzBH,EAAK,MAAM,KAAMI,CAAI,EACrBD,EAAU,IACZ,EAAGI,CAAK,CACV,CACF,CAEO,SAASC,EAAiBC,EAAc,CAC7C,GAAI,CAACA,EAAM,MAAO,GAMlB,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import { Context } from 'react';
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ import { ClassValue } from 'clsx';
3
+ import { ComponentPropsWithoutRef } from 'react';
4
+ import { ForwardRefExoticComponent } from 'react';
2
5
  import { JSX } from 'react/jsx-runtime';
6
+ import { RefAttributes } from 'react';
3
7
 
4
8
  export declare const AliveScope: React.FC<AliveScopeProps>;
5
9
 
@@ -7,9 +11,163 @@ declare type AliveScopeProps = {
7
11
  children?: React.ReactNode;
8
12
  };
9
13
 
10
- export declare const KeepAlive: React.FC<KeepAliveProps>;
14
+ export declare const Avatar: ({ src, name, size, className, }: {
15
+ src?: string;
16
+ name?: string;
17
+ size?: keyof typeof sizes;
18
+ className?: string;
19
+ }) => JSX.Element;
20
+
21
+ export declare function AvatarsGroup({ className, children, animate, ...props }: ComponentPropsWithoutRef<"div"> & {
22
+ animate?: boolean;
23
+ }): JSX.Element;
24
+
25
+ declare const borderRadiusStyles: {
26
+ none: string;
27
+ "1": string;
28
+ "2": string;
29
+ "3": string;
30
+ "4": string;
31
+ "5": string;
32
+ "6": string;
33
+ "7": string;
34
+ "8": string;
35
+ "9": string;
36
+ "10": string;
37
+ "11": string;
38
+ "12": string;
39
+ full: string;
40
+ };
41
+
42
+ export declare const Button: ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
43
+ color?: keyof typeof colorStyles;
44
+ size?: keyof typeof sizeStyles;
45
+ fontWeight?: keyof typeof fontWeightStyles;
46
+ rounded?: keyof typeof borderRadiusStyles;
47
+ state?: "enabled" | "disabled" | "loading";
48
+ onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
49
+ className?: string;
50
+ withRipple?: boolean;
51
+ contrastRipple?: boolean;
52
+ showFocus?: "all" | "desktop" | "mobile" | "none";
53
+ withDisabledDelay?: boolean;
54
+ type?: "button" | "submit" | "reset";
55
+ children?: React.ReactNode;
56
+ } & RefAttributes<HTMLButtonElement>>;
57
+
58
+ export declare type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
59
+ color?: keyof typeof colorStyles;
60
+ size?: keyof typeof sizeStyles;
61
+ fontWeight?: keyof typeof fontWeightStyles;
62
+ rounded?: keyof typeof borderRadiusStyles;
63
+ state?: "enabled" | "disabled" | "loading";
64
+ onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
65
+ className?: string;
66
+ withRipple?: boolean;
67
+ contrastRipple?: boolean;
68
+ showFocus?: "all" | "desktop" | "mobile" | "none";
69
+ withDisabledDelay?: boolean;
70
+ type?: "button" | "submit" | "reset";
71
+ children?: React.ReactNode;
72
+ };
73
+
74
+ export { ClassValue }
75
+
76
+ /**Tailwind Merge + Clsx */
77
+ export declare const cn: (...inputs: ClassValue[]) => string;
78
+
79
+ declare const colorStyles: {
80
+ transparent: string;
81
+ transparentinactive: string;
82
+ brand: string;
83
+ accent: string;
84
+ contrast: string;
85
+ solid: string;
86
+ solidhybrid: string;
87
+ outline: string;
88
+ info: string;
89
+ success: string;
90
+ warning: string;
91
+ danger: string;
92
+ dangersolid: string;
93
+ disabled: string;
94
+ };
95
+
96
+ /**
97
+ * Creates a debounced function that delays invoking func until after delay milliseconds
98
+ * have elapsed since the last time the debounced function was invoked. Each call resets
99
+ * the timer, ensuring func only executes after activity has stopped.
100
+ *
101
+ * @param func - The function to debounce
102
+ * @param delay - The number of milliseconds to delay (default: 300)
103
+ * @returns A debounced version of the function
104
+ *
105
+ * @example
106
+ * const handleSearch = debounce((query) => {
107
+ * fetchResults(query);
108
+ * }, 300);
109
+ *
110
+ * input.addEventListener('input', (e) => handleSearch(e.target.value));
111
+ */
112
+ export declare function debounce<T extends (...args: any[]) => any>(func: T, delay?: number): (...args: Parameters<T>) => void;
11
113
 
12
- export declare const KeepAliveContext: Context<KeepAliveContextType | null>;
114
+ declare const fontWeightStyles: {
115
+ light: string;
116
+ normal: string;
117
+ medium: string;
118
+ semibold: string;
119
+ bold: string;
120
+ };
121
+
122
+ export declare function generateInitials(name: string): string;
123
+
124
+ /**
125
+ * Base Icon component that provides a consistent SVG wrapper for creating custom icons.
126
+ * Handles common SVG properties while allowing full customization through standard SVG props.
127
+ *
128
+ * @example
129
+ * // Creating a reusable icon component
130
+ * export const CustomIcon = ({ size, className, ...props }: IndividualIconProps) => {
131
+ * return (
132
+ * <Icon size={size} className={className} fill="currentColor" {...props}>
133
+ * <path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z" />
134
+ * </Icon>
135
+ * );
136
+ * };
137
+ *
138
+ * @example
139
+ * // Creating a custom icon
140
+ * <Icon size={32} strokeWidth={1.5}>
141
+ * <path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z" />
142
+ * </Icon>
143
+ *
144
+ * @example
145
+ * // Using with custom viewBox for different icon sets
146
+ * <Icon viewBox="0 0 512 512" size={48}>
147
+ * <circle cx="256" cy="256" r="200" />
148
+ * </Icon>
149
+ */
150
+ export declare const Icon: React.FC<IconProps>;
151
+
152
+ /**
153
+ * Props for the base Icon component that provides a consistent SVG wrapper.
154
+ */
155
+ declare interface IconProps extends React.SVGProps<SVGSVGElement> {
156
+ /** Width and height of the icon in pixels (default: 24) */
157
+ size?: number | string;
158
+ /** Stroke width for outlined icons (default: 2) */
159
+ strokeWidth?: number;
160
+ /** SVG viewBox attribute defining the coordinate system (default: "0 0 24 24") */
161
+ viewBox?: "0 0 24 24" | "0 0 48 48" | "0 0 512 512";
162
+ /** CSS class names for styling */
163
+ className?: string;
164
+ /** SVG elements (paths, circles, etc.) that define the icon shape */
165
+ children?: React.ReactNode;
166
+ }
167
+
168
+ export declare type IndividualIconProps = Omit<IconProps, "children">;
169
+
170
+ export declare const KeepAlive: React.FC<KeepAliveProps>;
13
171
 
14
172
  declare type KeepAliveContextType = {
15
173
  keepAliveId: string;
@@ -25,11 +183,49 @@ declare type KeepAliveProps = React.HTMLAttributes<HTMLDivElement> & {
25
183
  enabled?: boolean;
26
184
  };
27
185
 
28
- export declare const KeepAliveProvider: ({ children, value, }: {
29
- children: React.ReactNode;
30
- value: KeepAliveContextType;
186
+ export declare const Separator: ({ className }: {
187
+ className?: string;
31
188
  }) => JSX.Element;
32
189
 
190
+ declare const sizes: {
191
+ xs: string;
192
+ sm: string;
193
+ md: string;
194
+ lg: string;
195
+ xl: string;
196
+ };
197
+
198
+ declare const sizeStyles: {
199
+ xs: string;
200
+ sm: string;
201
+ mdsm: string;
202
+ md: string;
203
+ lg: string;
204
+ picker: string;
205
+ iconXs: string;
206
+ iconSm: string;
207
+ iconMd: string;
208
+ iconLg: string;
209
+ };
210
+
211
+ /**
212
+ * Creates a throttled function that only invokes func at most once per every limit milliseconds.
213
+ * The first call executes immediately, subsequent calls are rate-limited, and the last call
214
+ * during rapid firing is guaranteed to execute with the most recent arguments.
215
+ *
216
+ * @param func - The function to throttle
217
+ * @param limit - The number of milliseconds to throttle invocations to (default: 100)
218
+ * @returns A throttled version of the function
219
+ *
220
+ * @example
221
+ * const handleScroll = throttle(() => {
222
+ * console.log('Scrolled!');
223
+ * }, 200);
224
+ *
225
+ * window.addEventListener('scroll', handleScroll);
226
+ */
227
+ export declare function throttle<T extends (...args: any[]) => any>(func: T, limit?: number): (...args: Parameters<T>) => void;
228
+
33
229
  export declare const useKeepAlive: () => KeepAliveContextType;
34
230
 
35
231
  export { }
package/dist/index.js CHANGED
@@ -1,118 +1,394 @@
1
- import { jsxs as K, jsx as p } from "react/jsx-runtime";
2
- import { createContext as a, useState as w, useRef as f, memo as S, useContext as E, useEffect as A } from "react";
3
- import { createPortal as g } from "react-dom";
4
- const h = a(null), b = ({
1
+ import { jsx as c, jsxs as k } from "react/jsx-runtime";
2
+ import { clsx as B } from "clsx";
3
+ import { twMerge as T } from "tailwind-merge";
4
+ import { useSyncExternalStore as I, useEffect as x, useRef as v, useCallback as O, forwardRef as $, useState as C, memo as X, useContext as P, createContext as N } from "react";
5
+ import { createPortal as z } from "react-dom";
6
+ import { atom as F } from "@mateosuarezdev/atoms";
7
+ const U = ({
8
+ children: e,
9
+ size: r = 24,
10
+ strokeWidth: t = 2,
11
+ viewBox: o = "0 0 24 24",
12
+ className: s,
13
+ ...a
14
+ }) => /* @__PURE__ */ c(
15
+ "svg",
16
+ {
17
+ xmlns: "http://www.w3.org/2000/svg",
18
+ width: r,
19
+ height: r,
20
+ viewBox: o,
21
+ className: s,
22
+ ...a,
23
+ children: e
24
+ }
25
+ ), f = (...e) => T(B(e));
26
+ function Y(e, r = 100) {
27
+ let t = null, o = null;
28
+ return function(...s) {
29
+ const a = Date.now();
30
+ t === null || a - t >= r ? (e.apply(this, s), t = a) : (o && clearTimeout(o), o = setTimeout(() => {
31
+ e.apply(this, s), t = Date.now();
32
+ }, r - (a - t)));
33
+ };
34
+ }
35
+ function fe(e, r = 500) {
36
+ let t = null;
37
+ return function(...o) {
38
+ t && clearTimeout(t), t = setTimeout(() => {
39
+ e.apply(this, o), t = null;
40
+ }, r);
41
+ };
42
+ }
43
+ function G(e) {
44
+ if (!e) return "";
45
+ const t = e.trim().replace(/\s+/g, " ").split(" ");
46
+ return t.length === 0 || t[0] === "" ? "" : t.length === 1 ? t[0].charAt(0).toUpperCase() : (t[0].charAt(0) + t[1].charAt(0)).toUpperCase();
47
+ }
48
+ const w = {
49
+ xs: "w-8 h-8",
50
+ sm: "w-10 h-10 text-lg",
51
+ md: "w-14 h-14 text-xl",
52
+ lg: "h-20 w-20 text-2xl",
53
+ xl: "h-24 w-24 text-2xl"
54
+ }, me = ({
55
+ src: e,
56
+ name: r,
57
+ size: t = "md",
58
+ className: o
59
+ }) => e ? /* @__PURE__ */ c(
60
+ "img",
61
+ {
62
+ alt: "avatar",
63
+ src: e,
64
+ className: f("rounded-full bg-base-3", w[t])
65
+ }
66
+ ) : r ? /* @__PURE__ */ c(
67
+ "p",
68
+ {
69
+ className: f(
70
+ "rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center",
71
+ w[t],
72
+ o
73
+ ),
74
+ children: G(r)
75
+ }
76
+ ) : /* @__PURE__ */ c(
77
+ "div",
78
+ {
79
+ className: f(
80
+ "rounded-full text-2xl font-medium flex items-center justify-center",
81
+ "bg-base-2 dark-theme:bg-base-3 border border-base-4",
82
+ "lg:hover:bg-base-3 max-lg:active:bg-base-4 transition-colors",
83
+ w[t],
84
+ o
85
+ ),
86
+ children: /* @__PURE__ */ k(
87
+ U,
88
+ {
89
+ size: t === "xs" ? 16 : t === "sm" ? 20 : 24,
90
+ fill: "none",
91
+ stroke: "currentColor",
92
+ strokeWidth: 2,
93
+ strokeLinecap: "round",
94
+ strokeLinejoin: "round",
95
+ children: [
96
+ /* @__PURE__ */ c("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
97
+ /* @__PURE__ */ c("circle", { cx: "12", cy: "7", r: "4" })
98
+ ]
99
+ }
100
+ )
101
+ }
102
+ );
103
+ function he({
104
+ className: e,
105
+ children: r,
106
+ animate: t = !1,
107
+ ...o
108
+ }) {
109
+ return /* @__PURE__ */ c(
110
+ "div",
111
+ {
112
+ className: f("flex -space-x-3 rtl:space-x-reverse", e),
113
+ ...o,
114
+ children: r
115
+ }
116
+ );
117
+ }
118
+ function H(e) {
119
+ return I(
120
+ (r) => e.subscribe(r),
121
+ () => e.get(),
122
+ () => e.get()
123
+ );
124
+ }
125
+ const A = F(!0);
126
+ let y = !1;
127
+ const S = Y(() => {
128
+ A.set(window.innerWidth > 1024);
129
+ });
130
+ typeof window < "u" && (y && (window.removeEventListener("resize", S), y = !1), window.addEventListener("resize", S), y = !0);
131
+ const _ = () => (x(() => {
132
+ A.set(window.innerWidth > 1024);
133
+ }, []), H(A));
134
+ function q(...e) {
135
+ return (r) => {
136
+ e.forEach((t) => {
137
+ typeof t == "function" ? t(r) : t != null && (t.current = r);
138
+ });
139
+ };
140
+ }
141
+ const J = (e = !0, r) => {
142
+ const t = _(), o = v(null), s = O(
143
+ (a) => {
144
+ if (!e || t) return;
145
+ const b = o.current;
146
+ if (!b) return;
147
+ const n = b.getBoundingClientRect(), l = Math.max(n.width, n.height), i = a.clientX - n.left - l / 2, u = a.clientY - n.top - l / 2, d = document.createElement("span");
148
+ d.classList.add("ripple-wrapper");
149
+ const p = document.createElement("span");
150
+ p.classList.add("ripple"), p.style.backgroundColor = r ? "var(--ripple-contrast)" : "var(--ripple-main)", p.style.width = `${l}px`, p.style.height = `${l}px`, p.style.left = `${i}px`, p.style.top = `${u}px`, d.appendChild(p);
151
+ const g = b.getElementsByClassName("ripple-wrapper");
152
+ if (g?.length)
153
+ for (const m of g)
154
+ m.remove();
155
+ b.appendChild(d), setTimeout(() => {
156
+ d.remove();
157
+ }, 700);
158
+ },
159
+ [e, t, r]
160
+ );
161
+ return {
162
+ ref: o,
163
+ ripple: s,
164
+ styles: {
165
+ position: "relative"
166
+ }
167
+ };
168
+ }, Q = "relative shrink-0 select-none transition outline-none duration-200 ease-out focus:ring-border-brand-light flex items-center justify-center", V = {
169
+ xs: "text-xs px-1 gap-x-0.5 py-1",
170
+ sm: "text-sm px-2.5 gap-x-1 py-1.5",
171
+ mdsm: "text-sm px-3 gap-x-1.5 py-2.5",
172
+ md: "text-base px-4 gap-x-1.5 py-2.5",
173
+ lg: "text-base px-4 gap-x-1.5 py-3.5",
174
+ picker: "text-base px-2 py-2 gap-x-1.5",
175
+ iconXs: "text-xs p-1",
176
+ iconSm: "text-sm p-2",
177
+ iconMd: "text-base p-3",
178
+ iconLg: "text-base p-4"
179
+ }, Z = {
180
+ all: "focus:ring-1",
181
+ desktop: "lg:focus:ring-1",
182
+ mobile: "focus:ring-1 lg:focus-ring-0",
183
+ none: ""
184
+ }, ee = {
185
+ light: "font-light",
186
+ normal: "font-normal",
187
+ medium: "font-medium",
188
+ semibold: "font-semibold",
189
+ bold: "font-bold"
190
+ }, te = {
191
+ none: "rounded-none",
192
+ 1: "rounded-1",
193
+ 2: "rounded-2",
194
+ 3: "rounded-3",
195
+ 4: "rounded-4",
196
+ 5: "rounded-5",
197
+ 6: "rounded-6",
198
+ 7: "rounded-7",
199
+ 8: "rounded-8",
200
+ 9: "rounded-9",
201
+ 10: "rounded-10",
202
+ 11: "rounded-11",
203
+ 12: "rounded-12",
204
+ full: "rounded-full"
205
+ }, re = {
206
+ transparent: "text-base-12 lg:hover:bg-base-4 focus:ring-base-6",
207
+ transparentinactive: "text-base-11 lg:hover:bg-base-4",
208
+ brand: "bg-brand text-brand-text lg:hover:bg-brand-hover focus:ring-base-6 border border-transparent",
209
+ accent: "bg-accent text-accent-text lg:hover:bg-accent-hover",
210
+ contrast: "bg-base-12 text-base-1 lg:hover:bg-base-11 focus:ring-base-6",
211
+ solid: "bg-base-3 dark-theme:bg-base-3 lg:hover:bg-base-4 border border-base-4 focus:ring-base-5",
212
+ solidhybrid: "border border-base-5 dark-theme:border-base-4 dark-theme:bg-base-3 lg:hover:bg-base-4 focus:ring-base-6",
213
+ outline: "border border-base-6 lg:hover:bg-base-3 focus:ring-base-6",
214
+ info: "bg-blue-3 text-blue-9 lg:hover:bg-blue-4 lg:active:bg-blue-5 focus:ring-blue-9 border border-transparent",
215
+ success: "bg-green-4 text-green-9 lg:hover:bg-green-5 lg:active:bg-green-6 focus:ring-green-9 border border-transparent",
216
+ warning: "bg-yellow-4 text-yellow-9 lg:hover:bg-yellow-5 lg:active:bg-yellow-6 focus:ring-yellow-9 border border-transparent",
217
+ danger: "bg-red-4 text-red-9 lg:hover:bg-red-5 focus:ring-red-9 border border-transparent",
218
+ dangersolid: "bg-red-9 text-base-1 dark-theme:text-base-12 lg:hover:bg-red-8 focus:ring-base-6 border border-transparent",
219
+ disabled: "bg-base-3 text-base-11 border border-transparent"
220
+ }, ne = {
221
+ enabled: "",
222
+ disabled: "opacity-75",
223
+ loading: ""
224
+ }, oe = $(
225
+ ({
226
+ color: e = "transparent",
227
+ size: r = "mdsm",
228
+ fontWeight: t = "normal",
229
+ rounded: o = "6",
230
+ state: s = "enabled",
231
+ onClick: a,
232
+ className: b,
233
+ children: n,
234
+ withRipple: l = !0,
235
+ contrastRipple: i,
236
+ showFocus: u = "desktop",
237
+ withDisabledDelay: d = !1,
238
+ type: p = "button",
239
+ ...g
240
+ }, m) => {
241
+ const [K, E] = C(!1), L = (h) => {
242
+ s === "enabled" && (d ? (E(!0), a && a(h), setTimeout(() => E(!1), 1e3)) : a && a(h));
243
+ }, { ref: j, ripple: D } = J(
244
+ l,
245
+ e === "contrast" || i
246
+ ), W = q(j, m);
247
+ return /* @__PURE__ */ c(
248
+ "button",
249
+ {
250
+ ref: W,
251
+ type: p,
252
+ disabled: g.disabled ? g.disabled : s === "disabled" || s === "loading",
253
+ onMouseDown: D,
254
+ onClick: (h) => K ? null : L(h),
255
+ className: f(
256
+ Q,
257
+ V[r],
258
+ ee[t],
259
+ te[o],
260
+ Z[u],
261
+ re[e],
262
+ ne[s],
263
+ g.disabled && "opacity-50",
264
+ b
265
+ ),
266
+ ...g,
267
+ children: n
268
+ }
269
+ );
270
+ }
271
+ );
272
+ oe.displayName = "Button";
273
+ const xe = ({ className: e }) => /* @__PURE__ */ c("div", { className: f("w-full h-px bg-base-4", e) }), M = N(null), se = ({
5
274
  children: e,
6
275
  value: r
7
- }) => /* @__PURE__ */ p(h.Provider, { value: r, children: e }), C = () => {
8
- const e = E(h);
276
+ }) => /* @__PURE__ */ c(M.Provider, { value: r, children: e }), le = () => {
277
+ const e = P(M);
9
278
  if (!e)
10
279
  throw new Error("useAliveScope must be wrapped within AliveScopeProvider");
11
280
  return e;
12
- }, F = ({ children: e }) => {
13
- const [r, s] = w({}), n = f(
281
+ }, ve = ({ children: e }) => {
282
+ const [r, t] = C({}), o = v(
14
283
  {}
15
- ), o = f(
284
+ ), s = v(
16
285
  {}
17
286
  );
18
- return /* @__PURE__ */ K(
19
- b,
287
+ return /* @__PURE__ */ k(
288
+ se,
20
289
  {
21
290
  value: {
22
- getPortalElement: (t, c, u) => {
23
- if (!r[t]) {
24
- const l = document.createElement("div");
25
- return t && (l.id = t), u && (l.className = u), s((i) => ({
26
- ...i,
27
- [t]: { children: c, element: l }
28
- })), n.current[t] = [], o.current[t] = [], n.current && n.current[t] && n.current[t].forEach((i) => i(t)), l;
291
+ getPortalElement: (n, l, i) => {
292
+ if (!r[n]) {
293
+ const u = document.createElement("div");
294
+ return n && (u.id = n), i && (u.className = i), t((d) => ({
295
+ ...d,
296
+ [n]: { children: l, element: u }
297
+ })), o.current[n] = [], s.current[n] = [], o.current && o.current[n] && o.current[n].forEach((d) => d(n)), u;
29
298
  }
30
- return n.current && n.current[t] && n.current[t].forEach((l) => l(t)), r[t].element;
299
+ return o.current && o.current[n] && o.current[n].forEach((u) => u(n)), r[n].element;
31
300
  },
32
- dropPortalElement: (t) => {
33
- s((c) => {
34
- const u = { ...c };
35
- return delete u[t], u;
36
- }), o.current && o.current[t] && o.current[t].forEach((c) => c(t));
301
+ dropPortalElement: (n) => {
302
+ t((l) => {
303
+ const i = { ...l };
304
+ return delete i[n], i;
305
+ }), s.current && s.current[n] && s.current[n].forEach((l) => l(n));
37
306
  }
38
307
  },
39
308
  children: [
40
309
  e,
41
- Object.entries(r).map(([t, { children: c, element: u }]) => /* @__PURE__ */ p(
42
- O,
310
+ Object.entries(r).map(([n, { children: l, element: i }]) => /* @__PURE__ */ c(
311
+ ie,
43
312
  {
44
- id: t,
45
- onMountCallbacks: n,
46
- onDropCallbacks: o,
47
- children: c,
48
- element: u
313
+ id: n,
314
+ onMountCallbacks: o,
315
+ onDropCallbacks: s,
316
+ children: l,
317
+ element: i
49
318
  },
50
- t
319
+ n
51
320
  ))
52
321
  ]
53
322
  }
54
323
  );
55
- }, P = a(
324
+ }, R = N(
56
325
  null
57
- ), M = ({
326
+ ), ae = ({
58
327
  children: e,
59
328
  value: r
60
- }) => /* @__PURE__ */ p(P.Provider, { value: r, children: e }), O = S(({ id: e, onMountCallbacks: r, onDropCallbacks: s, children: n, element: o }) => /* @__PURE__ */ p(
61
- M,
329
+ }) => /* @__PURE__ */ c(R.Provider, { value: r, children: e }), ie = X(({ id: e, onMountCallbacks: r, onDropCallbacks: t, children: o, element: s }) => /* @__PURE__ */ c(
330
+ ae,
62
331
  {
63
- value: { keepAliveId: e, onKeepAliveMount: (t, c = { runOnFirstMount: !1 }) => {
64
- A(() => {
65
- const u = () => {
332
+ value: { keepAliveId: e, onKeepAliveMount: (n, l = { runOnFirstMount: !1 }) => {
333
+ x(() => {
334
+ const i = () => {
66
335
  if (document.getElementById(e))
67
- t(e);
336
+ n(e);
68
337
  else {
69
- const i = new MutationObserver((d, x) => {
70
- document.getElementById(e) && (t(e), x.disconnect());
338
+ const d = new MutationObserver((p, g) => {
339
+ document.getElementById(e) && (n(e), g.disconnect());
71
340
  });
72
- return i.observe(document.body, {
341
+ return d.observe(document.body, {
73
342
  childList: !0,
74
343
  subtree: !0
75
- }), () => i.disconnect();
344
+ }), () => d.disconnect();
76
345
  }
77
346
  };
78
- return c?.runOnFirstMount && u(), r.current[e].push(u), () => {
347
+ return l?.runOnFirstMount && i(), r.current[e].push(i), () => {
79
348
  r.current[e] = r.current[e].filter(
80
- (l) => l !== u
349
+ (u) => u !== i
81
350
  );
82
351
  };
83
352
  }, []);
84
- }, onKeepAliveDrop: (t) => {
85
- A(() => (s.current[e].push(t), () => {
86
- s.current[e] = s.current[e].filter(
87
- (c) => c !== t
353
+ }, onKeepAliveDrop: (n) => {
354
+ x(() => (t.current[e].push(n), () => {
355
+ t.current[e] = t.current[e].filter(
356
+ (l) => l !== n
88
357
  );
89
358
  }), []);
90
359
  } },
91
- children: g(n, o, e)
360
+ children: z(o, s, e)
92
361
  }
93
- )), N = () => {
94
- const e = E(P);
362
+ )), we = () => {
363
+ const e = P(R);
95
364
  if (!e)
96
365
  throw new Error("useKeepAlive must be used within KeepAliveProvider");
97
366
  return e;
98
- }, R = ({
367
+ }, ye = ({
99
368
  aliveKey: e,
100
369
  children: r,
101
- enabled: s = !0,
102
- ...n
370
+ enabled: t = !0,
371
+ ...o
103
372
  }) => {
104
- const o = f(null), { getPortalElement: v } = C();
105
- return A(() => {
106
- const m = v(e, r, n.className);
107
- return s && o.current && o.current.replaceWith(m), () => {
373
+ const s = v(null), { getPortalElement: a } = le();
374
+ return x(() => {
375
+ const b = a(e, r, o.className);
376
+ return t && s.current && s.current.replaceWith(b), () => {
108
377
  };
109
- }, [e, r, s, n]), /* @__PURE__ */ p("div", { ...n, ref: o });
378
+ }, [e, r, t, o]), /* @__PURE__ */ c("div", { ...o, ref: s });
110
379
  };
111
380
  export {
112
- F as AliveScope,
113
- R as KeepAlive,
114
- P as KeepAliveContext,
115
- M as KeepAliveProvider,
116
- N as useKeepAlive
381
+ ve as AliveScope,
382
+ me as Avatar,
383
+ he as AvatarsGroup,
384
+ oe as Button,
385
+ U as Icon,
386
+ ye as KeepAlive,
387
+ xe as Separator,
388
+ f as cn,
389
+ fe as debounce,
390
+ G as generateInitials,
391
+ Y as throttle,
392
+ we as useKeepAlive
117
393
  };
118
394
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/components/keep-alive.tsx"],"sourcesContent":["import {\n createContext,\n memo,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\n//============================\n// #region AliveScope\n//============================\ntype AliveScopeContextType = {\n getPortalElement: (\n id: string,\n children: React.ReactNode,\n className?: string\n ) => HTMLElement;\n dropPortalElement: (id: string) => void;\n};\n\nconst AliveScopeContext = createContext<AliveScopeContextType | null>(null);\n\nconst AliveScopeProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: AliveScopeContextType;\n}) => {\n return (\n <AliveScopeContext.Provider value={value}>\n {children}\n </AliveScopeContext.Provider>\n );\n};\n\nconst useAliveScope = () => {\n const context = useContext(AliveScopeContext);\n\n if (!context)\n throw new Error(\"useAliveScope must be wrapped within AliveScopeProvider\");\n\n return context;\n};\n\ntype AliveScopeProps = {\n children?: React.ReactNode;\n};\n\nconst AliveScope: React.FC<AliveScopeProps> = ({ children }) => {\n const [nodes, setNodes] = useState<{\n [id: string]: { children: React.ReactNode; element: HTMLElement };\n }>({});\n\n const onMountCallbacks = useRef<{ [id: string]: ((id: string) => void)[] }>(\n {}\n );\n const onDropCallbacks = useRef<{ [id: string]: ((id: string) => void)[] }>(\n {}\n );\n\n const getPortalElement = (\n id: string,\n children: React.ReactNode,\n className?: string\n ) => {\n if (!nodes[id]) {\n const element = document.createElement(\"div\");\n if (id) {\n element.id = id;\n }\n if (className) {\n element.className = className;\n }\n setNodes((prevNodes) => ({\n ...prevNodes,\n [id]: { children, element },\n }));\n onMountCallbacks.current[id] = [];\n onDropCallbacks.current[id] = [];\n if (onMountCallbacks.current && onMountCallbacks.current[id]) {\n onMountCallbacks.current[id].forEach((callback) => callback(id));\n }\n return element;\n }\n if (onMountCallbacks.current && onMountCallbacks.current[id]) {\n onMountCallbacks.current[id].forEach((callback) => callback(id));\n }\n return nodes[id].element;\n };\n\n const dropPortalElement = (id: string) => {\n setNodes((prevNodes) => {\n const copy = { ...prevNodes };\n delete copy[id];\n return copy;\n });\n //console.log(\"dropped\", id);\n if (onDropCallbacks.current && onDropCallbacks.current[id]) {\n onDropCallbacks.current[id].forEach((callback) => callback(id));\n }\n };\n\n return (\n <AliveScopeProvider\n value={{\n getPortalElement,\n dropPortalElement,\n }}\n >\n {children}\n {Object.entries(nodes).map(([id, { children, element }]) => (\n <Component\n key={id}\n id={id}\n onMountCallbacks={onMountCallbacks}\n onDropCallbacks={onDropCallbacks}\n children={children}\n element={element}\n />\n ))}\n </AliveScopeProvider>\n );\n};\n//============================\n// #endregion AliveScope\n//============================\n\n//============================\n// #region KeepAlive\n//============================\ntype KeepAliveContextType = {\n keepAliveId: string;\n onKeepAliveMount: (\n callback: (id: string) => void,\n options?: { runOnFirstMount?: boolean }\n ) => void;\n onKeepAliveDrop: (callback: (id: string) => void) => void;\n};\n\nexport const KeepAliveContext = createContext<KeepAliveContextType | null>(\n null\n);\n\nexport const KeepAliveProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: KeepAliveContextType;\n}) => {\n return (\n <KeepAliveContext.Provider value={value}>\n {children}\n </KeepAliveContext.Provider>\n );\n};\n\nconst Component = memo<{\n id: string;\n onMountCallbacks: React.MutableRefObject<{\n [id: string]: ((id: string) => void)[];\n }>;\n onDropCallbacks: React.MutableRefObject<{\n [id: string]: ((id: string) => void)[];\n }>;\n children: React.ReactNode;\n element: HTMLElement;\n}>(({ id, onMountCallbacks, onDropCallbacks, children, element }) => {\n const onKeepAliveMount = (\n callback: (id: string) => void,\n options: { runOnFirstMount?: boolean } = { runOnFirstMount: false }\n ) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n const runCallback = () => {\n const el = document.getElementById(id);\n if (el) {\n callback(id);\n } else {\n // If element is not found, use MutationObserver to wait for it\n const observer = new MutationObserver((_mutations, obs) => {\n const el = document.getElementById(id);\n if (el) {\n callback(id);\n obs.disconnect(); // Stop observing once element is found\n }\n });\n\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n\n // Cleanup function to disconnect the observer if component unmounts\n return () => observer.disconnect();\n }\n };\n\n if (options?.runOnFirstMount) {\n runCallback();\n }\n\n onMountCallbacks.current[id].push(runCallback);\n return () => {\n onMountCallbacks.current[id] = onMountCallbacks.current[id].filter(\n (cb) => cb !== runCallback\n );\n };\n }, []);\n };\n\n const onKeepAliveDrop = (callback: (id: string) => void) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n onDropCallbacks.current[id].push(callback);\n return () => {\n onDropCallbacks.current[id] = onDropCallbacks.current[id].filter(\n (cb) => cb !== callback\n );\n };\n }, []);\n };\n\n return (\n <KeepAliveProvider\n value={{ keepAliveId: id, onKeepAliveMount, onKeepAliveDrop }}\n >\n {createPortal(children, element, id)}\n </KeepAliveProvider>\n );\n});\n\nconst useKeepAlive = () => {\n const context = useContext(KeepAliveContext);\n\n if (!context)\n throw new Error(\"useKeepAlive must be used within KeepAliveProvider\");\n\n return context;\n};\n\ntype KeepAliveProps = React.HTMLAttributes<HTMLDivElement> & {\n aliveKey: string;\n children: React.ReactNode;\n enabled?: boolean;\n};\n\nconst KeepAlive: React.FC<KeepAliveProps> = ({\n aliveKey,\n children,\n enabled = true,\n ...others\n}) => {\n const keepAliveRef = useRef<HTMLDivElement | null>(null);\n const { getPortalElement } = useAliveScope();\n\n useEffect(() => {\n const element = getPortalElement(aliveKey, children, others.className);\n\n if (enabled) {\n if (keepAliveRef.current) {\n keepAliveRef.current.replaceWith(element);\n }\n }\n\n return () => {\n //TODO\n //callUnmountCallbacks(aliveKey)\n };\n }, [aliveKey, children, enabled, others]);\n\n return <div {...others} ref={keepAliveRef} />;\n};\n//============================\n// #endregion KeepAlive\n//============================\n\nexport { AliveScope, KeepAlive, useKeepAlive };\n"],"names":["AliveScopeContext","createContext","AliveScopeProvider","children","value","jsx","useAliveScope","context","useContext","AliveScope","nodes","setNodes","useState","onMountCallbacks","useRef","onDropCallbacks","jsxs","id","className","element","prevNodes","callback","copy","Component","KeepAliveContext","KeepAliveProvider","memo","options","useEffect","runCallback","observer","_mutations","obs","cb","createPortal","useKeepAlive","KeepAlive","aliveKey","enabled","others","keepAliveRef","getPortalElement"],"mappings":";;;AAsBA,MAAMA,IAAoBC,EAA4C,IAAI,GAEpEC,IAAqB,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,OAAAC;AACF,MAKI,gBAAAC,EAACL,EAAkB,UAAlB,EAA2B,OAAAI,GACzB,UAAAD,EAAA,CACH,GAIEG,IAAgB,MAAM;AAC1B,QAAMC,IAAUC,EAAWR,CAAiB;AAE5C,MAAI,CAACO;AACH,UAAM,IAAI,MAAM,yDAAyD;AAE3E,SAAOA;AACT,GAMME,IAAwC,CAAC,EAAE,UAAAN,QAAe;AAC9D,QAAM,CAACO,GAAOC,CAAQ,IAAIC,EAEvB,CAAA,CAAE,GAECC,IAAmBC;AAAA,IACvB,CAAA;AAAA,EAAC,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,QAEnB;AAAA,MACF,GAAG,CAAA,CAAE;AAAA,IACP,GAgBgD,iBAdxB,CAACR,MAAmC;AAE1D,MAAAO,EAAU,OACRb,EAAgB,QAAQE,CAAE,EAAE,KAAKI,CAAQ,GAClC,MAAM;AACX,QAAAN,EAAgB,QAAQE,CAAE,IAAIF,EAAgB,QAAQE,CAAE,EAAE;AAAA,UACxD,CAACgB,MAAOA,MAAOZ;AAAA,QAAA;AAAA,MAEnB,IACC,CAAA,CAAE;AAAA,IACP,EAIgD;AAAA,IAE3C,UAAAa,EAAa/B,GAAUgB,GAASF,CAAE;AAAA,EAAA;AAAA,CAGxC,GAEKkB,IAAe,MAAM;AACzB,QAAM5B,IAAUC,EAAWgB,CAAgB;AAE3C,MAAI,CAACjB;AACH,UAAM,IAAI,MAAM,oDAAoD;AAEtE,SAAOA;AACT,GAQM6B,IAAsC,CAAC;AAAA,EAC3C,UAAAC;AAAA,EACA,UAAAlC;AAAA,EACA,SAAAmC,IAAU;AAAA,EACV,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAe1B,EAA8B,IAAI,GACjD,EAAE,kBAAA2B,EAAA,IAAqBnC,EAAA;AAE7B,SAAAsB,EAAU,MAAM;AACd,UAAMT,IAAUsB,EAAiBJ,GAAUlC,GAAUoC,EAAO,SAAS;AAErE,WAAID,KACEE,EAAa,WACfA,EAAa,QAAQ,YAAYrB,CAAO,GAIrC,MAAM;AAAA,IAGb;AAAA,EACF,GAAG,CAACkB,GAAUlC,GAAUmC,GAASC,CAAM,CAAC,GAEjC,gBAAAlC,EAAC,OAAA,EAAK,GAAGkC,GAAQ,KAAKC,GAAc;AAC7C;"}
1
+ {"version":3,"file":"index.js","sources":["../src/icons/index.tsx","../src/utils/index.ts","../src/components/Avatar.tsx","../src/components/AvatarsGroup.tsx","../../../node_modules/@mateosuarezdev/atoms/dist/react.js","../src/hooks/use-large-screen.tsx","../src/hooks/use-merged-ref.tsx","../src/hooks/use-ripple.tsx","../src/components/Button.tsx","../src/components/Separator.tsx","../src/components/KeepAlive.tsx"],"sourcesContent":["/**\r\n * Props for the base Icon component that provides a consistent SVG wrapper.\r\n */\r\ninterface IconProps extends React.SVGProps<SVGSVGElement> {\r\n /** Width and height of the icon in pixels (default: 24) */\r\n size?: number | string;\r\n /** Stroke width for outlined icons (default: 2) */\r\n strokeWidth?: number;\r\n /** SVG viewBox attribute defining the coordinate system (default: \"0 0 24 24\") */\r\n viewBox?: \"0 0 24 24\" | \"0 0 48 48\" | \"0 0 512 512\";\r\n /** CSS class names for styling */\r\n className?: string;\r\n /** SVG elements (paths, circles, etc.) that define the icon shape */\r\n children?: React.ReactNode;\r\n}\r\n\r\n/**\r\n * Base Icon component that provides a consistent SVG wrapper for creating custom icons.\r\n * Handles common SVG properties while allowing full customization through standard SVG props.\r\n *\r\n * @example\r\n * // Creating a reusable icon component\r\n * export const CustomIcon = ({ size, className, ...props }: IndividualIconProps) => {\r\n * return (\r\n * <Icon size={size} className={className} fill=\"currentColor\" {...props}>\r\n * <path d=\"M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z\" />\r\n * </Icon>\r\n * );\r\n * };\r\n *\r\n * @example\r\n * // Creating a custom icon\r\n * <Icon size={32} strokeWidth={1.5}>\r\n * <path d=\"M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z\" />\r\n * </Icon>\r\n *\r\n * @example\r\n * // Using with custom viewBox for different icon sets\r\n * <Icon viewBox=\"0 0 512 512\" size={48}>\r\n * <circle cx=\"256\" cy=\"256\" r=\"200\" />\r\n * </Icon>\r\n */\r\nexport const Icon: React.FC<IconProps> = ({\r\n children,\r\n size = 24,\r\n strokeWidth = 2,\r\n viewBox = \"0 0 24 24\",\r\n className,\r\n ...props\r\n}) => {\r\n return (\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width={size}\r\n height={size}\r\n viewBox={viewBox}\r\n className={className}\r\n {...props}\r\n >\r\n {children}\r\n </svg>\r\n );\r\n};\r\n\r\n// Define props for individual icons\r\nexport type IndividualIconProps = Omit<IconProps, \"children\">;\r\n","import { clsx, type ClassValue } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\n//Custom ClassName\r\nexport type { ClassValue };\r\n\r\n/**Tailwind Merge + Clsx */\r\nexport const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));\r\n\r\n/**\r\n * Creates a throttled function that only invokes func at most once per every limit milliseconds.\r\n * The first call executes immediately, subsequent calls are rate-limited, and the last call\r\n * during rapid firing is guaranteed to execute with the most recent arguments.\r\n *\r\n * @param func - The function to throttle\r\n * @param limit - The number of milliseconds to throttle invocations to (default: 100)\r\n * @returns A throttled version of the function\r\n *\r\n * @example\r\n * const handleScroll = throttle(() => {\r\n * console.log('Scrolled!');\r\n * }, 200);\r\n *\r\n * window.addEventListener('scroll', handleScroll);\r\n */\r\nexport function throttle<T extends (...args: any[]) => any>(\r\n func: T,\r\n limit: number = 100\r\n): (...args: Parameters<T>) => void {\r\n let lastRan: number | null = null;\r\n let timeout: ReturnType<typeof setTimeout> | null = null;\r\n\r\n return function (this: any, ...args: Parameters<T>) {\r\n const now = Date.now();\r\n\r\n if (lastRan === null || now - lastRan >= limit) {\r\n func.apply(this, args);\r\n lastRan = now;\r\n } else {\r\n if (timeout) clearTimeout(timeout);\r\n timeout = setTimeout(() => {\r\n func.apply(this, args);\r\n lastRan = Date.now();\r\n }, limit - (now - lastRan));\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Creates a debounced function that delays invoking func until after delay milliseconds\r\n * have elapsed since the last time the debounced function was invoked. Each call resets\r\n * the timer, ensuring func only executes after activity has stopped.\r\n *\r\n * @param func - The function to debounce\r\n * @param delay - The number of milliseconds to delay (default: 300)\r\n * @returns A debounced version of the function\r\n *\r\n * @example\r\n * const handleSearch = debounce((query) => {\r\n * fetchResults(query);\r\n * }, 300);\r\n *\r\n * input.addEventListener('input', (e) => handleSearch(e.target.value));\r\n */\r\nexport function debounce<T extends (...args: any[]) => any>(\r\n func: T,\r\n delay: number = 500\r\n): (...args: Parameters<T>) => void {\r\n let timeout: ReturnType<typeof setTimeout> | null = null;\r\n\r\n return function (this: any, ...args: Parameters<T>) {\r\n if (timeout) clearTimeout(timeout);\r\n\r\n timeout = setTimeout(() => {\r\n func.apply(this, args);\r\n timeout = null;\r\n }, delay);\r\n };\r\n}\r\n\r\nexport function generateInitials(name: string) {\r\n if (!name) return \"\";\r\n\r\n // Trim and remove extra spaces\r\n const trimmedName = name.trim().replace(/\\s+/g, \" \");\r\n\r\n // Split by space to get words\r\n const words = trimmedName.split(\" \");\r\n\r\n // If no words (empty string), return empty\r\n if (words.length === 0 || words[0] === \"\") {\r\n return \"\";\r\n }\r\n\r\n // If only one word, return first letter\r\n if (words.length === 1) {\r\n return words[0].charAt(0).toUpperCase();\r\n }\r\n\r\n // If two or more words, return first letter of first two words\r\n return (words[0].charAt(0) + words[1].charAt(0)).toUpperCase();\r\n}\r\n","import { Icon } from \"../icons\";\r\nimport { cn } from \"../utils\";\r\nimport { generateInitials } from \"../utils\";\r\n\r\nconst sizes = {\r\n xs: \"w-8 h-8\",\r\n sm: \"w-10 h-10 text-lg\",\r\n md: \"w-14 h-14 text-xl\",\r\n lg: \"h-20 w-20 text-2xl\",\r\n xl: \"h-24 w-24 text-2xl\",\r\n};\r\n\r\nconst Avatar = ({\r\n src,\r\n name,\r\n size = \"md\",\r\n className,\r\n}: {\r\n src?: string;\r\n name?: string;\r\n size?: keyof typeof sizes;\r\n className?: string;\r\n}) => {\r\n if (src) {\r\n return (\r\n <img\r\n alt=\"avatar\"\r\n src={src}\r\n className={cn(\"rounded-full bg-base-3\", sizes[size])}\r\n />\r\n );\r\n }\r\n\r\n if (name) {\r\n return (\r\n <p\r\n className={cn(\r\n \"rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center\",\r\n sizes[size],\r\n className\r\n )}\r\n >\r\n {generateInitials(name)}\r\n </p>\r\n );\r\n }\r\n\r\n return (\r\n <div\r\n className={cn(\r\n \"rounded-full text-2xl font-medium flex items-center justify-center\",\r\n \"bg-base-2 dark-theme:bg-base-3 border border-base-4\",\r\n \"lg:hover:bg-base-3 max-lg:active:bg-base-4 transition-colors\",\r\n sizes[size],\r\n className\r\n )}\r\n >\r\n <Icon\r\n size={size === \"xs\" ? 16 : size === \"sm\" ? 20 : 24}\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n strokeWidth={2}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n >\r\n <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" />\r\n <circle cx=\"12\" cy=\"7\" r=\"4\" />\r\n </Icon>\r\n </div>\r\n );\r\n};\r\n\r\nexport { Avatar };\r\n","import { ComponentPropsWithoutRef } from \"react\";\r\nimport { cn } from \"../utils\";\r\n\r\nfunction AvatarsGroup({\r\n className,\r\n children,\r\n animate = false,\r\n ...props\r\n}: ComponentPropsWithoutRef<\"div\"> & { animate?: boolean }) {\r\n return (\r\n <div\r\n className={cn(\"flex -space-x-3 rtl:space-x-reverse\", className)}\r\n {...props}\r\n >\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\nexport { AvatarsGroup };\r\n","import { useSyncExternalStore as s, useCallback as o, useRef as i, useEffect as l } from \"react\";\nimport { computed as p, effect as b } from \"./index.js\";\nfunction A(e) {\n const t = s(\n (u) => e.subscribe(u),\n () => e.get(),\n () => e.get()\n ), r = o(\n (u) => {\n e.set(u);\n },\n [e]\n );\n return [t, r];\n}\nfunction f(e) {\n return s(\n (t) => e.subscribe(t),\n () => e.get(),\n () => e.get()\n );\n}\nfunction d(e) {\n return o(\n (t) => {\n e.set(t);\n },\n [e]\n );\n}\nfunction E(e) {\n const t = i(null);\n return t.current || (t.current = p(e)), f(t.current);\n}\nfunction S(e) {\n l(() => b(e), []);\n}\nfunction h(e, ...t) {\n const r = t.length > 0 ? t : Object.keys(e), u = {};\n return r.forEach((c) => {\n const n = e[c];\n n && typeof n == \"object\" && \"get\" in n ? u[c] = f(n) : u[c] = n;\n }), u;\n}\nexport {\n A as useAtom,\n S as useAtomEffect,\n f as useAtomValue,\n E as useComputed,\n d as useSetAtom,\n h as useStore\n};\n//# sourceMappingURL=react.js.map\n","import { throttle } from \"../utils\";\r\nimport { useEffect } from \"react\";\r\nimport { atom } from \"@mateosuarezdev/atoms\";\r\nimport { useAtomValue } from \"@mateosuarezdev/atoms/react\";\r\n\r\n/**\r\n * Standard breakpoints for responsive design.\r\n */\r\n// export const mediaQueries = {\r\n// sm: 640,\r\n// md: 768,\r\n// lg: 1024,\r\n// xl: 1280,\r\n// \"2xl\": 1536,\r\n// };\r\n\r\n/**\r\n * Observable state tracking whether the screen is larger than the 'lg' breakpoint.\r\n * Default to true on server (assumes desktop), update on client.\r\n */\r\n// const largeObservable = observable(\r\n// typeof window !== \"undefined\" ? window.innerWidth > mediaQueries.lg : true\r\n// );\r\nconst largeAtom = atom(true);\r\n\r\nlet listening = false;\r\n\r\n/**\r\n * Throttled resize handler to update screen size state.\r\n * Only updates the observable when the viewport crosses the large screen threshold.\r\n * Throttled to improve performance by limiting update frequency.\r\n */\r\nconst handleResize = throttle(() => {\r\n largeAtom.set(window.innerWidth > 1024);\r\n}); // Throttle to once per 100ms\r\n\r\n// Only set up listeners on client\r\nif (typeof window !== \"undefined\") {\r\n if (listening) {\r\n window.removeEventListener(\"resize\", handleResize);\r\n listening = false;\r\n }\r\n\r\n // Attach resize listener to update state when window is resized\r\n window.addEventListener(\"resize\", handleResize);\r\n listening = true;\r\n}\r\n\r\n/**\r\n * Custom hook that returns whether the current viewport is larger than the 'lg' breakpoint.\r\n *\r\n * @example\r\n * function MyComponent() {\r\n * const lg = useLargeScreen();\r\n *\r\n * return (\r\n * <div>\r\n * {lg\r\n * ? <DesktopLayout />\r\n * : <MobileLayout />\r\n * }\r\n * </div>\r\n * );\r\n * }\r\n *\r\n * @returns {boolean} True if the current viewport width is larger than the 'lg' breakpoint\r\n */\r\nconst useLargeScreen = (): boolean => {\r\n useEffect(() => {\r\n largeAtom.set(window.innerWidth > 1024);\r\n }, []);\r\n return useAtomValue(largeAtom);\r\n};\r\n\r\nexport { useLargeScreen };\r\n","function useMergedRef<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\r\n return (value) => {\r\n refs.forEach((ref) => {\r\n if (typeof ref === \"function\") {\r\n ref(value);\r\n } else if (ref != null) {\r\n (ref as React.MutableRefObject<T | null>).current = value;\r\n }\r\n });\r\n };\r\n}\r\n\r\nexport { useMergedRef };\r\n","import { CSSProperties, useCallback, useRef } from \"react\";\r\nimport { useLargeScreen } from \"./use-large-screen\";\r\n\r\n// new ripple uses a wrapper so the parent doesn't need overflow-hidden\r\nconst useRipple = <T extends HTMLElement>(\r\n enabled: boolean = true,\r\n contrastRipple?: boolean\r\n) => {\r\n const lg = useLargeScreen();\r\n const ref = useRef<T>(null);\r\n\r\n const ripple = useCallback(\r\n (event: React.MouseEvent<T>) => {\r\n if (!enabled || lg) return;\r\n\r\n const button = ref.current;\r\n if (!button) return;\r\n\r\n // Get button's position and dimensions\r\n const buttonRect = button.getBoundingClientRect();\r\n const rippleSize = Math.max(buttonRect.width, buttonRect.height);\r\n const offsetX = event.clientX - buttonRect.left - rippleSize / 2;\r\n const offsetY = event.clientY - buttonRect.top - rippleSize / 2;\r\n\r\n // Create the ripple wrapper (this element holds the ripple)\r\n const rippleWrapper = document.createElement(\"span\");\r\n rippleWrapper.classList.add(\"ripple-wrapper\");\r\n\r\n // Create the ripple element (circle)\r\n const rippleEl = document.createElement(\"span\");\r\n rippleEl.classList.add(\"ripple\");\r\n rippleEl.style.backgroundColor = contrastRipple\r\n ? \"var(--ripple-contrast)\"\r\n : \"var(--ripple-main)\";\r\n\r\n // Set the position and size of the ripple\r\n rippleEl.style.width = `${rippleSize}px`;\r\n rippleEl.style.height = `${rippleSize}px`;\r\n rippleEl.style.left = `${offsetX}px`;\r\n rippleEl.style.top = `${offsetY}px`;\r\n\r\n rippleWrapper.appendChild(rippleEl);\r\n\r\n const ripples = button.getElementsByClassName(\"ripple-wrapper\");\r\n if (ripples?.length) {\r\n for (const ripple of ripples) {\r\n ripple.remove();\r\n }\r\n }\r\n\r\n // Append the ripple wrapper to the button\r\n button.appendChild(rippleWrapper);\r\n\r\n // Remove the ripple wrapper after animation\r\n setTimeout(() => {\r\n rippleWrapper.remove();\r\n }, 700); // Match the animation duration\r\n },\r\n [enabled, lg, contrastRipple]\r\n );\r\n\r\n return {\r\n ref,\r\n ripple,\r\n styles: {\r\n position: \"relative\",\r\n } as CSSProperties,\r\n };\r\n};\r\n\r\nexport { useRipple };\r\n\r\n// ios like fade effect\r\n// const useRipple = (enabled = true, contrastRipple?: boolean) => {\r\n// const lg = useLargeScreen();\r\n// const ref = useRef<HTMLElement>(null);\r\n\r\n// const ripple = useCallback(\r\n// (event: React.MouseEvent<HTMLElement>) => {\r\n// if (!enabled || lg) return;\r\n\r\n// const rippleEl = document.createElement(\"span\");\r\n// rippleEl.classList.add(\"simple-ripple\");\r\n// rippleEl.style.backgroundColor = contrastRipple\r\n// ? \"var(--ripple-contrast)\"\r\n// : \"var(--ripple-main)\";\r\n\r\n// const target = ref.current;\r\n// if (!target) return;\r\n\r\n// target.appendChild(rippleEl);\r\n\r\n// // Remove after animation\r\n// setTimeout(() => {\r\n// rippleEl.remove();\r\n// }, 400); // Match animation duration\r\n// },\r\n// [enabled, lg, contrastRipple]\r\n// );\r\n\r\n// return { ref, ripple };\r\n// };\r\n\r\n// export default useRipple;\r\n\r\n// old ripple requires parent with overflow-hidden\r\n// const useRipple = (enabled: boolean = true, contrastRipple?: boolean) => {\r\n// const lg = useLargeScreen();\r\n// const ref = useRef<HTMLElement>(null);\r\n// const ripple = useCallback(\r\n// (event: React.MouseEvent<HTMLElement, MouseEvent>) => {\r\n// if (!lg && enabled) {\r\n// const rippleContainer = event.currentTarget.getBoundingClientRect();\r\n// const circle = document.createElement(\"span\");\r\n// const diameter = Math.max(\r\n// rippleContainer.width,\r\n// rippleContainer.height\r\n// );\r\n// const radius = diameter / 2;\r\n\r\n// circle.style.width = circle.style.height = `${diameter}px`;\r\n// circle.style.left = `${\r\n// event.clientX - (rippleContainer.left + radius)\r\n// }px`;\r\n// circle.style.top = `${\r\n// event.clientY - (rippleContainer.top + radius)\r\n// }px`;\r\n// circle.style.backgroundColor = `${\r\n// contrastRipple ? \"var(--ripple-contrast)\" : \"var(--ripple-main)\"\r\n// }`;\r\n// circle.style.pointerEvents = \"none\";\r\n// circle.classList.add(\"ripple\");\r\n\r\n// const ripples = ref.current?.getElementsByClassName(\"ripple\");\r\n// if (ripples?.length) {\r\n// for (const ripple of ripples) {\r\n// ripple.remove();\r\n// }\r\n// }\r\n\r\n// ref.current?.appendChild(circle);\r\n\r\n// (async () => {\r\n// //await sleep(750);\r\n// setTimeout(\r\n// () => ref.current?.getElementsByClassName(\"ripple\")[0]?.remove(),\r\n// 750\r\n// );\r\n// })();\r\n// }\r\n// },\r\n// [contrastRipple, lg, enabled]\r\n// );\r\n\r\n// return {\r\n// ref: ref,\r\n// ripple: ripple,\r\n// classNames: \"relative overflow-hidden inline-block\",\r\n// };\r\n// };\r\n\r\n// export default useRipple;\r\n","import { forwardRef, useState, ForwardedRef } from \"react\";\r\nimport { cn } from \"../utils\";\r\nimport { useMergedRef } from \"../hooks\";\r\nimport { useRipple } from \"../hooks/use-ripple\";\r\n\r\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\r\n color?: keyof typeof colorStyles;\r\n size?: keyof typeof sizeStyles;\r\n fontWeight?: keyof typeof fontWeightStyles;\r\n rounded?: keyof typeof borderRadiusStyles;\r\n state?: \"enabled\" | \"disabled\" | \"loading\";\r\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\r\n className?: string;\r\n withRipple?: boolean;\r\n contrastRipple?: boolean;\r\n showFocus?: \"all\" | \"desktop\" | \"mobile\" | \"none\";\r\n withDisabledDelay?: boolean;\r\n type?: \"button\" | \"submit\" | \"reset\";\r\n children?: React.ReactNode;\r\n};\r\n\r\n// Base button styles that apply to all variants\r\nconst baseStyles =\r\n \"relative shrink-0 select-none transition outline-none duration-200 ease-out focus:ring-border-brand-light flex items-center justify-center\"; //was pl-1.5 and rounded-lg\r\n\r\nconst sizeStyles = {\r\n xs: \"text-xs px-1 gap-x-0.5 py-1\",\r\n sm: \"text-sm px-2.5 gap-x-1 py-1.5\",\r\n mdsm: \"text-sm px-3 gap-x-1.5 py-2.5\",\r\n md: \"text-base px-4 gap-x-1.5 py-2.5\",\r\n lg: \"text-base px-4 gap-x-1.5 py-3.5\",\r\n picker: \"text-base px-2 py-2 gap-x-1.5\",\r\n iconXs: \"text-xs p-1\",\r\n iconSm: \"text-sm p-2\",\r\n iconMd: \"text-base p-3\",\r\n iconLg: \"text-base p-4\",\r\n};\r\n\r\n// Focus styles based on showFocus prop\r\nconst focusStyles = {\r\n all: \"focus:ring-1\",\r\n desktop: \"lg:focus:ring-1\",\r\n mobile: \"focus:ring-1 lg:focus-ring-0\",\r\n none: \"\",\r\n};\r\n\r\nconst fontWeightStyles = {\r\n light: \"font-light\",\r\n normal: \"font-normal\",\r\n medium: \"font-medium\",\r\n semibold: \"font-semibold\",\r\n bold: \"font-bold\",\r\n};\r\n\r\nconst borderRadiusStyles = {\r\n none: \"rounded-none\",\r\n \"1\": \"rounded-1\",\r\n \"2\": \"rounded-2\",\r\n \"3\": \"rounded-3\",\r\n \"4\": \"rounded-4\",\r\n \"5\": \"rounded-5\",\r\n \"6\": \"rounded-6\",\r\n \"7\": \"rounded-7\",\r\n \"8\": \"rounded-8\",\r\n \"9\": \"rounded-9\",\r\n \"10\": \"rounded-10\",\r\n \"11\": \"rounded-11\",\r\n \"12\": \"rounded-12\",\r\n full: \"rounded-full\",\r\n};\r\n\r\n// Color variant styles\r\nconst colorStyles = {\r\n transparent: \"text-base-12 lg:hover:bg-base-4 focus:ring-base-6\",\r\n transparentinactive: \"text-base-11 lg:hover:bg-base-4\",\r\n brand:\r\n \"bg-brand text-brand-text lg:hover:bg-brand-hover focus:ring-base-6 border border-transparent\",\r\n accent: \"bg-accent text-accent-text lg:hover:bg-accent-hover\",\r\n contrast: \"bg-base-12 text-base-1 lg:hover:bg-base-11 focus:ring-base-6\",\r\n solid:\r\n \"bg-base-3 dark-theme:bg-base-3 lg:hover:bg-base-4 border border-base-4 focus:ring-base-5\",\r\n solidhybrid:\r\n \"border border-base-5 dark-theme:border-base-4 dark-theme:bg-base-3 lg:hover:bg-base-4 focus:ring-base-6\",\r\n outline: \"border border-base-6 lg:hover:bg-base-3 focus:ring-base-6\",\r\n info: \"bg-blue-3 text-blue-9 lg:hover:bg-blue-4 lg:active:bg-blue-5 focus:ring-blue-9 border border-transparent\",\r\n success:\r\n \"bg-green-4 text-green-9 lg:hover:bg-green-5 lg:active:bg-green-6 focus:ring-green-9 border border-transparent\",\r\n warning:\r\n \"bg-yellow-4 text-yellow-9 lg:hover:bg-yellow-5 lg:active:bg-yellow-6 focus:ring-yellow-9 border border-transparent\",\r\n danger:\r\n \"bg-red-4 text-red-9 lg:hover:bg-red-5 focus:ring-red-9 border border-transparent\",\r\n dangersolid:\r\n \"bg-red-9 text-base-1 dark-theme:text-base-12 lg:hover:bg-red-8 focus:ring-base-6 border border-transparent\",\r\n disabled: \"bg-base-3 text-base-11 border border-transparent\",\r\n};\r\n\r\n// State based styles\r\nconst stateStyles = {\r\n enabled: \"\",\r\n disabled: \"opacity-75\",\r\n loading: \"\",\r\n};\r\n\r\nconst Button = forwardRef(\r\n (\r\n {\r\n color = \"transparent\",\r\n size = \"mdsm\",\r\n fontWeight = \"normal\",\r\n rounded = \"6\",\r\n state = \"enabled\",\r\n onClick,\r\n className,\r\n children,\r\n withRipple = true,\r\n contrastRipple,\r\n showFocus = \"desktop\",\r\n withDisabledDelay = false,\r\n type = \"button\",\r\n ...others\r\n }: ButtonProps,\r\n forwardedRef: ForwardedRef<HTMLButtonElement>\r\n ) => {\r\n const [disabledDelay, setDisabledDelay] = useState(false);\r\n\r\n const handleClick = (\r\n e: React.MouseEvent<HTMLButtonElement, MouseEvent>\r\n ) => {\r\n if (state === \"enabled\") {\r\n if (withDisabledDelay) {\r\n setDisabledDelay(true);\r\n onClick && onClick(e);\r\n setTimeout(() => setDisabledDelay(false), 1000);\r\n } else {\r\n onClick && onClick(e);\r\n }\r\n }\r\n };\r\n\r\n const { ref: rippleRef, ripple } = useRipple(\r\n withRipple,\r\n color === \"contrast\" || contrastRipple\r\n );\r\n\r\n // Merge the ripple ref with forwarded ref\r\n const ref = useMergedRef(rippleRef, forwardedRef);\r\n\r\n return (\r\n <button\r\n ref={ref}\r\n type={type}\r\n disabled={\r\n others.disabled\r\n ? others.disabled\r\n : state === \"disabled\" || state === \"loading\"\r\n }\r\n onMouseDown={ripple}\r\n onClick={(e) => (!disabledDelay ? handleClick(e) : null)}\r\n className={cn(\r\n baseStyles,\r\n sizeStyles[size],\r\n fontWeightStyles[fontWeight],\r\n borderRadiusStyles[rounded],\r\n focusStyles[showFocus],\r\n colorStyles[color],\r\n stateStyles[state],\r\n others.disabled && \"opacity-50\",\r\n className\r\n )}\r\n {...others}\r\n >\r\n {children}\r\n </button>\r\n );\r\n }\r\n);\r\n\r\nButton.displayName = \"Button\";\r\n\r\nexport { Button };\r\n","import { cn } from \"../utils\";\r\n\r\nconst Separator = ({ className }: { className?: string }) => {\r\n return <div className={cn(\"w-full h-px bg-base-4\", className)} />;\r\n};\r\n\r\nexport { Separator };\r\n","import {\n createContext,\n memo,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\n//============================\n// #region AliveScope\n//============================\ntype AliveScopeContextType = {\n getPortalElement: (\n id: string,\n children: React.ReactNode,\n className?: string\n ) => HTMLElement;\n dropPortalElement: (id: string) => void;\n};\n\nconst AliveScopeContext = createContext<AliveScopeContextType | null>(null);\n\nconst AliveScopeProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: AliveScopeContextType;\n}) => {\n return (\n <AliveScopeContext.Provider value={value}>\n {children}\n </AliveScopeContext.Provider>\n );\n};\n\nconst useAliveScope = () => {\n const context = useContext(AliveScopeContext);\n\n if (!context)\n throw new Error(\"useAliveScope must be wrapped within AliveScopeProvider\");\n\n return context;\n};\n\ntype AliveScopeProps = {\n children?: React.ReactNode;\n};\n\nconst AliveScope: React.FC<AliveScopeProps> = ({ children }) => {\n const [nodes, setNodes] = useState<{\n [id: string]: { children: React.ReactNode; element: HTMLElement };\n }>({});\n\n const onMountCallbacks = useRef<{ [id: string]: ((id: string) => void)[] }>(\n {}\n );\n const onDropCallbacks = useRef<{ [id: string]: ((id: string) => void)[] }>(\n {}\n );\n\n const getPortalElement = (\n id: string,\n children: React.ReactNode,\n className?: string\n ) => {\n if (!nodes[id]) {\n const element = document.createElement(\"div\");\n if (id) {\n element.id = id;\n }\n if (className) {\n element.className = className;\n }\n setNodes((prevNodes) => ({\n ...prevNodes,\n [id]: { children, element },\n }));\n onMountCallbacks.current[id] = [];\n onDropCallbacks.current[id] = [];\n if (onMountCallbacks.current && onMountCallbacks.current[id]) {\n onMountCallbacks.current[id].forEach((callback) => callback(id));\n }\n return element;\n }\n if (onMountCallbacks.current && onMountCallbacks.current[id]) {\n onMountCallbacks.current[id].forEach((callback) => callback(id));\n }\n return nodes[id].element;\n };\n\n const dropPortalElement = (id: string) => {\n setNodes((prevNodes) => {\n const copy = { ...prevNodes };\n delete copy[id];\n return copy;\n });\n //console.log(\"dropped\", id);\n if (onDropCallbacks.current && onDropCallbacks.current[id]) {\n onDropCallbacks.current[id].forEach((callback) => callback(id));\n }\n };\n\n return (\n <AliveScopeProvider\n value={{\n getPortalElement,\n dropPortalElement,\n }}\n >\n {children}\n {Object.entries(nodes).map(([id, { children, element }]) => (\n <Component\n key={id}\n id={id}\n onMountCallbacks={onMountCallbacks}\n onDropCallbacks={onDropCallbacks}\n children={children}\n element={element}\n />\n ))}\n </AliveScopeProvider>\n );\n};\n//============================\n// #endregion AliveScope\n//============================\n\n//============================\n// #region KeepAlive\n//============================\ntype KeepAliveContextType = {\n keepAliveId: string;\n onKeepAliveMount: (\n callback: (id: string) => void,\n options?: { runOnFirstMount?: boolean }\n ) => void;\n onKeepAliveDrop: (callback: (id: string) => void) => void;\n};\n\nexport const KeepAliveContext = createContext<KeepAliveContextType | null>(\n null\n);\n\nexport const KeepAliveProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: KeepAliveContextType;\n}) => {\n return (\n <KeepAliveContext.Provider value={value}>\n {children}\n </KeepAliveContext.Provider>\n );\n};\n\nconst Component = memo<{\n id: string;\n onMountCallbacks: React.MutableRefObject<{\n [id: string]: ((id: string) => void)[];\n }>;\n onDropCallbacks: React.MutableRefObject<{\n [id: string]: ((id: string) => void)[];\n }>;\n children: React.ReactNode;\n element: HTMLElement;\n}>(({ id, onMountCallbacks, onDropCallbacks, children, element }) => {\n const onKeepAliveMount = (\n callback: (id: string) => void,\n options: { runOnFirstMount?: boolean } = { runOnFirstMount: false }\n ) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n const runCallback = () => {\n const el = document.getElementById(id);\n if (el) {\n callback(id);\n } else {\n // If element is not found, use MutationObserver to wait for it\n const observer = new MutationObserver((_mutations, obs) => {\n const el = document.getElementById(id);\n if (el) {\n callback(id);\n obs.disconnect(); // Stop observing once element is found\n }\n });\n\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n\n // Cleanup function to disconnect the observer if component unmounts\n return () => observer.disconnect();\n }\n };\n\n if (options?.runOnFirstMount) {\n runCallback();\n }\n\n onMountCallbacks.current[id].push(runCallback);\n return () => {\n onMountCallbacks.current[id] = onMountCallbacks.current[id].filter(\n (cb) => cb !== runCallback\n );\n };\n }, []);\n };\n\n const onKeepAliveDrop = (callback: (id: string) => void) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n onDropCallbacks.current[id].push(callback);\n return () => {\n onDropCallbacks.current[id] = onDropCallbacks.current[id].filter(\n (cb) => cb !== callback\n );\n };\n }, []);\n };\n\n return (\n <KeepAliveProvider\n value={{ keepAliveId: id, onKeepAliveMount, onKeepAliveDrop }}\n >\n {createPortal(children, element, id)}\n </KeepAliveProvider>\n );\n});\n\nconst useKeepAlive = () => {\n const context = useContext(KeepAliveContext);\n\n if (!context)\n throw new Error(\"useKeepAlive must be used within KeepAliveProvider\");\n\n return context;\n};\n\ntype KeepAliveProps = React.HTMLAttributes<HTMLDivElement> & {\n aliveKey: string;\n children: React.ReactNode;\n enabled?: boolean;\n};\n\nconst KeepAlive: React.FC<KeepAliveProps> = ({\n aliveKey,\n children,\n enabled = true,\n ...others\n}) => {\n const keepAliveRef = useRef<HTMLDivElement | null>(null);\n const { getPortalElement } = useAliveScope();\n\n useEffect(() => {\n const element = getPortalElement(aliveKey, children, others.className);\n\n if (enabled) {\n if (keepAliveRef.current) {\n keepAliveRef.current.replaceWith(element);\n }\n }\n\n return () => {\n //TODO\n //callUnmountCallbacks(aliveKey)\n };\n }, [aliveKey, children, enabled, others]);\n\n return <div {...others} ref={keepAliveRef} />;\n};\n//============================\n// #endregion KeepAlive\n//============================\n\nexport { AliveScope, KeepAlive, useKeepAlive };\n"],"names":["Icon","children","size","strokeWidth","viewBox","className","props","jsx","cn","inputs","twMerge","clsx","throttle","func","limit","lastRan","timeout","args","now","debounce","delay","generateInitials","name","words","sizes","Avatar","src","jsxs","AvatarsGroup","animate","f","s","t","largeAtom","atom","listening","handleResize","useLargeScreen","useEffect","useAtomValue","useMergedRef","refs","value","ref","useRipple","enabled","contrastRipple","lg","useRef","ripple","useCallback","event","button","buttonRect","rippleSize","offsetX","offsetY","rippleWrapper","rippleEl","ripples","baseStyles","sizeStyles","focusStyles","fontWeightStyles","borderRadiusStyles","colorStyles","stateStyles","Button","forwardRef","color","fontWeight","rounded","state","onClick","withRipple","showFocus","withDisabledDelay","type","others","forwardedRef","disabledDelay","setDisabledDelay","useState","handleClick","e","rippleRef","Separator","AliveScopeContext","createContext","AliveScopeProvider","useAliveScope","context","useContext","AliveScope","nodes","setNodes","onMountCallbacks","onDropCallbacks","id","element","prevNodes","callback","copy","Component","KeepAliveContext","KeepAliveProvider","memo","options","runCallback","observer","_mutations","obs","cb","createPortal","useKeepAlive","KeepAlive","aliveKey","keepAliveRef","getPortalElement"],"mappings":";;;;;;AA0CO,MAAMA,IAA4B,CAAC;AAAA,EACxC,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,aAAAC,IAAc;AAAA,EACd,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAOL;AAAA,IACP,QAAQA;AAAA,IACR,SAAAE;AAAA,IACA,WAAAC;AAAA,IACC,GAAGC;AAAA,IAEH,UAAAL;AAAA,EAAA;AAAA,GCpDMO,IAAK,IAAIC,MAAyBC,EAAQC,EAAKF,CAAM,CAAC;AAkB5D,SAASG,EACdC,GACAC,IAAgB,KACkB;AAClC,MAAIC,IAAyB,MACzBC,IAAgD;AAEpD,SAAO,YAAwBC,GAAqB;AAClD,UAAMC,IAAM,KAAK,IAAA;AAEjB,IAAIH,MAAY,QAAQG,IAAMH,KAAWD,KACvCD,EAAK,MAAM,MAAMI,CAAI,GACrBF,IAAUG,MAENF,kBAAsBA,CAAO,GACjCA,IAAU,WAAW,MAAM;AACzB,MAAAH,EAAK,MAAM,MAAMI,CAAI,GACrBF,IAAU,KAAK,IAAA;AAAA,IACjB,GAAGD,KAASI,IAAMH,EAAQ;AAAA,EAE9B;AACF;AAkBO,SAASI,GACdN,GACAO,IAAgB,KACkB;AAClC,MAAIJ,IAAgD;AAEpD,SAAO,YAAwBC,GAAqB;AAClD,IAAID,kBAAsBA,CAAO,GAEjCA,IAAU,WAAW,MAAM;AACzB,MAAAH,EAAK,MAAM,MAAMI,CAAI,GACrB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,QAAQ,YAAYlB,CAAO,GAIrC,MAAM;AAAA,IAGb;AAAA,EACF,GAAG,CAACiB,GAAUnH,GAAU4C,GAASiC,CAAM,CAAC,GAEjC,gBAAAvE,EAAC,OAAA,EAAK,GAAGuE,GAAQ,KAAKuC,GAAc;AAC7C;","x_google_ignoreList":[4]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mateosuarezdev/react-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "Dynamic React UI library designed to work alongside @mateosuarezdev/react-router",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -63,6 +63,12 @@
63
63
  "react-dom": "^18.0.0"
64
64
  },
65
65
  "peerDependenciesMeta": {
66
+ "@mateosuarezdev/atoms": {
67
+ "optional": false
68
+ },
69
+ "clsx": {
70
+ "optional": false
71
+ },
66
72
  "framer-motion": {
67
73
  "optional": true
68
74
  },
@@ -74,20 +80,23 @@
74
80
  },
75
81
  "react-dom": {
76
82
  "optional": false
83
+ },
84
+ "tailwind-merge": {
85
+ "optional": false
77
86
  }
78
87
  },
79
- "dependencies": {
80
- "@mateosuarezdev/url-change-event": "^1.0.12"
81
- },
82
88
  "devDependencies": {
89
+ "@mateosuarezdev/atoms": "^1.0.0",
83
90
  "@types/node": "^24.7.0",
84
91
  "@types/react": "^19.2.2",
85
92
  "@types/react-dom": "^19.2.1",
86
93
  "@vitejs/plugin-react": "^5.0.4",
94
+ "clsx": "^2.1.1",
87
95
  "motion": "^12.23.22",
88
96
  "react": "^19.2.0",
89
97
  "react-dom": "^19.2.0",
90
98
  "rimraf": "^6.0.1",
99
+ "tailwind-merge": "^3.3.1",
91
100
  "typescript": "^5.9.3",
92
101
  "vite": "^7.1.9",
93
102
  "vite-bundle-visualizer": "^1.2.1",