sellmate-design-system-react 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -21,8 +21,8 @@ npm install sellmate-design-system-react
21
21
 
22
22
  ```css
23
23
  /* app globals.css */
24
- @import "tailwindcss";
25
- @import "sellmate-design-system-react/theme.css";
24
+ @import 'tailwindcss';
25
+ @import 'sellmate-design-system-react/theme.css';
26
26
  @source "../node_modules/sellmate-design-system-react/dist";
27
27
  ```
28
28
 
@@ -34,37 +34,100 @@ npm install sellmate-design-system-react
34
34
  Tailwind를 쓰지 않는 앱은 컴파일된 CSS를 직접 import 합니다.
35
35
 
36
36
  ```ts
37
- import "sellmate-design-system-react/styles.css";
37
+ import 'sellmate-design-system-react/styles.css';
38
+ ```
39
+
40
+ ## Next.js (App Router)
41
+
42
+ 별도 설정 없이 동작합니다. `dist` 가 이미 빌드되어 있으므로 `transpilePackages` 는 필요 없습니다.
43
+
44
+ 전역 CSS 는 위 **방식 1** 과 같습니다. `@source` 는 **CSS 파일 기준 상대경로**이므로 `app/globals.css` 에 둔다면 다음과 같습니다.
45
+
46
+ ```css
47
+ /* app/globals.css */
48
+ @import 'tailwindcss';
49
+ @import 'sellmate-design-system-react/theme.css';
50
+ @source "../node_modules/sellmate-design-system-react/dist";
51
+ ```
52
+
53
+ ### 서버 컴포넌트에서 그대로 import 할 수 있습니다
54
+
55
+ 패키지 엔트리가 `"use client"` 로 선언된 클라이언트 경계라, 서버 컴포넌트에서 바로 import 해도 됩니다. 서버에서 렌더(SSR)된 뒤 클라이언트에서 하이드레이션됩니다.
56
+
57
+ ```tsx
58
+ // app/page.tsx — "use client" 없음
59
+ import { SButton } from 'sellmate-design-system-react';
60
+
61
+ export default function Page() {
62
+ return <SButton color="primary" size="md" label="확인" />;
63
+ }
64
+ ```
65
+
66
+ ### 이벤트 핸들러가 필요하면 소비자 쪽에 `"use client"`
67
+
68
+ RSC 경계를 넘어 **함수는 전달할 수 없습니다.** 위 페이지에 `onClick` 을 추가하면 빌드가 실패합니다.
69
+
70
+ ```text
71
+ Error: Event handlers cannot be passed to Client Component props.
72
+ ```
73
+
74
+ 이는 라이브러리 제약이 아니라 React 서버 컴포넌트의 규칙입니다. 핸들러·상태가 필요한 화면은 그 파일을 클라이언트 컴포넌트로 만드세요.
75
+
76
+ ```tsx
77
+ 'use client';
78
+
79
+ import { useState } from 'react';
80
+ import { SCheckbox } from 'sellmate-design-system-react';
81
+
82
+ export function AgreeField() {
83
+ const [value, setValue] = useState(false);
84
+ return <SCheckbox value={value} onValueChange={setValue} label="동의" />;
85
+ }
86
+ ```
87
+
88
+ 동작을 직접 확인하려면 Next playground 를 띄우세요 — 이 패키지를 소비 앱과 동일하게 `dist` 로 소비합니다.
89
+
90
+ ```bash
91
+ npm run playground:next # http://localhost:3010
38
92
  ```
39
93
 
40
94
  ## 사용법
41
95
 
42
96
  ```tsx
43
- import { Button } from "sellmate-design-system-react";
97
+ import { SButton } from 'sellmate-design-system-react';
44
98
 
45
99
  export function Example() {
46
- return (
47
- <Button variant="primary" size="md" onClick={() => alert("clicked")}>
48
- 확인
49
- </Button>
50
- );
100
+ return <SButton color="primary" size="md" label="확인" onClick={() => alert('clicked')} />;
51
101
  }
52
102
  ```
53
103
 
