@opsnow-mcp/opsnow-mcp-common-ui-server 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/build/components/data/icon-names.js +0 -129
  3. package/build/components/examples/opsnow-common-calendar-examples-data.js +0 -48
  4. package/build/components/examples/opsnow-common-chart-examples-data.js +0 -6590
  5. package/build/components/examples/opsnow-common-data-status-examples-data.js +0 -65
  6. package/build/components/examples/opsnow-common-file-upload-examples-data.js +0 -95
  7. package/build/components/examples/opsnow-common-forms-examples-data.js +0 -1699
  8. package/build/components/examples/opsnow-common-grid-examples-data.js +0 -2328
  9. package/build/components/examples/opsnow-common-icons-examples-data.js +0 -72
  10. package/build/components/examples/opsnow-common-layout-examples-data.js +0 -72
  11. package/build/components/examples/opsnow-common-notification-examples-data.js +0 -78
  12. package/build/components/examples/opsnow-common-pagination-examples-data.js +0 -82
  13. package/build/components/examples/opsnow-common-popup-examples-data.js +0 -205
  14. package/build/components/examples/opsnow-common-progress-examples-data.js +0 -86
  15. package/build/components/examples/opsnow-common-select-examples-data.js +0 -106
  16. package/build/components/examples/opsnow-common-stepper-examples-data.js +0 -180
  17. package/build/components/examples/opsnow-common-storage-examples-data.js +0 -8
  18. package/build/components/examples/opsnow-common-tab-examples-data.js +0 -87
  19. package/build/components/examples/opsnow-common-toast-popup-examples-data.js +0 -129
  20. package/build/components/examples/opsnow-common-tooltip-examples-data.js +0 -80
  21. package/build/components/examples/opsnow-common-typography-examples-data.js +0 -366
  22. package/build/components/opsnow-common-calendar.js +0 -228
  23. package/build/components/opsnow-common-chart.js +0 -1643
  24. package/build/components/opsnow-common-data-status.js +0 -116
  25. package/build/components/opsnow-common-examples.js +0 -109
  26. package/build/components/opsnow-common-file-upload.js +0 -57
  27. package/build/components/opsnow-common-forms.js +0 -1006
  28. package/build/components/opsnow-common-grid.js +0 -352
  29. package/build/components/opsnow-common-icons.js +0 -139
  30. package/build/components/opsnow-common-layout.js +0 -138
  31. package/build/components/opsnow-common-notification.js +0 -110
  32. package/build/components/opsnow-common-pagination.js +0 -164
  33. package/build/components/opsnow-common-popup.js +0 -71
  34. package/build/components/opsnow-common-progress.js +0 -177
  35. package/build/components/opsnow-common-select.js +0 -132
  36. package/build/components/opsnow-common-stepper.js +0 -72
  37. package/build/components/opsnow-common-tab.js +0 -111
  38. package/build/components/opsnow-common-toast-popup.js +0 -135
  39. package/build/components/opsnow-common-tooltip.js +0 -204
  40. package/build/components/opsnow-common-typography.js +0 -93
  41. package/build/index.js +0 -124
