"use client"; /** * UnifiedInput 설정 패널 * 통합 입력 컴포넌트의 세부 설정을 관리합니다. */ import React from "react"; import { Label } from "@/components/ui/label"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Separator } from "@/components/ui/separator"; interface UnifiedInputConfigPanelProps { config: Record; onChange: (config: Record) => void; } export const UnifiedInputConfigPanel: React.FC = ({ config, onChange }) => { // 설정 업데이트 핸들러 const updateConfig = (field: string, value: any) => { onChange({ ...config, [field]: value }); }; return (
{/* 입력 타입 */}
{/* 형식 (텍스트/숫자용) */} {(config.inputType === "text" || !config.inputType) && (
)} {/* 플레이스홀더 */}
updateConfig("placeholder", e.target.value)} placeholder="입력 안내 텍스트" className="h-8 text-xs" />
{/* 숫자/슬라이더 전용 설정 */} {(config.inputType === "number" || config.inputType === "slider") && ( <>
updateConfig("min", e.target.value ? Number(e.target.value) : undefined)} placeholder="0" className="h-8 text-xs" />
updateConfig("max", e.target.value ? Number(e.target.value) : undefined)} placeholder="100" className="h-8 text-xs" />
updateConfig("step", e.target.value ? Number(e.target.value) : undefined)} placeholder="1" className="h-8 text-xs" />
)} {/* 여러 줄 텍스트 전용 설정 */} {config.inputType === "textarea" && (
updateConfig("rows", parseInt(e.target.value) || 3)} min={2} max={20} className="h-8 text-xs" />
)} {/* 마스크 입력 (선택) */}
updateConfig("mask", e.target.value)} placeholder="예: ###-####-####" className="h-8 text-xs" />

# = 숫자, A = 문자, * = 모든 문자

); }; UnifiedInputConfigPanel.displayName = "UnifiedInputConfigPanel"; export default UnifiedInputConfigPanel;