insystem-atoms 0.1.0

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.
@@ -0,0 +1,385 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * 공통으로 사용되는 타입 정의
5
+ */
6
+ /** 컴포넌트 크기 */
7
+ type Size = 'sm' | 'md' | 'lg';
8
+ /** 컴포넌트 상태 색상 변형 */
9
+ type Variant = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'ghost';
10
+
11
+ type ButtonVariant = Variant | 'admin' | 'neutral' | 'conversion' | 'icon';
12
+ type ButtonSize = 'xs' | Size;
13
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
14
+ variant?: ButtonVariant;
15
+ size?: ButtonSize;
16
+ loading?: boolean;
17
+ fullWidth?: boolean;
18
+ width?: string | number;
19
+ leftIcon?: React.ReactNode;
20
+ rightIcon?: React.ReactNode;
21
+ iconOnly?: boolean;
22
+ borderRadius?: string;
23
+ borderColor?: string;
24
+ textColor?: string;
25
+ backgroundColor?: string;
26
+ padding?: string;
27
+ }
28
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
29
+
30
+ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
31
+ size?: Size;
32
+ error?: string;
33
+ hint?: string;
34
+ prefix?: React.ReactNode;
35
+ suffix?: React.ReactNode;
36
+ clearable?: boolean;
37
+ onClear?: () => void;
38
+ fullWidth?: boolean;
39
+ /** 고정 너비 (px 숫자 또는 CSS 문자열) */
40
+ width?: string | number;
41
+ label?: string;
42
+ required?: boolean;
43
+ /** border-radius 오버라이드 */
44
+ borderRadius?: string;
45
+ /** 기본 border-color 오버라이드 (포커스/에러 상태 제외) */
46
+ borderColor?: string;
47
+ /** 입력 텍스트 색상 오버라이드 */
48
+ textColor?: string;
49
+ /** 배경색 오버라이드 */
50
+ backgroundColor?: string;
51
+ /** 입력 영역 padding 오버라이드 */
52
+ padding?: string;
53
+ }
54
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
55
+
56
+ interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
57
+ label?: React.ReactNode;
58
+ size?: Size;
59
+ indeterminate?: boolean;
60
+ error?: boolean;
61
+ /** 체크 활성 색상 (배경 + 테두리) */
62
+ checkColor?: string;
63
+ /** 비활성 테두리 색상 */
64
+ borderColor?: string;
65
+ /** 체크박스 border-radius */
66
+ borderRadius?: string;
67
+ }
68
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
69
+
70
+ interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
71
+ label?: React.ReactNode;
72
+ size?: Size;
73
+ error?: boolean;
74
+ /** 선택 활성 색상 (테두리 + 내부 도트) */
75
+ checkColor?: string;
76
+ /** 비활성 테두리 색상 */
77
+ borderColor?: string;
78
+ }
79
+ declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
80
+ interface RadioOption {
81
+ value: string;
82
+ label: React.ReactNode;
83
+ disabled?: boolean;
84
+ }
85
+ interface RadioGroupProps {
86
+ options: RadioOption[];
87
+ value?: string;
88
+ onChange?: (value: string) => void;
89
+ name: string;
90
+ size?: Size;
91
+ /** 방향: row(가로) | column(세로) | grid(격자) */
92
+ direction?: 'row' | 'column' | 'grid';
93
+ /** grid 방향일 때 열 수 (기본 3) */
94
+ gridColumns?: number;
95
+ /** 항목 간격 오버라이드 */
96
+ gap?: string;
97
+ disabled?: boolean;
98
+ error?: boolean;
99
+ errorMessage?: string;
100
+ checkColor?: string;
101
+ borderColor?: string;
102
+ }
103
+ declare const RadioGroup: React.FC<RadioGroupProps>;
104
+
105
+ interface SelectOption {
106
+ value: string;
107
+ label: string;
108
+ disabled?: boolean;
109
+ }
110
+ interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
111
+ options: SelectOption[];
112
+ placeholder?: string;
113
+ size?: Size;
114
+ /** 배경 스타일 변형: default(기본 흰 배경) | outlined(테두리 강조) | filled(회색 배경) */
115
+ variant?: 'default' | 'outlined' | 'filled';
116
+ error?: string;
117
+ hint?: string;
118
+ label?: string;
119
+ required?: boolean;
120
+ fullWidth?: boolean;
121
+ /** 고정 너비 (px 숫자 또는 CSS 문자열) */
122
+ width?: string | number;
123
+ borderRadius?: string;
124
+ borderColor?: string;
125
+ textColor?: string;
126
+ backgroundColor?: string;
127
+ padding?: string;
128
+ }
129
+ declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
130
+
131
+ interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
132
+ size?: Size;
133
+ error?: string;
134
+ hint?: string;
135
+ label?: string;
136
+ required?: boolean;
137
+ fullWidth?: boolean;
138
+ /** 고정 너비 (px 숫자 또는 CSS 문자열) */
139
+ width?: string | number;
140
+ maxLength?: number;
141
+ resize?: 'none' | 'vertical' | 'horizontal' | 'both';
142
+ borderRadius?: string;
143
+ borderColor?: string;
144
+ textColor?: string;
145
+ backgroundColor?: string;
146
+ padding?: string;
147
+ }
148
+ declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
149
+
150
+ interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
151
+ /** 필수 여부 (*표시) */
152
+ required?: boolean;
153
+ /** 선택 여부 (선택 표시) */
154
+ optional?: boolean;
155
+ /** 크기 */
156
+ size?: Size;
157
+ /** 비활성 상태 */
158
+ disabled?: boolean;
159
+ }
160
+ declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
161
+
162
+ interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
163
+ variant?: Variant;
164
+ size?: Size;
165
+ outline?: boolean;
166
+ icon?: React.ReactNode;
167
+ dot?: boolean;
168
+ borderRadius?: string;
169
+ textColor?: string;
170
+ backgroundColor?: string;
171
+ borderColor?: string;
172
+ }
173
+ declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
174
+
175
+ interface ChipProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
176
+ /** 표시할 텍스트 */
177
+ label: string;
178
+ /** 활성 상태 */
179
+ active?: boolean;
180
+ /** 카운트 표시 (label 뒤에 붙음) */
181
+ count?: number;
182
+ /** 활성 상태 색상 (텍스트 + 테두리) */
183
+ activeColor?: string;
184
+ /** border-radius 오버라이드 */
185
+ borderRadius?: string;
186
+ /** 기본 테두리 색상 */
187
+ borderColor?: string;
188
+ /** 기본 텍스트 색상 */
189
+ textColor?: string;
190
+ /** 배경색 */
191
+ backgroundColor?: string;
192
+ }
193
+ declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLButtonElement>>;
194
+
195
+ interface LoadingProps {
196
+ /** 스피너 크기 */
197
+ size?: Size | 'xs';
198
+ /** 스피너 아래 텍스트 */
199
+ text?: string;
200
+ /** 전체 화면 오버레이 모드 */
201
+ fullscreen?: boolean;
202
+ /** 스피너 색상 오버라이드 */
203
+ color?: string;
204
+ /** 배경 오버레이 색상 (fullscreen 모드) */
205
+ overlayColor?: string;
206
+ }
207
+ declare const Loading: React.FC<LoadingProps>;
208
+
209
+ interface PaginationProps {
210
+ /** 현재 페이지 (1-based) */
211
+ currentPage: number;
212
+ /** 전체 페이지 수 */
213
+ totalPages: number;
214
+ /** 페이지 변경 콜백 */
215
+ onPageChange: (page: number) => void;
216
+ /** 표시할 최대 페이지 버튼 수 (기본 5) */
217
+ maxVisible?: number;
218
+ /** 활성 페이지 버튼 색상 */
219
+ activeColor?: string;
220
+ /** 버튼 border-radius */
221
+ borderRadius?: string;
222
+ }
223
+ declare const Pagination: React.FC<PaginationProps>;
224
+
225
+ type ToastType = 'info' | 'success' | 'error' | 'warning';
226
+ interface ToastProps {
227
+ /** 메시지 내용 */
228
+ message: string;
229
+ /** 토스트 타입 (아이콘/색상 결정) */
230
+ type?: ToastType;
231
+ /** 자동 닫힘 시간 (ms, 0이면 자동 닫힘 없음) */
232
+ duration?: number;
233
+ /** 닫기 콜백 */
234
+ onClose: () => void;
235
+ /** 토스트 위치 */
236
+ position?: 'top-center' | 'top-right' | 'bottom-center' | 'bottom-right';
237
+ backgroundColor?: string;
238
+ textColor?: string;
239
+ borderRadius?: string;
240
+ }
241
+ declare const Toast: React.FC<ToastProps>;
242
+
243
+ /**
244
+ * insystem-atoms 디자인 토큰
245
+ *
246
+ * ─── 소비자 오버라이드 방법 ───────────────────────────────────────────────
247
+ *
248
+ * 1) 앱 진입점에서 렌더링 전에 한 번만 호출:
249
+ *
250
+ * import { configureTokens } from 'insystem-atoms';
251
+ *
252
+ * configureTokens({
253
+ * color: {
254
+ * primary: '#a44945', // 브랜드 메인 색상
255
+ * primaryHover:'#8a3d3a',
256
+ * primaryLight:'#fff0ef',
257
+ * },
258
+ * font: {
259
+ * family: "'NanumSquareNeo', sans-serif",
260
+ * },
261
+ * radius: {
262
+ * md: '10px', // 버튼/인풋 기본 radius
263
+ * },
264
+ * });
265
+ *
266
+ * 2) 오버라이드 가능한 최상위 키 목록:
267
+ * color.primary / color.primaryHover / color.primaryLight
268
+ * color.secondary / color.secondaryHover / color.secondaryLight
269
+ * color.success / color.successLight
270
+ * color.warning / color.warningLight
271
+ * color.danger / color.dangerHover / color.dangerLight
272
+ * color.text.* / color.border.* / color.background.*
273
+ * font.family / font.size.* / font.weight.*
274
+ * spacing.* / radius.* / shadow.* / transition.*
275
+ *
276
+ * 주의: configureTokens 는 렌더링 전에 호출해야 합니다.
277
+ * 렌더링 후 호출 시 styled-components CSS 캐시로 인해 적용이 보장되지 않습니다.
278
+ */
279
+ type DeepPartial<T> = {
280
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
281
+ };
282
+ interface Tokens {
283
+ color: {
284
+ /** 브랜드 메인 색상 — 가장 자주 오버라이드 */
285
+ primary: string;
286
+ primaryHover: string;
287
+ /** primary 10% 투명도 배경 (Badge, 포커스 링 등) */
288
+ primaryLight: string;
289
+ secondary: string;
290
+ secondaryHover: string;
291
+ secondaryLight: string;
292
+ success: string;
293
+ successLight: string;
294
+ warning: string;
295
+ warningLight: string;
296
+ danger: string;
297
+ dangerHover: string;
298
+ dangerLight: string;
299
+ text: {
300
+ primary: string;
301
+ secondary: string;
302
+ disabled: string;
303
+ inverse: string;
304
+ placeholder: string;
305
+ error: string;
306
+ hint: string;
307
+ };
308
+ border: {
309
+ default: string;
310
+ /** 포커스 테두리 — 보통 primary 와 동일하게 오버라이드 */
311
+ focus: string;
312
+ error: string;
313
+ disabled: string;
314
+ };
315
+ background: {
316
+ default: string;
317
+ disabled: string;
318
+ hover: string;
319
+ subtle: string;
320
+ };
321
+ };
322
+ font: {
323
+ size: {
324
+ xs: string;
325
+ sm: string;
326
+ md: string;
327
+ lg: string;
328
+ };
329
+ weight: {
330
+ regular: number;
331
+ medium: number;
332
+ semibold: number;
333
+ };
334
+ /** 폰트 패밀리 — 프로젝트 폰트로 오버라이드 */
335
+ family: string;
336
+ };
337
+ spacing: {
338
+ xs: string;
339
+ sm: string;
340
+ md: string;
341
+ lg: string;
342
+ xl: string;
343
+ xxl: string;
344
+ };
345
+ radius: {
346
+ none: string;
347
+ sm: string;
348
+ md: string;
349
+ lg: string;
350
+ xl: string;
351
+ full: string;
352
+ };
353
+ shadow: {
354
+ sm: string;
355
+ md: string;
356
+ lg: string;
357
+ popup: string;
358
+ modal: string;
359
+ field: string;
360
+ card: string;
361
+ };
362
+ transition: {
363
+ fast: string;
364
+ base: string;
365
+ slow: string;
366
+ };
367
+ }
368
+ declare const defaultTokens: Tokens;
369
+ /**
370
+ * 토큰 값을 오버라이드합니다.
371
+ * 앱 렌더링 전(예: main.tsx 최상단)에 호출해야 합니다.
372
+ *
373
+ * @example
374
+ * configureTokens({
375
+ * color: { primary: '#a44945', primaryHover: '#8a3d3a', primaryLight: '#fff0ef' },
376
+ * font: { family: "'NanumSquareNeo', sans-serif" },
377
+ * });
378
+ */
379
+ declare function configureTokens(overrides: DeepPartial<Tokens>): void;
380
+ /**
381
+ * 토큰을 기본값으로 초기화합니다.
382
+ */
383
+ declare function resetTokens(): void;
384
+
385
+ export { Badge, type BadgeProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, Chip, type ChipProps, type DeepPartial, Input, type InputProps, Label, type LabelProps, Loading, type LoadingProps, Pagination, type PaginationProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, type SelectOption, type SelectProps, type Size, TextArea, type TextAreaProps, Toast, type ToastProps, type ToastType, type Tokens, type Variant, configureTokens, defaultTokens, resetTokens };