@@ -1,1006 +0,0 @@
1
- import { z } from "zod";
2
- import { IconNamesMap, generateIconDescription } from "./data/icon-names.js";
3
- // Button 컴포넌트 관련 스키마 정의
4
- export const ButtonSchema = z.object({
5
- label: z.string().optional().describe("버튼 라벨"),
6
- size: z.enum(["large", "medium", "small"]).default("medium").describe("버튼 크기"),
7
- color: z.enum(["primary", "secondary", "error", "inherit"]).default("primary").describe("버튼 색상"),
8
- variant: z.enum(["contained", "outlined", "text"]).default("contained").describe("버튼 스타일"),
9
- theme: z.enum(["white"]).optional().describe("테마"),
10
- iconName: z.enum(Object.keys(IconNamesMap)).optional().describe(generateIconDescription({ format: 'nested' })),
11
- muiIconName: z.string().optional().transform(val => val?.toLowerCase()).describe("Material-UI 아이콘 이름"),
12
- iconPosition: z.enum(["left", "right"]).optional().describe("아이콘 위치"),
13
- iconOnly: z.boolean().optional().describe("아이콘만 표시"),
14
- disabled: z.boolean().optional().describe("비활성화 여부"),
15
- onClick: z.string().optional().describe("클릭 이벤트 핸들러")
16
- });
17
- // Badge 컴포넌트 관련 스키마 정의
18
- export const BadgeSchema = z.object({
19
- badgeContent: z.number().optional().describe("뱃지 내용 (숫자)"),
20
- color: z.enum(["primary", "error", "info", "warning", "success"]).default("primary").describe("뱃지 색상"),
21
- variant: z.enum(["standard", "dot"]).optional().describe("뱃지 스타일"),
22
- showZero: z.boolean().optional().describe("0일 때도 표시 여부"),
23
- children: z.string().optional().describe("뱃지 내부 콘텐츠")
24
- });
25
- // Textarea 컴포넌트 관련 스키마 정의
26
- export const TextareaSchema = z.object({
27
- placeholder: z.string().optional().describe("텍스트 영역에 표시될 플레이스홀더 텍스트"),
28
- value: z.string().optional().describe("텍스트 영역의 값. React 상태 변수 이름을 전달하세요 (예: 'description')."),
29
- onChange: z.string().optional().describe("값이 변경될 때 실행할 함수의 본문을 문자열로 전달하세요 (예: '(e) => setDescription(e.target.value)')."),
30
- variant: z.enum(["outlined", "standard", "filled"]).default("outlined").describe("텍스트 영역 스타일"),
31
- rows: z.number().optional().describe("고정 높이를 위한 줄 수"),
32
- autoSize: z.boolean().optional().describe("내용에 따라 높이 자동 조절 여부"),
33
- helperText: z.string().optional().describe("텍스트 영역 아래에 표시될 도움말 텍스트"),
34
- });
35
- // Switch 컴포넌트 관련 스키마 정의
36
- export const SwitchSchema = z.object({
37
- checked: z.string().describe("스위치의 체크 여부를 나타내는 상태 변수. 예: 'isToggled'"),
38
- onChange: z.string().describe("스위치 상태 변경 시 호출될 함수. 예: '(e) => setIsToggled(e.target.checked)'"),
39
- color: z.enum(["primary", "secondary", "error", "warning", "info", "success", "default"]).optional().describe("스위치 색상"),
40
- size: z.enum(["small", "medium"]).optional().describe("스위치 크기 ('small' 또는 'medium')"),
41
- disabled: z.boolean().optional().describe("비활성화 여부"),
42
- });
43
- // Chip 컴포넌트 관련 스키마 정의
44
- export const ChipSchema = z.object({
45
- label: z.string().optional().describe('칩에 표시될 텍스트'),
46
- color: z.enum(['default', 'primary', 'secondary', 'error', 'warning', 'info', 'success']).default('default').describe('칩 색상'),
47
- size: z.enum(['medium', 'small']).optional().describe('칩 크기'),
48
- variant: z.enum(['filled', 'outlined']).optional().describe('칩 스타일'),
49
- disabled: z.boolean().optional().describe('비활성화 여부'),
50
- avatar: z.string().optional().describe('Avatar JSX 코드 문자열'),
51
- deleteIcon: z.string().optional().describe('DeleteIcon JSX 코드 문자열'),
52
- onClick: z.string().optional().describe('클릭 이벤트 핸들러'),
53
- onDelete: z.string().optional().describe('삭제 아이콘 클릭 핸들러'),
54
- });
55
- // TextField 컴포넌트 관련 스키마 정의
56
- export const TextFieldSchema = z.object({
57
- placeholder: z.string().optional().describe("입력 필드에 표시될 플레이스홀더 텍스트"),
58
- value: z.string().optional().describe("입력 필드의 값. React 상태 변수 이름을 전달하세요 (예: 'name')."),
59
- onChange: z.string().optional().describe("값이 변경될 때 실행할 함수의 본문을 문자열로 전달하세요 (예: '(e) => setName(e.target.value)')."),
60
- variant: z.enum(["standard", "outlined", "filled"]).default("standard").describe("입력 필드 스타일"),
61
- type: z.enum(["text", "password", "number"]).optional().describe("입력 타입"),
62
- size: z.enum(["medium", "small"]).optional().describe("입력 필드 크기"),
63
- error: z.boolean().optional().describe("에러 상태 여부"),
64
- helperText: z.string().optional().describe("입력 필드 아래에 표시될 도움말 텍스트"),
65
- disabled: z.boolean().optional().describe("비활성화 여부"),
66
- inputProps: z.string().optional().describe(`inputProps 객체(JSX/문자열).
67
- - input 엘리먼트에 직접 전달할 속성 객체입니다.
68
- - 예: { readOnly: true }, { inputMode: 'numeric', pattern: '[0-9]*' }
69
- - 여러 줄 객체 사용 시:
70
- {
71
- inputMode: 'numeric',
72
- pattern: '[0-9]*',
73
- readOnly: true
74
- }
75
- - 사용 예시:
76
- <OpsnowCommonTextField
77
- placeholder="Read Only"
78
- value="Read only text"
79
- inputProps={{ readOnly: true }}
80
- variant="outlined"
81
- />
82
- <OpsnowCommonTextField
83
- placeholder="숫자만 입력"
84
- inputProps={{ inputMode: 'numeric', pattern: '[0-9]*' }}
85
- variant="outlined"
86
- />
87
-
88
- ---
89
-
90
- ※ 고급 활용: InputProps와의 차이 및 비밀번호 보기/숨기기 예시
91
- - inputProps는 input 엘리먼트에 직접 적용되는 속성(HTML 속성, 예: readOnly, inputMode 등)만 지정합니다.
92
- - InputProps는 MUI TextField의 고급 확장 속성으로, input의 시작/끝에 커스텀 요소(아이콘, 버튼 등)를 추가할 때 사용합니다.
93
- - 예시(비밀번호 보기/숨기기 토글):
94
- <OpsnowCommonTextField
95
- placeholder="비밀번호를 입력하세요"
96
- variant="outlined"
97
- type={showPassword ? 'text' : 'password'}
98
- value={password}
99
- onChange={(e) => setPassword(e.target.value)}
100
- InputProps={{
101
- endAdornment: (
102
- <InputAdornment position="end">
103
- <IconButton
104
- aria-label={showPassword ? '비밀번호 숨기기' : '비밀번호 보이기'}
105
- onClick={handleToggleShow}
106
- onMouseDown={handleMouseDown}
107
- edge="end"
108
- >
109
- {showPassword ? <VisibilityOff /> : <Visibility />}
110
- </IconButton>
111
- </InputAdornment>
112
- ),
113
- }}
114
- />
115
- - InputProps를 활용하면 input 우측(end)에 아이콘 버튼 등 다양한 커스텀 요소를 배치할 수 있습니다.
116
- `),
117
- adornmentLabel: z.string().optional().describe("입력 필드 시작 또는 끝 부분에 표시될 텍스트 장식"),
118
- adornmentIconName: z.enum(Object.keys(IconNamesMap)).optional().describe(generateIconDescription({ format: 'nested' })),
119
- adornmentPosition: z.enum(["start", "end"]).optional().describe("장식(adornment)의 위치"),
120
- readOnly: z.boolean().optional().describe("읽기 전용 상태 여부"),
121
- });
122
- // Avatar 컴포넌트 관련 스키마 정의
123
- export const AvatarSchema = z.object({
124
- src: z.string().optional().describe('이미지 URL'),
125
- alt: z.string().optional().describe('이미지 대체 텍스트'),
126
- size: z.enum(['xsmall', 'small', 'medium', 'large']).optional().describe('아바타 크기'),
127
- variant: z.enum(['circular', 'rounded', 'square']).optional().describe('아바타 형태'),
128
- showBadge: z.boolean().optional().describe('뱃지 표시 여부'),
129
- sx: z.string().optional().describe('MUI sx 스타일 객체(JSX/문자열)'),
130
- onClick: z.string().optional().describe('클릭 이벤트 핸들러'),
131
- children: z.string().optional().describe('아바타 내부에 표시할 텍스트/JSX (예: 이름, 아이콘 등)'),
132
- });
133
- // Checkbox 컴포넌트 관련 스키마 정의
134
- export const CheckboxSchema = z.object({
135
- color: z.enum(["primary", "secondary", "error", "success", "warning", "info", "default"]).optional().describe("체크박스 색상"),
136
- checked: z.string().describe("체크 여부를 나타내는 상태 변수. 예: 'isChecked'"),
137
- onChange: z.string().describe("체크 상태 변경 시 호출될 함수. 예: '(e) => setIsChecked(e.target.checked)'"),
138
- name: z.string().optional().describe("체크박스 이름"),
139
- label: z.string().optional().describe("체크박스 라벨"),
140
- size: z.enum(["small", "medium", "large"]).optional().describe("체크박스 크기"),
141
- disabled: z.boolean().optional().describe("비활성화 여부"),
142
- indeterminate: z.string().optional().describe("부분 선택 상태 여부 (부모 체크박스 등)"),
143
- });
144
- // RadioGroup 컴포넌트 관련 스키마 정의
145
- export const RadioGroupSchema = z.object({
146
- options: z.string().describe("라디오 옵션 배열 변수명 (예: options)"),
147
- color: z.enum(["primary", "secondary", "error", "success", "warning", "info", "default"]).optional().describe("라디오 색상"),
148
- name: z.string().describe("라디오 그룹 이름"),
149
- defaultValue: z.string().optional().describe("기본 선택값"),
150
- row: z.boolean().optional().describe("가로 배치 여부"),
151
- size: z.enum(["small", "medium", "large"]).optional().describe("라디오 크기"),
152
- });
153
- // Collapse 컴포넌트 관련 스키마 정의
154
- export const CollapseSchema = z.object({
155
- label: z.string().describe("토글 라벨 텍스트"),
156
- defaultExpanded: z.boolean().optional().describe("기본 확장 여부"),
157
- children: z.string().describe("Collapse 내부에 들어갈 JSX/텍스트"),
158
- });
159
- // Slider 컴포넌트 관련 스키마 정의
160
- export const SliderSchema = z.object({
161
- defaultValue: z.string().optional().describe("기본 값 (string, 단일 값: '30', 범위: '[10, 50]')"),
162
- color: z.enum(["primary", "secondary"]).optional().describe("슬라이더 색상"),
163
- size: z.enum(["small", "medium"]).optional().describe("슬라이더 크기"),
164
- step: z.number().optional().describe("슬라이더 step 값"),
165
- marks: z.string().optional().describe(`마크 표시 여부/마크 배열(string, 예: 'true', 'false', 또는 아래와 같은 배열 문자열)
166
-
167
- 예시1 (달러):
168
- '[{ "value": 1, "label": "$1" }, { "value": 100, "label": "$100" }, { "value": 200, "label": "$200" }, { "value": 300, "label": "$300" }]'
169
-
170
- 예시2 (온도):
171
- '[{ "value": 0, "label": "0°C" }, { "value": 20, "label": "20°C" }, { "value": 37, "label": "37°C" }, { "value": 100, "label": "100°C" }]'
172
- `),
173
- valueLabelDisplay: z.enum(["on", "auto", "off"]).optional().describe("값 라벨 표시 방식"),
174
- min: z.number().optional().describe("최소값"),
175
- max: z.number().optional().describe("최대값"),
176
- disabled: z.boolean().optional().describe("비활성화 여부"),
177
- orientation: z.enum(["horizontal", "vertical"]).optional().describe("슬라이더 방향"),
178
- getAriaValueText: z.string().optional().describe("aria value 텍스트 함수 변수명"),
179
- ariaLabel: z.string().optional().describe("aria-label 속성"),
180
- sx: z.string().optional().describe("MUI sx 스타일 객체(JSX/문자열)"),
181
- });
182
- // Link 컴포넌트 관련 스키마 정의
183
- export const LinkSchema = z.object({
184
- href: z.string().describe("링크 주소(href)"),
185
- color: z.enum(["primary", "inherit"]).optional().describe("링크 색상"),
186
- underline: z.enum(["always", "hover", "none"]).optional().describe("밑줄 표시 방식"),
187
- onClick: z.string().optional().describe("클릭 이벤트 핸들러"),
188
- children: z.string().describe("링크 내부 텍스트/JSX"),
189
- });
190
- // ToggleButtonGroup 컴포넌트 관련 스키마 정의
191
- export const ToggleButtonSchema = z.object({
192
- value: z.string().describe('선택된 값'),
193
- onChange: z.string().describe('값 변경 핸들러 함수명'),
194
- size: z.enum(['large', 'medium', 'small']).optional().describe('토글 버튼 크기'),
195
- exclusive: z.boolean().optional().describe('단일 선택 여부'),
196
- disabled: z.boolean().optional().describe('비활성화 여부'),
197
- theme: z.enum(['new']).optional().describe('테마'),
198
- buttons: z.array(z.object({
199
- value: z.string().describe('버튼 값'),
200
- label: z.string().optional().describe('버튼 라벨'),
201
- iconName: z.enum(Object.keys(IconNamesMap)).optional().describe(generateIconDescription({ format: 'nested' })),
202
- iconOnly: z.boolean().optional().describe('아이콘만 표시'),
203
- iconPosition: z.enum(['left', 'right']).optional().describe('아이콘 위치'),
204
- disabled: z.boolean().optional().describe('비활성화 여부'),
205
- })).describe('토글 버튼 목록'),
206
- });
207
- // TreeView 컴포넌트 관련 스키마 정의
208
- export const TreeViewSchema = z.object({
209
- data: z.string().describe(`트리 데이터 배열 변수명 (예: sampleTreeData)
210
-
211
- 트리 데이터 구조 예시:
212
- - id: 노드 고유 ID
213
- - label: 노드 라벨 텍스트
214
- - muiIconName: Material-UI 아이콘 이름 (예: 'settings', 'person', 'lock' 등)
215
- - children: 자식 노드 배열 (선택사항)
216
- - data: 노드에 추가 데이터 (선택사항, 예: { memberCount: 5 })
217
-
218
- 예시 데이터:
219
- [
220
- {
221
- id: 'c1',
222
- label: 'Settings',
223
- muiIconName: 'settings',
224
- children: [
225
- { id: 'c11', label: 'Profile', muiIconName: 'person' },
226
- { id: 'c12', label: 'Security', muiIconName: 'lock' }
227
- ]
228
- }
229
- ]`),
230
- totalLabel: z.string().optional().describe("최상단 Total 라벨 텍스트"),
231
- totalIconName: z.enum(Object.keys(IconNamesMap)).optional().describe(generateIconDescription({ format: 'nested' })),
232
- showTotal: z.boolean().optional().describe("Total 라벨 표시 여부 (기본값: true)"),
233
- searchable: z.boolean().optional().describe("검색 기능 활성화 여부 (기본값: true)"),
234
- defaultExpandAll: z.boolean().optional().describe("기본 전체 확장 여부 (기본값: false)"),
235
- checkboxSelection: z.boolean().optional().describe("체크박스 선택 모드 활성화"),
236
- multiSelect: z.boolean().optional().describe("다중 선택 허용 여부"),
237
- onCheckedItemsChange: z.string().optional().describe("체크된 항목 변경 이벤트 핸들러 (예: handleMultiCheckedItemsChange)"),
238
- defaultCheckedItems: z.string().optional().describe("기본 체크된 항목 배열 상태 변수명 (예: multiCheckedItems)"),
239
- onTotalClick: z.string().optional().describe("Total 클릭 이벤트 핸들러 함수명 (예: handleTotalClick)"),
240
- renderTotalRightContent: z.string().optional().describe("Total 우측에 표시할 JSX 코드 문자열 (함수 형태)"),
241
- renderRightContent: z.string().optional().describe("각 노드 우측에 표시할 JSX 코드 문자열 (함수 형태, node 파라미터 사용)"),
242
- onNodeClick: z.string().optional().describe("노드 클릭 이벤트 핸들러 함수명 (예: handleNodeClick)"),
243
- selectedNodeId: z.string().optional().describe("선택된 노드 ID 상태 변수명 (예: selectedNode?.id)"),
244
- });
245
- // InsightCard 컴포넌트 관련 스키마 정의
246
- export const InsightCardSchema = z.object({
247
- loading: z.boolean().optional().describe("로딩 상태 여부 (기본값: false)"),
248
- loadingStage: z.enum(["1", "2", "3"]).optional().describe("현재 로딩 단계 (1, 2, 3 중 하나, 기본값: 1)"),
249
- loadingStagesMessages: z.string().optional().describe("커스텀 로딩 메시지 배열 변수명 (예: loadingMessages)"),
250
- insightText: z.string().optional().describe("AI insight 텍스트 내용"),
251
- title: z.string().optional().describe("타일 제목 (기본값: 'Opsnow Insight AI')"),
252
- subtitle: z.string().optional().describe("타일 부제목 (기본값: 'AI-powered analysis and recommendations')"),
253
- onDownload: z.string().optional().describe("커스텀 다운로드 콜백 함수명 (예: handleDownload)"),
254
- sx: z.string().optional().describe("MUI sx 스타일 객체(JSX/문자열)"),
255
- });
256
- // InsightContent 컴포넌트 관련 스키마 정의 (타일 없이 콘텐츠만)
257
- export const InsightContentSchema = z.object({
258
- loading: z.boolean().optional().describe("로딩 상태 여부 (기본값: false)"),
259
- loadingStage: z.enum(["1", "2", "3"]).optional().describe("현재 로딩 단계 (1, 2, 3 중 하나, 기본값: 1)"),
260
- loadingStagesMessages: z.string().optional().describe("커스텀 로딩 메시지 배열 변수명 (예: loadingMessages)"),
261
- insightText: z.string().optional().describe("AI insight 텍스트 내용"),
262
- collapsed: z.boolean().optional().describe("콘텐츠 접힘 상태 (외부에서 제어, 기본값: false)"),
263
- emptyMessage: z.string().optional().describe("insightText가 없을 때 표시할 빈 메시지"),
264
- sx: z.string().optional().describe("MUI sx 스타일 객체(JSX/문자열)"),
265
- });
266
- // Forms 컴포넌트 함수 - 배열 반환
267
- export function createFormsComponent() {
268
- return [
269
- {
270
- name: "createButton",
271
- description: `버튼 컴포넌트 - 다양한 스타일과 옵션 지원
272
-
273
- - iconName 또는 muiIconName 프로퍼티에 아이콘 이름을 문자열로 전달하여 버튼에 아이콘을 추가할 수 있습니다.
274
-
275
- **import:**
276
- \`\`\`javascript
277
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
278
- const { OpsnowCommonButton } = useCommonComponents();
279
- \`\`\``,
280
- parameters: ButtonSchema,
281
- handler: async (args) => {
282
- const props = [];
283
- if (args.label && !args.iconOnly)
284
- props.push(`label="${args.label}"`);
285
- if (args.size)
286
- props.push(`size="${args.size}"`);
287
- if (args.color)
288
- props.push(`color="${args.color}"`);
289
- if (args.variant)
290
- props.push(`variant="${args.variant}"`);
291
- if (args.theme)
292
- props.push(`theme="${args.theme}"`);
293
- if (args.iconName)
294
- props.push(`iconName="${args.iconName}"`);
295
- if (args.muiIconName)
296
- props.push(`muiIconName="${args.muiIconName}"`);
297
- if (args.iconPosition)
298
- props.push(`iconPosition="${args.iconPosition}"`);
299
- if (args.iconOnly)
300
- props.push(`iconOnly`);
301
- if (args.disabled)
302
- props.push(`disabled`);
303
- if (args.onClick)
304
- props.push(`onClick={${args.onClick}}`);
305
- const code = `<OpsnowCommonButton ${props.join(' ')} />`;
306
- return {
307
- content: [
308
- {
309
- type: "text",
310
- text: `\`\`\`jsx\n${code}\n\`\`\``
311
- }
312
- ]
313
- };
314
- }
315
- },
316
- {
317
- name: "createBadge",
318
- description: `뱃지 컴포넌트 - 숫자, dot, 색상, children 지원
319
-
320
- **import:**
321
- \`\`\`javascript
322
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
323
- const { OpsnowCommonBadge } = useCommonComponents();
324
- \`\`\``,
325
- parameters: BadgeSchema,
326
- handler: async (args) => {
327
- const props = [];
328
- if (args.badgeContent !== undefined)
329
- props.push(`badgeContent={${args.badgeContent}}`);
330
- if (args.color)
331
- props.push(`color="${args.color}"`);
332
- if (args.variant && args.variant !== "standard")
333
- props.push(`variant="${args.variant}"`);
334
- if (args.showZero)
335
- props.push(`showZero={true}`);
336
- let code = "";
337
- if (args.children) {
338
- code = `<OpsnowCommonBadge ${props.join(' ')}>\n ${args.children}\n</OpsnowCommonBadge>`;
339
- }
340
- else {
341
- code = `<OpsnowCommonBadge ${props.join(' ')} />`;
342
- }
343
- return {
344
- content: [
345
- {
346
- type: "text",
347
- text: `\`\`\`jsx\n${code}\n\`\`\``
348
- }
349
- ]
350
- };
351
- }
352
- },
353
- {
354
- name: "createTextarea",
355
- description: `Textarea 컴포넌트 - 여러 줄의 텍스트 입력을 위한 컴포넌트입니다.
356
-
357
- **import:**
358
- \`\`\`javascript
359
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
360
- const { OpsnowCommonTextarea } = useCommonComponents();
361
- \`\`\``,
362
- parameters: TextareaSchema,
363
- handler: async (args) => {
364
- const props = [];
365
- if (args.placeholder)
366
- props.push(`placeholder="${args.placeholder}"`);
367
- if (args.value)
368
- props.push(`value={${args.value}}`);
369
- if (args.onChange)
370
- props.push(`onChange={${args.onChange}}`);
371
- if (args.variant && args.variant !== 'outlined')
372
- props.push(`variant="${args.variant}"`);
373
- if (args.rows)
374
- props.push(`rows={${args.rows}}`);
375
- if (args.autoSize)
376
- props.push(`autoSize`);
377
- if (args.helperText)
378
- props.push(`helperText="${args.helperText}"`);
379
- const code = `<OpsnowCommonTextarea ${props.join(' ')} />`;
380
- return {
381
- content: [
382
- {
383
- type: "text",
384
- text: `\`\`\`jsx\n${code}\n\`\`\``
385
- }
386
- ]
387
- };
388
- }
389
- },
390
- {
391
- name: "createSwitch",
392
- description: `Switch 컴포넌트 - On/Off 토글 스위치를 제공합니다.
393
-
394
- **import:**
395
- \`\`\`javascript
396
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
397
- const { OpsnowCommonSwitch } = useCommonComponents();
398
- \`\`\``,
399
- parameters: SwitchSchema,
400
- handler: async (args) => {
401
- const props = [];
402
- if (args.checked)
403
- props.push(`checked={${args.checked}}`);
404
- if (args.onChange)
405
- props.push(`onChange={${args.onChange}}`);
406
- if (args.color)
407
- props.push(`color="${args.color}"`);
408
- if (args.size)
409
- props.push(`size="${args.size}"`);
410
- if (args.disabled)
411
- props.push(`disabled`);
412
- const code = `<OpsnowCommonSwitch ${props.join(' ')} />`;
413
- return {
414
- content: [
415
- {
416
- type: "text",
417
- text: `\`\`\`jsx\n${code}\n\`\`\``
418
- }
419
- ]
420
- };
421
- }
422
- },
423
- {
424
- name: "createChip",
425
- description: `Chip 컴포넌트 - 다양한 색상, 크기, 스타일, 아이콘, Avatar, 삭제 기능 등 지원
426
-
427
- - deleteIcon, avatar 등은 JSX로 전달할 수 있습니다.
428
- - onClick, onDelete 등 이벤트 핸들러도 지원합니다.
429
-
430
- **import:**
431
- \`\`\`javascript
432
- import { useCommonComponents, useOpsnowCommonIcons } from '@opsnow-common/opsnow-finops-common-ui-loader';
433
- const { OpsnowCommonChip } = useCommonComponents();
434
- const { OpsnowCommonIcon } = useOpsnowCommonIcons();
435
- \`\`\``,
436
- parameters: ChipSchema,
437
- handler: async (args) => {
438
- const props = [];
439
- if (args.label)
440
- props.push(`label=\"${args.label}\"`);
441
- if (args.color && args.color !== 'default')
442
- props.push(`color=\"${args.color}\"`);
443
- if (args.size)
444
- props.push(`size=\"${args.size}\"`);
445
- if (args.variant)
446
- props.push(`variant=\"${args.variant}\"`);
447
- if (args.disabled)
448
- props.push(`disabled`);
449
- if (args.avatar)
450
- props.push(`avatar={${args.avatar}}`);
451
- if (args.deleteIcon)
452
- props.push(`deleteIcon={${args.deleteIcon}}`);
453
- if (args.onClick)
454
- props.push(`onClick={${args.onClick}}`);
455
- if (args.onDelete)
456
- props.push(`onDelete={${args.onDelete}}`);
457
- const code = `<OpsnowCommonChip ${props.join(' ')} />`;
458
- return {
459
- content: [
460
- {
461
- type: "text",
462
- text: `\`\`\`jsx\n${code}\n\`\`\``
463
- }
464
- ]
465
- };
466
- }
467
- },
468
- {
469
- name: "createTextField",
470
- description: `TextField 컴포넌트 - 다양한 스타일, 어도먼트, 에러/비활성/읽기전용 등 지원
471
-
472
- - adornmentLabel, adornmentIconName, adornmentPosition 등으로 텍스트/아이콘 장식 지원
473
- - inputProps, InputProps 등 MUI TextField의 확장 옵션 지원
474
-
475
- **import:**
476
- \`\`\`javascript
477
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
478
- const { OpsnowCommonTextField } = useCommonComponents();
479
- \`\`\``,
480
- parameters: TextFieldSchema,
481
- handler: async (args) => {
482
- const props = [];
483
- let inputPropsBlock = '';
484
- let InputPropsBlock = '';
485
- if (args.placeholder)
486
- props.push(`placeholder=\"${args.placeholder}\"`);
487
- if (args.value)
488
- props.push(`value={${args.value}}`);
489
- if (args.onChange)
490
- props.push(`onChange={${args.onChange}}`);
491
- if (args.variant && args.variant !== "standard")
492
- props.push(`variant=\"${args.variant}\"`);
493
- if (args.type)
494
- props.push(`type=\"${args.type}\"`);
495
- if (args.size)
496
- props.push(`size=\"${args.size}\"`);
497
- if (args.error)
498
- props.push(`error`);
499
- if (args.helperText)
500
- props.push(`helperText=\"${args.helperText}\"`);
501
- if (args.disabled)
502
- props.push(`disabled`);
503
- if (args.adornmentLabel)
504
- props.push(`adornmentLabel=\"${args.adornmentLabel}\"`);
505
- if (args.adornmentIconName)
506
- props.push(`adornmentIconName=\"${args.adornmentIconName}\"`);
507
- if (args.adornmentPosition)
508
- props.push(`adornmentPosition=\"${args.adornmentPosition}\"`);
509
- if (args.readOnly)
510
- props.push(`readOnly`);
511
- // inputProps, InputProps 멀티라인/JSX 대응
512
- if (args.inputProps) {
513
- if (args.inputProps.trim().startsWith('{') && args.inputProps.includes('\n')) {
514
- inputPropsBlock = `inputProps=${args.inputProps}`;
515
- }
516
- else {
517
- props.push(`inputProps={${args.inputProps}}`);
518
- }
519
- }
520
- // 멀티라인 여부에 따라 코드 조립
521
- let code = '';
522
- if (inputPropsBlock || InputPropsBlock) {
523
- code = `<OpsnowCommonTextField\n ${props.join('\n ')}\n ${inputPropsBlock ? inputPropsBlock + '\n ' : ''}${InputPropsBlock ? InputPropsBlock + '\n' : ''}/>`;
524
- }
525
- else {
526
- code = `<OpsnowCommonTextField ${props.join(' ')} />`;
527
- }
528
- return {
529
- content: [
530
- {
531
- type: "text",
532
- text: `\`\`\`jsx\n${code}\n\`\`\``
533
- }
534
- ]
535
- };
536
- }
537
- },
538
- {
539
- name: "createAvatar",
540
- description: `Avatar 컴포넌트 - 텍스트, 아이콘, 이미지, 뱃지, 다양한 크기/모양, 클릭 등 지원\n\n- children에 텍스트, 아이콘(JSX), 이니셜 등 자유롭게 전달 가능\n- showBadge, variant, sx 등 다양한 옵션 지원\n\n**import:**\n\u0060\u0060\u0060javascript\nimport { useCommonComponents, useOpsnowCommonIcons } from '@opsnow-common/opsnow-finops-common-ui-loader';\nconst { OpsnowCommonAvatar } = useCommonComponents();\nconst { OpsnowCommonIcon } = useOpsnowCommonIcons();\n\u0060\u0060\u0060`,
541
- parameters: AvatarSchema,
542
- handler: async (args) => {
543
- const props = [];
544
- if (args.src)
545
- props.push(`src=\"${args.src}\"`);
546
- if (args.alt)
547
- props.push(`alt=\"${args.alt}\"`);
548
- if (args.size)
549
- props.push(`size=\"${args.size}\"`);
550
- if (args.variant)
551
- props.push(`variant=\"${args.variant}\"`);
552
- if (args.showBadge)
553
- props.push(`showBadge`);
554
- if (args.sx)
555
- props.push(`sx={${args.sx}}`);
556
- if (args.onClick)
557
- props.push(`onClick={${args.onClick}}`);
558
- let code = '';
559
- if (args.children) {
560
- // children이 여러 줄 JSX면 줄바꿈 처리
561
- if (args.children.trim().startsWith('<')) {
562
- code = `<OpsnowCommonAvatar ${props.join(' ')}>
563
- ${args.children}
564
- </OpsnowCommonAvatar>`;
565
- }
566
- else {
567
- code = `<OpsnowCommonAvatar ${props.join(' ')}>${args.children}</OpsnowCommonAvatar>`;
568
- }
569
- }
570
- else {
571
- code = `<OpsnowCommonAvatar ${props.join(' ')} />`;
572
- }
573
- return {
574
- content: [
575
- {
576
- type: "text",
577
- text: `\`\`\`jsx\n${code}\n\`\`\``
578
- }
579
- ]
580
- };
581
- }
582
- },
583
- {
584
- name: "createCheckbox",
585
- description: `Checkbox 컴포넌트 - 다양한 색상, 크기, 라벨, 부분선택 등 지원
586
-
587
- **import:**
588
- \`\`\`javascript
589
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
590
- const { OpsnowCommonCheckbox } = useCommonComponents();
591
- \`\`\``,
592
- parameters: CheckboxSchema,
593
- handler: async (args) => {
594
- const props = [];
595
- if (args.color)
596
- props.push(`color=\"${args.color}\"`);
597
- if (args.checked)
598
- props.push(`checked={${args.checked}}`);
599
- if (args.onChange)
600
- props.push(`onChange={${args.onChange}}`);
601
- if (args.name)
602
- props.push(`name=\"${args.name}\"`);
603
- if (args.label)
604
- props.push(`label=\"${args.label}\"`);
605
- if (args.size)
606
- props.push(`size=\"${args.size}\"`);
607
- if (args.disabled)
608
- props.push(`disabled`);
609
- if (args.indeterminate)
610
- props.push(`indeterminate={${args.indeterminate}}`);
611
- const code = `<OpsnowCommonCheckbox ${props.join(' ')} />`;
612
- return {
613
- content: [
614
- {
615
- type: "text",
616
- text: `\`\`\`jsx\n${code}\n\`\`\``
617
- }
618
- ]
619
- };
620
- }
621
- },
622
- {
623
- name: "createRadioGroup",
624
- description: `RadioGroup 컴포넌트 - 옵션, 색상, 크기, 가로/세로 배치 등 지원
625
-
626
- **import:**
627
- \`\`\`javascript
628
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
629
- const { OpsnowCommonRadioGroup } = useCommonComponents();
630
- \`\`\``,
631
- parameters: RadioGroupSchema,
632
- handler: async (args) => {
633
- const props = [];
634
- if (args.options)
635
- props.push(`options={${args.options}}`);
636
- if (args.color)
637
- props.push(`color=\"${args.color}\"`);
638
- if (args.name)
639
- props.push(`name=\"${args.name}\"`);
640
- if (args.defaultValue)
641
- props.push(`defaultValue=\"${args.defaultValue}\"`);
642
- if (args.row)
643
- props.push(`row`);
644
- if (args.size)
645
- props.push(`size=\"${args.size}\"`);
646
- const code = `<OpsnowCommonRadioGroup ${props.join(' ')} />`;
647
- return {
648
- content: [
649
- {
650
- type: "text",
651
- text: `\`\`\`jsx\n${code}\n\`\`\``
652
- }
653
- ]
654
- };
655
- }
656
- },
657
- {
658
- name: "createCollapse",
659
- description: `Collapse 컴포넌트 - 토글 라벨, 기본 확장, children 등 지원
660
-
661
- **import:**
662
- \`\`\`javascript
663
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
664
- const { OpsnowCommonCollapse } = useCommonComponents();
665
- \`\`\``,
666
- parameters: CollapseSchema,
667
- handler: async (args) => {
668
- const props = [];
669
- if (args.label)
670
- props.push(`label=\"${args.label}\"`);
671
- if (args.defaultExpanded)
672
- props.push(`defaultExpanded`);
673
- let code = '';
674
- if (args.children && args.children.trim().startsWith('<')) {
675
- code = `<OpsnowCommonCollapse ${props.join(' ')}>` + `\n ${args.children}\n</OpsnowCommonCollapse>`;
676
- }
677
- else {
678
- code = `<OpsnowCommonCollapse ${props.join(' ')}>${args.children || ''}</OpsnowCommonCollapse>`;
679
- }
680
- return {
681
- content: [
682
- {
683
- type: "text",
684
- text: `\`\`\`jsx\n${code}\n\`\`\``
685
- }
686
- ]
687
- };
688
- }
689
- },
690
- {
691
- name: "createSlider",
692
- description: `Slider 컴포넌트 - 단일/범위, 색상, 크기, 마크, 라벨, 수직/수평 등 지원
693
-
694
- **import:**
695
- \`\`\`javascript
696
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
697
- const { OpsnowCommonSlider } = useCommonComponents();
698
- \`\`\``,
699
- parameters: SliderSchema,
700
- handler: async (args) => {
701
- const props = [];
702
- // defaultValue 파싱: string -> number | number[] | string
703
- if (args.defaultValue !== undefined) {
704
- let parsedValue = undefined;
705
- try {
706
- if (args.defaultValue.trim().startsWith('[')) {
707
- parsedValue = JSON.parse(args.defaultValue);
708
- }
709
- else if (args.defaultValue.trim() !== '') {
710
- const num = Number(args.defaultValue);
711
- parsedValue = isNaN(num) ? args.defaultValue : num;
712
- }
713
- }
714
- catch (e) {
715
- parsedValue = args.defaultValue;
716
- }
717
- if (parsedValue !== undefined) {
718
- props.push(`defaultValue={${JSON.stringify(parsedValue)}}`);
719
- }
720
- }
721
- // marks 파싱: string -> boolean | any[] | string
722
- if (args.marks !== undefined) {
723
- let marksValue = args.marks;
724
- if (args.marks === "true")
725
- marksValue = true;
726
- else if (args.marks === "false")
727
- marksValue = false;
728
- else if (args.marks.trim().startsWith("[")) {
729
- try {
730
- marksValue = JSON.parse(args.marks);
731
- }
732
- catch {
733
- marksValue = args.marks;
734
- }
735
- }
736
- props.push(`marks={${typeof marksValue === "string" ? marksValue : JSON.stringify(marksValue)}}`);
737
- }
738
- if (args.color)
739
- props.push(`color=\"${args.color}\"`);
740
- if (args.size)
741
- props.push(`size=\"${args.size}\"`);
742
- if (args.step !== undefined)
743
- props.push(`step={${args.step}}`);
744
- if (args.valueLabelDisplay)
745
- props.push(`valueLabelDisplay=\"${args.valueLabelDisplay}\"`);
746
- if (args.min !== undefined)
747
- props.push(`min={${args.min}}`);
748
- if (args.max !== undefined)
749
- props.push(`max={${args.max}}`);
750
- if (args.disabled)
751
- props.push(`disabled`);
752
- if (args.orientation)
753
- props.push(`orientation=\"${args.orientation}\"`);
754
- if (args.getAriaValueText)
755
- props.push(`getAriaValueText={${args.getAriaValueText}}`);
756
- if (args.ariaLabel)
757
- props.push(`aria-label=\"${args.ariaLabel}\"`);
758
- if (args.sx)
759
- props.push(`sx={${args.sx}}`);
760
- const code = `<OpsnowCommonSlider ${props.join(' ')} />`;
761
- return {
762
- content: [
763
- {
764
- type: "text",
765
- text: `\`\`\`jsx\n${code}\n\`\`\``
766
- }
767
- ]
768
- };
769
- }
770
- },
771
- {
772
- name: "createLink",
773
- description: `Link 컴포넌트 - 다양한 색상, 밑줄, 클릭, children 등 지원
774
-
775
- **import:**
776
- \`\`\`javascript
777
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
778
- const { OpsnowCommonLink } = useCommonComponents();
779
- \`\`\``,
780
- parameters: LinkSchema,
781
- handler: async (args) => {
782
- const props = [];
783
- if (args.href)
784
- props.push(`href=\"${args.href}\"`);
785
- if (args.color)
786
- props.push(`color=\"${args.color}\"`);
787
- if (args.underline)
788
- props.push(`underline=\"${args.underline}\"`);
789
- if (args.onClick)
790
- props.push(`onClick={${args.onClick}}`);
791
- let code = '';
792
- if (args.children && args.children.trim().startsWith('<')) {
793
- code = `<OpsnowCommonLink ${props.join(' ')}>` + `\n ${args.children}\n</OpsnowCommonLink>`;
794
- }
795
- else {
796
- code = `<OpsnowCommonLink ${props.join(' ')}>${args.children || ''}</OpsnowCommonLink>`;
797
- }
798
- return {
799
- content: [
800
- {
801
- type: "text",
802
- text: `\`\`\`jsx\n${code}\n\`\`\``
803
- }
804
- ]
805
- };
806
- }
807
- },
808
- {
809
- name: "createToggleButton",
810
- description: `ToggleButtonGroup 컴포넌트 - 다양한 스타일, 아이콘, 단일/다중 선택 지원
811
-
812
- - 버튼별 아이콘, 라벨, 아이콘 위치, 아이콘만 표시 등 다양한 옵션 지원
813
- - exclusive: true로 단일 선택, false 또는 미설정 시 다중 선택
814
- - theme, disabled 등 다양한 스타일 속성 지원
815
-
816
- **import 예시:**
817
- \`\`\`javascript
818
- import { useCommonComponents, useOpsnowCommonIcons } from '@opsnow-common/opsnow-finops-common-ui-loader';
819
-
820
- const { OpsnowCommonToggleButton, OpsnowCommonToggleButtonGroup } =useCommonComponents()
821
- const { OpsnowCommonIcon } = useOpsnowCommonIcons()
822
- \`\`\``,
823
- parameters: ToggleButtonSchema,
824
- handler: async (args) => {
825
- const props = [];
826
- if (args.value)
827
- props.push(`value={${args.value}}`);
828
- if (args.onChange)
829
- props.push(`onChange={${args.onChange}}`);
830
- if (args.size)
831
- props.push(`size=\"${args.size}\"`);
832
- if (args.exclusive)
833
- props.push(`exclusive`);
834
- if (args.disabled)
835
- props.push(`disabled`);
836
- if (args.theme)
837
- props.push(`theme=\"${args.theme}\"`);
838
- // 버튼 목록 생성
839
- const buttonCodes = args.buttons.map(btn => {
840
- const btnProps = [];
841
- btnProps.push(`value=\"${btn.value}\"`);
842
- if (btn.label)
843
- btnProps.push(btn.iconName ? '' : btn.label); // label은 children으로 처리
844
- if (btn.iconName)
845
- btnProps.push(`<OpsnowCommonIcon iconName=\"${btn.iconName}\" />`);
846
- if (btn.iconOnly)
847
- btnProps.push(`iconOnly`);
848
- if (btn.iconPosition)
849
- btnProps.push(`iconPosition=\"${btn.iconPosition}\"`);
850
- if (btn.disabled)
851
- btnProps.push(`disabled`);
852
- // children 조립
853
- let children = btn.label ? btn.label : '';
854
- if (btn.iconName) {
855
- children = `<OpsnowCommonIcon iconName=\"${btn.iconName}\" />${btn.label ? ' ' + btn.label : ''}`;
856
- }
857
- return ` <OpsnowCommonToggleButton ${btnProps.filter(p => !p.startsWith('<')).join(' ')}>${children}</OpsnowCommonToggleButton>`;
858
- }).join('\n');
859
- const code = `<OpsnowCommonToggleButtonGroup\n ${props.join('\n ')}\n>\n${buttonCodes}\n</OpsnowCommonToggleButtonGroup>`;
860
- return {
861
- content: [
862
- {
863
- type: "text",
864
- text: `\`\`\`jsx\n${code}\n\`\`\``
865
- }
866
- ]
867
- };
868
- }
869
- },
870
- {
871
- name: "createTreeView",
872
- description: `TreeView 컴포넌트 - 계층 구조 데이터를 트리 형태로 표시
873
-
874
- - data: 트리 데이터 배열 변수
875
- - totalLabel, totalIconName: 최상단 Total 표시 옵션
876
- - renderTotalRightContent, renderRightContent: 각 노드의 우측에 커스텀 콘텐츠 렌더링
877
- - onTotalClick, onNodeClick: 클릭 이벤트 핸들러
878
- - selectedNodeId: 선택된 노드 ID
879
-
880
- **import:**
881
- \`\`\`javascript
882
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
883
- const { OpsnowCommonTreeView } = useCommonComponents();
884
- \`\`\``,
885
- parameters: TreeViewSchema,
886
- handler: async (args) => {
887
- const props = [];
888
- if (args.data)
889
- props.push(`data={${args.data}}`);
890
- if (args.totalLabel)
891
- props.push(`totalLabel=\"${args.totalLabel}\"`);
892
- if (args.totalIconName)
893
- props.push(`totalIconName=\"${args.totalIconName}\"`);
894
- if (args.showTotal !== undefined)
895
- props.push(`showTotal={${args.showTotal}}`);
896
- if (args.searchable !== undefined)
897
- props.push(`searchable={${args.searchable}}`);
898
- if (args.defaultExpandAll !== undefined)
899
- props.push(`defaultExpandAll={${args.defaultExpandAll}}`);
900
- if (args.checkboxSelection !== undefined)
901
- props.push(`checkboxSelection={${args.checkboxSelection}}`);
902
- if (args.multiSelect !== undefined)
903
- props.push(`multiSelect={${args.multiSelect}}`);
904
- if (args.onCheckedItemsChange)
905
- props.push(`onCheckedItemsChange={${args.onCheckedItemsChange}}`);
906
- if (args.defaultCheckedItems)
907
- props.push(`defaultCheckedItems={${args.defaultCheckedItems}}`);
908
- if (args.onTotalClick)
909
- props.push(`onTotalClick={${args.onTotalClick}}`);
910
- if (args.renderTotalRightContent)
911
- props.push(`renderTotalRightContent={${args.renderTotalRightContent}}`);
912
- if (args.renderRightContent)
913
- props.push(`renderRightContent={${args.renderRightContent}}`);
914
- if (args.onNodeClick)
915
- props.push(`onNodeClick={${args.onNodeClick}}`);
916
- if (args.selectedNodeId)
917
- props.push(`selectedNodeId={${args.selectedNodeId}}`);
918
- const code = `<OpsnowCommonTreeView\n ${props.join('\n ')}\n/>`;
919
- return {
920
- content: [
921
- {
922
- type: "text",
923
- text: `\`\`\`jsx\n${code}\n\`\`\``
924
- }
925
- ]
926
- };
927
- }
928
- },
929
- {
930
- name: "createInsightCard",
931
- description: `InsightCard 컴포넌트 - AI 인사이트, 로딩 상태 등 지원
932
-
933
- **import:**
934
- \`\`\`javascript
935
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
936
- const { OpsnowCommonInsightCard } = useCommonComponents();
937
- \`\`\``,
938
- parameters: InsightCardSchema,
939
- handler: async (args) => {
940
- const props = [];
941
- if (args.loading !== undefined)
942
- props.push(`loading={${args.loading}}`);
943
- if (args.loadingStage !== undefined)
944
- props.push(`loadingStage={${args.loadingStage}}`);
945
- if (args.loadingStagesMessages)
946
- props.push(`loadingStagesMessages={${args.loadingStagesMessages}}`);
947
- if (args.insightText)
948
- props.push(`insightText="${args.insightText}"`);
949
- if (args.title)
950
- props.push(`title="${args.title}"`);
951
- if (args.subtitle)
952
- props.push(`subtitle="${args.subtitle}"`);
953
- if (args.onDownload)
954
- props.push(`onDownload={${args.onDownload}}`);
955
- if (args.sx)
956
- props.push(`sx={${args.sx}}`);
957
- const code = `<OpsnowCommonInsightCard\n ${props.join('\n ')}\n/>`;
958
- return {
959
- content: [
960
- {
961
- type: "text",
962
- text: `\`\`\`jsx\n${code}\n\`\`\``
963
- }
964
- ]
965
- };
966
- }
967
- },
968
- {
969
- name: "createInsightContent",
970
- description: `InsightContent 컴포넌트 - 타일 없이 AI 인사이트 콘텐츠만 표시
971
-
972
- **import:**
973
- \`\`\`javascript
974
- import { useCommonComponents } from '@opsnow-common/opsnow-finops-common-ui-loader';
975
- const { OpsnowCommonInsightContent } = useCommonComponents();
976
- \`\`\``,
977
- parameters: InsightContentSchema,
978
- handler: async (args) => {
979
- const props = [];
980
- if (args.loading !== undefined)
981
- props.push(`loading={${args.loading}}`);
982
- if (args.loadingStage !== undefined)
983
- props.push(`loadingStage={${args.loadingStage}}`);
984
- if (args.loadingStagesMessages)
985
- props.push(`loadingStagesMessages={${args.loadingStagesMessages}}`);
986
- if (args.insightText)
987
- props.push(`insightText="${args.insightText}"`);
988
- if (args.collapsed !== undefined)
989
- props.push(`collapsed={${args.collapsed}}`);
990
- if (args.emptyMessage)
991
- props.push(`emptyMessage="${args.emptyMessage}"`);
992
- if (args.sx)
993
- props.push(`sx={${args.sx}}`);
994
- const code = `<OpsnowCommonInsightContent\n ${props.join('\n ')}\n/>`;
995
- return {
996
- content: [
997
- {
998
- type: "text",
999
- text: `\`\`\`jsx\n${code}\n\`\`\``
1000
- }
1001
- ]
1002
- };
1003
- }
1004
- }
1005
- ];
1006
- }