sellmate-design-system-react 3.0.0 → 3.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.
Files changed (75) hide show
  1. package/AGENTS.md +661 -0
  2. package/README.md +85 -0
  3. package/dist/components/SActionModal/README.md +41 -0
  4. package/dist/components/SBadge/README.md +25 -0
  5. package/dist/components/SBarcodeInput/README.md +64 -0
  6. package/dist/components/SButton/README.md +49 -0
  7. package/dist/components/SCalendar/README.md +42 -0
  8. package/dist/components/SCallout/README.md +29 -0
  9. package/dist/components/SCard/README.md +12 -0
  10. package/dist/components/SCheckbox/README.md +44 -0
  11. package/dist/components/SChip/README.md +57 -0
  12. package/dist/components/SChipInput/README.md +77 -0
  13. package/dist/components/SCircleProgress/README.md +35 -0
  14. package/dist/components/SConfirmModal/README.md +61 -0
  15. package/dist/components/SDatePicker/README.md +62 -0
  16. package/dist/components/SDateRangePicker/README.md +64 -0
  17. package/dist/components/SDivider/README.md +25 -0
  18. package/dist/components/SDraggableItem/README.md +40 -0
  19. package/dist/components/SDropdownButton/README.md +50 -0
  20. package/dist/components/SExpansionItem/README.md +40 -0
  21. package/dist/components/SField/README.md +91 -0
  22. package/dist/components/SFilePicker/README.md +72 -0
  23. package/dist/components/SForm/README.md +31 -0
  24. package/dist/components/SGhostButton/README.md +76 -0
  25. package/dist/components/SGnb/README.md +56 -0
  26. package/dist/components/SGuide/README.md +34 -0
  27. package/dist/components/SIcon/README.md +91 -0
  28. package/dist/components/SInput/README.md +66 -0
  29. package/dist/components/SKeyValueTable/README.md +59 -0
  30. package/dist/components/SLayout/README.md +42 -0
  31. package/dist/components/SLinearProgress/README.md +17 -0
  32. package/dist/components/SList/README.md +14 -0
  33. package/dist/components/SListItem/README.md +19 -0
  34. package/dist/components/SLoadingContainer/README.md +29 -0
  35. package/dist/components/SLoadingModal/README.md +52 -0
  36. package/dist/components/SModal/README.md +192 -0
  37. package/dist/components/SModalContainer/README.md +49 -0
  38. package/dist/components/SNumberInput/README.md +74 -0
  39. package/dist/components/SPage/README.md +25 -0
  40. package/dist/components/SPagination/README.md +40 -0
  41. package/dist/components/SPopover/README.md +54 -0
  42. package/dist/components/SPopup/README.md +38 -0
  43. package/dist/components/SPortal/README.md +51 -0
  44. package/dist/components/SRadio/README.md +57 -0
  45. package/dist/components/SRadioButton/README.md +24 -0
  46. package/dist/components/SScrollArea/README.md +16 -0
  47. package/dist/components/SSectionHeaderCard/README.md +51 -0
  48. package/dist/components/SSelect/README.md +79 -0
  49. package/dist/components/SStepper/README.md +30 -0
  50. package/dist/components/SSwitch/README.md +24 -0
  51. package/dist/components/STable/README.md +82 -0
  52. package/dist/components/STableBar/README.md +28 -0
  53. package/dist/components/STabs/README.md +37 -0
  54. package/dist/components/STag/README.md +44 -0
  55. package/dist/components/STextLink/README.md +48 -0
  56. package/dist/components/STextarea/README.md +60 -0
  57. package/dist/components/STimePicker/README.md +65 -0
  58. package/dist/components/STimeRangePicker/README.md +63 -0
  59. package/dist/components/SToast/README.md +70 -0
  60. package/dist/components/SToggle/README.md +22 -0
  61. package/dist/components/STooltip/README.md +57 -0
  62. package/dist/llms.txt +3496 -0
  63. package/dist/styles.css +209 -0
  64. package/dist/theme.css +8 -0
  65. package/eslint/index.mjs +66 -0
  66. package/eslint/lib/class-names.mjs +119 -0
  67. package/eslint/lib/table-column.mjs +53 -0
  68. package/eslint/rules/no-arbitrary-class.mjs +91 -0
  69. package/eslint/rules/no-off-scale-spacing.mjs +67 -0
  70. package/eslint/rules/no-raw-html-control.mjs +117 -0
  71. package/eslint/rules/prefer-typo-preset.mjs +73 -0
  72. package/eslint/rules/require-locale-number.mjs +78 -0
  73. package/eslint/rules/table-numeric-align.mjs +93 -0
  74. package/eslint/scale.gen.mjs +16 -0
  75. package/package.json +9 -4
