@farmzone/fz-react-ui 1.0.19 → 1.0.20
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/dist/index.cjs +272 -225
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +272 -225
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2429,6 +2429,8 @@ function DatePickerRange(props) {
|
|
|
2429
2429
|
endValue = "",
|
|
2430
2430
|
onRangeChange,
|
|
2431
2431
|
className = "",
|
|
2432
|
+
width,
|
|
2433
|
+
height,
|
|
2432
2434
|
editDateSelect = true,
|
|
2433
2435
|
onKeyDownEnter,
|
|
2434
2436
|
datePosition = "bottom",
|
|
@@ -2539,7 +2541,7 @@ function DatePickerRange(props) {
|
|
|
2539
2541
|
}
|
|
2540
2542
|
};
|
|
2541
2543
|
const inputClassName = cn(
|
|
2542
|
-
"w-full px-2 py-1.25 border border-gray-300 shadow-xs outline-none text-sm rounded-sm pr-7 transition-colors",
|
|
2544
|
+
"w-full h-full px-2 py-1.25 border border-gray-300 shadow-xs outline-none text-sm rounded-sm pr-7 transition-colors",
|
|
2543
2545
|
disabled ? DATE_PICKER_FIELD_DISABLED_CLASS : "bg-white text-gray-900 focus:border-blue-600"
|
|
2544
2546
|
);
|
|
2545
2547
|
const iconWrapperClassName = cn(
|
|
@@ -2582,72 +2584,84 @@ function DatePickerRange(props) {
|
|
|
2582
2584
|
)
|
|
2583
2585
|
}
|
|
2584
2586
|
);
|
|
2585
|
-
return /* @__PURE__ */ jsxs(
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2587
|
+
return /* @__PURE__ */ jsxs(
|
|
2588
|
+
"div",
|
|
2589
|
+
{
|
|
2590
|
+
ref: containerRef,
|
|
2591
|
+
className: cn("relative w-64 h-8", className),
|
|
2592
|
+
style: {
|
|
2593
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
2594
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
2595
|
+
},
|
|
2596
|
+
"aria-disabled": disabled,
|
|
2597
|
+
children: [
|
|
2598
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1 h-full", children: [
|
|
2599
|
+
/* @__PURE__ */ jsxs("div", { ref: startAnchorRef, className: "relative flex-1 h-full", children: [
|
|
2600
|
+
/* @__PURE__ */ jsx(
|
|
2601
|
+
"input",
|
|
2602
|
+
{
|
|
2603
|
+
type: "text",
|
|
2604
|
+
value: startInputValue,
|
|
2605
|
+
onChange: (e) => handleRangeInputChange(e, true),
|
|
2606
|
+
placeholder: "\uC2DC\uC791 \uB0A0\uC9DC",
|
|
2607
|
+
disabled,
|
|
2608
|
+
className: inputClassName,
|
|
2609
|
+
maxLength: 10,
|
|
2610
|
+
onKeyDown: (e) => {
|
|
2611
|
+
if (e.key === "Enter") {
|
|
2612
|
+
e.preventDefault();
|
|
2613
|
+
handleFieldEnter(startInputValue);
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2602
2616
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
className: iconWrapperClassName,
|
|
2613
|
-
children: /* @__PURE__ */ jsx(Calendar, { size: 15, className: iconClassName })
|
|
2614
|
-
}
|
|
2615
|
-
)
|
|
2616
|
-
] }),
|
|
2617
|
-
/* @__PURE__ */ jsx("div", { className: cn("text-sm w-2 text-center", disabled && "text-neutral-400 opacity-50"), children: "~" }),
|
|
2618
|
-
/* @__PURE__ */ jsxs("div", { ref: endAnchorRef, className: "relative flex-1", children: [
|
|
2619
|
-
/* @__PURE__ */ jsx(
|
|
2620
|
-
"input",
|
|
2621
|
-
{
|
|
2622
|
-
type: "text",
|
|
2623
|
-
value: endInputValue,
|
|
2624
|
-
onChange: (e) => handleRangeInputChange(e, false),
|
|
2625
|
-
placeholder: "\uC885\uB8CC \uB0A0\uC9DC",
|
|
2626
|
-
disabled,
|
|
2627
|
-
className: inputClassName,
|
|
2628
|
-
maxLength: 10,
|
|
2629
|
-
onKeyDown: (e) => {
|
|
2630
|
-
if (e.key === "Enter") {
|
|
2631
|
-
e.preventDefault();
|
|
2632
|
-
handleFieldEnter(endInputValue);
|
|
2617
|
+
),
|
|
2618
|
+
/* @__PURE__ */ jsx(
|
|
2619
|
+
"div",
|
|
2620
|
+
{
|
|
2621
|
+
onClick: () => {
|
|
2622
|
+
if (!disabled) handleCalendarIconClick("start");
|
|
2623
|
+
},
|
|
2624
|
+
className: iconWrapperClassName,
|
|
2625
|
+
children: /* @__PURE__ */ jsx(Calendar, { size: 15, className: iconClassName })
|
|
2633
2626
|
}
|
|
2634
|
-
|
|
2635
|
-
}
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2627
|
+
)
|
|
2628
|
+
] }),
|
|
2629
|
+
/* @__PURE__ */ jsx("div", { className: cn("text-sm w-2 text-center", disabled && "text-neutral-400 opacity-50"), children: "~" }),
|
|
2630
|
+
/* @__PURE__ */ jsxs("div", { ref: endAnchorRef, className: "relative flex-1 h-full", children: [
|
|
2631
|
+
/* @__PURE__ */ jsx(
|
|
2632
|
+
"input",
|
|
2633
|
+
{
|
|
2634
|
+
type: "text",
|
|
2635
|
+
value: endInputValue,
|
|
2636
|
+
onChange: (e) => handleRangeInputChange(e, false),
|
|
2637
|
+
placeholder: "\uC885\uB8CC \uB0A0\uC9DC",
|
|
2638
|
+
disabled,
|
|
2639
|
+
className: inputClassName,
|
|
2640
|
+
maxLength: 10,
|
|
2641
|
+
onKeyDown: (e) => {
|
|
2642
|
+
if (e.key === "Enter") {
|
|
2643
|
+
e.preventDefault();
|
|
2644
|
+
handleFieldEnter(endInputValue);
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
),
|
|
2649
|
+
/* @__PURE__ */ jsx(
|
|
2650
|
+
"div",
|
|
2651
|
+
{
|
|
2652
|
+
onClick: () => {
|
|
2653
|
+
if (!disabled) handleCalendarIconClick("end");
|
|
2654
|
+
},
|
|
2655
|
+
className: iconWrapperClassName,
|
|
2656
|
+
children: /* @__PURE__ */ jsx(Calendar, { size: 15, className: iconClassName })
|
|
2657
|
+
}
|
|
2658
|
+
)
|
|
2659
|
+
] })
|
|
2660
|
+
] }),
|
|
2661
|
+
calendarNode
|
|
2662
|
+
]
|
|
2663
|
+
}
|
|
2664
|
+
);
|
|
2651
2665
|
}
|
|
2652
2666
|
function DatePickerSingle(props) {
|
|
2653
2667
|
const {
|
|
@@ -2655,6 +2669,8 @@ function DatePickerSingle(props) {
|
|
|
2655
2669
|
onChange,
|
|
2656
2670
|
placeholder = "\uB0A0\uC9DC \uC120\uD0DD",
|
|
2657
2671
|
className = "",
|
|
2672
|
+
width,
|
|
2673
|
+
height,
|
|
2658
2674
|
editDateSelect = true,
|
|
2659
2675
|
onKeyDownEnter,
|
|
2660
2676
|
datePosition = "bottom",
|
|
@@ -2765,56 +2781,70 @@ function DatePickerSingle(props) {
|
|
|
2765
2781
|
)
|
|
2766
2782
|
}
|
|
2767
2783
|
);
|
|
2768
|
-
return /* @__PURE__ */ jsxs(
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2784
|
+
return /* @__PURE__ */ jsxs(
|
|
2785
|
+
"div",
|
|
2786
|
+
{
|
|
2787
|
+
ref: containerRef,
|
|
2788
|
+
className: cn("relative w-30 h-8", className),
|
|
2789
|
+
style: {
|
|
2790
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
2791
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
2792
|
+
},
|
|
2793
|
+
"aria-disabled": disabled,
|
|
2794
|
+
children: [
|
|
2795
|
+
/* @__PURE__ */ jsxs("div", { className: "relative h-full", children: [
|
|
2796
|
+
/* @__PURE__ */ jsx(
|
|
2797
|
+
"input",
|
|
2798
|
+
{
|
|
2799
|
+
type: "text",
|
|
2800
|
+
value: inputValue,
|
|
2801
|
+
onChange: handleInputChange,
|
|
2802
|
+
onBlur: () => onBlur && handleInputBlur(),
|
|
2803
|
+
placeholder,
|
|
2804
|
+
disabled,
|
|
2805
|
+
className: cn(
|
|
2806
|
+
"w-full h-full px-2 py-1.25 border text-sm rounded-sm outline-none shadow-xs transition-colors",
|
|
2807
|
+
validation ? "border-red-600 focus:border-blue-600 focus-visible:border-blue-600 focus-visible:ring-1 focus-visible:ring-blue-600/30 focus-visible:outline-none" : "border-gray-300 focus:border-blue-600 focus-visible:border-blue-600 focus-visible:ring-1 focus-visible:ring-blue-600/30 focus-visible:outline-none",
|
|
2808
|
+
disabled ? DATE_PICKER_FIELD_DISABLED_CLASS : "bg-white text-gray-900"
|
|
2809
|
+
),
|
|
2810
|
+
maxLength: 10,
|
|
2811
|
+
onKeyDown: (e) => {
|
|
2812
|
+
if (e.key === "Enter") {
|
|
2813
|
+
e.preventDefault();
|
|
2814
|
+
handleFieldEnter(inputValue);
|
|
2815
|
+
}
|
|
2816
|
+
},
|
|
2817
|
+
"data-date-input": "true"
|
|
2789
2818
|
}
|
|
2790
|
-
},
|
|
2791
|
-
"data-date-input": "true"
|
|
2792
|
-
}
|
|
2793
|
-
),
|
|
2794
|
-
/* @__PURE__ */ jsx(
|
|
2795
|
-
"div",
|
|
2796
|
-
{
|
|
2797
|
-
role: "button",
|
|
2798
|
-
tabIndex: -1,
|
|
2799
|
-
"aria-hidden": disabled,
|
|
2800
|
-
onClick: () => {
|
|
2801
|
-
if (!disabled) toggleCalendar(inputValue);
|
|
2802
|
-
},
|
|
2803
|
-
className: cn(
|
|
2804
|
-
"absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-1",
|
|
2805
|
-
disabled ? DATE_PICKER_ICON_DISABLED_CLASS : DATE_PICKER_ICON_ENABLED_CLASS
|
|
2806
2819
|
),
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2820
|
+
/* @__PURE__ */ jsx(
|
|
2821
|
+
"div",
|
|
2822
|
+
{
|
|
2823
|
+
role: "button",
|
|
2824
|
+
tabIndex: -1,
|
|
2825
|
+
"aria-hidden": disabled,
|
|
2826
|
+
onClick: () => {
|
|
2827
|
+
if (!disabled) toggleCalendar(inputValue);
|
|
2828
|
+
},
|
|
2829
|
+
className: cn(
|
|
2830
|
+
"absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-1",
|
|
2831
|
+
disabled ? DATE_PICKER_ICON_DISABLED_CLASS : DATE_PICKER_ICON_ENABLED_CLASS
|
|
2832
|
+
),
|
|
2833
|
+
children: /* @__PURE__ */ jsx(Calendar, { size: 15, className: cn(disabled ? "text-neutral-400 opacity-50" : "text-gray-600") })
|
|
2834
|
+
}
|
|
2835
|
+
)
|
|
2836
|
+
] }),
|
|
2837
|
+
calendarNode
|
|
2838
|
+
]
|
|
2839
|
+
}
|
|
2840
|
+
);
|
|
2813
2841
|
}
|
|
2814
2842
|
function DatePicker(props) {
|
|
2815
2843
|
const {
|
|
2816
2844
|
isRange,
|
|
2817
2845
|
className,
|
|
2846
|
+
width,
|
|
2847
|
+
height,
|
|
2818
2848
|
editDateSelect,
|
|
2819
2849
|
onKeyDownEnter,
|
|
2820
2850
|
datePosition,
|
|
@@ -2833,6 +2863,8 @@ function DatePicker(props) {
|
|
|
2833
2863
|
endValue,
|
|
2834
2864
|
onRangeChange,
|
|
2835
2865
|
className,
|
|
2866
|
+
width,
|
|
2867
|
+
height,
|
|
2836
2868
|
editDateSelect,
|
|
2837
2869
|
onKeyDownEnter,
|
|
2838
2870
|
datePosition,
|
|
@@ -2852,6 +2884,8 @@ function DatePicker(props) {
|
|
|
2852
2884
|
onChange,
|
|
2853
2885
|
placeholder,
|
|
2854
2886
|
className,
|
|
2887
|
+
width,
|
|
2888
|
+
height,
|
|
2855
2889
|
editDateSelect,
|
|
2856
2890
|
onKeyDownEnter,
|
|
2857
2891
|
datePosition,
|
|
@@ -8589,7 +8623,9 @@ function BaseUploader(props) {
|
|
|
8589
8623
|
maxSize,
|
|
8590
8624
|
disabled = false,
|
|
8591
8625
|
placeholder,
|
|
8592
|
-
className
|
|
8626
|
+
className,
|
|
8627
|
+
width,
|
|
8628
|
+
height
|
|
8593
8629
|
} = props;
|
|
8594
8630
|
const inputRef = useRef(null);
|
|
8595
8631
|
const inputId = useId();
|
|
@@ -8632,7 +8668,7 @@ function BaseUploader(props) {
|
|
|
8632
8668
|
};
|
|
8633
8669
|
const showZone = multiple || files.length === 0;
|
|
8634
8670
|
const acceptLabel = accept ? accept.split(",").map((s) => s.trim().toUpperCase()).join(", ") : "\uBAA8\uB4E0 \uD615\uC2DD";
|
|
8635
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), children: [
|
|
8671
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), style: { width: typeof width === "number" ? `${width}px` : width }, children: [
|
|
8636
8672
|
/* @__PURE__ */ jsx(
|
|
8637
8673
|
"input",
|
|
8638
8674
|
{
|
|
@@ -8666,6 +8702,7 @@ function BaseUploader(props) {
|
|
|
8666
8702
|
setIsDragging(false);
|
|
8667
8703
|
},
|
|
8668
8704
|
onDrop: handleDrop,
|
|
8705
|
+
style: { minHeight: typeof height === "number" ? `${height}px` : height ?? "7rem" },
|
|
8669
8706
|
className: cn(
|
|
8670
8707
|
"flex flex-col items-center justify-center gap-2 min-h-28 w-full rounded-lg bg-gray-50/50 border-[1.5px] border-dashed",
|
|
8671
8708
|
disabled ? "cursor-not-allowed border-gray-200 bg-gray-100 opacity-60" : "cursor-pointer hover:bg-gray-50",
|
|
@@ -8711,7 +8748,7 @@ function BaseUploader(props) {
|
|
|
8711
8748
|
var EXCEL_ACCEPT = ".xlsx,.xls,.csv";
|
|
8712
8749
|
var MAX_EXCEL_BYTES = 10 * 1024 * 1024;
|
|
8713
8750
|
function ExcelUploader(props) {
|
|
8714
|
-
const { files, onChange, disabled, className } = props;
|
|
8751
|
+
const { files, onChange, disabled, className, width, height } = props;
|
|
8715
8752
|
return /* @__PURE__ */ jsx(
|
|
8716
8753
|
BaseUploader,
|
|
8717
8754
|
{
|
|
@@ -8722,7 +8759,9 @@ function ExcelUploader(props) {
|
|
|
8722
8759
|
maxSize: MAX_EXCEL_BYTES,
|
|
8723
8760
|
disabled,
|
|
8724
8761
|
placeholder: "\uC5D1\uC140 \uD30C\uC77C\uC744 \uD074\uB9AD\uD558\uAC70\uB098 \uB4DC\uB798\uADF8\uD558\uC138\uC694",
|
|
8725
|
-
className
|
|
8762
|
+
className,
|
|
8763
|
+
width,
|
|
8764
|
+
height
|
|
8726
8765
|
}
|
|
8727
8766
|
);
|
|
8728
8767
|
}
|
|
@@ -8819,7 +8858,7 @@ var compressImage = (file) => {
|
|
|
8819
8858
|
}).catch(() => file);
|
|
8820
8859
|
};
|
|
8821
8860
|
function FileUploader(props) {
|
|
8822
|
-
const { files, onChange, multiple = true, disabled = false, className } = props;
|
|
8861
|
+
const { files, onChange, multiple = true, disabled = false, className, width, height } = props;
|
|
8823
8862
|
const inputRef = useRef(null);
|
|
8824
8863
|
const containerRef = useRef(null);
|
|
8825
8864
|
const [isDragging, setIsDragging] = useState(false);
|
|
@@ -8926,121 +8965,129 @@ function FileUploader(props) {
|
|
|
8926
8965
|
setError("");
|
|
8927
8966
|
};
|
|
8928
8967
|
const isProcessing = processingCount > 0;
|
|
8929
|
-
return /* @__PURE__ */ jsxs(
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
onClick: isProcessing || disabled ? void 0 : () => inputRef.current?.click(),
|
|
8950
|
-
onDragOver: handleDragOver,
|
|
8951
|
-
onDragEnter: handleDragOver,
|
|
8952
|
-
onDragLeave: handleDragLeave,
|
|
8953
|
-
onDrop: handleDrop,
|
|
8954
|
-
className: cn(
|
|
8955
|
-
"relative w-full rounded-lg bg-gray-50/50 border-[1.5px] border-dashed",
|
|
8956
|
-
disabled ? "cursor-not-allowed border-gray-200 bg-gray-100 opacity-60" : isProcessing ? "cursor-default border-gray-300" : "cursor-pointer hover:bg-gray-50",
|
|
8957
|
-
isDragging ? "border-blue-500 bg-blue-50" : "border-gray-300",
|
|
8958
|
-
error && !isDragging ? "border-red-300 bg-red-50" : "",
|
|
8959
|
-
files.length > 0 ? "p-3" : "flex flex-col items-center justify-center gap-1 min-h-32"
|
|
8968
|
+
return /* @__PURE__ */ jsxs(
|
|
8969
|
+
"div",
|
|
8970
|
+
{
|
|
8971
|
+
className: cn("space-y-3", className),
|
|
8972
|
+
style: { width: typeof width === "number" ? `${width}px` : width },
|
|
8973
|
+
children: [
|
|
8974
|
+
/* @__PURE__ */ jsx(
|
|
8975
|
+
"input",
|
|
8976
|
+
{
|
|
8977
|
+
ref: inputRef,
|
|
8978
|
+
type: "file",
|
|
8979
|
+
multiple,
|
|
8980
|
+
accept: "image/jpeg,image/png,image/webp,image/heic,image/heif,application/pdf,.heic,.heif",
|
|
8981
|
+
disabled,
|
|
8982
|
+
className: "hidden",
|
|
8983
|
+
onChange: (e) => {
|
|
8984
|
+
handleFiles(e.target.files);
|
|
8985
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
8986
|
+
}
|
|
8987
|
+
}
|
|
8960
8988
|
),
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
},
|
|
8983
|
-
className: "block w-full aspect-square cursor-pointer",
|
|
8984
|
-
"aria-label": `${file.name} \uBBF8\uB9AC\uBCF4\uAE30`,
|
|
8985
|
-
children: isImage && url ? /* @__PURE__ */ jsx("img", { src: url, alt: file.name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center bg-gray-50 text-gray-400", children: [
|
|
8986
|
-
/* @__PURE__ */ jsx(FileText, { className: "w-8 h-8" }),
|
|
8987
|
-
/* @__PURE__ */ jsx("span", { className: "mt-1 max-w-full truncate px-1 text-center text-[10px]", children: file.name })
|
|
8988
|
-
] })
|
|
8989
|
-
}
|
|
8990
|
-
),
|
|
8991
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-1 border-t border-gray-100 px-1.5 py-1", children: [
|
|
8992
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-[10px] text-gray-600", title: file.name, children: file.name }),
|
|
8993
|
-
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] text-gray-400", children: formatFileSize(file.size) })
|
|
8994
|
-
] }),
|
|
8995
|
-
!disabled && /* @__PURE__ */ jsx(
|
|
8996
|
-
"button",
|
|
8997
|
-
{
|
|
8998
|
-
type: "button",
|
|
8999
|
-
onClick: (e) => {
|
|
9000
|
-
e.stopPropagation();
|
|
9001
|
-
removeFile(idx);
|
|
9002
|
-
},
|
|
9003
|
-
className: "absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full bg-black/60 text-white opacity-0 transition-opacity group-hover:opacity-100 cursor-pointer",
|
|
9004
|
-
"aria-label": "\uD30C\uC77C \uC81C\uAC70",
|
|
9005
|
-
children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
|
|
9006
|
-
}
|
|
9007
|
-
)
|
|
9008
|
-
]
|
|
9009
|
-
},
|
|
9010
|
-
`${file.name}-${idx}`
|
|
9011
|
-
);
|
|
9012
|
-
}) }),
|
|
9013
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center justify-between text-xs text-gray-500", children: [
|
|
9014
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
9015
|
-
files.length,
|
|
9016
|
-
"\uAC1C \uD30C\uC77C \uC120\uD0DD\uB428",
|
|
9017
|
-
!disabled && " \xB7 \uD074\uB9AD\uD558\uC5EC \uCD94\uAC00"
|
|
8989
|
+
/* @__PURE__ */ jsxs(
|
|
8990
|
+
"div",
|
|
8991
|
+
{
|
|
8992
|
+
ref: containerRef,
|
|
8993
|
+
onClick: isProcessing || disabled ? void 0 : () => inputRef.current?.click(),
|
|
8994
|
+
onDragOver: handleDragOver,
|
|
8995
|
+
onDragEnter: handleDragOver,
|
|
8996
|
+
onDragLeave: handleDragLeave,
|
|
8997
|
+
onDrop: handleDrop,
|
|
8998
|
+
className: cn(
|
|
8999
|
+
"relative w-full rounded-lg bg-gray-50/50 border-[1.5px] border-dashed",
|
|
9000
|
+
disabled ? "cursor-not-allowed border-gray-200 bg-gray-100 opacity-60" : isProcessing ? "cursor-default border-gray-300" : "cursor-pointer hover:bg-gray-50",
|
|
9001
|
+
isDragging ? "border-blue-500 bg-blue-50" : "border-gray-300",
|
|
9002
|
+
error && !isDragging ? "border-red-300 bg-red-50" : "",
|
|
9003
|
+
files.length > 0 ? "p-3" : "flex flex-col items-center justify-center gap-1"
|
|
9004
|
+
),
|
|
9005
|
+
style: files.length === 0 ? { minHeight: typeof height === "number" ? `${height}px` : height ?? "8rem" } : void 0,
|
|
9006
|
+
children: [
|
|
9007
|
+
isProcessing && /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-lg bg-white/80", children: [
|
|
9008
|
+
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-blue-400 border-t-transparent" }),
|
|
9009
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: "\uCC98\uB9AC \uC911..." })
|
|
9018
9010
|
] }),
|
|
9019
|
-
/* @__PURE__ */ jsxs(
|
|
9020
|
-
"
|
|
9021
|
-
|
|
9011
|
+
files.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9012
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3", children: files.map((file, idx) => {
|
|
9013
|
+
const url = previewUrls[idx];
|
|
9014
|
+
const isImage = file.type.startsWith("image/");
|
|
9015
|
+
return /* @__PURE__ */ jsxs(
|
|
9016
|
+
"div",
|
|
9017
|
+
{
|
|
9018
|
+
className: "group relative overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm transition-shadow hover:shadow-md",
|
|
9019
|
+
children: [
|
|
9020
|
+
/* @__PURE__ */ jsx(
|
|
9021
|
+
"button",
|
|
9022
|
+
{
|
|
9023
|
+
type: "button",
|
|
9024
|
+
onClick: (e) => {
|
|
9025
|
+
e.stopPropagation();
|
|
9026
|
+
viewer.open(idx);
|
|
9027
|
+
},
|
|
9028
|
+
className: "block w-full aspect-square cursor-pointer",
|
|
9029
|
+
"aria-label": `${file.name} \uBBF8\uB9AC\uBCF4\uAE30`,
|
|
9030
|
+
children: isImage && url ? /* @__PURE__ */ jsx("img", { src: url, alt: file.name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center bg-gray-50 text-gray-400", children: [
|
|
9031
|
+
/* @__PURE__ */ jsx(FileText, { className: "w-8 h-8" }),
|
|
9032
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 max-w-full truncate px-1 text-center text-[10px]", children: file.name })
|
|
9033
|
+
] })
|
|
9034
|
+
}
|
|
9035
|
+
),
|
|
9036
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-1 border-t border-gray-100 px-1.5 py-1", children: [
|
|
9037
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-[10px] text-gray-600", title: file.name, children: file.name }),
|
|
9038
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] text-gray-400", children: formatFileSize(file.size) })
|
|
9039
|
+
] }),
|
|
9040
|
+
!disabled && /* @__PURE__ */ jsx(
|
|
9041
|
+
"button",
|
|
9042
|
+
{
|
|
9043
|
+
type: "button",
|
|
9044
|
+
onClick: (e) => {
|
|
9045
|
+
e.stopPropagation();
|
|
9046
|
+
removeFile(idx);
|
|
9047
|
+
},
|
|
9048
|
+
className: "absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full bg-black/60 text-white opacity-0 transition-opacity group-hover:opacity-100 cursor-pointer",
|
|
9049
|
+
"aria-label": "\uD30C\uC77C \uC81C\uAC70",
|
|
9050
|
+
children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
|
|
9051
|
+
}
|
|
9052
|
+
)
|
|
9053
|
+
]
|
|
9054
|
+
},
|
|
9055
|
+
`${file.name}-${idx}`
|
|
9056
|
+
);
|
|
9057
|
+
}) }),
|
|
9058
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center justify-between text-xs text-gray-500", children: [
|
|
9059
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
9060
|
+
files.length,
|
|
9061
|
+
"\uAC1C \uD30C\uC77C \uC120\uD0DD\uB428",
|
|
9062
|
+
!disabled && " \xB7 \uD074\uB9AD\uD558\uC5EC \uCD94\uAC00"
|
|
9063
|
+
] }),
|
|
9064
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
9065
|
+
"\uCD1D ",
|
|
9066
|
+
formatFileSize(files.reduce((sum, f) => sum + f.size, 0))
|
|
9067
|
+
] })
|
|
9068
|
+
] })
|
|
9069
|
+
] }) : isDragging ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-1 text-blue-500", children: [
|
|
9070
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm font-semibold flex gap-1", children: [
|
|
9071
|
+
/* @__PURE__ */ jsx(FileUp, { size: 15, className: "mt-[1px]" }),
|
|
9072
|
+
"\uD30C\uC77C\uC744 \uC5EC\uAE30\uC5D0 \uB193\uC544\uC8FC\uC138\uC694"
|
|
9073
|
+
] }),
|
|
9074
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium", children: "\uB4DC\uB86D\uD558\uBA74 \uC790\uB3D9\uC73C\uB85C \uC5C5\uB85C\uB4DC\uB429\uB2C8\uB2E4." })
|
|
9075
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9076
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 flex gap-1", children: [
|
|
9077
|
+
/* @__PURE__ */ jsx(FileUp, { size: 15, className: "text-gray-400 mt-[1px]" }),
|
|
9078
|
+
" \uD074\uB9AD\uD558\uC5EC \uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uAC70\uB098 \uB4DC\uB798\uADF8\uD558\uC138\uC694"
|
|
9079
|
+
] }),
|
|
9080
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: "\uC774\uBBF8\uC9C0(JPG \xB7 PNG \xB7 WEBP \xB7 HEIC, \uCD5C\uB300 50MB) \xB7 PDF(\uCD5C\uB300 10MB)" }),
|
|
9081
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: multiple ? `\uCD5C\uB300 ${MAX_FILES}\uAC1C \xB7 \uC804\uCCB4 20MB \uC774\uD558` : "\uB2E8\uC77C \uD30C\uC77C" })
|
|
9022
9082
|
] })
|
|
9023
|
-
]
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
/* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 flex gap-1", children: [
|
|
9032
|
-
/* @__PURE__ */ jsx(FileUp, { size: 15, className: "text-gray-400 mt-[1px]" }),
|
|
9033
|
-
" \uD074\uB9AD\uD558\uC5EC \uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uAC70\uB098 \uB4DC\uB798\uADF8\uD558\uC138\uC694"
|
|
9034
|
-
] }),
|
|
9035
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: "\uC774\uBBF8\uC9C0(JPG \xB7 PNG \xB7 WEBP \xB7 HEIC, \uCD5C\uB300 50MB) \xB7 PDF(\uCD5C\uB300 10MB)" }),
|
|
9036
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: multiple ? `\uCD5C\uB300 ${MAX_FILES}\uAC1C \xB7 \uC804\uCCB4 20MB \uC774\uD558` : "\uB2E8\uC77C \uD30C\uC77C" })
|
|
9037
|
-
] })
|
|
9038
|
-
]
|
|
9039
|
-
}
|
|
9040
|
-
),
|
|
9041
|
-
error && /* @__PURE__ */ jsx("p", { className: "whitespace-pre-line text-xs text-red-500 bg-red-50 border border-red-200 rounded px-3 py-2", children: error }),
|
|
9042
|
-
/* @__PURE__ */ jsx(FilePreviewViewer, { ...viewer.viewerProps, fileTypes, fileNames: files.map((f) => f.name) })
|
|
9043
|
-
] });
|
|
9083
|
+
]
|
|
9084
|
+
}
|
|
9085
|
+
),
|
|
9086
|
+
error && /* @__PURE__ */ jsx("p", { className: "whitespace-pre-line text-xs text-red-500 bg-red-50 border border-red-200 rounded px-3 py-2", children: error }),
|
|
9087
|
+
/* @__PURE__ */ jsx(FilePreviewViewer, { ...viewer.viewerProps, fileTypes, fileNames: files.map((f) => f.name) })
|
|
9088
|
+
]
|
|
9089
|
+
}
|
|
9090
|
+
);
|
|
9044
9091
|
}
|
|
9045
9092
|
var VARIANT_STYLES2 = {
|
|
9046
9093
|
light: {
|