@sonamu-kit/react-components 0.1.0 โ†’ 0.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.
Files changed (146) hide show
  1. package/dist/components/index.d.ts +65 -0
  2. package/dist/components/ui/accordion.d.ts +7 -0
  3. package/dist/components/ui/alert-dialog.d.ts +20 -0
  4. package/dist/components/ui/alert.d.ts +8 -0
  5. package/dist/components/ui/aspect-ratio.d.ts +3 -0
  6. package/dist/components/ui/async-select.d.ts +36 -0
  7. package/dist/components/ui/avatar.d.ts +6 -0
  8. package/dist/components/ui/badge.d.ts +9 -0
  9. package/dist/components/ui/breadcrumb.d.ts +19 -0
  10. package/dist/components/ui/button.d.ts +13 -0
  11. package/dist/components/ui/calendar.d.ts +5 -0
  12. package/dist/components/ui/card.d.ts +9 -0
  13. package/dist/components/ui/carousel.d.ts +18 -0
  14. package/dist/components/ui/checkbox.d.ts +8 -0
  15. package/dist/components/ui/collapsible.d.ts +5 -0
  16. package/dist/components/ui/combobox.d.ts +20 -0
  17. package/dist/components/ui/command.d.ts +80 -0
  18. package/dist/components/ui/common-modal.d.ts +28 -0
  19. package/dist/components/ui/context-menu.d.ts +27 -0
  20. package/dist/components/ui/date-input.d.ts +7 -0
  21. package/dist/components/ui/date-picker.d.ts +26 -0
  22. package/dist/components/ui/date-selector-multiple.d.ts +38 -0
  23. package/dist/components/ui/dialog.d.ts +19 -0
  24. package/dist/components/ui/drawer.d.ts +22 -0
  25. package/dist/components/ui/dropdown-menu.d.ts +27 -0
  26. package/dist/components/ui/form.d.ts +23 -0
  27. package/dist/components/ui/hover-card.d.ts +6 -0
  28. package/dist/components/ui/image-uploader.d.ts +14 -0
  29. package/dist/components/ui/input-otp.d.ts +34 -0
  30. package/dist/components/ui/input.d.ts +7 -0
  31. package/dist/components/ui/label.d.ts +5 -0
  32. package/dist/components/ui/menubar.d.ts +28 -0
  33. package/dist/components/ui/month-picker-multiple.d.ts +41 -0
  34. package/dist/components/ui/multi-image-uploader.d.ts +15 -0
  35. package/dist/components/ui/multi-select.d.ts +229 -0
  36. package/dist/components/ui/navigation-menu.d.ts +12 -0
  37. package/dist/components/ui/pagination.d.ts +10 -0
  38. package/dist/components/ui/popover.d.ts +7 -0
  39. package/dist/components/ui/progress.d.ts +4 -0
  40. package/dist/components/ui/radio-group.d.ts +5 -0
  41. package/dist/components/ui/resizable.d.ts +23 -0
  42. package/dist/components/ui/scroll-area.d.ts +5 -0
  43. package/dist/components/ui/select.d.ts +20 -0
  44. package/dist/components/ui/separator.d.ts +4 -0
  45. package/dist/components/ui/sheet.d.ts +25 -0
  46. package/dist/components/ui/sidebar.d.ts +69 -0
  47. package/dist/components/ui/skeleton.d.ts +2 -0
  48. package/dist/components/ui/slider.d.ts +8 -0
  49. package/dist/components/ui/sonner.d.ts +4 -0
  50. package/dist/components/ui/switch.d.ts +8 -0
  51. package/dist/components/ui/table.d.ts +24 -0
  52. package/dist/components/ui/tabs.d.ts +7 -0
  53. package/dist/components/ui/textarea.d.ts +7 -0
  54. package/dist/components/ui/toast.d.ts +15 -0
  55. package/dist/components/ui/toaster.d.ts +1 -0
  56. package/dist/components/ui/toggle-group.d.ts +12 -0
  57. package/dist/components/ui/toggle.d.ts +12 -0
  58. package/dist/components/ui/tooltip.d.ts +7 -0
  59. package/dist/hooks/index.d.ts +1 -0
  60. package/dist/hooks/use-toast.d.ts +44 -0
  61. package/dist/index.d.ts +3 -0
  62. package/dist/lib/caster.d.ts +3 -0
  63. package/dist/lib/helpers.d.ts +72 -0
  64. package/dist/lib/index.d.ts +6 -0
  65. package/{src/lib/lazy-upload.ts โ†’ dist/lib/lazy-upload.d.ts} +1 -12
  66. package/dist/lib/use-mobile.d.ts +1 -0
  67. package/dist/lib/utils.d.ts +2 -0
  68. package/dist/react-components.es.js +28375 -0
  69. package/package.json +105 -76
  70. package/COMPONENTS_LIST.md +0 -106
  71. package/COMPONENTS_STATUS.md +0 -114
  72. package/HELPERS_GUIDE.md +0 -489
  73. package/MIGRATION_PLAN.md +0 -404
  74. package/SETUP_GUIDE.md +0 -125
  75. package/components.json +0 -21
  76. package/postcss.config.js +0 -6
  77. package/src/components/index.ts +0 -315
  78. package/src/components/ui/accordion.tsx +0 -54
  79. package/src/components/ui/alert-dialog.tsx +0 -115
  80. package/src/components/ui/alert.tsx +0 -49
  81. package/src/components/ui/aspect-ratio.tsx +0 -5
  82. package/src/components/ui/async-select.tsx +0 -186
  83. package/src/components/ui/avatar.tsx +0 -45
  84. package/src/components/ui/badge.tsx +0 -38
  85. package/src/components/ui/breadcrumb.tsx +0 -102
  86. package/src/components/ui/button.tsx +0 -54
  87. package/src/components/ui/calendar.tsx +0 -193
  88. package/src/components/ui/card.tsx +0 -65
  89. package/src/components/ui/carousel.tsx +0 -243
  90. package/src/components/ui/checkbox.tsx +0 -67
  91. package/src/components/ui/collapsible.tsx +0 -9
  92. package/src/components/ui/combobox.tsx +0 -135
  93. package/src/components/ui/command.tsx +0 -143
  94. package/src/components/ui/common-modal.tsx +0 -95
  95. package/src/components/ui/context-menu.tsx +0 -189
  96. package/src/components/ui/date-picker.tsx +0 -112
  97. package/src/components/ui/date-selector-multiple.tsx +0 -197
  98. package/src/components/ui/dialog.tsx +0 -104
  99. package/src/components/ui/drawer.tsx +0 -100
  100. package/src/components/ui/dropdown-menu.tsx +0 -189
  101. package/src/components/ui/form.tsx +0 -171
  102. package/src/components/ui/hover-card.tsx +0 -27
  103. package/src/components/ui/image-uploader.tsx +0 -251
  104. package/src/components/ui/input-otp.tsx +0 -69
  105. package/src/components/ui/input.tsx +0 -38
  106. package/src/components/ui/label.tsx +0 -19
  107. package/src/components/ui/menubar.tsx +0 -231
  108. package/src/components/ui/month-picker-multiple.tsx +0 -351
  109. package/src/components/ui/multi-image-uploader.tsx +0 -283
  110. package/src/components/ui/multi-select.tsx +0 -1143
  111. package/src/components/ui/navigation-menu.tsx +0 -120
  112. package/src/components/ui/pagination.tsx +0 -72
  113. package/src/components/ui/popover.tsx +0 -42
  114. package/src/components/ui/progress.tsx +0 -25
  115. package/src/components/ui/radio-group.tsx +0 -38
  116. package/src/components/ui/resizable.tsx +0 -42
  117. package/src/components/ui/scroll-area.tsx +0 -46
  118. package/src/components/ui/select.tsx +0 -235
  119. package/src/components/ui/separator.tsx +0 -24
  120. package/src/components/ui/sheet.tsx +0 -119
  121. package/src/components/ui/sidebar.tsx +0 -683
  122. package/src/components/ui/skeleton.tsx +0 -7
  123. package/src/components/ui/slider.tsx +0 -57
  124. package/src/components/ui/sonner.tsx +0 -39
  125. package/src/components/ui/switch.tsx +0 -63
  126. package/src/components/ui/table.tsx +0 -94
  127. package/src/components/ui/tabs.tsx +0 -53
  128. package/src/components/ui/textarea.tsx +0 -34
  129. package/src/components/ui/toast.tsx +0 -122
  130. package/src/components/ui/toaster.tsx +0 -29
  131. package/src/components/ui/toggle-group.tsx +0 -55
  132. package/src/components/ui/toggle.tsx +0 -41
  133. package/src/components/ui/tooltip.tsx +0 -28
  134. package/src/hooks/index.ts +0 -2
  135. package/src/hooks/use-toast.ts +0 -189
  136. package/src/icons.d.ts +0 -1
  137. package/src/index.ts +0 -4
  138. package/src/lib/caster.ts +0 -66
  139. package/src/lib/helpers.ts +0 -394
  140. package/src/lib/index.ts +0 -31
  141. package/src/lib/use-mobile.ts +0 -19
  142. package/src/lib/utils.ts +0 -6
  143. package/src/styles/globals.css +0 -658
  144. package/tailwind.config.ts +0 -8
  145. package/tsconfig.json +0 -31
  146. package/tsconfig.node.json +0 -11
