+ "content": "import type { JSX, ValidComponent } from \"solid-js\"\nimport { splitProps } from \"solid-js\"\n\nimport * as AlertDialogPrimitive from \"@kobalte/core/alert-dialog\"\nimport type { PolymorphicProps } from \"@kobalte/core/polymorphic\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst AlertDialog = AlertDialogPrimitive.Root\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger\nconst AlertDialogPortal = AlertDialogPrimitive.Portal\n\ntype AlertDialogOverlayProps<T extends ValidComponent = \"div\"> =\n AlertDialogPrimitive.AlertDialogOverlayProps<T> & {\n class?: string | undefined\n }\n\nconst AlertDialogOverlay = <T extends ValidComponent = \"div\">(\n props: PolymorphicProps<T, AlertDialogOverlayProps<T>>\n) => {\n const [local, others] = splitProps(props as AlertDialogOverlayProps, [\"class\"])\n return (\n <AlertDialogPrimitive.Overlay\n class={cn(\n \"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0\",\n local.class\n )}\n {...others}\n />\n )\n}\n\ntype AlertDialogContentProps<T extends ValidComponent = \"div\"> =\n AlertDialogPrimitive.AlertDialogContentProps<T> & {\n class?: string | undefined\n children?: JSX.Element\n }\n\nconst AlertDialogContent = <T extends ValidComponent = \"div\">(\n props: PolymorphicProps<T, AlertDialogContentProps<T>>\n) => {\n const [local, others] = splitProps(props as AlertDialogContentProps, [\"class\", \"children\"])\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n class={cn(\n \"fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 data-[closed]:slide-out-to-left-1/2 data-[closed]:slide-out-to-top-[48%] data-[expanded]:slide-in-from-left-1/2 data-[expanded]:slide-in-from-top-[48%] sm:rounded-lg md:w-full\",\n local.class\n )}\n {...others}\n >\n {local.children}\n <AlertDialogPrimitive.CloseButton class=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[expanded]:bg-accent data-[expanded]:text-muted-foreground\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"size-4\"\n >\n <path d=\"M18 6l-12 12\" />\n <path d=\"M6 6l12 12\" />\n </svg>\n <span class=\"sr-only\">Close</span>\n </AlertDialogPrimitive.CloseButton>\n </AlertDialogPrimitive.Content>\n </AlertDialogPortal>\n )\n}\n\ntype AlertDialogTitleProps<T extends ValidComponent = \"h2\"> =\n AlertDialogPrimitive.AlertDialogTitleProps<T> & {\n class?: string | undefined\n }\n\nconst AlertDialogTitle = <T extends ValidComponent = \"h2\">(\n props: PolymorphicProps<T, AlertDialogTitleProps<T>>\n) => {\n const [local, others] = splitProps(props as AlertDialogTitleProps, [\"class\"])\n return <AlertDialogPrimitive.Title class={cn(\"text-lg font-semibold\", local.class)} {...others} />\n}\n\ntype AlertDialogDescriptionProps<T extends ValidComponent = \"p\"> =\n AlertDialogPrimitive.AlertDialogDescriptionProps<T> & {\n class?: string | undefined\n }\n\nconst AlertDialogDescription = <T extends ValidComponent = \"p\">(\n props: PolymorphicProps<T, AlertDialogDescriptionProps<T>>\n) => {\n const [local, others] = splitProps(props as AlertDialogDescriptionProps, [\"class\"])\n return (\n <AlertDialogPrimitive.Description\n class={cn(\"text-sm text-muted-foreground\", local.class)}\n {...others}\n />\n )\n}\n\nexport {\n AlertDialog,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogTitle,\n AlertDialogDescription\n}\n",
0 commit comments