{"version":3,"file":"index.cjs","sources":["../../../src/components/ShowToast/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { X } from 'lucide-react'\n\nconst showToastVariants = cva(\n  'group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-4 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n  {\n    variants: {\n      variant: {\n        default: 'border bg-background text-foreground',\n        destructive:\n          'destructive group border-destructive bg-destructive text-destructive-foreground',\n        success: 'success group border-green-600 bg-green-600 text-white',\n      },\n    },\n    defaultVariants: {\n      variant: 'default',\n    },\n  },\n)\n\nexport interface ShowToastProps\n  extends React.HTMLAttributes<HTMLDivElement>,\n    VariantProps<typeof showToastVariants> {\n  title?: string\n  description: string\n  action?: React.ReactNode\n}\n\nconst ShowToast = React.forwardRef<HTMLDivElement, ShowToastProps>(\n  ({ className, variant, title, description, action, ...props }, ref) => {\n    const [close, setClose] = React.useState(false)\n    React.useEffect(() => {\n      setTimeout(() => {\n        setClose(true)\n      }, 5000)\n    }, [])\n    const handleClose = () => setClose(true)\n    return close ? null : (\n      <div className=\"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\">\n        <div className={showToastVariants({ variant, className })} ref={ref} {...props}>\n          <div className=\"grid gap-1\">\n            {title && <h4>{title}</h4>}\n            {description && <p>{description}</p>}\n          </div>\n          {action}\n          <X onClick={handleClose} className=\"cursor-pointer\" />\n        </div>\n      </div>\n    )\n  },\n)\n\nexport default ShowToast\n"],"names":["showToastVariants","cva","variants","variant","default","destructive","success","defaultVariants","ShowToast$1","React","forwardRef","className","title","description","action","props","ref","close","setClose","useState","useEffect","setTimeout","jsx","children","jsxs","jsxRuntimeExports","X","onClick"],"mappings":"+iBAIMA,EAAoBC,EAAAA,IACxB,ulBACA,CACEC,SAAU,CACRC,QAAS,CACPC,QAAS,uCACTC,YACE,kFACFC,QAAS,2DAGbC,gBAAiB,CACfJ,QAAS,aAqCfK,EAxBkBC,EAAMC,YACtB,EAAGC,YAAWR,UAASS,QAAOC,cAAaC,YAAWC,GAASC,KAC7D,MAAOC,EAAOC,GAAYT,EAAMU,UAAS,GACzCV,EAAMW,WAAU,KACdC,YAAW,KACTH,GAAS,EAAI,GACZ,IAAI,GACN,IAEI,OAAAD,EAAQ,KACbK,wBAAC,MAAI,CAAAX,UAAU,oIACbY,kCAAC,MAAA,CAAIZ,UAAWX,EAAkB,CAAEG,UAASQ,cAAcK,SAAcD,EACvEQ,SAAA,GAACC,kBAAAA,KAAA,MAAA,CAAIb,UAAU,aACZY,SAAA,CAASX,KAAAU,kBAAAA,IAAC,MAAIC,SAAMX,IACpBC,KAAgBS,kBAAAA,IAAA,IAAA,CAAGC,SAAYV,OAEjCC,EACAQ,EAAAG,kBAAAH,IAAAI,EAAAA,EAAA,CAAEC,QATW,IAAMT,GAAS,GASJP,UAAU,uBAEvC"}