// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import classNames from 'classnames';
import React, { type ReactNode, useMemo } from 'react';
import { v4 as uuid } from 'uuid';
import { noop } from 'lodash';
import {
CircleCheckbox,
Variant as CircleCheckboxVariant,
} from './CircleCheckbox';
export function SettingsRow({
children,
title,
className,
}: {
children: ReactNode;
title?: string;
className?: string;
}): JSX.Element {
return (
);
}
export function FlowingSettingsControl({
children,
}: {
children: ReactNode;
}): JSX.Element {
return {children}
;
}
export function LightIconLabel({
icon,
children,
}: {
icon: string;
children: ReactNode;
}): JSX.Element {
return (
);
}
export function SettingsControl({
icon,
left,
onClick,
right,
description,
}: {
/** A className or `true` to leave room for icon */
icon?: string | true;
left: ReactNode;
onClick?: () => unknown;
right: ReactNode;
description?: boolean;
}): JSX.Element {
const content = (
<>
{icon && (
)}
{left}
{right}
{description ? (
{description}
) : undefined}
>
);
if (onClick) {
return (
);
}
return {content}
;
}
type SettingsRadioOptionType = Readonly<{
text: string;
value: Enum;
readOnly?: boolean;
onClick?: () => void;
}>;
export function SettingsRadio({
value,
options,
onChange,
}: {
value: Enum;
options: ReadonlyArray>;
onChange: (value: Enum) => void;
}): JSX.Element {
const htmlIds = useMemo(() => {
return Array.from({ length: options.length }, () => uuid());
}, [options.length]);
return (
{options.map(({ text, value: optionValue, readOnly, onClick }, i) => {
const htmlId = htmlIds[i];
return (
);
})}
);
}