65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import { createComponentDefinition } from "../../utils/createComponentDefinition";
|
|
import { ComponentCategory } from "@/types/component";
|
|
import { ButtonWrapper } from "./ButtonComponent";
|
|
import { ButtonConfigPanel } from "./ButtonConfigPanel";
|
|
import type { ButtonConfig } from "./types";
|
|
|
|
/**
|
|
* Button — 통합 단일 버튼 컴포넌트 정의 (2026-04-11, Phase A-3)
|
|
*
|
|
* 흡수 대상:
|
|
* - v2-button-primary (base)
|
|
* - button-primary (legacy)
|
|
* - related-data-buttons (legacy; 버튼 그룹은 여러 `button` 배치로 대체)
|
|
*
|
|
* 변형:
|
|
* - variant: primary | secondary | default | destructive | outline | ghost
|
|
* - size: sm | md | lg
|
|
* - actionType: save/edit/delete/add/cancel/close/navigate/popup/search/reset/submit/approval/custom (13종)
|
|
* - confirm, icon, backgroundColor/textColor override
|
|
*
|
|
* 관련 문서:
|
|
* notes/gbpark/2026-04-11-component-unification-plan.md §3.5
|
|
*/
|
|
|
|
const DEFAULT_CONFIG: Partial<ButtonConfig> = {
|
|
text: "버튼",
|
|
variant: "primary",
|
|
size: "md",
|
|
actionType: "save",
|
|
borderRadius: "6px",
|
|
};
|
|
|
|
export const ButtonDefinition = createComponentDefinition({
|
|
id: "button",
|
|
name: "버튼",
|
|
name_eng: "Button",
|
|
description: "저장, 삭제, 팝업 등 동작 실행",
|
|
category: ComponentCategory.ACTION,
|
|
web_type: "button",
|
|
component: ButtonWrapper,
|
|
default_config: DEFAULT_CONFIG as Record<string, any>,
|
|
default_size: { width: 120, height: 36 },
|
|
config_panel: ButtonConfigPanel,
|
|
icon: "MousePointer",
|
|
tags: ["버튼", "button", "action", "click"],
|
|
version: "2.0.0",
|
|
author: "INVYONE",
|
|
documentation:
|
|
"notes/gbpark/2026-04-11-component-unification-plan.md#35-button",
|
|
// ─── INVYONE DataPort 선언 ───
|
|
dataPorts: {
|
|
inputs: [
|
|
{ name: "disabled", type: "value" },
|
|
{ name: "formData", type: "row" },
|
|
],
|
|
outputs: [{ name: "clicked", type: "value" }],
|
|
},
|
|
});
|
|
|
|
export type { ButtonConfig } from "./types";
|
|
export { ButtonComponent, ButtonWrapper } from "./ButtonComponent";
|
|
export { ButtonConfigPanel } from "./ButtonConfigPanel";
|