'use client'
import { ChevronDown } from 'lucide-react'
import { cn } from '@/lib/utils'
import { HelpPopover } from '@/components/ui/help-popover'
/**
* The Fönster settings language (founder-approved concept 2026-07-25):
* flat hairline rows with an uppercase micro-label on the left and the
* control on the right, section titles in the display serif, groups under
* eyebrow labels, and every explanation collapsed behind a "?" popover
* (UI-migration convention 7 applied at row level).
*
* All settings sections compose these primitives; do not hand-roll row
* layouts or inline help paragraphs in section components.
*/
interface SettingsSectionHeaderProps {
title: string
/** One quiet line under the title. Longer guidance belongs in row help. */
intro?: React.ReactNode
/** Right-aligned header action (e.g. "Förhandsvisa faktura", "Skapa nyckel"). */
action?: React.ReactNode
/**
* Brand mark for a section that represents a third-party channel
* (WhatsApp today). Sections that are just Accounted settings leave this
* unset: the serif title carries them, and a decorative icon per tab
* would turn the settings rail into a sticker album.
*/
mark?: React.ReactNode
}
export function SettingsSectionHeader({ title, intro, action, mark }: SettingsSectionHeaderProps) {
return (
{mark ? {mark} : null}
{title}
{action ?
{action}
: null}
{intro ? (
{intro}
) : null}
)
}
interface SettingsGroupProps {
label?: string
/** Group-level help ("?" right after the eyebrow) for guidance that spans the rows. */
help?: React.ReactNode
children: React.ReactNode
className?: string
}
export function SettingsGroup({ label, help, children, className }: SettingsGroupProps) {
return (
{label ? (
{label}
{help ? {help} : null}
) : null}
{children}
)
}
interface SettingsRowProps {
label: React.ReactNode
/** Ties the label to a control; renders a