@farmzone/fz-react-ui 1.1.0 → 1.1.2
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 +85 -58
- package/dist/index.cjs +1021 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -1
- package/dist/index.d.ts +134 -1
- package/dist/index.js +1017 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +18 -2
package/README.md
CHANGED
|
@@ -1,93 +1,120 @@
|
|
|
1
|
-
# fz-react-ui
|
|
1
|
+
# @farmzone/fz-react-ui
|
|
2
2
|
|
|
3
|
+
Farmzone 사내 프로젝트에서 공통으로 쓰는 React 컴포넌트 라이브러리입니다. Tailwind CSS 기반 스타일링, Radix UI 프리미티브, tiptap 기반 리치 에디터를 포함합니다.
|
|
3
4
|
|
|
5
|
+
## 요구 사항
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
- React `>=18` / React DOM `>=18`
|
|
8
|
+
- Node.js 20+
|
|
9
|
+
- Tailwind CSS v4 (스타일을 직접 통합하는 경우)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
## 설치
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
```bash
|
|
14
|
+
npm install @farmzone/fz-react-ui
|
|
15
|
+
```
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
### 필수 peer dependency
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
|
19
|
+
아래 패키지들은 `peerDependencies`로 선언되어 있어 **직접 설치**해야 합니다 (라이브러리 번들에 포함되지 않음):
|
|
15
20
|
|
|
21
|
+
```bash
|
|
22
|
+
npm install react react-dom lucide-react react-router
|
|
16
23
|
```
|
|
17
|
-
cd existing_repo
|
|
18
|
-
git remote add origin http://git.farmzonesnc.com/si/fz-react-ui.git
|
|
19
|
-
git branch -M main
|
|
20
|
-
git push -uf origin main
|
|
21
|
-
```
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
- `lucide-react` — 아이콘. Sidebar, Pagination, Input, RichEditorToolbar 등 다수 컴포넌트가 사용합니다.
|
|
26
|
+
- `react-router` — `Sidebar`가 내부적으로 `useNavigate`/`useLocation`을 사용합니다.
|
|
27
|
+
|
|
28
|
+
### 선택 peer dependency
|
|
29
|
+
|
|
30
|
+
특정 컴포넌트를 쓸 때만 필요합니다. 해당 컴포넌트를 쓰지 않으면 설치하지 않아도 됩니다.
|
|
31
|
+
|
|
32
|
+
| 패키지 | 필요한 컴포넌트 |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `react-hook-form`, `@hookform/resolvers`, `zod` | `SubmitForm` |
|
|
35
|
+
| `react-daum-postcode` | `SearchAddress` |
|
|
24
36
|
|
|
25
|
-
|
|
37
|
+
## 스타일 설정
|
|
26
38
|
|
|
27
|
-
|
|
39
|
+
두 가지 방법 중 하나를 선택합니다.
|
|
28
40
|
|
|
29
|
-
|
|
30
|
-
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
|
31
|
-
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
32
|
-
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
33
|
-
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
|
41
|
+
**옵션 A — 컴파일된 CSS 그대로 사용** (Tailwind를 직접 쓰지 않는 프로젝트)
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
```ts
|
|
44
|
+
import "@farmzone/fz-react-ui/styles";
|
|
45
|
+
```
|
|
36
46
|
|
|
37
|
-
|
|
47
|
+
**옵션 B — 컨슈머 프로젝트의 Tailwind v4 빌드에 통합** (권장, 트리쉐이킹됨)
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
|
49
|
+
```css
|
|
50
|
+
/* 프로젝트의 Tailwind 진입 CSS 파일에 추가 */
|
|
51
|
+
@import "@farmzone/fz-react-ui/tw.css";
|
|
52
|
+
```
|
|
44
53
|
|
|
45
|
-
|
|
54
|
+
`tw.css`는 fz-react-ui의 컴파일된 JS를 `@source`로 스캔하고, 라이브러리 전용 색상 토큰(`--color-main-red` 등)을 `@theme`으로 노출합니다. 컨슈머 프로젝트도 Tailwind v4를 쓰고 있어야 합니다.
|
|
46
55
|
|
|
47
|
-
|
|
56
|
+
## 사용 예시
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
```tsx
|
|
59
|
+
import { Button, Input, Table } from "@farmzone/fz-react-ui";
|
|
60
|
+
import type { Column } from "@farmzone/fz-react-ui";
|
|
50
61
|
|
|
51
|
-
|
|
62
|
+
function UserSearch() {
|
|
63
|
+
const [name, setName] = useState("");
|
|
52
64
|
|
|
53
|
-
|
|
65
|
+
return (
|
|
66
|
+
<div className="flex flex-col gap-3">
|
|
67
|
+
<div className="flex items-end gap-2">
|
|
68
|
+
<Input label="이름" value={name} onChange={(e) => setName(e.target.value)} />
|
|
69
|
+
<Button variant="search" size="sm">검색</Button>
|
|
70
|
+
</div>
|
|
71
|
+
<Table columns={columns as Array<Column<unknown>>} data={rows} rowKey="id" />
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
54
76
|
|
|
55
|
-
|
|
56
|
-
Choose a self-explaining name for your project.
|
|
77
|
+
컴포넌트 조합 시 임의의 Tailwind 팔레트 클래스(`bg-blue-600` 등)보다 라이브러리 자체 semantic 토큰(`bg-main`, `Button`의 `variant`/`size` prop 등)을 우선 사용하세요 — 컴파일된 CSS에 없는 클래스는 조용히 무시됩니다.
|
|
57
78
|
|
|
58
|
-
##
|
|
59
|
-
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
79
|
+
## 컴포넌트
|
|
60
80
|
|
|
61
|
-
|
|
62
|
-
|
|
81
|
+
**Form / Input**
|
|
82
|
+
`Input`, `Textarea`, `Checkbox`, `Switch`, `Slider`, `Radio` / `RadioGroup`, `Select` / `SelectGroup`, `DatePicker`, `SearchBar`, `SearchAddress`, `SubmitForm`, `DebouncedButton`
|
|
63
83
|
|
|
64
|
-
|
|
65
|
-
|
|
84
|
+
**Feedback / Overlay**
|
|
85
|
+
`Modal`, `ToastProvider` (+ `toast`), `Tooltip`, `Popover` / `SimplePopover`, `Empty`, `Loading` / `LoadingOverlay`, `Spinner`, `Skeleton`, `confirmModal`
|
|
66
86
|
|
|
67
|
-
|
|
68
|
-
|
|
87
|
+
**Layout / Navigation**
|
|
88
|
+
`Sidebar`, `Tab`, `MultiTab`, `BreadCrumb`, `Pagination`, `PageFilter`, `ScrollArea`
|
|
69
89
|
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
**Data Display**
|
|
91
|
+
`Table`, `Badge`, `Carousel`, `FilePreviewViewer`, `DetailModalFrame` / `DetailPageFrame` / `DetailContent`
|
|
72
92
|
|
|
73
|
-
|
|
74
|
-
|
|
93
|
+
**Upload**
|
|
94
|
+
`BaseUploader`, `ExcelUploader`, `FileUploader`
|
|
75
95
|
|
|
76
|
-
|
|
77
|
-
|
|
96
|
+
**Editor**
|
|
97
|
+
`RichEditor` (+ `RichEditorContent`, `RichEditorToolbar`, `useRichEditor`) — tiptap 기반 리치 텍스트 에디터. 멘션, 테이블, 이미지, 정렬 등을 지원합니다.
|
|
78
98
|
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
**Hooks**
|
|
100
|
+
`useModal`, `useCustomBlocker`, `useBlockModalConfirm`, `useScrollToTop`, `useFilePreviewViewer`, `useParams`, `useMultiTabStore`, `useBreadCrumbItems`
|
|
81
101
|
|
|
82
|
-
|
|
102
|
+
**Utils**
|
|
103
|
+
`cn`, `buttonVariants`, `textVariants`, `Z_INDEX`
|
|
83
104
|
|
|
84
|
-
|
|
105
|
+
전체 export 목록과 정확한 타입은 `dist/index.d.ts`를 참고하세요.
|
|
85
106
|
|
|
86
|
-
##
|
|
87
|
-
|
|
107
|
+
## 로컬 개발
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pnpm i --frozen-lockfile # 이 리포는 pnpm 사용
|
|
111
|
+
pnpm dev # tsup watch 빌드
|
|
112
|
+
pnpm storybook # Storybook (localhost:6006)
|
|
113
|
+
pnpm build # dist/ 전체 빌드 (JS + CSS)
|
|
114
|
+
pnpm lint
|
|
115
|
+
pnpm typecheck
|
|
116
|
+
```
|
|
88
117
|
|
|
89
|
-
##
|
|
90
|
-
For open source projects, say how it is licensed.
|
|
118
|
+
## 배포
|
|
91
119
|
|
|
92
|
-
|
|
93
|
-
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
120
|
+
`main` 브랜치에 머지되면 GitLab CI가 `npm publish`를 실행합니다 (`.gitlab-ci.yml`). 배포 전 `package.json`의 `version`을 수동으로 올려야 합니다 — 특히 `peerDependencies` 변경처럼 컨슈머 쪽 설치 요구사항이 바뀌는 경우 최소 minor 버전을 올리세요.
|