104
+ 모든 컴포넌트는 **`S` 접두어**를 씁니다(`SButton`, `SInput` …). 공개 타입도 마찬가지입니다(`SButtonProps`).
105
+
106
+ `SButton` 은 텍스트를 **`label`(문자열)로만** 받습니다 — `children` 은 받지 않으며, 아이콘은 `icon`/`rightIcon` 을 씁니다. 색상 prop 은 `color` 입니다(`variant` 아님).
107
+
54
108
  ## 제공 컴포넌트
55
109
 
56
- | 분류 | 컴포넌트 |
57
- | --- | --- |
58
- | 버튼·액션 | `Button` · `GhostButton` · `DropdownButton` · `TextLink` · `Toggle` · `Switch` |
59
- | 입력 | `Input` · `Textarea` · `NumberInput` · `BarcodeInput` · `Select` · `Checkbox` · `Radio` · `RadioButton` · `Chip` · `ChipInput` · `Field` · `FilePicker` |
60
- | 날짜 | `Calendar` · `DatePicker` · `DateRangePicker` |
61
- | 표시·피드백 | `Badge` · `Tag` · `Card` · `Callout` · `Divider` · `Tooltip` · `Popover` · `Popup` · `Guide` · `Toast` |
62
- | 진행 상태 | `LinearProgress` · `CircleProgress` · `LoadingContainer` · `LoadingModal` |
63
- | 모달 | `ModalContainer` · `ConfirmModal` · `ActionModal` |
64
- | 데이터 표시 | `Table` · `KeyValueTable` · `Tabs` · `Pagination` |
65
- | 아이콘 | `Icon` |
66
-
67
- 유틸리티로 클래스 병합 헬퍼 `cn`도 export 합니다.
110
+ 분류는 `src/index.ts` export 그룹과 동일합니다.
111
+
112
+ | 분류 | 컴포넌트 |
113
+ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114
+ | Atoms | `SIcon` · `SBadge` · `SCard` · `SDivider` · `STag` · `SButton` · `SCallout` · `SLinearProgress` · `SCircleProgress` · `SLoadingContainer` |
115
+ | Control | `STextLink` · `SDropdownButton` · `SGhostButton` · `SSwitch` · `SToggle` |
116
+ | Overlays | `STooltip` · `SPopover` · `SPortal` · `SPopup` · `SGuide` |
117
+ | Modals | `SConfirmModal` · `SActionModal` · `SLoadingModal` |
118
+ | Layout | `SGnb` · `SLayout` · `SPage` |
119
+ | Navigation | `STabs` · `SPagination` |
120
+ | Data | `STable` · `SKeyValueTable` |
121
+ | Feedback | `SToast` |
122
+ | SField (폼) | `SForm` · `SField` · `SCheckbox` · `SRadio` · `SRadioButton` · `SInput` · `STextarea` · `SSelect` · `SNumberInput` · `SChip` · `SChipInput` · `SBarcodeInput` · `SCalendar` · `SDatePicker` · `SDateRangePicker` · `SFilePicker` |
123
+
124
+ `SModalContainer` 는 모달 3종의 내부 공통 컨테이너로 **공개 export 가 아닙니다.** 소비자는 `SConfirmModal`/`SActionModal`/`SLoadingModal` 을 사용하세요.
125
+
126
+ 유틸리티도 함께 export 합니다.
127
+
128
+ - `cn` — 클래스 병합 헬퍼
129
+ - `resolveColor` · `isColorKey` · `COLOR_KEYS` · `SColor` · `SColorKey` — 색상 토큰 유틸
130
+ - `Rule` — `rules` prop(`SField` · `SChip` · `SBarcodeInput` 등)에 넘기는 검증 함수 타입
68
131
 
69
132
  ## 특징
70
133
 
@@ -4678,7 +4678,7 @@ var STable = react.forwardRef(function STable2({
4678
4678
  ref: scrollRef,
4679
4679
  onScroll: handleScroll,
4680
4680
  className: cn(
4681
- "relative overflow-auto border border-solid border-[color:var(--cmp-table-border-color)]",
4681
+ "bg-white relative overflow-auto border border-solid border-[color:var(--cmp-table-border-color)]",
4682
4682
  radiusClass,
4683
4683
  // 원본 sd-table__scroll-container--loading/--no-data: 로딩·데이터 없음 시 스크롤·인터랙션 차단
4684
4684
  (isLoading || rowCount === 0) && "overflow-hidden pointer-events-none"