import { createContext, useContext, useId, type ComponentProps } from 'react';
import { Check } from 'lucide-react';
import { Slot } from 'radix-ui';
import { cn } from '../../lib/cn';
import { Card, CardFrame } from '../Card/Card';
import { Label } from '../ui/label';
import { RadioGroup, RadioGroupItem } from '../ui/radio-group';
import { Spinner } from '../Spinner/Spinner';
/* ---------------------------------------------------------------- Nav */
/** Left-hand navigation between settings pages: `SettingsNavLabel`s and `SettingsNavItem`s. */
export function SettingsNav({ className, ...props }: ComponentProps<'nav'>) {
return (
);
}
/** Group title, e.g. "Persönlich". */
export function SettingsNavLabel({ className, ...props }: ComponentProps<'div'>) {
return (
);
}
export interface SettingsNavItemProps extends ComponentProps<'a'> {
active?: boolean;
asChild?: boolean;
}
/** Icon and label; the active one is framed with an accent icon. */
export function SettingsNavItem({ active, asChild, className, ...props }: SettingsNavItemProps) {
const Comp = asChild ? Slot.Root : 'a';
return (
svg]:text-fg-subtle',
'aria-[current=page]:bg-side-active aria-[current=page]:text-fg aria-[current=page]:shadow-[inset_0_0_0_1px_var(--cl-side-active-line)] aria-[current=page]:[&>svg]:text-accent-fg',
className,
)}
{...props}
/>
);
}
/* ---------------------------------------------------------------- Section */
const SectionContext = createContext(undefined);
/**
* A settings card: header, then `SettingsRow`s separated by hairlines, then an optional footer.
* Labelled by its `SettingsSectionTitle`. `className` goes to the frame.
*/
export function SettingsSection({ className, ...props }: ComponentProps<'section'>) {
const titleId = useId();
return (
);
}
export function SettingsSectionHeader({ className, ...props }: ComponentProps<'div'>) {
return ;
}
export function SettingsSectionTitle({ className, ...props }: ComponentProps<'h2'>) {
return (
);
}
export function SettingsSectionDescription({ className, ...props }: ComponentProps<'p'>) {
return (
);
}
/** Right-aligned actions, e.g. Verwerfen / Speichern. */
export function SettingsSectionFooter({ className, ...props }: ComponentProps<'div'>) {
return (
);
}
export interface SettingsRowProps extends ComponentProps<'div'> {
/** Put the control on its own line under the text. */
stacked?: boolean;
}
/** `SettingsRowText` on the left, `SettingsRowControl` on the right; wraps on narrow screens. Also fits free content. */
export function SettingsRow({ stacked, className, ...props }: SettingsRowProps) {
return (
);
}
export function SettingsRowText({ className, ...props }: ComponentProps<'div'>) {
return (
);
}
/** A `