@poodle-kit/ui 0.1.0 → 0.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 poodle-kit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # @poodle-kit/ui
2
+
3
+ TypeScript와 Tailwind CSS로 만든 React UI 컴포넌트 라이브러리예요.
4
+
5
+ ## 📦 설치하기
6
+
7
+ ```bash
8
+ npm install @poodle-kit/ui
9
+ ```
10
+
11
+ ### 같이 필요한 패키지들
12
+
13
+ ```bash
14
+ npm install react@">=18" react-dom@">=18"
15
+ ```
16
+
17
+ ## 💡 사용 방법
18
+
19
+ ### 기본 예제
20
+
21
+ ```tsx
22
+ import { Button } from '@poodle-kit/ui';
23
+ import '@poodle-kit/ui/styles.css';
24
+
25
+ function App() {
26
+ return (
27
+ <Button
28
+ label="클릭해주세요"
29
+ variant="primary"
30
+ onClick={() => alert('클릭했어요!')}
31
+ />
32
+ );
33
+ }
34
+ ```
35
+
36
+ ### TypeScript와 함께 사용하기
37
+
38
+ ```tsx
39
+ import { Button, ButtonProps } from '@poodle-kit/ui';
40
+ import '@poodle-kit/ui/styles.css';
41
+
42
+ const MyButton: React.FC<ButtonProps> = (props) => {
43
+ return <Button {...props} />;
44
+ };
45
+ ```
46
+
47
+ ## 🎨 컴포넌트
48
+
49
+ ### Button
50
+
51
+ 다양한 스타일과 크기를 지원하는 버튼 컴포넌트예요.
52
+
53
+ #### Props
54
+
55
+ | Prop | 타입 | 기본값 | 설명 |
56
+ | ----------- | ------------------------------------------------- | ----------- | ------------------------------- |
57
+ | `label` | `string` | - | 버튼에 표시될 텍스트 **(필수)** |
58
+ | `variant` | `"primary" \| "secondary" \| "ghost" \| "danger"` | `"primary"` | 버튼의 스타일 종류 |
59
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` | 버튼의 크기 |
60
+ | `fullWidth` | `boolean` | `false` | 버튼을 전체 너비로 만들기 |
61
+ | `disabled` | `boolean` | `false` | 버튼 비활성화하기 |
62
+ | `onClick` | `() => void` | - | 클릭 이벤트 핸들러 |
63
+
64
+ 일반적인 HTML button 속성들도 모두 사용할 수 있어요.
65
+
66
+ #### 예제
67
+
68
+ **다양한 스타일**
69
+
70
+ ```tsx
71
+ <Button label="Primary" variant="primary" />
72
+ <Button label="Secondary" variant="secondary" />
73
+ <Button label="Ghost" variant="ghost" />
74
+ <Button label="Danger" variant="danger" />
75
+ ```
76
+
77
+ **다양한 크기**
78
+
79
+ ```tsx
80
+ <Button label="작아요" size="sm" />
81
+ <Button label="보통이에요" size="md" />
82
+ <Button label="커요" size="lg" />
83
+ ```
84
+
85
+ **전체 너비로 만들기**
86
+
87
+ ```tsx
88
+ <Button label="전체 너비 버튼" fullWidth />
89
+ ```
90
+
91
+ **비활성화 상태**
92
+
93
+ ```tsx
94
+ <Button label="비활성화된 버튼" disabled />
95
+ ```
96
+
97
+ ## 🎨 스타일링
98
+
99
+ 이 라이브러리는 Tailwind CSS를 사용해요. 스타일을 꼭 import 해주세요:
100
+
101
+ ```tsx
102
+ import '@poodle-kit/ui/styles.css';
103
+ ```
104
+
105
+ ### 커스텀 스타일 적용하기
106
+
107
+ className을 통해 추가 스타일을 적용할 수 있어요:
108
+
109
+ ```tsx
110
+ <Button label="커스텀" className="my-custom-class" />
111
+ ```
112
+
113
+ ## 🔧 TypeScript 지원
114
+
115
+ TypeScript로 작성되어 완벽한 타입 정의를 제공해요.
116
+
117
+ ```tsx
118
+ import type { ButtonProps } from '@poodle-kit/ui';
119
+ ```
120
+
121
+ ## 🌐 브라우저 지원
122
+
123
+ - Chrome (최신 버전)
124
+ - Firefox (최신 버전)
125
+ - Safari (최신 버전)
126
+ - Edge (최신 버전)
127
+
128
+ ## 🛠️ 개발하기
129
+
130
+ ### 빌드
131
+
132
+ ```bash
133
+ npm run build
134
+ ```
135
+
136
+ ### Watch 모드
137
+
138
+ ```bash
139
+ npm run dev
140
+ ```
141
+
142
+ ## 📦 리포지토리
143
+
144
+ [GitHub](https://github.com/poodle-kit/poodle-kit/tree/main/packages/ui)
145
+
146
+ ## 📄 라이선스
147
+
148
+ MIT
@@ -0,0 +1,4 @@
1
+ import 'react';
2
+ import 'class-variance-authority/types';
3
+ import 'class-variance-authority';
4
+ export { E as ExistingImage, I as ImageUploader, b as ImageUploaderProps, N as NewImageFile, i as imageUploaderVariants } from '../../image-uploader-BFvQ4s0a.mjs';
@@ -0,0 +1,4 @@
1
+ import 'react';
2
+ import 'class-variance-authority/types';
3
+ import 'class-variance-authority';
4
+ export { E as ExistingImage, I as ImageUploader, b as ImageUploaderProps, N as NewImageFile, i as imageUploaderVariants } from '../../image-uploader-BFvQ4s0a.js';
@@ -0,0 +1,471 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/image-uploader/image-uploader.tsx
22
+ var image_uploader_exports = {};
23
+ __export(image_uploader_exports, {
24
+ ImageUploader: () => ImageUploader,
25
+ imageUploaderVariants: () => imageUploaderVariants
26
+ });
27
+ module.exports = __toCommonJS(image_uploader_exports);
28
+ var import_react2 = require("react");
29
+ var import_class_variance_authority = require("class-variance-authority");
30
+
31
+ // src/lib/cn.ts
32
+ var import_clsx = require("clsx");
33
+ var import_tailwind_merge = require("tailwind-merge");
34
+ function cn(...inputs) {
35
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
36
+ }
37
+
38
+ // src/icons/index.tsx
39
+ var import_jsx_runtime = require("react/jsx-runtime");
40
+ function createIcon(paths, defaultSize = 24) {
41
+ return function Icon({
42
+ width = defaultSize,
43
+ height = defaultSize,
44
+ ...props
45
+ }) {
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
+ "svg",
48
+ {
49
+ xmlns: "http://www.w3.org/2000/svg",
50
+ width,
51
+ height,
52
+ viewBox: "0 0 24 24",
53
+ fill: "none",
54
+ stroke: "currentColor",
55
+ strokeWidth: "2",
56
+ strokeLinecap: "round",
57
+ strokeLinejoin: "round",
58
+ "aria-hidden": "true",
59
+ ...props,
60
+ children: paths
61
+ }
62
+ );
63
+ };
64
+ }
65
+ var PlusIcon = createIcon(
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 12h14" }),
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 5v14" })
69
+ ] })
70
+ );
71
+ var XIcon = createIcon(
72
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }),
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })
75
+ ] }),
76
+ 12
77
+ );
78
+
79
+ // src/components/image-uploader/use-image-uploader.ts
80
+ var import_react = require("react");
81
+ function matchesAccept(file, accept) {
82
+ return accept.split(",").map((s) => s.trim().toLowerCase()).some((pattern) => {
83
+ if (pattern === "*" || pattern === "*/*") return true;
84
+ if (pattern.startsWith("."))
85
+ return file.name.toLowerCase().endsWith(pattern);
86
+ if (pattern.endsWith("/*"))
87
+ return file.type.startsWith(pattern.slice(0, -2));
88
+ return file.type === pattern;
89
+ });
90
+ }
91
+ function useImageUploader({
92
+ initialImages,
93
+ maxImages = 4,
94
+ maxSizeMb,
95
+ accept = "image/*",
96
+ onFileSelect,
97
+ onDeleteExisting,
98
+ onError
99
+ }) {
100
+ const [newImages, setNewImages] = (0, import_react.useState)([]);
101
+ const [deletedIds, setDeletedIds] = (0, import_react.useState)([]);
102
+ const [isDragActive, setIsDragActive] = (0, import_react.useState)(false);
103
+ const inputRef = (0, import_react.useRef)(null);
104
+ const onFileSelectRef = (0, import_react.useRef)(onFileSelect);
105
+ const onDeleteExistingRef = (0, import_react.useRef)(onDeleteExisting);
106
+ const onErrorRef = (0, import_react.useRef)(onError);
107
+ (0, import_react.useEffect)(() => {
108
+ onFileSelectRef.current = onFileSelect;
109
+ onDeleteExistingRef.current = onDeleteExisting;
110
+ onErrorRef.current = onError;
111
+ });
112
+ const newImagesRef = (0, import_react.useRef)([]);
113
+ const deletedIdsRef = (0, import_react.useRef)([]);
114
+ const existingCountRef = (0, import_react.useRef)(0);
115
+ const existingImages = (0, import_react.useMemo)(
116
+ () => (initialImages != null ? initialImages : []).filter(
117
+ (img) => !deletedIds.includes(img.id)
118
+ ),
119
+ [initialImages, deletedIds]
120
+ );
121
+ (0, import_react.useEffect)(() => {
122
+ newImagesRef.current = newImages;
123
+ }, [newImages]);
124
+ (0, import_react.useEffect)(() => {
125
+ deletedIdsRef.current = deletedIds;
126
+ }, [deletedIds]);
127
+ (0, import_react.useEffect)(() => {
128
+ existingCountRef.current = existingImages.length;
129
+ }, [existingImages.length]);
130
+ (0, import_react.useEffect)(() => {
131
+ return () => {
132
+ newImagesRef.current.forEach(
133
+ (item) => URL.revokeObjectURL(item.preview)
134
+ );
135
+ };
136
+ }, []);
137
+ const processFiles = (0, import_react.useCallback)(
138
+ (files) => {
139
+ const currentTotal = existingCountRef.current + newImagesRef.current.length;
140
+ const onErr = onErrorRef.current;
141
+ const onSelect = onFileSelectRef.current;
142
+ if (currentTotal >= maxImages) {
143
+ onErr == null ? void 0 : onErr({
144
+ type: "MAX_IMAGES",
145
+ message: `\uC774\uBBF8\uC9C0\uB294 \uCD5C\uB300 ${maxImages}\uC7A5\uAE4C\uC9C0 \uCD94\uAC00\uD560 \uC218 \uC788\uC5B4\uC694.`,
146
+ maxImages
147
+ });
148
+ return;
149
+ }
150
+ const remainingSlots = maxImages - currentTotal;
151
+ if (files.length > remainingSlots) {
152
+ onErr == null ? void 0 : onErr({
153
+ type: "MAX_IMAGES",
154
+ message: `\uC774\uBBF8\uC9C0\uB294 \uCD5C\uB300 ${maxImages}\uC7A5\uAE4C\uC9C0 \uCD94\uAC00\uD560 \uC218 \uC788\uC5B4\uC694.`,
155
+ maxImages
156
+ });
157
+ }
158
+ const validFiles = [];
159
+ for (const file of files.slice(0, remainingSlots)) {
160
+ if (!matchesAccept(file, accept)) {
161
+ onErr == null ? void 0 : onErr({
162
+ type: "INVALID_TYPE",
163
+ message: `\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC774\uC5D0\uC694.`,
164
+ file,
165
+ accept
166
+ });
167
+ continue;
168
+ }
169
+ if (maxSizeMb !== void 0 && file.size > maxSizeMb * 1024 * 1024) {
170
+ onErr == null ? void 0 : onErr({
171
+ type: "MAX_SIZE",
172
+ message: `${file.name}\uC758 \uD06C\uAE30\uAC00 ${maxSizeMb}MB\uB97C \uCD08\uACFC\uD574\uC694.`,
173
+ maxSizeMb,
174
+ file
175
+ });
176
+ continue;
177
+ }
178
+ validFiles.push({
179
+ file,
180
+ preview: URL.createObjectURL(file),
181
+ id: crypto.randomUUID()
182
+ });
183
+ }
184
+ if (validFiles.length === 0) return;
185
+ const next = [...newImagesRef.current, ...validFiles];
186
+ newImagesRef.current = next;
187
+ setNewImages(next);
188
+ onSelect == null ? void 0 : onSelect(next.map((item) => item.file));
189
+ },
190
+ [maxImages, accept, maxSizeMb]
191
+ );
192
+ const removeExisting = (0, import_react.useCallback)((id) => {
193
+ var _a;
194
+ const next = [...deletedIdsRef.current, id];
195
+ deletedIdsRef.current = next;
196
+ setDeletedIds(next);
197
+ (_a = onDeleteExistingRef.current) == null ? void 0 : _a.call(onDeleteExistingRef, next);
198
+ }, []);
199
+ const removeNew = (0, import_react.useCallback)((id) => {
200
+ var _a;
201
+ const current = newImagesRef.current;
202
+ const toRemove = current.find((item) => item.id === id);
203
+ if (toRemove) URL.revokeObjectURL(toRemove.preview);
204
+ const next = current.filter((item) => item.id !== id);
205
+ newImagesRef.current = next;
206
+ setNewImages(next);
207
+ (_a = onFileSelectRef.current) == null ? void 0 : _a.call(onFileSelectRef, next.map((item) => item.file));
208
+ }, []);
209
+ const handleChange = (0, import_react.useCallback)(
210
+ (e) => {
211
+ if (!e.target.files) return;
212
+ processFiles(Array.from(e.target.files));
213
+ e.target.value = "";
214
+ },
215
+ [processFiles]
216
+ );
217
+ const handleDragOver = (0, import_react.useCallback)((e) => {
218
+ e.preventDefault();
219
+ e.stopPropagation();
220
+ setIsDragActive(true);
221
+ }, []);
222
+ const handleDragLeave = (0, import_react.useCallback)((e) => {
223
+ e.preventDefault();
224
+ e.stopPropagation();
225
+ if (e.currentTarget.contains(e.relatedTarget)) return;
226
+ setIsDragActive(false);
227
+ }, []);
228
+ const handleDrop = (0, import_react.useCallback)(
229
+ (e) => {
230
+ e.preventDefault();
231
+ e.stopPropagation();
232
+ setIsDragActive(false);
233
+ processFiles(Array.from(e.dataTransfer.files));
234
+ },
235
+ [processFiles]
236
+ );
237
+ return {
238
+ existingImages,
239
+ newImages,
240
+ totalCount: existingImages.length + newImages.length,
241
+ isDragActive,
242
+ inputRef,
243
+ openFilePicker: () => {
244
+ var _a;
245
+ return (_a = inputRef.current) == null ? void 0 : _a.click();
246
+ },
247
+ removeExisting,
248
+ removeNew,
249
+ dragHandlers: {
250
+ onDragOver: handleDragOver,
251
+ onDragLeave: handleDragLeave,
252
+ onDrop: handleDrop
253
+ },
254
+ inputProps: {
255
+ onChange: handleChange,
256
+ accept,
257
+ multiple: true
258
+ }
259
+ };
260
+ }
261
+
262
+ // src/components/image-uploader/image-uploader.tsx
263
+ var import_jsx_runtime2 = require("react/jsx-runtime");
264
+ var imageUploaderVariants = (0, import_class_variance_authority.cva)("flex gap-2", {
265
+ variants: {
266
+ layout: {
267
+ /** 가로 스크롤 행 (기본값) */
268
+ row: "flex-row flex-nowrap overflow-x-auto",
269
+ /** 자동 줄바꿈 격자 */
270
+ grid: "flex-wrap"
271
+ }
272
+ },
273
+ defaultVariants: { layout: "row" }
274
+ });
275
+ function AddButton({
276
+ onClick,
277
+ disabled,
278
+ current,
279
+ max,
280
+ children
281
+ }) {
282
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
283
+ "button",
284
+ {
285
+ type: "button",
286
+ onClick,
287
+ disabled,
288
+ "aria-label": `\uC774\uBBF8\uC9C0 \uCD94\uAC00 (${current}/${max})`,
289
+ className: cn(
290
+ "shrink-0 w-20 h-20",
291
+ "flex flex-col items-center justify-center gap-1",
292
+ "rounded-lg",
293
+ "border-2 border-dashed border-border",
294
+ "bg-muted text-muted-foreground",
295
+ "cursor-pointer select-none",
296
+ "transition-colors duration-150",
297
+ "hover:bg-accent hover:text-accent-foreground hover:border-border",
298
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
299
+ "disabled:pointer-events-none disabled:opacity-50"
300
+ ),
301
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
302
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlusIcon, { className: "w-5 h-5" }),
303
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "text-[10px] font-medium leading-none tabular-nums", children: [
304
+ current,
305
+ "/",
306
+ max
307
+ ] })
308
+ ] })
309
+ }
310
+ );
311
+ }
312
+ function ImageItem({ src, alt, onRemove, disabled }) {
313
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "relative shrink-0 w-20 h-20 group/item", children: [
314
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
315
+ "img",
316
+ {
317
+ src,
318
+ alt,
319
+ draggable: false,
320
+ className: "w-full h-full object-cover rounded-lg"
321
+ }
322
+ ),
323
+ !disabled && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
324
+ "button",
325
+ {
326
+ type: "button",
327
+ onClick: onRemove,
328
+ "aria-label": `${alt} \uC0AD\uC81C`,
329
+ className: cn(
330
+ "absolute -top-1.5 -right-1.5",
331
+ "w-5 h-5 rounded-full",
332
+ "flex items-center justify-center",
333
+ "bg-foreground text-background",
334
+ "transition-all duration-150",
335
+ "opacity-0 scale-75",
336
+ "group-hover/item:opacity-100 group-hover/item:scale-100",
337
+ "group-focus-within/item:opacity-100 group-focus-within/item:scale-100",
338
+ "hover:scale-110 active:scale-90",
339
+ "focus-visible:opacity-100 focus-visible:scale-100",
340
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"
341
+ ),
342
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(XIcon, { strokeWidth: "2.5" })
343
+ }
344
+ )
345
+ ] });
346
+ }
347
+ var ImageUploader = (0, import_react2.forwardRef)(
348
+ ({
349
+ className,
350
+ layout,
351
+ disabled,
352
+ placeholder,
353
+ initialImages,
354
+ maxImages = 4,
355
+ maxSizeMb,
356
+ accept,
357
+ onFileSelect,
358
+ onDeleteExisting,
359
+ onError
360
+ }, ref) => {
361
+ const uid = (0, import_react2.useId)();
362
+ const {
363
+ existingImages,
364
+ newImages,
365
+ totalCount,
366
+ isDragActive,
367
+ inputRef,
368
+ openFilePicker,
369
+ removeExisting,
370
+ removeNew,
371
+ dragHandlers,
372
+ inputProps
373
+ } = useImageUploader({
374
+ initialImages,
375
+ maxImages,
376
+ maxSizeMb,
377
+ accept,
378
+ onFileSelect,
379
+ onDeleteExisting,
380
+ onError
381
+ });
382
+ const canAdd = !disabled && totalCount < maxImages;
383
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: cn("flex flex-col gap-2", className), children: [
384
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
385
+ "div",
386
+ {
387
+ role: "status",
388
+ "aria-live": "polite",
389
+ "aria-atomic": "true",
390
+ className: "sr-only",
391
+ children: totalCount > 0 ? `\uC774\uBBF8\uC9C0 ${totalCount}\uAC1C \uC120\uD0DD\uB428. \uCD5C\uB300 ${maxImages}\uAC1C\uAE4C\uC9C0 \uCD94\uAC00\uD560 \uC218 \uC788\uC5B4\uC694.` : `\uC774\uBBF8\uC9C0\uB97C \uCD94\uAC00\uD574\uC8FC\uC138\uC694. \uCD5C\uB300 ${maxImages}\uAC1C\uAE4C\uC9C0 \uCD94\uAC00\uD560 \uC218 \uC788\uC5B4\uC694.`
392
+ }
393
+ ),
394
+ isDragActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { role: "alert", className: "sr-only", children: "\uD30C\uC77C\uC744 \uC5EC\uAE30\uC5D0 \uB193\uC544\uC8FC\uC138\uC694" }),
395
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
396
+ "input",
397
+ {
398
+ ref: inputRef,
399
+ id: `${uid}-input`,
400
+ type: "file",
401
+ tabIndex: -1,
402
+ "aria-hidden": "true",
403
+ className: "sr-only",
404
+ disabled,
405
+ ...inputProps
406
+ }
407
+ ),
408
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
409
+ "div",
410
+ {
411
+ role: "group",
412
+ "aria-label": `\uC774\uBBF8\uC9C0 \uC5C5\uB85C\uB354, ${totalCount}/${maxImages}\uAC1C \uC120\uD0DD\uB428`,
413
+ className: cn(
414
+ imageUploaderVariants({ layout }),
415
+ "rounded-lg p-1 -ml-1",
416
+ "transition-all duration-200",
417
+ isDragActive && "ring-2 ring-primary ring-offset-2 bg-primary/5"
418
+ ),
419
+ ...canAdd ? dragHandlers : {},
420
+ children: [
421
+ canAdd && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
422
+ AddButton,
423
+ {
424
+ onClick: openFilePicker,
425
+ disabled,
426
+ current: totalCount,
427
+ max: maxImages,
428
+ children: placeholder
429
+ }
430
+ ),
431
+ sortBySequence(existingImages).map((img, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
432
+ ImageItem,
433
+ {
434
+ src: img.url,
435
+ alt: `\uC774\uBBF8\uC9C0 ${index + 1}`,
436
+ onRemove: () => removeExisting(img.id),
437
+ disabled
438
+ },
439
+ `existing-${img.id}`
440
+ )),
441
+ newImages.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
442
+ ImageItem,
443
+ {
444
+ src: item.preview,
445
+ alt: `\uC0C8 \uC774\uBBF8\uC9C0 ${existingImages.length + index + 1}`,
446
+ onRemove: () => removeNew(item.id),
447
+ disabled
448
+ },
449
+ `new-${item.id}`
450
+ ))
451
+ ]
452
+ }
453
+ )
454
+ ] });
455
+ }
456
+ );
457
+ ImageUploader.displayName = "ImageUploader";
458
+ function sortBySequence(images) {
459
+ return [...images].sort(
460
+ (a, b) => {
461
+ var _a, _b;
462
+ return ((_a = a.sequence) != null ? _a : 0) - ((_b = b.sequence) != null ? _b : 0);
463
+ }
464
+ );
465
+ }
466
+ // Annotate the CommonJS export names for ESM import in node:
467
+ 0 && (module.exports = {
468
+ ImageUploader,
469
+ imageUploaderVariants
470
+ });
471
+ //# sourceMappingURL=image-uploader.js.map