import { Dialog as Kobalte } from "@kobalte/core/dialog" import { ComponentProps, JSXElement, Match, ParentProps, Show, Switch } from "solid-js" import { useI18n } from "../context/i18n" import { IconButton } from "./icon-button" export interface DialogProps extends ParentProps { title?: JSXElement description?: JSXElement action?: JSXElement size?: "normal" | "large" | "x-large" class?: ComponentProps<"div">["class"] classList?: ComponentProps<"div">["classList"] fit?: boolean transition?: boolean } export function Dialog(props: DialogProps) { const i18n = useI18n() return (
{ const target = e.currentTarget as HTMLElement | null const autofocusEl = target?.querySelector("[autofocus]") as HTMLElement | null if (autofocusEl) { e.preventDefault() autofocusEl.focus() } }} >
{props.title} {props.action}
{props.description}
{props.children}
) }