'use client'; import { IconPlus, IconX } from '@tabler/icons-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import type { KeyValue } from '@/lib/settings/types'; type KeyValueInputProps = { items: KeyValue[]; onChange: (items: KeyValue[]) => void; keyPlaceholder?: string; valuePlaceholder?: string; addButtonLabel?: string; masked?: boolean; }; export function KeyValueInput({ items, onChange, keyPlaceholder = 'Key', valuePlaceholder = 'Value', addButtonLabel = 'Add Item', masked = false, }: KeyValueInputProps) { const handleAdd = () => { onChange([...items, { id: crypto.randomUUID(), key: '', value: '' }]); }; const handleRemove = (id: string) => { onChange(items.filter((item) => item.id !== id)); }; const handleChange = (id: string, field: 'key' | 'value', value: string) => { onChange( items.map((item) => item.id === id ? { ...item, [field]: value } : item ) ); }; return (