Centralises all Dialog prop interfaces and schemas in dialog.props.ts. Adds DialogRootPropsSchema, DialogContentPropsSchema, and DialogMeta for AI/MCP discovery. Sub-components now import types from the shared file.
24 lines
763 B
TypeScript
24 lines
763 B
TypeScript
// packages/core/src/components/dialog/dialog-title.tsx
|
|
import type { JSX } from "solid-js";
|
|
import { createUniqueId, onCleanup, onMount, splitProps } from "solid-js";
|
|
import { useInternalDialogContext } from "./dialog-context";
|
|
import type { DialogTitleProps } from "./dialog.props";
|
|
|
|
export type { DialogTitleProps };
|
|
|
|
/** Renders as h2 and registers its ID for aria-labelledby on Dialog.Content. */
|
|
export function DialogTitle(props: DialogTitleProps): JSX.Element {
|
|
const [local, rest] = splitProps(props, ["children"]);
|
|
const ctx = useInternalDialogContext();
|
|
const id = createUniqueId();
|
|
|
|
onMount(() => ctx.setTitleId(id));
|
|
onCleanup(() => ctx.setTitleId(undefined));
|
|
|
|
return (
|
|
<h2 id={id} {...rest}>
|
|
{local.children}
|
|
</h2>
|
|
);
|
|
}
|