@@ -0,0 +1,91 @@
1
+ # SIcon
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SIcon
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `name` | `SIconName` | — | 아이콘명 |
12
+ | `size?` | `number \| string` | `24` | 아이콘 크기(px 또는 CSS 길이) |
13
+ | `color?` | `SColor` | — | 아이콘 색상. 팔레트 키(`grey_65`, `red_95` …) 또는 임의 CSS 색상. 미지정 시 currentColor 상속 |
14
+ | `rotate?` | `0 \| 90 \| 180 \| 270` | — | 회전 각도 |
15
+ | `label?` | `string` | — | 접근성 라벨. 없으면 aria-hidden 처리 |
16
+ | `className?` | `string` | — | |
17
+ | `style?` | `CSSProperties` | — | |
18
+
19
+ ## Dependencies
20
+
21
+ ### Used by
22
+
23
+ - [SButton](../SButton)
24
+ - [SCallout](../SCallout)
25
+ - [SCheckbox](../SCheckbox)
26
+ - [SChipInput](../SChipInput)
27
+ - [SConfirmModal](../SConfirmModal)
28
+ - [SDatePicker](../SDatePicker)
29
+ - [SDateRangePicker](../SDateRangePicker)
30
+ - [SDraggableItem](../SDraggableItem)
31
+ - [SDropdownButton](../SDropdownButton)
32
+ - [SExpansionItem](../SExpansionItem)
33
+ - [SField](../SField)
34
+ - [SFilePicker](../SFilePicker)
35
+ - [SGhostButton](../SGhostButton)
36
+ - [SGnb](../SGnb)
37
+ - [SGuide](../SGuide)
38
+ - [SKeyValueTable](../SKeyValueTable)
39
+ - [SList](../SList)
40
+ - [SLoadingModal](../SLoadingModal)
41
+ - [SNumberInput](../SNumberInput)
42
+ - [SPagination](../SPagination)
43
+ - [SPopover](../SPopover)
44
+ - [SSectionHeaderCard](../SSectionHeaderCard)
45
+ - [SSelect](../SSelect)
46
+ - [SStepper](../SStepper)
47
+ - [STable](../STable)
48
+ - [STag](../STag)
49
+ - [STextLink](../STextLink)
50
+ - [STimePicker](../STimePicker)
51
+ - [STimeRangePicker](../STimeRangePicker)
52
+ - [SToast](../SToast)
53
+ - [STooltip](../STooltip)
54
+
55
+ ### Graph
56
+
57
+ ```mermaid
58
+ graph TD;
59
+ SButton --> SIcon
60
+ SCallout --> SIcon
61
+ SCheckbox --> SIcon
62
+ SChipInput --> SIcon
63
+ SConfirmModal --> SIcon
64
+ SDatePicker --> SIcon
65
+ SDateRangePicker --> SIcon
66
+ SDraggableItem --> SIcon
67
+ SDropdownButton --> SIcon
68
+ SExpansionItem --> SIcon
69
+ SField --> SIcon
70
+ SFilePicker --> SIcon
71
+ SGhostButton --> SIcon
72
+ SGnb --> SIcon
73
+ SGuide --> SIcon
74
+ SKeyValueTable --> SIcon
75
+ SList --> SIcon
76
+ SLoadingModal --> SIcon
77
+ SNumberInput --> SIcon
78
+ SPagination --> SIcon
79
+ SPopover --> SIcon
80
+ SSectionHeaderCard --> SIcon
81
+ SSelect --> SIcon
82
+ SStepper --> SIcon
83
+ STable --> SIcon
84
+ STag --> SIcon
85
+ STextLink --> SIcon
86
+ STimePicker --> SIcon
87
+ STimeRangePicker --> SIcon
88
+ SToast --> SIcon
89
+ STooltip --> SIcon
90
+ style SIcon fill:#f9f,stroke:#333,stroke-width:4px
91
+ ```
@@ -0,0 +1,66 @@
1
+ # SInput
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SInput
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `value?` | `string \| number` | — | 값 (제어) |
12
+ | `type?` | `'text' \| 'password' \| 'email' \| 'number' \| 'tel' \| 'search' \| 'url'` | `'text'` | 입력 타입 |
13
+ | `size?` | `SFieldSize` | `'sm'` | 크기 |
14
+ | `icon?` | `SIconName` | — | 좌측 아이콘명 |
15
+ | `iconColor?` | `SColor` | — | 좌측 아이콘 색상 |
16
+ | `prefix?` | `ReactNode` | — | 입력 앞(좌측) 커스텀 노드 — 원본 slot="prefix" |
17
+ | `suffix?` | `ReactNode` | — | 입력 뒤(우측) 커스텀 노드 — 원본 slot="suffix" |
18
+ | `clearable?` | `boolean` | `false` | 지우기 버튼 |
19
+ | `rules?` | `Rule[]` | — | 유효성 규칙 — blur 시 자동 검증 |
20
+ | `status?` | `SFieldStatus` | — | 필드 상태 ('default' | 'pass' | 'error') |
21
+ | `focused?` | `boolean` | — | 포커스 상태 (제어/반영) |
22
+ | `hovered?` | `boolean` | — | 호버 상태 (제어/반영) |
23
+ | `inputClass?` | `string` | — | 내부 input 요소 className |
24
+ | `inputStyle?` | `CSSProperties` | — | 내부 input 요소 style |
25
+ | `label?` | `string` | — | |
26
+ | `labelWidth?` | `number \| string` | — | |
27
+ | `labelTooltip?` | `string` | — | 레이블 툴팁 텍스트 |
28
+ | `labelTooltipProps?` | `Partial<STooltipProps>` | — | 레이블 툴팁 상세 옵션 |
29
+ | `hint?` | `string` | — | |
30
+ | `error?` | `boolean` | — | |
31
+ | `errorMessage?` | `string` | — | |
32
+ | `addonLabel?` | `string` | — | |
33
+ | `addonAlign?` | `SFieldAddonAlign` | — | 어드온 정렬 |
34
+ | `width?` | `number \| string` | — | |
35
+ | `disabled?` | `boolean` | `false` | |
36
+ | `readOnly?` | `boolean` | `false` | |
37
+ | `className?` | `string` | — | |
38
+ | `style?` | `CSSProperties` | — | |
39
+
40
+ #### Events
41
+
42
+ | Event | Type | Description |
43
+ |-------|------|-------------|
44
+ | `onValueChange` | `(value: string) => void` | 값 변경 (sdUpdate) — 문자열 전달 |
45
+ | `onChange` | `InputHTMLAttributes<HTMLInputElement>['onChange']` | 네이티브 onChange (form-agnostic 연동용, RHF 등) |
46
+
47
+ ## Dependencies
48
+
49
+ ### Used by
50
+
51
+ - [SKeyValueTable](../SKeyValueTable)
52
+
53
+ ### Depends on
54
+
55
+ - [SField](../SField)
56
+ - [SGhostButton](../SGhostButton)
57
+
58
+ ### Graph
59
+
60
+ ```mermaid
61
+ graph TD;
62
+ SInput --> SField
63
+ SInput --> SGhostButton
64
+ SKeyValueTable --> SInput
65
+ style SInput fill:#f9f,stroke:#333,stroke-width:4px
66
+ ```
@@ -0,0 +1,59 @@
1
+ # SKeyValueTable
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SKeyValueTable
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `fields?` | `SKeyValueField[][]` | `[]` | 2차원 배열. row → [th|td] 필드들 |
12
+ | `values?` | `Record<string, unknown>` | `{}` | field name을 key로 하는 값 객체 (`{ [name]: value }`). 지정 시 해당 field의 값으로 사용되며, field별 `options.value`보다 우선합니다. `onChange`의 `detail.values`와 함께 controlled 패턴으로 사용합니다. |
13
+ | `search?` | `boolean` | `false` | 우측 검색 패널 |
14
+ | `radius?` | `'default' \| 'useTop' \| 'full'` | `'default'` | border-radius 제어 |
15
+ | `className?` | `string` | — | |
16
+ | `style?` | `CSSProperties` | — | |
17
+
18
+ #### Events
19
+
20
+ | Event | Type | Description |
21
+ |-------|------|-------------|
22
+ | `onChange` | `(detail: SKeyValueChangeDetail) => void` | 값 변경 (sdChange) |
23
+ | `onSearch` | `() => void` | 검색 클릭 (sdSearch) |
24
+
25
+ ## Dependencies
26
+
27
+ ### Depends on
28
+
29
+ - [SButton](../SButton)
30
+ - [SCheckbox](../SCheckbox)
31
+ - [SDatePicker](../SDatePicker)
32
+ - [SDateRangePicker](../SDateRangePicker)
33
+ - [SFilePicker](../SFilePicker)
34
+ - [SIcon](../SIcon)
35
+ - [SInput](../SInput)
36
+ - [SNumberInput](../SNumberInput)
37
+ - [SRadio](../SRadio)
38
+ - [SSelect](../SSelect)
39
+ - [STextarea](../STextarea)
40
+ - [STooltip](../STooltip)
41
+
42
+ ### Graph
43
+
44
+ ```mermaid
45
+ graph TD;
46
+ SKeyValueTable --> SButton
47
+ SKeyValueTable --> SCheckbox
48
+ SKeyValueTable --> SDatePicker
49
+ SKeyValueTable --> SDateRangePicker
50
+ SKeyValueTable --> SFilePicker
51
+ SKeyValueTable --> SIcon
52
+ SKeyValueTable --> SInput
53
+ SKeyValueTable --> SNumberInput
54
+ SKeyValueTable --> SRadio
55
+ SKeyValueTable --> SSelect
56
+ SKeyValueTable --> STextarea
57
+ SKeyValueTable --> STooltip
58
+ style SKeyValueTable fill:#f9f,stroke:#333,stroke-width:4px
59
+ ```
@@ -0,0 +1,42 @@
1
+ # SLayout
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SLayout
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `type?` | `SLayoutType` | `'box'` | 메뉴 스타일: box(라운드) / belt(풀폭 행). 자식 SGnb 가 이 값을 따른다. |
12
+ | `header?` | `SLayoutHeader` | `'fix'` | 레이아웃 구조: fix(가로 분할) / full(풀폭 상단바). 자식 SGnb·SPage 가 이 값을 따른다. |
13
+ | `useRail?` | `boolean` | `false` | GNB 좌측 레일 사용 여부. 자식 SGnb 가 이 값을 따르고, full 의 메뉴 열 폭도 레일만큼 넓어진다. 레일에 children 없는 아이템이 있으면 SGnb 가 header 를 full 로 강제하고, 이 레이아웃도 그에 맞춰 full 그리드로 선다. |
14
+ | `folded?` | `boolean` | — | GNB 접힘 상태 (controlled) |
15
+ | `defaultFolded?` | `boolean` | `false` | GNB 초기 접힘 상태 (uncontrolled) |
16
+
17
+ #### Events
18
+
19
+ | Event | Type | Description |
20
+ |-------|------|-------------|
21
+ | `onFoldedChange` | `(folded: boolean) => void` | 접힘 상태 변경 |
22
+
23
+ ## Dependencies
24
+
25
+ ### Used by
26
+
27
+ - [SGnb](../SGnb)
28
+ - [SPage](../SPage)
29
+
30
+ ### Depends on
31
+
32
+ - [SGnb](../SGnb)
33
+
34
+ ### Graph
35
+
36
+ ```mermaid
37
+ graph TD;
38
+ SLayout --> SGnb
39
+ SGnb --> SLayout
40
+ SPage --> SLayout
41
+ style SLayout fill:#f9f,stroke:#333,stroke-width:4px
42
+ ```
@@ -0,0 +1,17 @@
1
+ # SLinearProgress
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SLinearProgress
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `value?` | `number` | `0` | 진행률 (0–100) |
12
+ | `type?` | `SLinearProgressType` | `'primary'` | 색상 타입 |
13
+ | `indeterminate?` | `boolean` | `false` | 진행률 없이 무한 애니메이션 |
14
+ | `label?` | `string` | — | 하단 레이블 |
15
+ | `className?` | `string` | — | |
16
+ | `style?` | `CSSProperties` | — | |
17
+
@@ -0,0 +1,14 @@
1
+ # SList
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SList
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `children?` | `ReactNode` | — | 리스트 컨테이너 내부에 렌더링할 내용 |
12
+ | `useGap?` | `boolean` | `false` | 리스트 아이템 사이 gap 토큰 적용 여부 |
13
+ | `usePadding?` | `boolean` | `false` | 리스트 컨테이너 padding 토큰 적용 여부 |
14
+
@@ -0,0 +1,19 @@
1
+ # SListItem
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SListItem
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `title` | `SListItemSlot` | — | 리스트 아이템 제목 |
12
+ | `depth?` | `1 \| 2 \| 3` | `1` | 중첩 단계. Figma 기준 1~3단계 |
13
+ | `leading?` | `SListItemSlot` | — | 타이틀 앞에 표시할 아이콘/콘텐츠 |
14
+ | `trailing?` | `SListItemSlot` | — | 타이틀 뒤에 표시할 태그/콘텐츠 |
15
+ | `bordered?` | `boolean` | `false` | 외곽 테두리 사용 여부 |
16
+ | `accentStripe?` | `boolean` | `false` | 아이템 왼쪽 accent stripe 표시 여부 |
17
+ | `dense?` | `boolean` | `false` | 조밀한 높이 사용 여부 |
18
+ | `disabled?` | `boolean` | `false` | 비활성 상태 여부 |
19
+
@@ -0,0 +1,29 @@
1
+ # SLoadingContainer
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SLoadingContainer
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `open?` | `boolean` | `false` | 오버레이 표시 여부 (Stencil의 show()/hide() 명령형 API → 제어 prop으로 대체) |
12
+ | `message?` | `string` | — | 스피너 하단 메시지 |
13
+ | `zIndex?` | `number` | `1200` | z-index. 기본값(1200)은 토스트(1100)·모달(1000/1001) 위 — 전체 화면을 막는 최상단 블로킹 오버레이 |
14
+ | `className?` | `string` | — | |
15
+ | `style?` | `CSSProperties` | — | |
16
+
17
+ ## Dependencies
18
+
19
+ ### Depends on
20
+
21
+ - [SCircleProgress](../SCircleProgress)
22
+
23
+ ### Graph
24
+
25
+ ```mermaid
26
+ graph TD;
27
+ SLoadingContainer --> SCircleProgress
28
+ style SLoadingContainer fill:#f9f,stroke:#333,stroke-width:4px
29
+ ```
@@ -0,0 +1,52 @@
1
+ # SLoadingModal
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SLoadingModal
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `open?` | `boolean` | — | |
12
+ | `persistent?` | `boolean` | — | true면 백드롭·ESC로 안 닫히고 흔들림 (sd-modal-container persistent). 로딩 중 닫힘 방지에 유용 |
13
+ | `state?` | `LoadingModalState` | `'loading'` | 상태 (loading: 스피너, error: 경고 아이콘) |
14
+ | `progress?` | `number` | — | 진행률 (0–100) — 지정 시 determinate 스피너 |
15
+ | `message?` | `string \| string[]` | — | 메시지 (없으면 state 기본값) |
16
+ | `useButton?` | `boolean` | `false` | 하단 버튼 표시 |
17
+ | `buttonLabel?` | `string` | — | 버튼 레이블 (없으면 state 기본값) |
18
+ | `width?` | `number \| string` | `520` | |
19
+ | `height?` | `number \| string` | `320` | |
20
+
21
+ #### Events
22
+
23
+ | Event | Type | Description |
24
+ |-------|------|-------------|
25
+ | `onOpenChange` | `(open: boolean) => void` | |
26
+ | `onClose` | `() => void` | 닫기(X) 버튼 클릭 (sdClose) — error 상태에서만 노출 |
27
+ | `onButtonClick` | `() => void` | 버튼 클릭 (sdClick) |
28
+
29
+ ## Dependencies
30
+
31
+ ### Used by
32
+
33
+ - [SModal](../SModal)
34
+
35
+ ### Depends on
36
+
37
+ - [SButton](../SButton)
38
+ - [SCircleProgress](../SCircleProgress)
39
+ - [SIcon](../SIcon)
40
+ - [SModalContainer](../SModalContainer)
41
+
42
+ ### Graph
43
+
44
+ ```mermaid
45
+ graph TD;
46
+ SLoadingModal --> SButton
47
+ SLoadingModal --> SCircleProgress
48
+ SLoadingModal --> SIcon
49
+ SLoadingModal --> SModalContainer
50
+ SModal --> SLoadingModal
51
+ style SLoadingModal fill:#f9f,stroke:#333,stroke-width:4px
52
+ ```
@@ -0,0 +1,192 @@
1
+ # SModal
2
+
3
+ > 수작성 문서 — SModal 은 컴포넌트가 아니라 **명령형 모달 서비스**라 `docs:gen`(Props/Events 표) 대상이 아니다.
4
+
5
+ 버튼 핸들러에서 바로 호출해 모달을 띄우는 명령형 API. 선언형 `<SConfirmModal open>` / `<SLoadingModal open>` 을 **대체하지 않고 추가로** 제공한다. (원본 디자인 시스템 `sdModal` 파리티)
6
+
7
+ 호출 시마다 `document.body` 에 컨테이너를 만들어 모달을 렌더하고, 닫힘 애니메이션이 끝나면 자동으로 언마운트한다. 모든 메서드는 체이닝 핸들 [`SModalRef`](#smodalref) 를 반환한다.
8
+
9
+ | 메서드 | 띄우는 모달 | 용도 | 주요 콜백/제어 |
10
+ |---|---|---|---|
11
+ | [`SModal.confirm(options)`](#smodalconfirm) | `SConfirmModal` | 확인/취소 | `onOk` / `onCancel` / `onClose` |
12
+ | [`SModal.loading(options?)`](#smodalloading) | `SLoadingModal` | 로딩·에러 (persistent 기본 true) | `onClick` / `update` |
13
+ | [`SModal.create({ component })`](#smodalcreate) | `SActionModal` | 액션 모달 | `modalRef` 주입 → `ok/cancel/close/submit` |
14
+
15
+ > **띄울 수 있는 모달은 `SActionModal` / `SConfirmModal` / `SLoadingModal` 세 가지뿐이고, 위 메서드가 1:1 로 대응한다.** 그 밖의 스타일로 모달을 띄우는 경로는 제공하지 않는다. `create` 는 컨테이너를 덧씌우지 않고 `component` 를 **그대로** 렌더하므로, `component` 는 루트에 `SActionModal` 을 렌더해야 한다 — 그러지 않으면 딤·카드 없이 콘텐츠만 뜨며, 개발 모드에서 `console.warn` 으로 경고한다.
16
+
17
+ ```ts
18
+ import { SModal } from 'sellmate-design-system-react';
19
+ ```
20
+
21
+ ---
22
+
23
+ ## SModal.confirm
24
+
25
+ 아이콘 + 제목 + 메시지 + 확인/취소 버튼. `type` 에 따라 아이콘·메인 버튼 색이 결정된다.
26
+
27
+ ```tsx
28
+ SModal.confirm({
29
+ type: 'negative', // 'positive' | 'negative' | 'default'
30
+ modalTitle: '삭제하시겠습니까?',
31
+ topMessage: ['이 작업은 되돌릴 수 없습니다.'],
32
+ mainButtonLabel: '삭제',
33
+ subButtonLabel: '취소',
34
+ })
35
+ .onOk(() => deleteItem())
36
+ .onCancel(() => {});
37
+ ```
38
+
39
+ **옵션 (`SConfirmOptions`)** — 선언형 `SConfirmModalProps` 에서 제어 흐름 props(`open`/`onOpenChange`/`onOk`/`onCancel`/`onClose`)를 제외한 전부. 주요 키: `type`, `modalTitle`, `topMessage`/`bottomMessage`, `mainButtonLabel`/`mainButtonName`, `subButtonLabel`, `tagSlot`/`optionSlot`, `persistent`.
40
+
41
+ ---
42
+
43
+ ## SModal.loading
44
+
45
+ 스피너/에러 모달. 로딩 중 임의 닫힘을 막기 위해 **`persistent` 기본값이 `true`** 다(백드롭·ESC로 안 닫힘). "띄우고 → 작업 → 결과 반영" 흐름을 `update()` / `close()` 로 제어한다.
46
+
47
+ ```tsx
48
+ const ref = SModal.loading({ message: '업로드 중...' });
49
+ try {
50
+ await upload();
51
+ ref.close();
52
+ } catch {
53
+ ref.update({ state: 'error', message: '업로드 실패' }) // 표시 중 상태 갱신
54
+ .onClick(() => retry()); // 「다시 시도」 버튼
55
+ }
56
+ ```
57
+
58
+ 진행률:
59
+
60
+ ```tsx
61
+ const ref = SModal.loading({ progress: 0, message: '파일 업로드 중...' });
62
+ ref.update({ progress: 60 }); // 0–100
63
+ ref.update({ progress: 100 });
64
+ ref.close();
65
+ ```
66
+
67
+ > **버튼 클릭은 자동 닫힘이 아니다.** error 상태의 버튼(기본 "다시 시도")은 `onClick` 만 발화하고 모달은 유지된다. consumer 가 `update()`(다시 로딩) / `close()` 로 후속 동작을 결정한다.
68
+
69
+ **옵션 (`SLoadingOptions`)** — `state`('loading' | 'error'), `progress`(0–100), `message`(string | string[]), `useButton`, `buttonLabel`, `width`/`height`, `persistent`.
70
+
71
+ ---
72
+
73
+ ## SModal.create
74
+
75
+ **`SActionModal` 을 루트로 렌더하는 컴포넌트**를 띄운다. `create` 는 컨테이너를 덧씌우지 않고 `component` 를 **그대로** 렌더하며, 표시 제어(`open` / `onOpenChange` / `onClose`)와 [`modalRef`](#smodalref) 를 주입하고 닫힘 애니메이션 종료 후 언마운트를 담당한다.
76
+
77
+ 컴포넌트는 주입받은 `open` / `onOpenChange` / `onClose` 를 **SActionModal 에 그대로 전달**해야 한다. 전달하지 않으면 모달이 열리지도, 닫히지도 않는다.
78
+
79
+ ```tsx
80
+ import { SModal, SActionModal, type SModalCreateComponentProps } from 'sellmate-design-system-react';
81
+
82
+ // componentProps 로 넘긴 값 + 주입 prop 을 함께 받는다
83
+ interface OrderModalProps extends SModalCreateComponentProps {
84
+ orderId: string;
85
+ }
86
+
87
+ function OrderModal({ open, onOpenChange, onClose, modalRef, orderId }: OrderModalProps) {
88
+ return (
89
+ <SActionModal
90
+ open={open}
91
+ onOpenChange={onOpenChange}
92
+ onClose={onClose}
93
+ modalTitle="주문 처리"
94
+ button={{ label: '처리', onClick: () => modalRef.ok() }}
95
+ >
96
+ <p>주문번호 {orderId} 를 접수합니다.</p>
97
+ </SActionModal>
98
+ );
99
+ }
100
+
101
+ SModal.create({ component: OrderModal, componentProps: { orderId: 'ORD-001' } })
102
+ .onOk(() => toast('저장 완료'))
103
+ .onDismissed(() => cleanup());
104
+ ```
105
+
106
+ **옵션 (`SCreateOptions<P>`)**
107
+
108
+ | 키 | 타입 | 설명 |
109
+ |---|---|---|
110
+ | `component` | `ComponentType<P & SModalCreateComponentProps>` | 루트에 `SActionModal` 을 렌더하는 컴포넌트 |
111
+ | `componentProps?` | `P` | 컴포넌트에 전달할 추가 props |
112
+
113
+ **주입되는 prop (`SModalCreateComponentProps`)**
114
+
115
+ | 키 | 타입 | 설명 |
116
+ |---|---|---|
117
+ | `open` | `boolean` | SActionModal 의 `open` 에 그대로 전달 |
118
+ | `onOpenChange` | `(open: boolean) => void` | SActionModal 의 `onOpenChange` 에 그대로 전달 |
119
+ | `onClose` | `() => void` | SActionModal 의 `onClose` 에 그대로 전달 |
120
+ | `modalRef` | `SModalRef` | `ok()`/`cancel()`/`close()`/`submit()` 으로 자기 모달 제어 |
121
+
122
+ ### 비동기 제출 — 응답 보고 닫기
123
+
124
+ SActionModal `button` 의 푸터 버튼은 클릭 시 **즉시 닫힌다**. 저장 API 응답에 따라 닫힘 여부를 정해야 하면 푸터 버튼 대신 **본문에 버튼을 두고** `modalRef` 로 닫힘 시점을 직접 제어한다.
125
+
126
+ ```tsx
127
+ function OrderModal({ open, onOpenChange, onClose, modalRef, orderId }: OrderModalProps) {
128
+ const [error, setError] = useState('');
129
+ const handleSubmit = async () => {
130
+ try {
131
+ await save(orderId);
132
+ modalRef.ok(); // 성공 → onOk + 닫기
133
+ } catch {
134
+ setError('저장 실패'); // 실패 → 모달 유지
135
+ }
136
+ };
137
+ return (
138
+ // button 을 주지 않으면 푸터가 렌더되지 않는다
139
+ <SActionModal open={open} onOpenChange={onOpenChange} onClose={onClose} persistent modalTitle="주문 처리">
140
+ {error && <p>{error}</p>}
141
+ <SButton label="저장" onClick={handleSubmit} />
142
+ <SButton label="취소" onClick={() => modalRef.cancel()} />
143
+ </SActionModal>
144
+ );
145
+ }
146
+ ```
147
+
148
+ ---
149
+
150
+ ## SModalRef
151
+
152
+ 모든 `SModal.*` 호출이 반환하고, `create` 에서는 컴포넌트 prop 으로도 주입되는 제어 핸들. 콜백 등록(체이닝)과 트리거/갱신 메서드를 함께 제공한다. 모달 종류에 따라 관련 있는 메서드만 실제로 발화한다.
153
+
154
+ ### 콜백 등록 (체이닝)
155
+
156
+ | 메서드 | 발화 시점 |
157
+ |---|---|
158
+ | `onOk(fn)` | 확인 버튼(confirm) 또는 `ok()` |
159
+ | `onCancel(fn)` | 취소 버튼(confirm) 또는 `cancel()` |
160
+ | `onClose(fn)` | 닫기(X) 버튼 또는 `close()` |
161
+ | `onClick(fn)` | 단일 버튼 모달(loading error)의 버튼 클릭 — **닫힘 없음** |
162
+ | `onSubmit(fn)` | create 커스텀 모달의 `submit()` — **닫힘 없음** |
163
+ | `onDismissed(fn)` | 사유 무관 완전히 닫혀 언마운트된 뒤(백드롭·ESC 포함) |
164
+
165
+ ### 트리거 / 제어
166
+
167
+ | 메서드 | 동작 |
168
+ |---|---|
169
+ | `ok()` | `onOk` 발화 + 닫기 (저장/처리 성공) |
170
+ | `cancel()` | `onCancel` 발화 + 닫기 (작업 취소) |
171
+ | `close()` | `onClose` 발화 + 닫기 (중립적 닫기) |
172
+ | `submit()` | `onSubmit` 발화 (닫힘 없음) |
173
+ | `update(patch)` | 표시 중 옵션 갱신 (loading→error, progress 등). create 는 미지원. |
174
+
175
+ 모든 닫힘은 애니메이션 종료 후 `onDismissed` 로 수렴한다. 이미 닫힘이 시작된 뒤의 중복 트리거는 무시된다.
176
+
177
+ ---
178
+
179
+ ## 주의사항
180
+
181
+ - **선언형과 공존**: 서비스는 추가 API다. open 상태가 앱 상태/라우트에 묶인 경우엔 선언형 `<SConfirmModal open>` / `<SLoadingModal open>` 이 더 적합하다.
182
+ - **백드롭·ESC = 중립적 닫힘**: 특정 콜백(onClose 등) 없이 `onDismissed` 만 발화한다. 명시적 버튼·메서드만 onOk/onCancel/onClose 를 발화한다.
183
+ - **Context 미상속**: `create` 의 커스텀 컴포넌트는 새 React 트리(createRoot)에서 렌더되어 부모의 Context Provider(Theme·Store 등)를 상속하지 않는다. 필요하면 컴포넌트 내부에서 직접 Provider 로 감싸라. (confirm/loading 은 토큰이 `:root` CSS 변수라 무관)
184
+ - **`create` 의 `component` 는 SActionModal 을 루트로**: `create` 는 컨테이너를 덧씌우지 않으므로, 본문만 렌더하는 컴포넌트를 넘기면 딤·카드 없이 콘텐츠가 그대로 화면에 붙는다. TypeScript 는 이를 막지 못한다(`component` 타입이 아무 컴포넌트나 허용). 개발 모드에서는 마운트 직후 렌더 결과로 이를 감지해 `console.warn` 으로 경고한다 — 세 모달은 모두 Portal 로 `body` 에 렌더되므로 `create` 가 만든 host 는 비어 있어야 하는데, host 에 엘리먼트가 남아 있으면 모달이 아닌 것으로 판정한다.
185
+
186
+ ## Dependencies
187
+
188
+ ### Depends on
189
+
190
+ - [SActionModal](../SActionModal)
191
+ - [SConfirmModal](../SConfirmModal)
192
+ - [SLoadingModal](../SLoadingModal)
@@ -0,0 +1,49 @@
1
+ # SModalContainer
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### SModalContainer
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `open?` | `boolean` | — | 표시 여부 (제어) |
12
+ | `ariaTitle?` | `string` | `'모달'` | 접근성 제목 (스크린리더용). 시각 제목은 children이 담당 |
13
+ | `showClose?` | `boolean` | `false` | 우측 상단 닫기 버튼 |
14
+ | `persistent?` | `boolean` | `false` | true면 백드롭 클릭·ESC로 닫히지 않고 흔들림(shake) 애니메이션 (sd-modal-container persistent) |
15
+ | `width?` | `number \| string` | — | 너비/높이 |
16
+ | `height?` | `number \| string` | — | |
17
+ | `children?` | `ReactNode` | — | |
18
+ | `className?` | `string` | — | |
19
+ | `style?` | `CSSProperties` | — | |
20
+
21
+ #### Events
22
+
23
+ | Event | Type | Description |
24
+ |-------|------|-------------|
25
+ | `onOpenChange` | `(open: boolean) => void` | 표시 상태 변경 |
26
+ | `onClose` | `() => void` | 닫기(X) 버튼 클릭 시 발생 (sd-modal-container 닫기 버튼 대응) |
27
+
28
+ ## Dependencies
29
+
30
+ ### Used by
31
+
32
+ - [SActionModal](../SActionModal)
33
+ - [SConfirmModal](../SConfirmModal)
34
+ - [SLoadingModal](../SLoadingModal)
35
+
36
+ ### Depends on
37
+
38
+ - [SGhostButton](../SGhostButton)
39
+
40
+ ### Graph
41
+
42
+ ```mermaid
43
+ graph TD;
44
+ SModalContainer --> SGhostButton
45
+ SActionModal --> SModalContainer
46
+ SConfirmModal --> SModalContainer
47
+ SLoadingModal --> SModalContainer
48
+ style SModalContainer fill:#f9f,stroke:#333,stroke-width:4px
49
+ ```