import { DownOutlined } from "@ant-design/icons";
import type { ReactNode } from "react";
import type { WorkbenchOption, WorkbenchFieldGroup } from "./workbenchConstants";
import { getRatioOptionClassName, getSettingsGridColumnsClassName } from "./workbenchReferenceUtils";
export function SelectChip({
chipId,
value,
options,
disabled,
isOpen,
onToggle,
onClose,
onChange,
ariaLabel,
direction = "up",
}: {
chipId: string;
value: string;
options: WorkbenchOption[];
disabled?: boolean;
isOpen: boolean;
onToggle: () => void;
onClose: () => void;
onChange: (value: string) => void;
ariaLabel?: string;
direction?: "up" | "down";
}) {
const activeOption = options.find((option) => option.value === value);
return (
{isOpen ? (
{options.map((option, index) => {
const active = option.value === value;
return (
);
})}
) : null}
);
}
export function CompoundSelectChip({
chipId,
summary,
groups,
disabled,
isOpen,
onToggle,
direction = "up",
}: {
chipId: string;
summary: string;
groups: WorkbenchFieldGroup[];
disabled?: boolean;
isOpen: boolean;
onToggle: () => void;
direction?: "up" | "down";
}) {
return (
{isOpen ? (
{groups.map((group) => {
const currentLabel =
group.options.find((option) => option.value === group.value)?.label || group.value;
const fieldKey = `${group.kind || "pill"}-${group.label}`;
return (
{group.icon ? (
{group.icon}
) : null}
{currentLabel}
);
})}
) : null}
);
}
export function InlineOptionChip({
chipId,
value,
options,
icon,
disabled,
isOpen,
onToggle,
onClose,
onChange,
direction = "up",
}: {
chipId: string;
value: string;
options: WorkbenchOption[];
icon?: ReactNode;
disabled?: boolean;
isOpen: boolean;
onToggle: () => void;
onClose: () => void;
onChange: (value: string) => void;
direction?: "up" | "down";
}) {
const activeOption = options.find((option) => option.value === value);
return (
{isOpen ? (
{options.map((option) => {
const active = option.value === value;
return (
);
})}
) : null}
);
}