package/HELPERS_GUIDE.md DELETED
@@ -1,489 +0,0 @@
1
- # shadcn/ui Helpers ์‚ฌ์šฉ ๊ฐ€์ด๋“œ
2
-
3
- `@sonamu-kit/react-components`์˜ helpers๋Š” **semantic-ui-react์™€ shadcn/ui ๋ชจ๋‘ ์ง€์›**ํ•˜๋Š” ๋ฒ”์šฉ helper์ž…๋‹ˆ๋‹ค.
4
-
5
- ## โœจ ํ•ต์‹ฌ ํŠน์ง•
6
-
7
- - โœ… **semantic-ui-react์™€ shadcn/ui ๋ชจ๋‘ ๋™์ผํ•˜๊ฒŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅ**
8
- - โœ… **`{...register("field")}` ํŒจํ„ด์œผ๋กœ ๊ฐ„๋‹จํ•œ ์‚ฌ์šฉ**
9
- - โœ… **์ปดํฌ๋„ŒํŠธ๋ณ„ onChange ์ฐจ์ด ์ž๋™ ์ฒ˜๋ฆฌ**
10
- - โœ… **URL ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ ์ž๋™ ์—ฐ๋™** (useListParams)
11
-
12
- ---
13
-
14
- ## ๐Ÿ“ฆ Import
15
-
16
- ```typescript
17
- import { useTypeForm, useListParams } from "@sonamu-kit/react-components/lib";
18
- ```
19
-
20
- ---
21
-
22
- ## ๐ŸŽฏ useListParams
23
-
24
- URL ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ์™€ ์ž๋™ ์—ฐ๋™๋˜๋Š” ๋ฆฌ์ŠคํŠธ ํŒŒ๋ผ๋ฏธํ„ฐ ๊ด€๋ฆฌ Hook
25
-
26
- ### shadcn/ui ์‚ฌ์šฉ๋ฒ•
27
-
28
- ```typescript
29
- import { useListParams } from "@sonamu-kit/react-components/lib";
30
- import {
31
- Select,
32
- SelectTrigger,
33
- SelectValue,
34
- SelectContent,
35
- SelectItem,
36
- Input,
37
- } from "@sonamu-kit/react-components/components";
38
- import { z } from "zod";
39
-
40
- // Zod ์Šคํ‚ค๋งˆ ์ •์˜
41
- const FeedSiteListParams = z.object({
42
- num: z.number(),
43
- page: z.number(),
44
- orderBy: z.string(),
45
- search: z.string(),
46
- keyword: z.string().optional(),
47
- });
48
-
49
- function FeedSiteList() {
50
- const { listParams, register } = useListParams(FeedSiteListParams, {
51
- num: 10,
52
- page: 1,
53
- orderBy: "id-desc",
54
- search: "id",
55
- keyword: "",
56
- });
57
-
58
- return (
59
- <div>
60
- {/* ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ์— register๋ฅผ ๊ทธ๋Œ€๋กœ ์Šคํ”„๋ ˆ๋“œ */}
61
-
62
- {/* Search Type Select */}
63
- <Select {...register("search")}>
64
- <SelectTrigger>
65
- <SelectValue />
66
- </SelectTrigger>
67
- <SelectContent>
68
- <SelectItem value="id">Search ID</SelectItem>
69
- <SelectItem value="title">Search Name</SelectItem>
70
- </SelectContent>
71
- </Select>
72
-
73
- {/* Search Input */}
74
- <Input {...register("keyword")} placeholder="Search..." />
75
-
76
- {/* Order By Select */}
77
- <Select {...register("orderBy")}>
78
- <SelectTrigger>
79
- <SelectValue />
80
- </SelectTrigger>
81
- <SelectContent>
82
- <SelectItem value="id-desc">Recently</SelectItem>
83
- <SelectItem value="id-asc">Oldest</SelectItem>
84
- </SelectContent>
85
- </Select>
86
- </div>
87
- );
88
- }
89
- ```
90
-
91
- ### semantic-ui-react ์‚ฌ์šฉ๋ฒ•
92
-
93
- ```typescript
94
- import { useListParams } from "@sonamu-kit/react-components/lib";
95
- import { FeedSiteSearchInput } from "src/components/feed-site/FeedSiteSearchInput";
96
- import { FeedSiteOrderBySelect } from "src/components/feed-site/FeedSiteOrderBySelect";
97
-
98
- function FeedSiteList() {
99
- const { listParams, register } = useListParams(FeedSiteListParams, {
100
- num: 12,
101
- page: 1,
102
- orderBy: "id-desc",
103
- search: "id",
104
- });
105
-
106
- return (
107
- <div>
108
- {/* semantic-ui-react๋„ ๋™์ผํ•˜๊ฒŒ ์‚ฌ์šฉ */}
109
- <FeedSiteSearchInput
110
- input={register("keyword")}
111
- dropdown={register("search")}
112
- />
113
-
114
- <FeedSiteOrderBySelect {...register("orderBy")} />
115
- </div>
116
- );
117
- }
118
- ```
119
-
120
- ### API
121
-
122
- #### `useListParams(schema, defaultValue, options?)`
123
-
124
- **Parameters:**
125
-
126
- - `schema`: Zod ์Šคํ‚ค๋งˆ
127
- - `defaultValue`: ๊ธฐ๋ณธ๊ฐ’
128
- - `options`: (์„ ํƒ)
129
- - `disableSearchParams?: boolean` - URL ํŒŒ๋ผ๋ฏธํ„ฐ ์—ฐ๋™ ๋น„ํ™œ์„ฑํ™”
130
-
131
- **Returns:**
132
-
133
- - `listParams`: ํ˜„์žฌ ํŒŒ๋ผ๋ฏธํ„ฐ ๊ฐ’
134
- - `setListParams`: ํŒŒ๋ผ๋ฏธํ„ฐ ์ „์ฒด ์—…๋ฐ์ดํŠธ
135
- - `register(name)`: ์ปดํฌ๋„ŒํŠธ์™€ ์—ฐ๊ฒฐํ•  props ๋ฐ˜ํ™˜
136
- - `registerInput(name)`: Input ์ „์šฉ (ํ•„์š” ์‹œ)
137
- - `registerSelect(name)`: Select ์ „์šฉ (ํ•„์š” ์‹œ)
138
- - `registerCheckbox(name)`: Checkbox ์ „์šฉ (ํ•„์š” ์‹œ)
139
- - `updateParams(updates)`: ๋ถ€๋ถ„ ์—…๋ฐ์ดํŠธ
140
-
141
- #### `register(name)` ๋ฐ˜ํ™˜ ๊ฐ’
142
-
143
- ```typescript
144
- {
145
- name: string;
146
- value: any;
147
- checked: boolean;
148
- // semantic-ui-react: onChange(e, { value })
149
- // shadcn/ui Input: onChange(e)
150
- onChange: (e: any, data?: { value: any; checked?: boolean }) => void;
151
- // shadcn/ui Select: onValueChange(value)
152
- onValueChange: (value: any) => void;
153
- // shadcn/ui Checkbox: onCheckedChange(checked)
154
- onCheckedChange: (checked: boolean) => void;
155
- }
156
- ```
157
-
158
- **ํ•ต์‹ฌ**: ๋ชจ๋“  ํ•ธ๋“ค๋Ÿฌ๋ฅผ ๋™์‹œ์— ์ œ๊ณตํ•˜๋ฏ€๋กœ, ๊ฐ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ž์‹ ์—๊ฒŒ ํ•„์š”ํ•œ ํ•ธ๋“ค๋Ÿฌ๋งŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
159
-
160
- ---
161
-
162
- ## ๐Ÿ“ useTypeForm
163
-
164
- Form ์ƒํƒœ ๊ด€๋ฆฌ ๋ฐ Validation Hook
165
-
166
- ### shadcn/ui ์‚ฌ์šฉ๋ฒ•
167
-
168
- ```typescript
169
- import { useTypeForm } from "@sonamu-kit/react-components/lib";
170
- import {
171
- Input,
172
- Select,
173
- SelectTrigger,
174
- SelectValue,
175
- SelectContent,
176
- SelectItem,
177
- Checkbox,
178
- } from "@sonamu-kit/react-components/components";
179
- import { z } from "zod";
180
-
181
- // Zod ์Šคํ‚ค๋งˆ ์ •์˜
182
- const FeedSiteSchema = z.object({
183
- title: z.string(),
184
- list_url: z.string().url(),
185
- crawling_status: z.enum(["active", "stopped"]),
186
- is_enabled: z.boolean(),
187
- });
188
-
189
- function FeedSiteForm() {
190
- const { form, setForm, register, reset } = useTypeForm(FeedSiteSchema, {
191
- title: "",
192
- list_url: "",
193
- crawling_status: "active",
194
- is_enabled: true,
195
- });
196
-
197
- const handleSubmit = async () => {
198
- try {
199
- await FeedSiteService.save(form);
200
- reset();
201
- } catch (error) {
202
- console.error(error);
203
- }
204
- };
205
-
206
- return (
207
- <form>
208
- {/* ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ์— register๋ฅผ ๊ทธ๋Œ€๋กœ ์Šคํ”„๋ ˆ๋“œ */}
209
-
210
- {/* Input */}
211
- <Input {...register("title")} placeholder="Site Name" />
212
- <Input {...register("list_url")} placeholder="https://example.com" />
213
-
214
- {/* Select */}
215
- <Select {...register("crawling_status")}>
216
- <SelectTrigger>
217
- <SelectValue />
218
- </SelectTrigger>
219
- <SelectContent>
220
- <SelectItem value="active">Active</SelectItem>
221
- <SelectItem value="stopped">Stopped</SelectItem>
222
- </SelectContent>
223
- </Select>
224
-
225
- {/* Checkbox */}
226
- <Checkbox {...register("is_enabled")} />
227
-
228
- <Button onClick={handleSubmit}>Save</Button>
229
- <Button onClick={reset}>Reset</Button>
230
- </form>
231
- );
232
- }
233
- ```
234
-
235
- ### semantic-ui-react ์‚ฌ์šฉ๋ฒ•
236
-
237
- ```typescript
238
- import { useTypeForm } from "@sonamu-kit/react-components/lib";
239
- import { Form, Input, Dropdown, Checkbox } from "semantic-ui-react";
240
-
241
- function FeedSiteForm() {
242
- const { form, setForm, register, reset } = useTypeForm(
243
- FeedSiteSchema,
244
- defaultValue
245
- );
246
-
247
- return (
248
- <Form>
249
- {/* semantic-ui-react๋„ ๋™์ผํ•˜๊ฒŒ ์‚ฌ์šฉ */}
250
- <Form.Field>
251
- <label>Site Name</label>
252
- <Input {...register("title")} />
253
- </Form.Field>
254
-
255
- <Form.Field>
256
- <label>Status</label>
257
- <Dropdown
258
- {...register("crawling_status")}
259
- options={[
260
- { key: "active", value: "active", text: "Active" },
261
- { key: "stopped", value: "stopped", text: "Stopped" },
262
- ]}
263
- />
264
- </Form.Field>
265
-
266
- <Form.Field>
267
- <Checkbox {...register("is_enabled")} label="Enabled" />
268
- </Form.Field>
269
- </Form>
270
- );
271
- }
272
- ```
273
-
274
- ### API
275
-
276
- #### `useTypeForm(schema, defaultValue)`
277
-
278
- **Parameters:**
279
-
280
- - `schema`: Zod ์Šคํ‚ค๋งˆ
281
- - `defaultValue`: ๊ธฐ๋ณธ๊ฐ’
282
-
283
- **Returns:**
284
-
285
- - `form`: ํ˜„์žฌ form ์ƒํƒœ
286
- - `setForm`: form ์ƒํƒœ ์—…๋ฐ์ดํŠธ
287
- - `register(path)`: ์ปดํฌ๋„ŒํŠธ์™€ ์—ฐ๊ฒฐ (๋ฒ”์šฉ)
288
- - `registerInput(path)`: Input/Textarea ์ „์šฉ
289
- - `registerSelect(path)`: Select/RadioGroup ์ „์šฉ
290
- - `registerCheckbox(path)`: Checkbox/Switch ์ „์šฉ
291
- - `addError(path, message)`: ์—๋Ÿฌ ์ถ”๊ฐ€
292
- - `removeError(path)`: ์—๋Ÿฌ ์ œ๊ฑฐ
293
- - `clearError()`: ๋ชจ๋“  ์—๋Ÿฌ ์ œ๊ฑฐ
294
- - `reset()`: ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋ฆฌ์…‹
295
-
296
- ---
297
-
298
- ## ๐Ÿ” ๋‚ด๋ถ€ ๋™์ž‘ ์›๋ฆฌ
299
-
300
- ### ๋ฌธ์ œ: shadcn/ui์™€ semantic-ui-react์˜ onChange ์ฐจ์ด
301
-
302
- **semantic-ui-react** (ํ†ต์ผ๋œ ํŒจํ„ด):
303
-
304
- ```typescript
305
- onChange={(e, { value }) => setValue(value)}
306
- ```
307
-
308
- **shadcn/ui** (์ปดํฌ๋„ŒํŠธ๋ณ„ ๋‹ค๋ฅธ ํŒจํ„ด):
309
-
310
- - `Input`: `onChange={(e) => setValue(e.target.value)}`
311
- - `Select`: `onValueChange={(value) => setValue(value)}`
312
- - `Checkbox`: `onCheckedChange={(checked) => setChecked(checked)}`
313
-
314
- ### ํ•ด๊ฒฐ: ๋ชจ๋“  ํ•ธ๋“ค๋Ÿฌ๋ฅผ ๋™์‹œ์— ์ œ๊ณต
315
-
316
- `register()`๊ฐ€ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฐ์ฒด๋Š” **๋ชจ๋“  ํ•ธ๋“ค๋Ÿฌ๋ฅผ ํฌํ•จ**ํ•ฉ๋‹ˆ๋‹ค:
317
-
318
- ```typescript
319
- {
320
- name: "field",
321
- value: "...",
322
- checked: true/false,
323
- onChange: (e, data?) => { /* ๋ฒ”์šฉ ํ•ธ๋“ค๋Ÿฌ */ },
324
- onValueChange: (value) => { /* Select์šฉ */ },
325
- onCheckedChange: (checked) => { /* Checkbox์šฉ */ },
326
- }
327
- ```
328
-
329
- ์ด๋ฅผ `{...register("field")}`๋กœ ์Šคํ”„๋ ˆ๋“œํ•˜๋ฉด:
330
-
331
- - `Input`์€ `onChange`๋งŒ ์‚ฌ์šฉ
332
- - `Select`๋Š” `onValueChange`๋งŒ ์‚ฌ์šฉ
333
- - `Checkbox`๋Š” `onCheckedChange`๋งŒ ์‚ฌ์šฉ
334
-
335
- ๊ฐ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ž์‹ ์—๊ฒŒ ํ•„์š”ํ•œ ํ•ธ๋“ค๋Ÿฌ๋งŒ ์„ ํƒ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค! ๐ŸŽ‰
336
-
337
- ---
338
-
339
- ## ๐Ÿ’ก ์‚ฌ์šฉ ํŒ
340
-
341
- ### 1. ๊ฐ„๋‹จํ•œ ์‚ฌ์šฉ๋ฒ•
342
-
343
- ```typescript
344
- // โœ… ์ด๋ ‡๊ฒŒ ๊ฐ„๋‹จํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜์„ธ์š”
345
- <Input {...register("keyword")} />
346
- <Select {...register("orderBy")}>...</Select>
347
- <Checkbox {...register("isActive")} />
348
-
349
- // โŒ ๋ณต์žกํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ํ•„์š” ์—†์Œ
350
- <Input
351
- value={register("keyword").value}
352
- onChange={(e) => register("keyword").onChange(e, { value: e.target.value })}
353
- />
354
- ```
355
-
356
- ### 2. semantic-ui-react ํ˜ธํ™˜
357
-
358
- ```typescript
359
- // FeedSiteSearchInput ๊ฐ™์€ ์ปค์Šคํ…€ ์ปดํฌ๋„ŒํŠธ
360
- <FeedSiteSearchInput
361
- input={register("keyword")}
362
- dropdown={register("search")}
363
- />
364
-
365
- // ๊ธฐ๋ณธ semantic-ui-react ์ปดํฌ๋„ŒํŠธ
366
- <Dropdown {...register("category")} options={options} />
367
- ```
368
-
369
- ### 3. URL ํŒŒ๋ผ๋ฏธํ„ฐ ์ž๋™ ์—ฐ๋™
370
-
371
- ```typescript
372
- const { listParams } = useListParams(Schema, defaultValue);
373
-
374
- // URL: /admin/feed-sites?keyword=test&search=title
375
- console.log(listParams.keyword); // "test"
376
- console.log(listParams.search); // "title"
377
-
378
- // register๋กœ Input์„ ๋ณ€๊ฒฝํ•˜๋ฉด URL๋„ ์ž๋™์œผ๋กœ ์—…๋ฐ์ดํŠธ๋จ
379
- <Input {...register("keyword")} />;
380
- ```
381
-
382
- ### 4. ์ง์ ‘ ๊ฐ’ ์—…๋ฐ์ดํŠธ
383
-
384
- ```typescript
385
- const { listParams, updateParams } = useListParams(Schema, defaultValue);
386
-
387
- // ํŽ˜์ด์ง€๋„ค์ด์…˜ ๋“ฑ์—์„œ ์ง์ ‘ ์—…๋ฐ์ดํŠธ
388
- updateParams({ page: 2 });
389
-
390
- // ๋˜๋Š”
391
- setListParams({ ...listParams, page: 2 });
392
- ```
393
-
394
- ---
395
-
396
- ## ๐ŸŽฏ ์‹ค์ „ ์˜ˆ์ œ
397
-
398
- ### ์™„์ „ํ•œ Feed Sites ๋ฆฌ์ŠคํŠธ ํŽ˜์ด์ง€
399
-
400
- `src/pages/admin/feed-sites/index-ui.tsx` ์ฐธ๊ณ 
401
-
402
- ```typescript
403
- import { useListParams } from "@sonamu-kit/react-componentslib";
404
- import {
405
- Select,
406
- SelectTrigger,
407
- SelectValue,
408
- SelectContent,
409
- SelectItem,
410
- Input,
411
- } from "@sonamu-kit/react-components/components";
412
- import { FeedSiteService } from "src/services/feed-site/feed-site.service";
413
- import { FeedSiteListParams } from "src/services/feed-site/feed-site.types";
414
-
415
- function FeedSiteList() {
416
- // ๋ฆฌ์ŠคํŠธ ํŒŒ๋ผ๋ฏธํ„ฐ ๊ด€๋ฆฌ
417
- const { listParams, register } = useListParams(FeedSiteListParams, {
418
- num: 10,
419
- page: 1,
420
- orderBy: "id-desc",
421
- search: "id",
422
- keyword: "",
423
- });
424
-
425
- // API ํ˜ธ์ถœ (listParams๊ฐ€ ๋ณ€๊ฒฝ๋˜๋ฉด ์ž๋™์œผ๋กœ ์žฌํ˜ธ์ถœ)
426
- const { data, mutate, isLoading } = FeedSiteService.useFeedSites(
427
- "A",
428
- listParams
429
- );
430
- const { rows, total } = data ?? {};
431
-
432
- return (
433
- <div>
434
- {/* ํ•„ํ„ฐ ์˜์—ญ */}
435
- <div className="filters">
436
- <Select {...register("search")}>
437
- <SelectTrigger>
438
- <SelectValue />
439
- </SelectTrigger>
440
- <SelectContent>
441
- <SelectItem value="id">Search ID</SelectItem>
442
- <SelectItem value="title">Search Name</SelectItem>
443
- </SelectContent>
444
- </Select>
445
-
446
- <Input {...register("keyword")} placeholder="Search..." />
447
-
448
- <Select {...register("orderBy")}>
449
- <SelectTrigger>
450
- <SelectValue />
451
- </SelectTrigger>
452
- <SelectContent>
453
- <SelectItem value="id-desc">Recently</SelectItem>
454
- <SelectItem value="id-asc">Oldest</SelectItem>
455
- </SelectContent>
456
- </Select>
457
- </div>
458
-
459
- {/* ํ…Œ์ด๋ธ” */}
460
- <Table>
461
- <TableBody>
462
- {rows?.map((row) => (
463
- <TableRow key={row.id}>
464
- <TableCell>{row.title}</TableCell>
465
- <TableCell>{row.list_url}</TableCell>
466
- </TableRow>
467
- ))}
468
- </TableBody>
469
- </Table>
470
-
471
- {/* ํŽ˜์ด์ง€๋„ค์ด์…˜ */}
472
- <Pagination
473
- {...register("page")}
474
- totalPages={Math.ceil(total / listParams.num)}
475
- />
476
- </div>
477
- );
478
- }
479
- ```
480
-
481
- ---
482
-
483
- ## ๐Ÿ“š ๋” ์•Œ์•„๋ณด๊ธฐ
484
-
485
- - [shadcn/ui ๊ณต์‹ ๋ฌธ์„œ](https://ui.shadcn.com)
486
- - [MIGRATION_PLAN.md](./MIGRATION_PLAN.md) - ์ „์ฒด ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ๊ณ„ํš
487
- - [COMPONENTS_LIST.md](./COMPONENTS_LIST.md) - ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์ปดํฌ๋„ŒํŠธ ๋ชฉ๋ก
488
- - `src/pages/admin/feed-sites/index-ui.tsx` - ์‹ค์ œ ๊ตฌํ˜„ ์˜ˆ์ œ (shadcn/ui)
489
- - `src/pages/admin/feed-sites/index.tsx` - ์‹ค์ œ ๊ตฌํ˜„ ์˜ˆ์ œ (semantic-ui-react)