import type { JSX, ValidComponent } from "@solidjs/web"; import { dynamic } from "@solidjs/web"; import { omit } from "solid-js"; import { mergeRootProps } from "../internals/merge-root-props"; import { resolveClassStyle } from "../internals/resolve-class-style"; import type { BaseUIComponentProps, Orientation } from "../internals/types"; export type { Orientation }; export interface SeparatorState { orientation: Orientation; } export interface SeparatorProps extends Omit< BaseUIComponentProps<"div", SeparatorState>, "role" | "aria-orientation" > { /** * Tag/component to render. Defaults to `"div"`. Replaces the * pre-spike `render` prop (axis G). */ as?: ValidComponent; orientation?: Orientation; } /** * A separator that visually or semantically divides content. Renders a * `
` element (or `as` override). * * Solid 2.0-native rewire (ยง1 wave 1): replaces `renderElement` with * `dynamic(() => props.as ?? "div")`, threading the role + * `aria-orientation` + `data-orientation` reactive bag through * `mergeRootProps`. */ export function Separator(props: SeparatorProps): JSX.Element { const orientation = (): Orientation => props.orientation ?? "horizontal"; const internal = { role: "separator" as const, get "aria-orientation"() { return orientation(); }, get "data-orientation"() { return orientation(); }, }; const userStyling = resolveClassStyle(props, () => ({ orientation: orientation(), })); const userProps = omit(props, "class", "style", "attrs", "as", "orientation"); const styledUserProps = mergeRootProps(userStyling, userProps); const merged = mergeRootProps(internal, styledUserProps); const Tag = dynamic(() => props.as ?? "div"); return ; }