import { DefaultsOnly, HostDefaultBadge } from "@/lib/host-defaults-context"; import { useState } from "react"; import { useInSeamlessTile } from "@/components/tile-grid/context"; import { cn } from "@/lib/utils"; import type React from "react"; export function SectionCard({ title, icon, action, children, className, rowId, }: { title: string; icon: React.ReactNode; action?: React.ReactNode; children: React.ReactNode; className?: string; /** Lets settings search jump to this card. */ rowId?: string; }) { // Inside an edge to edge tile layout the layout draws the lines. const tiled = useInSeamlessTile(); return (
{icon} {title} {action &&
{action}
}
{children}
); } export function SettingRow({ label, badge, description, defaultKey, rowId, children, }: { label: string; badge?: string; description?: React.ReactNode; /** * In the host editor, the host default this row edits: a plugin's own * field key, or "core.". Shows where the value comes from. */ defaultKey?: string; /** Lets settings search jump to this row. */ rowId?: string; children: React.ReactNode; }) { return ( {/* In a gap-4 form stack the gap already spaces the row, so its own padding and divider would double up. */}
{label} {badge && ( {badge} )} {defaultKey && }
{description && ( {description} )}
{children}
); } export function FakeSwitch({ defaultChecked = false, disabled = false, checked, onChange, }: { defaultChecked?: boolean; disabled?: boolean; checked?: boolean; onChange?: (v: boolean) => void; }) { const [internalOn, setInternalOn] = useState(defaultChecked); const on = checked !== undefined ? checked : internalOn; return ( ); }