bynana-ui 1.9.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var h=require('framer-motion'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var h__namespace=/*#__PURE__*/_interopNamespace(h);var m=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!d.call(e,n)&&n!==i&&m(e,n,{get:()=>t[n],enumerable:!(o=p(t,n))||o.enumerable});return e},c=(e,t,i)=>(l(e,t,"default"),i);var a={};c(a,h__namespace);function s(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function y({children:e,className:t,delay:i=0}){return jsxRuntime.jsx("div",{className:s("w-full min-h-[500px] flex items-center justify-center bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800",t),children:jsxRuntime.jsx(a.motion.div,{className:"text-center px-8",initial:{opacity:0,filter:"blur(30px)",scale:.85},animate:{opacity:1,filter:"blur(0px)",scale:1},transition:{duration:1.2,delay:i,ease:[.25,.1,.25,1]},children:e||jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(a.motion.h2,{className:"text-8xl font-bold mb-6 text-zinc-900 dark:text-zinc-100",initial:{opacity:0},animate:{opacity:1},transition:{delay:i+.3,duration:.8},style:{fontFamily:"system-ui, -apple-system, sans-serif",letterSpacing:"-0.03em",fontWeight:700,lineHeight:.9},children:"BLUR TO FOCUS"}),jsxRuntime.jsx(a.motion.p,{className:"text-2xl text-zinc-500 font-light",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:i+.6,duration:.8},style:{letterSpacing:"0.05em",fontWeight:300},children:"Cinematic Entrance Animation"})]})})})}var C=y;exports.BlurFadeEffect=y;exports.default=C;//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../node_modules/motion/dist/es/react.mjs","../../src/utils/cn.ts","../../src/blur-fade-effect/index.tsx"],"names":["react_exports","__reExport","framer_motion_star","cn","inputs","twMerge","clsx","BlurFadeEffect","children","className","delay","jsx","jsxs","blur_fade_effect_default"],"mappings":"gjBAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,wBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,mBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAAA,QAAA,EAAA,OAAA,CAAA,EAAA,UAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA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,CACAC,cAAAA,CAAC,SAAO,CAAA,CAAP,CACC,UAAU,mCAAA,CACV,OAAA,CAAS,CAAE,OAAA,CAAS,CAAA,CAAG,CAAA,CAAG,EAAG,EAC7B,OAAA,CAAS,CAAE,QAAS,CAAA,CAAG,CAAA,CAAG,CAAE,CAAA,CAC5B,UAAA,CAAY,CAAE,KAAA,CAAOD,EAAQ,EAAA,CAAK,QAAA,CAAU,EAAI,CAAA,CAChD,KAAA,CAAO,CACL,aAAA,CAAe,QAAA,CACf,WAAY,GACd,CAAA,CACD,wCAED,CAAA,CAAA,CACF,CAAA,CAEJ,EACF,CAEJ,KAGOG,CAAAA,CAAQN","file":"index.js","sourcesContent":["export * from 'framer-motion';\n","import { clsx, type ClassValue } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return twMerge(clsx(inputs));\r\n}\r\n","\"use client\"\r\n\r\nimport { motion } from \"motion/react\"\r\nimport { cn } from \"../utils/cn\"\r\n\r\ninterface BlurFadeEffectProps {\r\n children?: React.ReactNode\r\n className?: string\r\n delay?: number\r\n}\r\n\r\nfunction BlurFadeEffect({\r\n children,\r\n className,\r\n delay = 0,\r\n}: BlurFadeEffectProps) {\r\n return (\r\n <div className={cn(\"w-full min-h-[500px] flex items-center justify-center bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800\", className)}>\r\n <motion.div\r\n className=\"text-center px-8\"\r\n initial={{ opacity: 0, filter: \"blur(30px)\", scale: 0.85 }}\r\n animate={{ opacity: 1, filter: \"blur(0px)\", scale: 1 }}\r\n transition={{ duration: 1.2, delay, ease: [0.25, 0.1, 0.25, 1] }}\r\n >\r\n {children || (\r\n <div>\r\n <motion.h2\r\n className=\"text-8xl font-bold mb-6 text-zinc-900 dark:text-zinc-100\"\r\n initial={{ opacity: 0 }}\r\n animate={{ opacity: 1 }}\r\n transition={{ delay: delay + 0.3, duration: 0.8 }}\r\n style={{\r\n fontFamily: \"system-ui, -apple-system, sans-serif\",\r\n letterSpacing: \"-0.03em\",\r\n fontWeight: 700,\r\n lineHeight: 0.9\r\n }}\r\n >\r\n BLUR TO FOCUS\r\n </motion.h2>\r\n <motion.p\r\n className=\"text-2xl text-zinc-500 font-light\"\r\n initial={{ opacity: 0, y: 10 }}\r\n animate={{ opacity: 1, y: 0 }}\r\n transition={{ delay: delay + 0.6, duration: 0.8 }}\r\n style={{\r\n letterSpacing: \"0.05em\",\r\n fontWeight: 300\r\n }}\r\n >\r\n Cinematic Entrance Animation\r\n </motion.p>\r\n </div>\r\n )}\r\n </motion.div>\r\n </div>\r\n )\r\n}\r\n\r\nexport { BlurFadeEffect };\r\nexport default BlurFadeEffect;\r\n"]}
@@ -0,0 +1,2 @@
1
+ import*as h from'framer-motion';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx,jsxs}from'react/jsx-runtime';var m=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!d.call(e,n)&&n!==i&&m(e,n,{get:()=>t[n],enumerable:!(o=p(t,n))||o.enumerable});return e},c=(e,t,i)=>(l(e,t,"default"),i);var a={};c(a,h);function s(...e){return twMerge(clsx(e))}function y({children:e,className:t,delay:i=0}){return jsx("div",{className:s("w-full min-h-[500px] flex items-center justify-center bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800",t),children:jsx(a.motion.div,{className:"text-center px-8",initial:{opacity:0,filter:"blur(30px)",scale:.85},animate:{opacity:1,filter:"blur(0px)",scale:1},transition:{duration:1.2,delay:i,ease:[.25,.1,.25,1]},children:e||jsxs("div",{children:[jsx(a.motion.h2,{className:"text-8xl font-bold mb-6 text-zinc-900 dark:text-zinc-100",initial:{opacity:0},animate:{opacity:1},transition:{delay:i+.3,duration:.8},style:{fontFamily:"system-ui, -apple-system, sans-serif",letterSpacing:"-0.03em",fontWeight:700,lineHeight:.9},children:"BLUR TO FOCUS"}),jsx(a.motion.p,{className:"text-2xl text-zinc-500 font-light",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:i+.6,duration:.8},style:{letterSpacing:"0.05em",fontWeight:300},children:"Cinematic Entrance Animation"})]})})})}var C=y;export{y as BlurFadeEffect,C as default};//# sourceMappingURL=index.mjs.map
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../node_modules/motion/dist/es/react.mjs","../../src/utils/cn.ts","../../src/blur-fade-effect/index.tsx"],"names":["react_exports","__reExport","framer_motion_star","cn","inputs","twMerge","clsx","BlurFadeEffect","children","className","delay","jsx","jsxs","blur_fade_effect_default"],"mappings":"sIAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,wBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,mBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAAA,QAAA,EAAA,OAAA,CAAA,EAAA,UAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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CACD,QAAA,CAAA,eAAA,CAED,CAAA,CACAC,GAAAA,CAAC,SAAO,CAAA,CAAP,CACC,UAAU,mCAAA,CACV,OAAA,CAAS,CAAE,OAAA,CAAS,CAAA,CAAG,CAAA,CAAG,EAAG,EAC7B,OAAA,CAAS,CAAE,QAAS,CAAA,CAAG,CAAA,CAAG,CAAE,CAAA,CAC5B,UAAA,CAAY,CAAE,KAAA,CAAOD,EAAQ,EAAA,CAAK,QAAA,CAAU,EAAI,CAAA,CAChD,KAAA,CAAO,CACL,aAAA,CAAe,QAAA,CACf,WAAY,GACd,CAAA,CACD,wCAED,CAAA,CAAA,CACF,CAAA,CAEJ,EACF,CAEJ,KAGOG,CAAAA,CAAQN","file":"index.mjs","sourcesContent":["export * from 'framer-motion';\n","import { clsx, type ClassValue } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return twMerge(clsx(inputs));\r\n}\r\n","\"use client\"\r\n\r\nimport { motion } from \"motion/react\"\r\nimport { cn } from \"../utils/cn\"\r\n\r\ninterface BlurFadeEffectProps {\r\n children?: React.ReactNode\r\n className?: string\r\n delay?: number\r\n}\r\n\r\nfunction BlurFadeEffect({\r\n children,\r\n className,\r\n delay = 0,\r\n}: BlurFadeEffectProps) {\r\n return (\r\n <div className={cn(\"w-full min-h-[500px] flex items-center justify-center bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800\", className)}>\r\n <motion.div\r\n className=\"text-center px-8\"\r\n initial={{ opacity: 0, filter: \"blur(30px)\", scale: 0.85 }}\r\n animate={{ opacity: 1, filter: \"blur(0px)\", scale: 1 }}\r\n transition={{ duration: 1.2, delay, ease: [0.25, 0.1, 0.25, 1] }}\r\n >\r\n {children || (\r\n <div>\r\n <motion.h2\r\n className=\"text-8xl font-bold mb-6 text-zinc-900 dark:text-zinc-100\"\r\n initial={{ opacity: 0 }}\r\n animate={{ opacity: 1 }}\r\n transition={{ delay: delay + 0.3, duration: 0.8 }}\r\n style={{\r\n fontFamily: \"system-ui, -apple-system, sans-serif\",\r\n letterSpacing: \"-0.03em\",\r\n fontWeight: 700,\r\n lineHeight: 0.9\r\n }}\r\n >\r\n BLUR TO FOCUS\r\n </motion.h2>\r\n <motion.p\r\n className=\"text-2xl text-zinc-500 font-light\"\r\n initial={{ opacity: 0, y: 10 }}\r\n animate={{ opacity: 1, y: 0 }}\r\n transition={{ delay: delay + 0.6, duration: 0.8 }}\r\n style={{\r\n letterSpacing: \"0.05em\",\r\n fontWeight: 300\r\n }}\r\n >\r\n Cinematic Entrance Animation\r\n </motion.p>\r\n </div>\r\n )}\r\n </motion.div>\r\n </div>\r\n )\r\n}\r\n\r\nexport { BlurFadeEffect };\r\nexport default BlurFadeEffect;\r\n"]}
@@ -0,0 +1,16 @@
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var react=require('react'),Ca=require('framer-motion'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Ca__namespace=/*#__PURE__*/_interopNamespace(Ca);var ea=Object.defineProperty;var ta=Object.getOwnPropertyDescriptor;var ua=Object.getOwnPropertyNames;var oa=Object.prototype.hasOwnProperty;var G=(a,e,o,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of ua(e))!oa.call(a,f)&&f!==o&&ea(a,f,{get:()=>e[f],enumerable:!(d=ta(e,f))||d.enumerable});return a},E=(a,e,o)=>(G(a,e,"default"),o);var i={};E(i,Ca__namespace);var W=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),da=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,o,d)=>d?d.toUpperCase():o.toLowerCase()),M=a=>{let e=da(a);return e.charAt(0).toUpperCase()+e.slice(1)},P=(...a)=>a.filter((e,o,d)=>!!e&&e.trim()!==""&&d.indexOf(e)===o).join(" ").trim(),V=a=>{for(let e in a)if(e.startsWith("aria-")||e==="role"||e==="title")return true};var z={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var N=react.forwardRef(({color:a="currentColor",size:e=24,strokeWidth:o=2,absoluteStrokeWidth:d,className:f="",children:s,iconNode:g,...x},B)=>react.createElement("svg",{ref:B,...z,width:e,height:e,stroke:a,strokeWidth:d?Number(o)*24/Number(e):o,className:P("lucide",f),...!s&&!V(x)&&{"aria-hidden":"true"},...x},[...g.map(([S,C])=>react.createElement(S,C)),...Array.isArray(s)?s:[s]]));var K=(a,e)=>{let o=react.forwardRef(({className:d,...f},s)=>react.createElement(N,{ref:s,iconNode:e,className:P(`lucide-${W(M(a))}`,`lucide-${a}`,d),...f}));return o.displayName=M(a),o};var sa=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],L=K("cloud-upload",sa);function R(...a){return tailwindMerge.twMerge(clsx.clsx(a))}var pa=5*1024*1024,Q=5,T=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],y=(a,e=2)=>{if(!+a)return "0 Bytes";let o=1024,d=e<0?0:e,f=Math.floor(Math.log(a)/Math.log(o)),s=T[f]||T[T.length-1];return `${Number.parseFloat((a/o**f).toFixed(d))} ${s}`},ma=()=>jsxRuntime.jsx("div",{className:"relative w-16 h-16",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",children:[jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"45",className:"stroke-gray-200 dark:stroke-gray-700",strokeWidth:"2",strokeDasharray:"4 4",children:jsxRuntime.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 50 50",to:"360 50 50",dur:"60s",repeatCount:"indefinite"})}),jsxRuntime.jsx("path",{d:"M30 35H70C75 35 75 40 75 40V65C75 70 70 70 70 70H30C25 70 25 65 25 65V40C25 35 30 35 30 35Z",className:"fill-blue-100 dark:fill-blue-900/30 stroke-blue-500 dark:stroke-blue-400",strokeWidth:"2"}),jsxRuntime.jsxs("g",{className:"transform translate-y-2",children:[jsxRuntime.jsx("line",{x1:"50",y1:"45",x2:"50",y2:"60",className:"stroke-blue-500 dark:stroke-blue-400",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("polyline",{points:"42,52 50,45 58,52",className:"stroke-blue-500 dark:stroke-blue-400",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})]})}),La=({progress:a})=>jsxRuntime.jsxs("div",{className:"relative w-16 h-16",children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:[jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"40",className:"stroke-gray-200 dark:stroke-gray-700",strokeWidth:"8",fill:"none"}),jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"40",className:"stroke-blue-500",strokeWidth:"8",fill:"none",strokeLinecap:"round",strokeDasharray:`${a/100*251.2} 251.2`,transform:"rotate(-90 50 50)"})]}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-sm font-medium text-blue-500",children:[Math.round(a),"%"]})})]});function Ia({onUploadSuccess:a=()=>{},onUploadError:e=()=>{},acceptedFileTypes:o=[],maxFileSize:d=pa,currentFile:f=null,onFileRemove:s=()=>{},uploadDelay:g=2e3,validateFile:x=()=>null,className:B}){let[S,C]=react.useState(f),[n,p]=react.useState("idle"),[q,h]=react.useState(0),[D,F]=react.useState(null),b=react.useRef(null),m=react.useRef(null);react.useEffect(()=>()=>{m.current&&clearInterval(m.current);},[]);let U=react.useCallback(t=>t.size>d?{message:`File size exceeds ${y(d)}`,code:"FILE_TOO_LARGE"}:null,[d]),v=react.useCallback(t=>{if(!o?.length)return null;let l=t.type.toLowerCase();return o.some(I=>l.match(I.toLowerCase()))?null:{message:`File type must be ${o.join(", ")}`,code:"INVALID_FILE_TYPE"}},[o]),k=react.useCallback(t=>{F(t),p("error"),e?.(t),setTimeout(()=>{F(null),p("idle");},3e3);},[e]),H=react.useCallback(t=>{let l=0;m.current&&clearInterval(m.current),m.current=setInterval(()=>{l+=Q,l>=100?(m.current&&clearInterval(m.current),h(0),p("idle"),C(null),a?.(t)):p(I=>I==="uploading"?(h(l),"uploading"):(m.current&&clearInterval(m.current),I));},g/(100/Q));},[a,g]),w=react.useCallback(t=>{if(!t)return;F(null);let l=U(t);if(l){k(l);return}let I=v(t);if(I){k(I);return}let O=x?.(t);if(O){k(O);return}C(t),p("uploading"),h(0),H(t);},[H,U,v,x,k]),J=react.useCallback(t=>{t.preventDefault(),t.stopPropagation(),p(l=>l!=="uploading"?"dragging":l);},[]),j=react.useCallback(t=>{t.preventDefault(),t.stopPropagation(),p(l=>l==="dragging"?"idle":l);},[]),Y=react.useCallback(t=>{if(t.preventDefault(),t.stopPropagation(),n==="uploading")return;p("idle");let l=t.dataTransfer.files?.[0];l&&w(l);},[n,w]),_=react.useCallback(t=>{let l=t.target.files?.[0];w(l||null),t.target&&(t.target.value="");},[w]),$=react.useCallback(()=>{n!=="uploading"&&b.current?.click();},[n]),aa=react.useCallback(()=>{C(null),p("idle"),h(0),s&&s();},[s]);return jsxRuntime.jsx("div",{className:R("relative w-full max-w-sm mx-auto",B),children:jsxRuntime.jsx("div",{className:"group relative w-full rounded-xl bg-gray-900 dark:bg-black ring-1 ring-gray-200 dark:ring-white/10 p-0.5",children:jsxRuntime.jsx("div",{className:"relative w-full rounded-[10px] bg-gray-50/50 dark:bg-white/[0.02] p-1.5",children:jsxRuntime.jsxs("div",{className:R("relative mx-auto w-full overflow-hidden rounded-lg border border-gray-100 dark:border-white/[0.08] bg-gray-900 dark:bg-black/50",D?"border-red-500/50":""),children:[jsxRuntime.jsx("div",{className:"relative h-[240px]",children:jsxRuntime.jsx(i.AnimatePresence,{mode:"wait",children:n==="idle"||n==="dragging"?jsxRuntime.jsxs(i.motion.div,{initial:{opacity:0,y:10},animate:{opacity:n==="dragging"?.8:1,y:0,scale:n==="dragging"?.98:1},exit:{opacity:0,y:-10},transition:{duration:.2},className:"absolute inset-0 flex flex-col items-center justify-center p-6",onDragOver:J,onDragLeave:j,onDrop:Y,children:[jsxRuntime.jsx("div",{className:"mb-4",children:jsxRuntime.jsx(ma,{})}),jsxRuntime.jsxs("div",{className:"text-center space-y-1.5 mb-4",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-white dark:text-white tracking-tight",children:"Drag and drop or"}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[o?.length?`${o.map(t=>t.split("/")[1]).join(", ").toUpperCase()}`:"SVG, PNG, JPG or GIF"," ",d&&`up to ${y(d)}`]})]}),jsxRuntime.jsxs("button",{type:"button",onClick:$,className:"w-4/5 flex items-center justify-center gap-2 rounded-lg bg-gray-800 dark:bg-white/10 px-4 py-2.5 text-sm font-semibold text-white dark:text-white transition-all duration-200 hover:bg-gray-700 dark:hover:bg-white/20 group",children:[jsxRuntime.jsx("span",{children:"Upload File"}),jsxRuntime.jsx(L,{className:"w-4 h-4 group-hover:scale-110 transition-transform duration-200"})]}),jsxRuntime.jsx("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:"or drag and drop your file here"}),jsxRuntime.jsx("input",{ref:b,type:"file",className:"sr-only",onChange:_,accept:o?.join(",")})]},"dropzone"):n==="uploading"?jsxRuntime.jsxs(i.motion.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"absolute inset-0 flex flex-col items-center justify-center p-6",children:[jsxRuntime.jsx("div",{className:"mb-4",children:jsxRuntime.jsx(La,{progress:q})}),jsxRuntime.jsxs("div",{className:"text-center space-y-1.5 mb-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white truncate",children:S?.name}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 text-xs",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:y(S?.size||0)}),jsxRuntime.jsxs("span",{className:"font-medium text-blue-500",children:[Math.round(q),"%"]})]})]}),jsxRuntime.jsx("button",{onClick:aa,type:"button",className:"w-4/5 flex items-center justify-center gap-2 rounded-lg bg-gray-100 dark:bg-white/10 px-4 py-2.5 text-sm font-semibold text-gray-900 dark:text-white transition-all duration-200 hover:bg-gray-200 dark:hover:bg-white/20",children:"Cancel"})]},"uploading"):null})}),jsxRuntime.jsx(i.AnimatePresence,{children:D&&jsxRuntime.jsx(i.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 px-4 py-2 bg-red-500/10 border border-red-500/20 rounded-lg",children:jsxRuntime.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:D.message})})})]})})})})}var Ea=Ia;/*! Bundled license information:
2
+
3
+ lucide-react/dist/esm/shared/src/utils.js:
4
+ lucide-react/dist/esm/defaultAttributes.js:
5
+ lucide-react/dist/esm/Icon.js:
6
+ lucide-react/dist/esm/createLucideIcon.js:
7
+ lucide-react/dist/esm/icons/cloud-upload.js:
8
+ lucide-react/dist/esm/lucide-react.js:
9
+ (**
10
+ * @license lucide-react v0.545.0 - ISC
11
+ *
12
+ * This source code is licensed under the ISC license.
13
+ * See the LICENSE file in the root directory of this source tree.
14
+ *)
15
+ */exports.FileUpload=Ia;exports.default=Ea;//# sourceMappingURL=index.js.map
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/file-upload/index.tsx","../../../../node_modules/motion/dist/es/react.mjs","../../../../node_modules/shared/src/utils.ts","../../../../node_modules/lucide-react/src/defaultAttributes.ts","../../../../node_modules/lucide-react/src/Icon.ts","../../../../node_modules/lucide-react/src/createLucideIcon.ts","../../../../node_modules/lucide-react/src/icons/cloud-upload.ts","../../src/utils/cn.ts"],"names":["react_exports","__reExport","framer_motion_star","toKebabCase","string","toCamelCase","match","p1","p2","toPascalCase","camelCase","mergeClasses","classes","className","index","array","hasA11yProp","props","prop","defaultAttributes","Icon","forwardRef","color","size","strokeWidth","absoluteStrokeWidth","children","iconNode","rest","ref","createElement","tag","attrs","createLucideIcon","iconName","Component","__iconNode","CloudUpload","cn","inputs","twMerge","clsx","DEFAULT_MAX_FILE_SIZE","UPLOAD_STEP_SIZE","FILE_SIZES","formatBytes","bytes","decimals","k","dm","i","unit","UploadIllustration","jsx","jsxs","UploadingAnimation","progress","FileUpload","onUploadSuccess","onUploadError","acceptedFileTypes","maxFileSize","initialFile","onFileRemove","uploadDelay","validateFile","file","setFile","useState","status","setStatus","setProgress","error","setError","fileInputRef","useRef","uploadIntervalRef","useEffect","validateFileSize","useCallback","validateFileType","fileType","type","handleError","simulateUpload","uploadingFile","currentProgress","prevStatus","handleFileSelect","selectedFile","sizeError","typeError","customError","handleDragOver","e","prev","handleDragLeave","handleDrop","droppedFile","handleFileInputChange","triggerFileInput","resetState","file_upload_default"],"mappings":"0kBAEA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,wBAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,mBAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,SAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAAA,QAAA,EAAA,OAAA,CAAA,EAAA,UAAA,C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Z,gBAAC,KAAA,CAAA,CAAI,SAAA,CAAU,iDACX,QAAA,CAAA,CAAAD,cAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,mCAAoC,QAAA,CAAAR,CAAAA,CAAYqB,CAAAA,EAAM,IAAA,EAAQ,CAAC,CAAA,CAAE,CAAA,CACjFZ,eAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,2BAAA,CAA6B,QAAA,CAAA,CAAA,IAAA,CAAK,MAAME,CAAQ,CAAA,CAAE,KAAC,CAAA,CAAA,CACvE,CAAA,CAAA,CACJ,CAAA,CACAH,cAAAA,CAAC,UAAO,OAAA,CAASgD,EAAAA,CAAY,KAAK,QAAA,CAAS,SAAA,CAAU,4NAA4N,QAAA,CAAA,QAAA,CAAM,CAAA,CAAA,CAAA,CAT3Q,WAUhB,CAAA,CACA,KACR,CAAA,CACJ,CAAA,CACAhD,eAAC,CAAA,CAAA,eAAA,CAAA,CACI,QAAA,CAAAmB,GACGnB,cAAAA,CAAC,CAAA,CAAA,MAAA,CAAO,GAAA,CAAP,CAAW,QAAS,CAAE,OAAA,CAAS,EAAG,CAAA,CAAG,EAAG,EAAG,OAAA,CAAS,CAAE,OAAA,CAAS,CAAA,CAAG,EAAG,CAAE,CAAA,CAAG,KAAM,CAAE,OAAA,CAAS,EAAG,CAAA,CAAG,GAAI,CAAA,CAAG,SAAA,CAAU,oHAC/G,QAAA,CAAAA,cAAAA,CAAC,KAAE,SAAA,CAAU,wCAAA,CAA0C,SAAAmB,CAAAA,CAAM,OAAA,CAAQ,CAAA,CACzE,CAAA,CAER,GACJ,CAAA,CACJ,CAAA,CACJ,EACJ,CAER,KAGO8B,EAAAA,CAAQ7C","file":"index.js","sourcesContent":["\"use client\";\r\n\r\nimport {\r\n useState,\r\n useRef,\r\n useCallback,\r\n type DragEvent,\r\n useEffect,\r\n} from \"react\";\r\nimport { motion, AnimatePresence } from \"motion/react\";\r\nimport { UploadCloud } from \"lucide-react\";\r\nimport { cn } from \"../utils/cn\";\r\n\r\ntype FileStatus = \"idle\" | \"dragging\" | \"uploading\" | \"error\";\r\n\r\ninterface FileError {\r\n message: string;\r\n code: string;\r\n}\r\n\r\ninterface FileUploadProps {\r\n onUploadSuccess?: (file: File) => void;\r\n onUploadError?: (error: FileError) => void;\r\n acceptedFileTypes?: string[];\r\n maxFileSize?: number;\r\n currentFile?: File | null;\r\n onFileRemove?: () => void;\r\n uploadDelay?: number;\r\n validateFile?: (file: File) => FileError | null;\r\n className?: string;\r\n}\r\n\r\nconst DEFAULT_MAX_FILE_SIZE = 5 * 1024 * 1024;\r\nconst UPLOAD_STEP_SIZE = 5;\r\nconst FILE_SIZES = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"] as const;\r\n\r\nconst formatBytes = (bytes: number, decimals = 2): string => {\r\n if (!+bytes) return \"0 Bytes\";\r\n const k = 1024;\r\n const dm = decimals < 0 ? 0 : decimals;\r\n const i = Math.floor(Math.log(bytes) / Math.log(k));\r\n const unit = FILE_SIZES[i] || FILE_SIZES[FILE_SIZES.length - 1];\r\n return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${unit}`;\r\n};\r\n\r\nconst UploadIllustration = () => (\r\n <div className=\"relative w-16 h-16\">\r\n <svg viewBox=\"0 0 100 100\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" className=\"w-full h-full\">\r\n <circle cx=\"50\" cy=\"50\" r=\"45\" className=\"stroke-gray-200 dark:stroke-gray-700\" strokeWidth=\"2\" strokeDasharray=\"4 4\">\r\n <animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0 50 50\" to=\"360 50 50\" dur=\"60s\" repeatCount=\"indefinite\" />\r\n </circle>\r\n <path d=\"M30 35H70C75 35 75 40 75 40V65C75 70 70 70 70 70H30C25 70 25 65 25 65V40C25 35 30 35 30 35Z\" className=\"fill-blue-100 dark:fill-blue-900/30 stroke-blue-500 dark:stroke-blue-400\" strokeWidth=\"2\" />\r\n <g className=\"transform translate-y-2\">\r\n <line x1=\"50\" y1=\"45\" x2=\"50\" y2=\"60\" className=\"stroke-blue-500 dark:stroke-blue-400\" strokeWidth=\"2\" strokeLinecap=\"round\" />\r\n <polyline points=\"42,52 50,45 58,52\" className=\"stroke-blue-500 dark:stroke-blue-400\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" fill=\"none\" />\r\n </g>\r\n </svg>\r\n </div>\r\n);\r\n\r\nconst UploadingAnimation = ({ progress }: { progress: number }) => (\r\n <div className=\"relative w-16 h-16\">\r\n <svg viewBox=\"0 0 100 100\" className=\"w-full h-full\">\r\n <circle cx=\"50\" cy=\"50\" r=\"40\" className=\"stroke-gray-200 dark:stroke-gray-700\" strokeWidth=\"8\" fill=\"none\" />\r\n <circle cx=\"50\" cy=\"50\" r=\"40\" className=\"stroke-blue-500\" strokeWidth=\"8\" fill=\"none\" strokeLinecap=\"round\" strokeDasharray={`${(progress / 100) * 251.2} 251.2`} transform=\"rotate(-90 50 50)\" />\r\n </svg>\r\n <div className=\"absolute inset-0 flex items-center justify-center\">\r\n <span className=\"text-sm font-medium text-blue-500\">{Math.round(progress)}%</span>\r\n </div>\r\n </div>\r\n);\r\n\r\nfunction FileUpload({\r\n onUploadSuccess = () => {},\r\n onUploadError = () => {},\r\n acceptedFileTypes = [],\r\n maxFileSize = DEFAULT_MAX_FILE_SIZE,\r\n currentFile: initialFile = null,\r\n onFileRemove = () => {},\r\n uploadDelay = 2000,\r\n validateFile = () => null,\r\n className,\r\n}: FileUploadProps) {\r\n const [file, setFile] = useState<File | null>(initialFile);\r\n const [status, setStatus] = useState<FileStatus>(\"idle\");\r\n const [progress, setProgress] = useState(0);\r\n const [error, setError] = useState<FileError | null>(null);\r\n const fileInputRef = useRef<HTMLInputElement>(null);\r\n const uploadIntervalRef = useRef<NodeJS.Timeout | null>(null);\r\n\r\n useEffect(() => {\r\n return () => {\r\n if (uploadIntervalRef.current) clearInterval(uploadIntervalRef.current);\r\n };\r\n }, []);\r\n\r\n const validateFileSize = useCallback((file: File): FileError | null => {\r\n if (file.size > maxFileSize) {\r\n return { message: `File size exceeds ${formatBytes(maxFileSize)}`, code: \"FILE_TOO_LARGE\" };\r\n }\r\n return null;\r\n }, [maxFileSize]);\r\n\r\n const validateFileType = useCallback((file: File): FileError | null => {\r\n if (!acceptedFileTypes?.length) return null;\r\n const fileType = file.type.toLowerCase();\r\n if (!acceptedFileTypes.some((type) => fileType.match(type.toLowerCase()))) {\r\n return { message: `File type must be ${acceptedFileTypes.join(\", \")}`, code: \"INVALID_FILE_TYPE\" };\r\n }\r\n return null;\r\n }, [acceptedFileTypes]);\r\n\r\n const handleError = useCallback((error: FileError) => {\r\n setError(error);\r\n setStatus(\"error\");\r\n onUploadError?.(error);\r\n setTimeout(() => { setError(null); setStatus(\"idle\"); }, 3000);\r\n }, [onUploadError]);\r\n\r\n const simulateUpload = useCallback((uploadingFile: File) => {\r\n let currentProgress = 0;\r\n if (uploadIntervalRef.current) clearInterval(uploadIntervalRef.current);\r\n uploadIntervalRef.current = setInterval(() => {\r\n currentProgress += UPLOAD_STEP_SIZE;\r\n if (currentProgress >= 100) {\r\n if (uploadIntervalRef.current) clearInterval(uploadIntervalRef.current);\r\n setProgress(0);\r\n setStatus(\"idle\");\r\n setFile(null);\r\n onUploadSuccess?.(uploadingFile);\r\n } else {\r\n setStatus((prevStatus) => {\r\n if (prevStatus === \"uploading\") { setProgress(currentProgress); return \"uploading\"; }\r\n if (uploadIntervalRef.current) clearInterval(uploadIntervalRef.current);\r\n return prevStatus;\r\n });\r\n }\r\n }, uploadDelay / (100 / UPLOAD_STEP_SIZE));\r\n }, [onUploadSuccess, uploadDelay]);\r\n\r\n const handleFileSelect = useCallback((selectedFile: File | null) => {\r\n if (!selectedFile) return;\r\n setError(null);\r\n const sizeError = validateFileSize(selectedFile);\r\n if (sizeError) { handleError(sizeError); return; }\r\n const typeError = validateFileType(selectedFile);\r\n if (typeError) { handleError(typeError); return; }\r\n const customError = validateFile?.(selectedFile);\r\n if (customError) { handleError(customError); return; }\r\n setFile(selectedFile);\r\n setStatus(\"uploading\");\r\n setProgress(0);\r\n simulateUpload(selectedFile);\r\n }, [simulateUpload, validateFileSize, validateFileType, validateFile, handleError]);\r\n\r\n const handleDragOver = useCallback((e: DragEvent<HTMLDivElement>) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n setStatus((prev) => (prev !== \"uploading\" ? \"dragging\" : prev));\r\n }, []);\r\n\r\n const handleDragLeave = useCallback((e: DragEvent<HTMLDivElement>) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n setStatus((prev) => (prev === \"dragging\" ? \"idle\" : prev));\r\n }, []);\r\n\r\n const handleDrop = useCallback((e: DragEvent<HTMLDivElement>) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n if (status === \"uploading\") return;\r\n setStatus(\"idle\");\r\n const droppedFile = e.dataTransfer.files?.[0];\r\n if (droppedFile) handleFileSelect(droppedFile);\r\n }, [status, handleFileSelect]);\r\n\r\n const handleFileInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n const selectedFile = e.target.files?.[0];\r\n handleFileSelect(selectedFile || null);\r\n if (e.target) e.target.value = \"\";\r\n }, [handleFileSelect]);\r\n\r\n const triggerFileInput = useCallback(() => {\r\n if (status === \"uploading\") return;\r\n fileInputRef.current?.click();\r\n }, [status]);\r\n\r\n const resetState = useCallback(() => {\r\n setFile(null);\r\n setStatus(\"idle\");\r\n setProgress(0);\r\n if (onFileRemove) onFileRemove();\r\n }, [onFileRemove]);\r\n\r\n return (\r\n <div className={cn(\"relative w-full max-w-sm mx-auto\", className)}>\r\n <div className=\"group relative w-full rounded-xl bg-gray-900 dark:bg-black ring-1 ring-gray-200 dark:ring-white/10 p-0.5\">\r\n <div className=\"relative w-full rounded-[10px] bg-gray-50/50 dark:bg-white/[0.02] p-1.5\">\r\n <div className={cn(\"relative mx-auto w-full overflow-hidden rounded-lg border border-gray-100 dark:border-white/[0.08] bg-gray-900 dark:bg-black/50\", error ? \"border-red-500/50\" : \"\")}>\r\n <div className=\"relative h-[240px]\">\r\n <AnimatePresence mode=\"wait\">\r\n {status === \"idle\" || status === \"dragging\" ? (\r\n <motion.div key=\"dropzone\" initial={{ opacity: 0, y: 10 }} animate={{ opacity: status === \"dragging\" ? 0.8 : 1, y: 0, scale: status === \"dragging\" ? 0.98 : 1 }} exit={{ opacity: 0, y: -10 }} transition={{ duration: 0.2 }} className=\"absolute inset-0 flex flex-col items-center justify-center p-6\" onDragOver={handleDragOver} onDragLeave={handleDragLeave} onDrop={handleDrop}>\r\n <div className=\"mb-4\"><UploadIllustration /></div>\r\n <div className=\"text-center space-y-1.5 mb-4\">\r\n <h3 className=\"text-lg font-semibold text-white dark:text-white tracking-tight\">Drag and drop or</h3>\r\n <p className=\"text-xs text-gray-500 dark:text-gray-400\">{acceptedFileTypes?.length ? `${acceptedFileTypes.map((t) => t.split(\"/\")[1]).join(\", \").toUpperCase()}` : \"SVG, PNG, JPG or GIF\"} {maxFileSize && `up to ${formatBytes(maxFileSize)}`}</p>\r\n </div>\r\n <button type=\"button\" onClick={triggerFileInput} className=\"w-4/5 flex items-center justify-center gap-2 rounded-lg bg-gray-800 dark:bg-white/10 px-4 py-2.5 text-sm font-semibold text-white dark:text-white transition-all duration-200 hover:bg-gray-700 dark:hover:bg-white/20 group\">\r\n <span>Upload File</span>\r\n <UploadCloud className=\"w-4 h-4 group-hover:scale-110 transition-transform duration-200\" />\r\n </button>\r\n <p className=\"mt-3 text-xs text-gray-500 dark:text-gray-400\">or drag and drop your file here</p>\r\n <input ref={fileInputRef} type=\"file\" className=\"sr-only\" onChange={handleFileInputChange} accept={acceptedFileTypes?.join(\",\")} />\r\n </motion.div>\r\n ) : status === \"uploading\" ? (\r\n <motion.div key=\"uploading\" initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.95 }} className=\"absolute inset-0 flex flex-col items-center justify-center p-6\">\r\n <div className=\"mb-4\"><UploadingAnimation progress={progress} /></div>\r\n <div className=\"text-center space-y-1.5 mb-4\">\r\n <h3 className=\"text-sm font-semibold text-gray-900 dark:text-white truncate\">{file?.name}</h3>\r\n <div className=\"flex items-center justify-center gap-2 text-xs\">\r\n <span className=\"text-gray-500 dark:text-gray-400\">{formatBytes(file?.size || 0)}</span>\r\n <span className=\"font-medium text-blue-500\">{Math.round(progress)}%</span>\r\n </div>\r\n </div>\r\n <button onClick={resetState} type=\"button\" className=\"w-4/5 flex items-center justify-center gap-2 rounded-lg bg-gray-100 dark:bg-white/10 px-4 py-2.5 text-sm font-semibold text-gray-900 dark:text-white transition-all duration-200 hover:bg-gray-200 dark:hover:bg-white/20\">Cancel</button>\r\n </motion.div>\r\n ) : null}\r\n </AnimatePresence>\r\n </div>\r\n <AnimatePresence>\r\n {error && (\r\n <motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -10 }} className=\"absolute bottom-4 left-1/2 transform -translate-x-1/2 px-4 py-2 bg-red-500/10 border border-red-500/20 rounded-lg\">\r\n <p className=\"text-sm text-red-500 dark:text-red-400\">{error.message}</p>\r\n </motion.div>\r\n )}\r\n </AnimatePresence>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n\r\nexport { FileUpload };\r\nexport default FileUpload;\r\n","export * from 'framer-motion';\n","import { CamelToPascal } from './utility-types';\n\n/**\n * Converts string to kebab case\n *\n * @param {string} string\n * @returns {string} A kebabized string\n */\nexport const toKebabCase = (string: string) =>\n string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Converts string to camel case\n *\n * @param {string} string\n * @returns {string} A camelized string\n */\nexport const toCamelCase = <T extends string>(string: T) =>\n string.replace(/^([A-Z])|[\\s-_]+(\\w)/g, (match, p1, p2) =>\n p2 ? p2.toUpperCase() : p1.toLowerCase(),\n );\n\n/**\n * Converts string to pascal case\n *\n * @param {string} string\n * @returns {string} A pascalized string\n */\nexport const toPascalCase = <T extends string>(string: T): CamelToPascal<T> => {\n const camelCase = toCamelCase(string);\n\n return (camelCase.charAt(0).toUpperCase() + camelCase.slice(1)) as CamelToPascal<T>;\n};\n\n/**\n * Merges classes into a single string\n *\n * @param {array} classes\n * @returns {string} A string of classes\n */\nexport const mergeClasses = <ClassType = string | undefined | null>(...classes: ClassType[]) =>\n classes\n .filter((className, index, array) => {\n return (\n Boolean(className) &&\n (className as string).trim() !== '' &&\n array.indexOf(className) === index\n );\n })\n .join(' ')\n .trim();\n\n/**\n * Is empty string\n *\n * @param {unknown} value\n * @returns {boolean} Whether the value is an empty string\n */\nexport const isEmptyString = (value: unknown): boolean => value === '';\n\n/**\n * Check if a component has an accessibility prop\n *\n * @param {object} props\n * @returns {boolean} Whether the component has an accessibility prop\n */\nexport const hasA11yProp = (props: Record<string, any>) => {\n for (const prop in props) {\n if (prop.startsWith('aria-') || prop === 'role' || prop === 'title') {\n return true;\n }\n }\n};\n","export default {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n};\n","import { createElement, forwardRef } from 'react';\nimport defaultAttributes from './defaultAttributes';\nimport { IconNode, LucideProps } from './types';\nimport { mergeClasses, hasA11yProp } from '@lucide/shared';\n\ninterface IconComponentProps extends LucideProps {\n iconNode: IconNode;\n}\n\n/**\n * Lucide icon component\n *\n * @component Icon\n * @param {object} props\n * @param {string} props.color - The color of the icon\n * @param {number} props.size - The size of the icon\n * @param {number} props.strokeWidth - The stroke width of the icon\n * @param {boolean} props.absoluteStrokeWidth - Whether to use absolute stroke width\n * @param {string} props.className - The class name of the icon\n * @param {IconNode} props.children - The children of the icon\n * @param {IconNode} props.iconNode - The icon node of the icon\n *\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst Icon = forwardRef<SVGSVGElement, IconComponentProps>(\n (\n {\n color = 'currentColor',\n size = 24,\n strokeWidth = 2,\n absoluteStrokeWidth,\n className = '',\n children,\n iconNode,\n ...rest\n },\n ref,\n ) =>\n createElement(\n 'svg',\n {\n ref,\n ...defaultAttributes,\n width: size,\n height: size,\n stroke: color,\n strokeWidth: absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth,\n className: mergeClasses('lucide', className),\n ...(!children && !hasA11yProp(rest) && { 'aria-hidden': 'true' }),\n ...rest,\n },\n [\n ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),\n ...(Array.isArray(children) ? children : [children]),\n ],\n ),\n);\n\nexport default Icon;\n","import { createElement, forwardRef } from 'react';\nimport { mergeClasses, toKebabCase, toPascalCase } from '@lucide/shared';\nimport { IconNode, LucideProps } from './types';\nimport Icon from './Icon';\n\n/**\n * Create a Lucide icon component\n * @param {string} iconName\n * @param {array} iconNode\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst createLucideIcon = (iconName: string, iconNode: IconNode) => {\n const Component = forwardRef<SVGSVGElement, LucideProps>(({ className, ...props }, ref) =>\n createElement(Icon, {\n ref,\n iconNode,\n className: mergeClasses(\n `lucide-${toKebabCase(toPascalCase(iconName))}`,\n `lucide-${iconName}`,\n className,\n ),\n ...props,\n }),\n );\n\n Component.displayName = toPascalCase(iconName);\n\n return Component;\n};\n\nexport default createLucideIcon;\n","import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [\n ['path', { d: 'M12 13v8', key: '1l5pq0' }],\n ['path', { d: 'M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242', key: '1pljnt' }],\n ['path', { d: 'm8 17 4-4 4 4', key: '1quai1' }],\n];\n\n/**\n * @component @name CloudUpload\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMTN2OCIgLz4KICA8cGF0aCBkPSJNNCAxNC44OTlBNyA3IDAgMSAxIDE1LjcxIDhoMS43OWE0LjUgNC41IDAgMCAxIDIuNSA4LjI0MiIgLz4KICA8cGF0aCBkPSJtOCAxNyA0LTQgNCA0IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/cloud-upload\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst CloudUpload = createLucideIcon('cloud-upload', __iconNode);\n\nexport default CloudUpload;\n","import { clsx, type ClassValue } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return twMerge(clsx(inputs));\r\n}\r\n"]}
@@ -0,0 +1,16 @@
1
+ import {forwardRef,createElement,useState,useRef,useEffect,useCallback}from'react';import*as Ca from'framer-motion';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx,jsxs}from'react/jsx-runtime';var ea=Object.defineProperty;var ta=Object.getOwnPropertyDescriptor;var ua=Object.getOwnPropertyNames;var oa=Object.prototype.hasOwnProperty;var G=(a,e,o,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of ua(e))!oa.call(a,f)&&f!==o&&ea(a,f,{get:()=>e[f],enumerable:!(d=ta(e,f))||d.enumerable});return a},E=(a,e,o)=>(G(a,e,"default"),o);var i={};E(i,Ca);var W=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),da=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,o,d)=>d?d.toUpperCase():o.toLowerCase()),M=a=>{let e=da(a);return e.charAt(0).toUpperCase()+e.slice(1)},P=(...a)=>a.filter((e,o,d)=>!!e&&e.trim()!==""&&d.indexOf(e)===o).join(" ").trim(),V=a=>{for(let e in a)if(e.startsWith("aria-")||e==="role"||e==="title")return true};var z={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var N=forwardRef(({color:a="currentColor",size:e=24,strokeWidth:o=2,absoluteStrokeWidth:d,className:f="",children:s,iconNode:g,...x},B)=>createElement("svg",{ref:B,...z,width:e,height:e,stroke:a,strokeWidth:d?Number(o)*24/Number(e):o,className:P("lucide",f),...!s&&!V(x)&&{"aria-hidden":"true"},...x},[...g.map(([S,C])=>createElement(S,C)),...Array.isArray(s)?s:[s]]));var K=(a,e)=>{let o=forwardRef(({className:d,...f},s)=>createElement(N,{ref:s,iconNode:e,className:P(`lucide-${W(M(a))}`,`lucide-${a}`,d),...f}));return o.displayName=M(a),o};var sa=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],L=K("cloud-upload",sa);function R(...a){return twMerge(clsx(a))}var pa=5*1024*1024,Q=5,T=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],y=(a,e=2)=>{if(!+a)return "0 Bytes";let o=1024,d=e<0?0:e,f=Math.floor(Math.log(a)/Math.log(o)),s=T[f]||T[T.length-1];return `${Number.parseFloat((a/o**f).toFixed(d))} ${s}`},ma=()=>jsx("div",{className:"relative w-16 h-16",children:jsxs("svg",{viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",children:[jsx("circle",{cx:"50",cy:"50",r:"45",className:"stroke-gray-200 dark:stroke-gray-700",strokeWidth:"2",strokeDasharray:"4 4",children:jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 50 50",to:"360 50 50",dur:"60s",repeatCount:"indefinite"})}),jsx("path",{d:"M30 35H70C75 35 75 40 75 40V65C75 70 70 70 70 70H30C25 70 25 65 25 65V40C25 35 30 35 30 35Z",className:"fill-blue-100 dark:fill-blue-900/30 stroke-blue-500 dark:stroke-blue-400",strokeWidth:"2"}),jsxs("g",{className:"transform translate-y-2",children:[jsx("line",{x1:"50",y1:"45",x2:"50",y2:"60",className:"stroke-blue-500 dark:stroke-blue-400",strokeWidth:"2",strokeLinecap:"round"}),jsx("polyline",{points:"42,52 50,45 58,52",className:"stroke-blue-500 dark:stroke-blue-400",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})]})}),La=({progress:a})=>jsxs("div",{className:"relative w-16 h-16",children:[jsxs("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:[jsx("circle",{cx:"50",cy:"50",r:"40",className:"stroke-gray-200 dark:stroke-gray-700",strokeWidth:"8",fill:"none"}),jsx("circle",{cx:"50",cy:"50",r:"40",className:"stroke-blue-500",strokeWidth:"8",fill:"none",strokeLinecap:"round",strokeDasharray:`${a/100*251.2} 251.2`,transform:"rotate(-90 50 50)"})]}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxs("span",{className:"text-sm font-medium text-blue-500",children:[Math.round(a),"%"]})})]});function Ia({onUploadSuccess:a=()=>{},onUploadError:e=()=>{},acceptedFileTypes:o=[],maxFileSize:d=pa,currentFile:f=null,onFileRemove:s=()=>{},uploadDelay:g=2e3,validateFile:x=()=>null,className:B}){let[S,C]=useState(f),[n,p]=useState("idle"),[q,h]=useState(0),[D,F]=useState(null),b=useRef(null),m=useRef(null);useEffect(()=>()=>{m.current&&clearInterval(m.current);},[]);let U=useCallback(t=>t.size>d?{message:`File size exceeds ${y(d)}`,code:"FILE_TOO_LARGE"}:null,[d]),v=useCallback(t=>{if(!o?.length)return null;let l=t.type.toLowerCase();return o.some(I=>l.match(I.toLowerCase()))?null:{message:`File type must be ${o.join(", ")}`,code:"INVALID_FILE_TYPE"}},[o]),k=useCallback(t=>{F(t),p("error"),e?.(t),setTimeout(()=>{F(null),p("idle");},3e3);},[e]),H=useCallback(t=>{let l=0;m.current&&clearInterval(m.current),m.current=setInterval(()=>{l+=Q,l>=100?(m.current&&clearInterval(m.current),h(0),p("idle"),C(null),a?.(t)):p(I=>I==="uploading"?(h(l),"uploading"):(m.current&&clearInterval(m.current),I));},g/(100/Q));},[a,g]),w=useCallback(t=>{if(!t)return;F(null);let l=U(t);if(l){k(l);return}let I=v(t);if(I){k(I);return}let O=x?.(t);if(O){k(O);return}C(t),p("uploading"),h(0),H(t);},[H,U,v,x,k]),J=useCallback(t=>{t.preventDefault(),t.stopPropagation(),p(l=>l!=="uploading"?"dragging":l);},[]),j=useCallback(t=>{t.preventDefault(),t.stopPropagation(),p(l=>l==="dragging"?"idle":l);},[]),Y=useCallback(t=>{if(t.preventDefault(),t.stopPropagation(),n==="uploading")return;p("idle");let l=t.dataTransfer.files?.[0];l&&w(l);},[n,w]),_=useCallback(t=>{let l=t.target.files?.[0];w(l||null),t.target&&(t.target.value="");},[w]),$=useCallback(()=>{n!=="uploading"&&b.current?.click();},[n]),aa=useCallback(()=>{C(null),p("idle"),h(0),s&&s();},[s]);return jsx("div",{className:R("relative w-full max-w-sm mx-auto",B),children:jsx("div",{className:"group relative w-full rounded-xl bg-gray-900 dark:bg-black ring-1 ring-gray-200 dark:ring-white/10 p-0.5",children:jsx("div",{className:"relative w-full rounded-[10px] bg-gray-50/50 dark:bg-white/[0.02] p-1.5",children:jsxs("div",{className:R("relative mx-auto w-full overflow-hidden rounded-lg border border-gray-100 dark:border-white/[0.08] bg-gray-900 dark:bg-black/50",D?"border-red-500/50":""),children:[jsx("div",{className:"relative h-[240px]",children:jsx(i.AnimatePresence,{mode:"wait",children:n==="idle"||n==="dragging"?jsxs(i.motion.div,{initial:{opacity:0,y:10},animate:{opacity:n==="dragging"?.8:1,y:0,scale:n==="dragging"?.98:1},exit:{opacity:0,y:-10},transition:{duration:.2},className:"absolute inset-0 flex flex-col items-center justify-center p-6",onDragOver:J,onDragLeave:j,onDrop:Y,children:[jsx("div",{className:"mb-4",children:jsx(ma,{})}),jsxs("div",{className:"text-center space-y-1.5 mb-4",children:[jsx("h3",{className:"text-lg font-semibold text-white dark:text-white tracking-tight",children:"Drag and drop or"}),jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[o?.length?`${o.map(t=>t.split("/")[1]).join(", ").toUpperCase()}`:"SVG, PNG, JPG or GIF"," ",d&&`up to ${y(d)}`]})]}),jsxs("button",{type:"button",onClick:$,className:"w-4/5 flex items-center justify-center gap-2 rounded-lg bg-gray-800 dark:bg-white/10 px-4 py-2.5 text-sm font-semibold text-white dark:text-white transition-all duration-200 hover:bg-gray-700 dark:hover:bg-white/20 group",children:[jsx("span",{children:"Upload File"}),jsx(L,{className:"w-4 h-4 group-hover:scale-110 transition-transform duration-200"})]}),jsx("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:"or drag and drop your file here"}),jsx("input",{ref:b,type:"file",className:"sr-only",onChange:_,accept:o?.join(",")})]},"dropzone"):n==="uploading"?jsxs(i.motion.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"absolute inset-0 flex flex-col items-center justify-center p-6",children:[jsx("div",{className:"mb-4",children:jsx(La,{progress:q})}),jsxs("div",{className:"text-center space-y-1.5 mb-4",children:[jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white truncate",children:S?.name}),jsxs("div",{className:"flex items-center justify-center gap-2 text-xs",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:y(S?.size||0)}),jsxs("span",{className:"font-medium text-blue-500",children:[Math.round(q),"%"]})]})]}),jsx("button",{onClick:aa,type:"button",className:"w-4/5 flex items-center justify-center gap-2 rounded-lg bg-gray-100 dark:bg-white/10 px-4 py-2.5 text-sm font-semibold text-gray-900 dark:text-white transition-all duration-200 hover:bg-gray-200 dark:hover:bg-white/20",children:"Cancel"})]},"uploading"):null})}),jsx(i.AnimatePresence,{children:D&&jsx(i.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 px-4 py-2 bg-red-500/10 border border-red-500/20 rounded-lg",children:jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:D.message})})})]})})})})}var Ea=Ia;/*! Bundled license information:
2
+
3
+ lucide-react/dist/esm/shared/src/utils.js:
4
+ lucide-react/dist/esm/defaultAttributes.js:
5
+ lucide-react/dist/esm/Icon.js:
6
+ lucide-react/dist/esm/createLucideIcon.js:
7
+ lucide-react/dist/esm/icons/cloud-upload.js:
8
+ lucide-react/dist/esm/lucide-react.js:
9
+ (**
10
+ * @license lucide-react v0.545.0 - ISC
11
+ *
12
+ * This source code is licensed under the ISC license.
13
+ * See the LICENSE file in the root directory of this source tree.
14
+ *)
15
+ */export{Ia as FileUpload,Ea as default};//# sourceMappingURL=index.mjs.map
16
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/file-upload/index.tsx","../../../../node_modules/motion/dist/es/react.mjs","../../../../node_modules/shared/src/utils.ts","../../../../node_modules/lucide-react/src/defaultAttributes.ts","../../../../node_modules/lucide-react/src/Icon.ts","../../../../node_modules/lucide-react/src/createLucideIcon.ts","../../../../node_modules/lucide-react/src/icons/cloud-upload.ts","../../src/utils/cn.ts"],"names":["react_exports","__reExport","framer_motion_star","toKebabCase","string","toCamelCase","match","p1","p2","toPascalCase","camelCase","mergeClasses","classes","className","index","array","hasA11yProp","props","prop","defaultAttributes","Icon","forwardRef","color","size","strokeWidth","absoluteStrokeWidth","children","iconNode","rest","ref","createElement","tag","attrs","createLucideIcon","iconName","Component","__iconNode","CloudUpload","cn","inputs","twMerge","clsx","DEFAULT_MAX_FILE_SIZE","UPLOAD_STEP_SIZE","FILE_SIZES","formatBytes","bytes","decimals","k","dm","i","unit","UploadIllustration","jsx","jsxs","UploadingAnimation","progress","FileUpload","onUploadSuccess","onUploadError","acceptedFileTypes","maxFileSize","initialFile","onFileRemove","uploadDelay","validateFile","file","setFile","useState","status","setStatus","setProgress","error","setError","fileInputRef","useRef","uploadIntervalRef","useEffect","validateFileSize","useCallback","validateFileType","fileType","type","handleError","simulateUpload","uploadingFile","currentProgress","prevStatus","handleFileSelect","selectedFile","sizeError","typeError","customError","handleDragOver","e","prev","handleDragLeave","handleDrop","droppedFile","handleFileInputChange","triggerFileInput","resetState","file_upload_default"],"mappings":"0NAEA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,wBAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,mBAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,SAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAAA,QAAA,EAAA,OAAA,CAAA,EAAA,UAAA,CAAA,IAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,GAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA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AAA,CAAC,UAAO,OAAA,CAASgD,EAAAA,CAAY,KAAK,QAAA,CAAS,SAAA,CAAU,4NAA4N,QAAA,CAAA,QAAA,CAAM,CAAA,CAAA,CAAA,CAT3Q,WAUhB,CAAA,CACA,KACR,CAAA,CACJ,CAAA,CACAhD,IAAC,CAAA,CAAA,eAAA,CAAA,CACI,QAAA,CAAAmB,GACGnB,GAAAA,CAAC,CAAA,CAAA,MAAA,CAAO,GAAA,CAAP,CAAW,QAAS,CAAE,OAAA,CAAS,EAAG,CAAA,CAAG,EAAG,EAAG,OAAA,CAAS,CAAE,OAAA,CAAS,CAAA,CAAG,EAAG,CAAE,CAAA,CAAG,KAAM,CAAE,OAAA,CAAS,EAAG,CAAA,CAAG,GAAI,CAAA,CAAG,SAAA,CAAU,oHAC/G,QAAA,CAAAA,GAAAA,CAAC,KAAE,SAAA,CAAU,wCAAA,CAA0C,SAAAmB,CAAAA,CAAM,OAAA,CAAQ,CAAA,CACzE,CAAA,CAER,GACJ,CAAA,CACJ,CAAA,CACJ,EACJ,CAER,KAGO8B,EAAAA,CAAQ7C","file":"index.mjs","sourcesContent":["\"use client\";\r\n\r\nimport {\r\n useState,\r\n useRef,\r\n useCallback,\r\n type DragEvent,\r\n useEffect,\r\n} from \"react\";\r\nimport { motion, AnimatePresence } from \"motion/react\";\r\nimport { UploadCloud } from \"lucide-react\";\r\nimport { cn } from \"../utils/cn\";\r\n\r\ntype FileStatus = \"idle\" | \"dragging\" | \"uploading\" | \"error\";\r\n\r\ninterface FileError {\r\n message: string;\r\n code: string;\r\n}\r\n\r\ninterface FileUploadProps {\r\n onUploadSuccess?: (file: File) => void;\r\n onUploadError?: (error: FileError) => void;\r\n acceptedFileTypes?: string[];\r\n maxFileSize?: number;\r\n currentFile?: File | null;\r\n onFileRemove?: () => void;\r\n uploadDelay?: number;\r\n validateFile?: (file: File) => FileError | null;\r\n className?: string;\r\n}\r\n\r\nconst DEFAULT_MAX_FILE_SIZE = 5 * 1024 * 1024;\r\nconst UPLOAD_STEP_SIZE = 5;\r\nconst FILE_SIZES = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"] as const;\r\n\r\nconst formatBytes = (bytes: number, decimals = 2): string => {\r\n if (!+bytes) return \"0 Bytes\";\r\n const k = 1024;\r\n const dm = decimals < 0 ? 0 : decimals;\r\n const i = Math.floor(Math.log(bytes) / Math.log(k));\r\n const unit = FILE_SIZES[i] || FILE_SIZES[FILE_SIZES.length - 1];\r\n return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${unit}`;\r\n};\r\n\r\nconst UploadIllustration = () => (\r\n <div className=\"relative w-16 h-16\">\r\n <svg viewBox=\"0 0 100 100\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" className=\"w-full h-full\">\r\n <circle cx=\"50\" cy=\"50\" r=\"45\" className=\"stroke-gray-200 dark:stroke-gray-700\" strokeWidth=\"2\" strokeDasharray=\"4 4\">\r\n <animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0 50 50\" to=\"360 50 50\" dur=\"60s\" repeatCount=\"indefinite\" />\r\n </circle>\r\n <path d=\"M30 35H70C75 35 75 40 75 40V65C75 70 70 70 70 70H30C25 70 25 65 25 65V40C25 35 30 35 30 35Z\" className=\"fill-blue-100 dark:fill-blue-900/30 stroke-blue-500 dark:stroke-blue-400\" strokeWidth=\"2\" />\r\n <g className=\"transform translate-y-2\">\r\n <line x1=\"50\" y1=\"45\" x2=\"50\" y2=\"60\" className=\"stroke-blue-500 dark:stroke-blue-400\" strokeWidth=\"2\" strokeLinecap=\"round\" />\r\n <polyline points=\"42,52 50,45 58,52\" className=\"stroke-blue-500 dark:stroke-blue-400\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" fill=\"none\" />\r\n </g>\r\n </svg>\r\n </div>\r\n);\r\n\r\nconst UploadingAnimation = ({ progress }: { progress: number }) => (\r\n <div className=\"relative w-16 h-16\">\r\n <svg viewBox=\"0 0 100 100\" className=\"w-full h-full\">\r\n <circle cx=\"50\" cy=\"50\" r=\"40\" className=\"stroke-gray-200 dark:stroke-gray-700\" strokeWidth=\"8\" fill=\"none\" />\r\n <circle cx=\"50\" cy=\"50\" r=\"40\" className=\"stroke-blue-500\" strokeWidth=\"8\" fill=\"none\" strokeLinecap=\"round\" strokeDasharray={`${(progress / 100) * 251.2} 251.2`} transform=\"rotate(-90 50 50)\" />\r\n </svg>\r\n <div className=\"absolute inset-0 flex items-center justify-center\">\r\n <span className=\"text-sm font-medium text-blue-500\">{Math.round(progress)}%</span>\r\n </div>\r\n </div>\r\n);\r\n\r\nfunction FileUpload({\r\n onUploadSuccess = () => {},\r\n onUploadError = () => {},\r\n acceptedFileTypes = [],\r\n maxFileSize = DEFAULT_MAX_FILE_SIZE,\r\n currentFile: initialFile = null,\r\n onFileRemove = () => {},\r\n uploadDelay = 2000,\r\n validateFile = () => null,\r\n className,\r\n}: FileUploadProps) {\r\n const [file, setFile] = useState<File | null>(initialFile);\r\n const [status, setStatus] = useState<FileStatus>(\"idle\");\r\n const [progress, setProgress] = useState(0);\r\n const [error, setError] = useState<FileError | null>(null);\r\n const fileInputRef = useRef<HTMLInputElement>(null);\r\n const uploadIntervalRef = useRef<NodeJS.Timeout | null>(null);\r\n\r\n useEffect(() => {\r\n return () => {\r\n if (uploadIntervalRef.current) clearInterval(uploadIntervalRef.current);\r\n };\r\n }, []);\r\n\r\n const validateFileSize = useCallback((file: File): FileError | null => {\r\n if (file.size > maxFileSize) {\r\n return { message: `File size exceeds ${formatBytes(maxFileSize)}`, code: \"FILE_TOO_LARGE\" };\r\n }\r\n return null;\r\n }, [maxFileSize]);\r\n\r\n const validateFileType = useCallback((file: File): FileError | null => {\r\n if (!acceptedFileTypes?.length) return null;\r\n const fileType = file.type.toLowerCase();\r\n if (!acceptedFileTypes.some((type) => fileType.match(type.toLowerCase()))) {\r\n return { message: `File type must be ${acceptedFileTypes.join(\", \")}`, code: \"INVALID_FILE_TYPE\" };\r\n }\r\n return null;\r\n }, [acceptedFileTypes]);\r\n\r\n const handleError = useCallback((error: FileError) => {\r\n setError(error);\r\n setStatus(\"error\");\r\n onUploadError?.(error);\r\n setTimeout(() => { setError(null); setStatus(\"idle\"); }, 3000);\r\n }, [onUploadError]);\r\n\r\n const simulateUpload = useCallback((uploadingFile: File) => {\r\n let currentProgress = 0;\r\n if (uploadIntervalRef.current) clearInterval(uploadIntervalRef.current);\r\n uploadIntervalRef.current = setInterval(() => {\r\n currentProgress += UPLOAD_STEP_SIZE;\r\n if (currentProgress >= 100) {\r\n if (uploadIntervalRef.current) clearInterval(uploadIntervalRef.current);\r\n setProgress(0);\r\n setStatus(\"idle\");\r\n setFile(null);\r\n onUploadSuccess?.(uploadingFile);\r\n } else {\r\n setStatus((prevStatus) => {\r\n if (prevStatus === \"uploading\") { setProgress(currentProgress); return \"uploading\"; }\r\n if (uploadIntervalRef.current) clearInterval(uploadIntervalRef.current);\r\n return prevStatus;\r\n });\r\n }\r\n }, uploadDelay / (100 / UPLOAD_STEP_SIZE));\r\n }, [onUploadSuccess, uploadDelay]);\r\n\r\n const handleFileSelect = useCallback((selectedFile: File | null) => {\r\n if (!selectedFile) return;\r\n setError(null);\r\n const sizeError = validateFileSize(selectedFile);\r\n if (sizeError) { handleError(sizeError); return; }\r\n const typeError = validateFileType(selectedFile);\r\n if (typeError) { handleError(typeError); return; }\r\n const customError = validateFile?.(selectedFile);\r\n if (customError) { handleError(customError); return; }\r\n setFile(selectedFile);\r\n setStatus(\"uploading\");\r\n setProgress(0);\r\n simulateUpload(selectedFile);\r\n }, [simulateUpload, validateFileSize, validateFileType, validateFile, handleError]);\r\n\r\n const handleDragOver = useCallback((e: DragEvent<HTMLDivElement>) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n setStatus((prev) => (prev !== \"uploading\" ? \"dragging\" : prev));\r\n }, []);\r\n\r\n const handleDragLeave = useCallback((e: DragEvent<HTMLDivElement>) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n setStatus((prev) => (prev === \"dragging\" ? \"idle\" : prev));\r\n }, []);\r\n\r\n const handleDrop = useCallback((e: DragEvent<HTMLDivElement>) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n if (status === \"uploading\") return;\r\n setStatus(\"idle\");\r\n const droppedFile = e.dataTransfer.files?.[0];\r\n if (droppedFile) handleFileSelect(droppedFile);\r\n }, [status, handleFileSelect]);\r\n\r\n const handleFileInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n const selectedFile = e.target.files?.[0];\r\n handleFileSelect(selectedFile || null);\r\n if (e.target) e.target.value = \"\";\r\n }, [handleFileSelect]);\r\n\r\n const triggerFileInput = useCallback(() => {\r\n if (status === \"uploading\") return;\r\n fileInputRef.current?.click();\r\n }, [status]);\r\n\r\n const resetState = useCallback(() => {\r\n setFile(null);\r\n setStatus(\"idle\");\r\n setProgress(0);\r\n if (onFileRemove) onFileRemove();\r\n }, [onFileRemove]);\r\n\r\n return (\r\n <div className={cn(\"relative w-full max-w-sm mx-auto\", className)}>\r\n <div className=\"group relative w-full rounded-xl bg-gray-900 dark:bg-black ring-1 ring-gray-200 dark:ring-white/10 p-0.5\">\r\n <div className=\"relative w-full rounded-[10px] bg-gray-50/50 dark:bg-white/[0.02] p-1.5\">\r\n <div className={cn(\"relative mx-auto w-full overflow-hidden rounded-lg border border-gray-100 dark:border-white/[0.08] bg-gray-900 dark:bg-black/50\", error ? \"border-red-500/50\" : \"\")}>\r\n <div className=\"relative h-[240px]\">\r\n <AnimatePresence mode=\"wait\">\r\n {status === \"idle\" || status === \"dragging\" ? (\r\n <motion.div key=\"dropzone\" initial={{ opacity: 0, y: 10 }} animate={{ opacity: status === \"dragging\" ? 0.8 : 1, y: 0, scale: status === \"dragging\" ? 0.98 : 1 }} exit={{ opacity: 0, y: -10 }} transition={{ duration: 0.2 }} className=\"absolute inset-0 flex flex-col items-center justify-center p-6\" onDragOver={handleDragOver} onDragLeave={handleDragLeave} onDrop={handleDrop}>\r\n <div className=\"mb-4\"><UploadIllustration /></div>\r\n <div className=\"text-center space-y-1.5 mb-4\">\r\n <h3 className=\"text-lg font-semibold text-white dark:text-white tracking-tight\">Drag and drop or</h3>\r\n <p className=\"text-xs text-gray-500 dark:text-gray-400\">{acceptedFileTypes?.length ? `${acceptedFileTypes.map((t) => t.split(\"/\")[1]).join(\", \").toUpperCase()}` : \"SVG, PNG, JPG or GIF\"} {maxFileSize && `up to ${formatBytes(maxFileSize)}`}</p>\r\n </div>\r\n <button type=\"button\" onClick={triggerFileInput} className=\"w-4/5 flex items-center justify-center gap-2 rounded-lg bg-gray-800 dark:bg-white/10 px-4 py-2.5 text-sm font-semibold text-white dark:text-white transition-all duration-200 hover:bg-gray-700 dark:hover:bg-white/20 group\">\r\n <span>Upload File</span>\r\n <UploadCloud className=\"w-4 h-4 group-hover:scale-110 transition-transform duration-200\" />\r\n </button>\r\n <p className=\"mt-3 text-xs text-gray-500 dark:text-gray-400\">or drag and drop your file here</p>\r\n <input ref={fileInputRef} type=\"file\" className=\"sr-only\" onChange={handleFileInputChange} accept={acceptedFileTypes?.join(\",\")} />\r\n </motion.div>\r\n ) : status === \"uploading\" ? (\r\n <motion.div key=\"uploading\" initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.95 }} className=\"absolute inset-0 flex flex-col items-center justify-center p-6\">\r\n <div className=\"mb-4\"><UploadingAnimation progress={progress} /></div>\r\n <div className=\"text-center space-y-1.5 mb-4\">\r\n <h3 className=\"text-sm font-semibold text-gray-900 dark:text-white truncate\">{file?.name}</h3>\r\n <div className=\"flex items-center justify-center gap-2 text-xs\">\r\n <span className=\"text-gray-500 dark:text-gray-400\">{formatBytes(file?.size || 0)}</span>\r\n <span className=\"font-medium text-blue-500\">{Math.round(progress)}%</span>\r\n </div>\r\n </div>\r\n <button onClick={resetState} type=\"button\" className=\"w-4/5 flex items-center justify-center gap-2 rounded-lg bg-gray-100 dark:bg-white/10 px-4 py-2.5 text-sm font-semibold text-gray-900 dark:text-white transition-all duration-200 hover:bg-gray-200 dark:hover:bg-white/20\">Cancel</button>\r\n </motion.div>\r\n ) : null}\r\n </AnimatePresence>\r\n </div>\r\n <AnimatePresence>\r\n {error && (\r\n <motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -10 }} className=\"absolute bottom-4 left-1/2 transform -translate-x-1/2 px-4 py-2 bg-red-500/10 border border-red-500/20 rounded-lg\">\r\n <p className=\"text-sm text-red-500 dark:text-red-400\">{error.message}</p>\r\n </motion.div>\r\n )}\r\n </AnimatePresence>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n\r\nexport { FileUpload };\r\nexport default FileUpload;\r\n","export * from 'framer-motion';\n","import { CamelToPascal } from './utility-types';\n\n/**\n * Converts string to kebab case\n *\n * @param {string} string\n * @returns {string} A kebabized string\n */\nexport const toKebabCase = (string: string) =>\n string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Converts string to camel case\n *\n * @param {string} string\n * @returns {string} A camelized string\n */\nexport const toCamelCase = <T extends string>(string: T) =>\n string.replace(/^([A-Z])|[\\s-_]+(\\w)/g, (match, p1, p2) =>\n p2 ? p2.toUpperCase() : p1.toLowerCase(),\n );\n\n/**\n * Converts string to pascal case\n *\n * @param {string} string\n * @returns {string} A pascalized string\n */\nexport const toPascalCase = <T extends string>(string: T): CamelToPascal<T> => {\n const camelCase = toCamelCase(string);\n\n return (camelCase.charAt(0).toUpperCase() + camelCase.slice(1)) as CamelToPascal<T>;\n};\n\n/**\n * Merges classes into a single string\n *\n * @param {array} classes\n * @returns {string} A string of classes\n */\nexport const mergeClasses = <ClassType = string | undefined | null>(...classes: ClassType[]) =>\n classes\n .filter((className, index, array) => {\n return (\n Boolean(className) &&\n (className as string).trim() !== '' &&\n array.indexOf(className) === index\n );\n })\n .join(' ')\n .trim();\n\n/**\n * Is empty string\n *\n * @param {unknown} value\n * @returns {boolean} Whether the value is an empty string\n */\nexport const isEmptyString = (value: unknown): boolean => value === '';\n\n/**\n * Check if a component has an accessibility prop\n *\n * @param {object} props\n * @returns {boolean} Whether the component has an accessibility prop\n */\nexport const hasA11yProp = (props: Record<string, any>) => {\n for (const prop in props) {\n if (prop.startsWith('aria-') || prop === 'role' || prop === 'title') {\n return true;\n }\n }\n};\n","export default {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n};\n","import { createElement, forwardRef } from 'react';\nimport defaultAttributes from './defaultAttributes';\nimport { IconNode, LucideProps } from './types';\nimport { mergeClasses, hasA11yProp } from '@lucide/shared';\n\ninterface IconComponentProps extends LucideProps {\n iconNode: IconNode;\n}\n\n/**\n * Lucide icon component\n *\n * @component Icon\n * @param {object} props\n * @param {string} props.color - The color of the icon\n * @param {number} props.size - The size of the icon\n * @param {number} props.strokeWidth - The stroke width of the icon\n * @param {boolean} props.absoluteStrokeWidth - Whether to use absolute stroke width\n * @param {string} props.className - The class name of the icon\n * @param {IconNode} props.children - The children of the icon\n * @param {IconNode} props.iconNode - The icon node of the icon\n *\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst Icon = forwardRef<SVGSVGElement, IconComponentProps>(\n (\n {\n color = 'currentColor',\n size = 24,\n strokeWidth = 2,\n absoluteStrokeWidth,\n className = '',\n children,\n iconNode,\n ...rest\n },\n ref,\n ) =>\n createElement(\n 'svg',\n {\n ref,\n ...defaultAttributes,\n width: size,\n height: size,\n stroke: color,\n strokeWidth: absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth,\n className: mergeClasses('lucide', className),\n ...(!children && !hasA11yProp(rest) && { 'aria-hidden': 'true' }),\n ...rest,\n },\n [\n ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),\n ...(Array.isArray(children) ? children : [children]),\n ],\n ),\n);\n\nexport default Icon;\n","import { createElement, forwardRef } from 'react';\nimport { mergeClasses, toKebabCase, toPascalCase } from '@lucide/shared';\nimport { IconNode, LucideProps } from './types';\nimport Icon from './Icon';\n\n/**\n * Create a Lucide icon component\n * @param {string} iconName\n * @param {array} iconNode\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst createLucideIcon = (iconName: string, iconNode: IconNode) => {\n const Component = forwardRef<SVGSVGElement, LucideProps>(({ className, ...props }, ref) =>\n createElement(Icon, {\n ref,\n iconNode,\n className: mergeClasses(\n `lucide-${toKebabCase(toPascalCase(iconName))}`,\n `lucide-${iconName}`,\n className,\n ),\n ...props,\n }),\n );\n\n Component.displayName = toPascalCase(iconName);\n\n return Component;\n};\n\nexport default createLucideIcon;\n","import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [\n ['path', { d: 'M12 13v8', key: '1l5pq0' }],\n ['path', { d: 'M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242', key: '1pljnt' }],\n ['path', { d: 'm8 17 4-4 4 4', key: '1quai1' }],\n];\n\n/**\n * @component @name CloudUpload\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMTN2OCIgLz4KICA8cGF0aCBkPSJNNCAxNC44OTlBNyA3IDAgMSAxIDE1LjcxIDhoMS43OWE0LjUgNC41IDAgMCAxIDIuNSA4LjI0MiIgLz4KICA8cGF0aCBkPSJtOCAxNyA0LTQgNCA0IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/cloud-upload\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst CloudUpload = createLucideIcon('cloud-upload', __iconNode);\n\nexport default CloudUpload;\n","import { clsx, type ClassValue } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return twMerge(clsx(inputs));\r\n}\r\n"]}