import type { JSX, ValidComponent } from "@solidjs/web"; /** * `` — paragraph with additional info. */ import { dynamic } from "@solidjs/web"; import { omit, untrack } from "solid-js"; import { mergeRootProps } from "../../internals/merge-root-props"; import { resolveClassStyle } from "../../internals/resolve-class-style"; import type { BaseUIComponentProps } from "../../internals/types"; import { useRegisteredLabelId } from "../../internals/use-registered-label-id"; import { useDialogRootContext } from "../dialog-root-context"; // biome-ignore lint/complexity/noBannedTypes: matches Base UI React — description exposes no state fields. export type DialogDescriptionState = {}; export interface DialogDescriptionProps extends BaseUIComponentProps<"p", DialogDescriptionState> { /** * Tag/component to render. Defaults to `"p"`. Replaces the * pre-spike `render` prop (axis G). */ as?: ValidComponent; } /** * A paragraph with additional information about the dialog. Renders a * `

` by default. */ export function DialogDescription(props: DialogDescriptionProps): JSX.Element { const root = useDialogRootContext(); // `props.id` is an id override read once at setup; untrack it so the read // doesn't trip STRICT_READ_UNTRACKED (same fix as ). const id = useRegisteredLabelId( untrack(() => props.id as string | undefined), root.setDescriptionId, ); const internal = { id }; const userClassStyle = resolveClassStyle(props, () => ({})); const userProps = omit(props, "as", "class", "style", "attrs"); let merged: Record = mergeRootProps( internal, userClassStyle, ); merged = mergeRootProps(merged, userProps); const Tag = dynamic(() => props.as ?? "p"); return ; }