@farmzone/fz-react-ui 1.0.18 → 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.js CHANGED
@@ -717,7 +717,7 @@ function Slider(props) {
717
717
  RadixSlider.Track,
718
718
  {
719
719
  className: cn(
720
- "relative h-[3px] grow rounded-full bg-blackA7",
720
+ "relative h-[3px] grow rounded-full bg-gray-200",
721
721
  orientation === "vertical" && "w-[3px] h-full",
722
722
  trackClassName
723
723
  ),
@@ -725,7 +725,7 @@ function Slider(props) {
725
725
  RadixSlider.Range,
726
726
  {
727
727
  className: cn(
728
- "absolute h-full rounded-full bg-white",
728
+ "absolute h-full rounded-full bg-[#009fe3]",
729
729
  orientation === "vertical" && "w-full",
730
730
  rangeClassName
731
731
  )
@@ -733,17 +733,18 @@ function Slider(props) {
733
733
  )
734
734
  }
735
735
  ),
736
- /* @__PURE__ */ jsx(
736
+ (value ?? defaultValue).map((_, index) => /* @__PURE__ */ jsx(
737
737
  RadixSlider.Thumb,
738
738
  {
739
739
  className: cn(
740
- "block size-5 rounded-[10px] bg-white shadow-[0_2px_10px] shadow-blackA4 hover:bg-violet3 focus:shadow-[0_0_0_5px] focus:shadow-blackA5 focus:outline-none",
740
+ "block size-4 rounded-full bg-white border-2 border-[#009fe3] shadow-md hover:border-[#0090cf] focus:outline-none focus:ring-2 focus:ring-[#009fe3]/40 focus:ring-offset-1",
741
741
  disabled && "cursor-not-allowed opacity-50",
742
742
  thumbClassName
743
743
  ),
744
- "aria-label": ariaLabel
745
- }
746
- )
744
+ "aria-label": index === 0 ? ariaLabel : `${ariaLabel} max`
745
+ },
746
+ index
747
+ ))
747
748
  ]
748
749
  }
749
750
  );
@@ -2428,6 +2429,8 @@ function DatePickerRange(props) {
2428
2429
  endValue = "",
2429
2430
  onRangeChange,
2430
2431
  className = "",
2432
+ width,
2433
+ height,
2431
2434
  editDateSelect = true,
2432
2435
  onKeyDownEnter,
2433
2436
  datePosition = "bottom",
@@ -2538,7 +2541,7 @@ function DatePickerRange(props) {
2538
2541
  }
2539
2542
  };
2540
2543
  const inputClassName = cn(
2541
- "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",
2542
2545
  disabled ? DATE_PICKER_FIELD_DISABLED_CLASS : "bg-white text-gray-900 focus:border-blue-600"
2543
2546
  );
2544
2547
  const iconWrapperClassName = cn(
@@ -2581,72 +2584,84 @@ function DatePickerRange(props) {
2581
2584
  )
2582
2585
  }
2583
2586
  );
2584
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: cn("relative w-64 h-8", className), "aria-disabled": disabled, children: [
2585
- /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
2586
- /* @__PURE__ */ jsxs("div", { ref: startAnchorRef, className: "relative flex-1", children: [
2587
- /* @__PURE__ */ jsx(
2588
- "input",
2589
- {
2590
- type: "text",
2591
- value: startInputValue,
2592
- onChange: (e) => handleRangeInputChange(e, true),
2593
- placeholder: "\uC2DC\uC791 \uB0A0\uC9DC",
2594
- disabled,
2595
- className: inputClassName,
2596
- maxLength: 10,
2597
- onKeyDown: (e) => {
2598
- if (e.key === "Enter") {
2599
- e.preventDefault();
2600
- handleFieldEnter(startInputValue);
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
+ }
2601
2616
  }
2602
- }
2603
- }
2604
- ),
2605
- /* @__PURE__ */ jsx(
2606
- "div",
2607
- {
2608
- onClick: () => {
2609
- if (!disabled) handleCalendarIconClick("start");
2610
- },
2611
- className: iconWrapperClassName,
2612
- children: /* @__PURE__ */ jsx(Calendar, { size: 15, className: iconClassName })
2613
- }
2614
- )
2615
- ] }),
2616
- /* @__PURE__ */ jsx("div", { className: cn("text-sm w-2 text-center", disabled && "text-neutral-400 opacity-50"), children: "~" }),
2617
- /* @__PURE__ */ jsxs("div", { ref: endAnchorRef, className: "relative flex-1", children: [
2618
- /* @__PURE__ */ jsx(
2619
- "input",
2620
- {
2621
- type: "text",
2622
- value: endInputValue,
2623
- onChange: (e) => handleRangeInputChange(e, false),
2624
- placeholder: "\uC885\uB8CC \uB0A0\uC9DC",
2625
- disabled,
2626
- className: inputClassName,
2627
- maxLength: 10,
2628
- onKeyDown: (e) => {
2629
- if (e.key === "Enter") {
2630
- e.preventDefault();
2631
- 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 })
2632
2626
  }
2633
- }
2634
- }
2635
- ),
2636
- /* @__PURE__ */ jsx(
2637
- "div",
2638
- {
2639
- onClick: () => {
2640
- if (!disabled) handleCalendarIconClick("end");
2641
- },
2642
- className: iconWrapperClassName,
2643
- children: /* @__PURE__ */ jsx(Calendar, { size: 15, className: iconClassName })
2644
- }
2645
- )
2646
- ] })
2647
- ] }),
2648
- calendarNode
2649
- ] });
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
+ );
2650
2665
  }
2651
2666
  function DatePickerSingle(props) {
2652
2667
  const {
@@ -2654,6 +2669,8 @@ function DatePickerSingle(props) {
2654
2669
  onChange,
2655
2670
  placeholder = "\uB0A0\uC9DC \uC120\uD0DD",
2656
2671
  className = "",
2672
+ width,
2673
+ height,
2657
2674
  editDateSelect = true,
2658
2675
  onKeyDownEnter,
2659
2676
  datePosition = "bottom",
@@ -2764,56 +2781,70 @@ function DatePickerSingle(props) {
2764
2781
  )
2765
2782
  }
2766
2783
  );
2767
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: cn("relative w-30 h-8", className), "aria-disabled": disabled, children: [
2768
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2769
- /* @__PURE__ */ jsx(
2770
- "input",
2771
- {
2772
- type: "text",
2773
- value: inputValue,
2774
- onChange: handleInputChange,
2775
- onBlur: () => onBlur && handleInputBlur(),
2776
- placeholder,
2777
- disabled,
2778
- className: cn(
2779
- "w-full px-2 py-1.25 border text-sm rounded-sm outline-none shadow-xs transition-colors",
2780
- 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",
2781
- disabled ? DATE_PICKER_FIELD_DISABLED_CLASS : "bg-white text-gray-900"
2782
- ),
2783
- maxLength: 10,
2784
- onKeyDown: (e) => {
2785
- if (e.key === "Enter") {
2786
- e.preventDefault();
2787
- handleFieldEnter(inputValue);
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"
2788
2818
  }
2789
- },
2790
- "data-date-input": "true"
2791
- }
2792
- ),
2793
- /* @__PURE__ */ jsx(
2794
- "div",
2795
- {
2796
- role: "button",
2797
- tabIndex: -1,
2798
- "aria-hidden": disabled,
2799
- onClick: () => {
2800
- if (!disabled) toggleCalendar(inputValue);
2801
- },
2802
- className: cn(
2803
- "absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-1",
2804
- disabled ? DATE_PICKER_ICON_DISABLED_CLASS : DATE_PICKER_ICON_ENABLED_CLASS
2805
2819
  ),
2806
- children: /* @__PURE__ */ jsx(Calendar, { size: 15, className: cn(disabled ? "text-neutral-400 opacity-50" : "text-gray-600") })
2807
- }
2808
- )
2809
- ] }),
2810
- calendarNode
2811
- ] });
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
+ );
2812
2841
  }
2813
2842
  function DatePicker(props) {
2814
2843
  const {
2815
2844
  isRange,
2816
2845
  className,
2846
+ width,
2847
+ height,
2817
2848
  editDateSelect,
2818
2849
  onKeyDownEnter,
2819
2850
  datePosition,
@@ -2832,6 +2863,8 @@ function DatePicker(props) {
2832
2863
  endValue,
2833
2864
  onRangeChange,
2834
2865
  className,
2866
+ width,
2867
+ height,
2835
2868
  editDateSelect,
2836
2869
  onKeyDownEnter,
2837
2870
  datePosition,
@@ -2851,6 +2884,8 @@ function DatePicker(props) {
2851
2884
  onChange,
2852
2885
  placeholder,
2853
2886
  className,
2887
+ width,
2888
+ height,
2854
2889
  editDateSelect,
2855
2890
  onKeyDownEnter,
2856
2891
  datePosition,
@@ -6114,7 +6149,7 @@ function FilePreviewViewerSession(props) {
6114
6149
  useEffect(() => {
6115
6150
  if (!showNavigation) return;
6116
6151
  const [prevIndex, nextIndex] = getAdjacentIndexes(currentIndex, fileArray.length);
6117
- const urlsToPreload = [prevIndex, nextIndex].filter((idx) => idx !== currentIndex).map((idx) => fileArray[idx]);
6152
+ const urlsToPreload = [prevIndex, nextIndex].filter((idx) => idx !== currentIndex).map((idx) => fileArray[idx]).filter((url) => url !== void 0);
6118
6153
  preloadPreviewImages(urlsToPreload);
6119
6154
  }, [showNavigation, currentIndex, fileArray]);
6120
6155
  useEffect(() => {
@@ -7750,7 +7785,7 @@ var SubmitForm = Object.assign(SubmitFormRoot, {
7750
7785
  function LabeledFilterOption(props) {
7751
7786
  const { label, children, gap } = props;
7752
7787
  return /* @__PURE__ */ jsxs("div", { style: { marginLeft: gap }, className: "flex flex-row items-center gap-4", children: [
7753
- label && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-60 shrink-0", children: label }),
7788
+ label && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-60 shrink-0 select-none", children: label }),
7754
7789
  children
7755
7790
  ] });
7756
7791
  }
@@ -7786,8 +7821,9 @@ function PageFilter(props) {
7786
7821
  onChange({ [key]: value });
7787
7822
  if (autoSubmit) pendingAutoSubmitRef.current = { key, value };
7788
7823
  };
7789
- const handleRadioChange = (key) => (value) => {
7824
+ const handleRadioChange = (key, autoSubmit) => (value) => {
7790
7825
  onChange({ [key]: value });
7826
+ if (autoSubmit) pendingAutoSubmitRef.current = { key, value };
7791
7827
  };
7792
7828
  const handleDateChange = (key) => (date) => {
7793
7829
  onChange({ [key]: date });
@@ -7795,8 +7831,10 @@ function PageFilter(props) {
7795
7831
  const handleRangeChangeCurried = (startKey, endKey) => (start, end) => {
7796
7832
  onChange({ [startKey]: start, [endKey]: end });
7797
7833
  };
7798
- const handleCheckboxChange = (key) => (checked) => {
7799
- onChange({ [key]: checked ? "true" : "false" });
7834
+ const handleCheckboxChange = (key, autoSubmit) => (checked) => {
7835
+ const value = checked ? "true" : "false";
7836
+ onChange({ [key]: value });
7837
+ if (autoSubmit) pendingAutoSubmitRef.current = { key, value };
7800
7838
  };
7801
7839
  const handleSubmit = () => {
7802
7840
  pendingAutoSubmitRef.current = null;
@@ -7842,7 +7880,7 @@ function PageFilter(props) {
7842
7880
  {
7843
7881
  name: String(optionKey),
7844
7882
  value: currentValue,
7845
- onChange: handleRadioChange(optionKey),
7883
+ onChange: handleRadioChange(optionKey, option.autoSubmit),
7846
7884
  options: option.options,
7847
7885
  direction: "horizontal"
7848
7886
  }
@@ -7874,7 +7912,7 @@ function PageFilter(props) {
7874
7912
  checked: currentValue === "true",
7875
7913
  name: String(optionKey),
7876
7914
  value: currentValue,
7877
- onChange: handleCheckboxChange(optionKey)
7915
+ onChange: handleCheckboxChange(optionKey, option.autoSubmit)
7878
7916
  }
7879
7917
  ) }, String(optionKey));
7880
7918
  default: {
@@ -8585,7 +8623,9 @@ function BaseUploader(props) {
8585
8623
  maxSize,
8586
8624
  disabled = false,
8587
8625
  placeholder,
8588
- className
8626
+ className,
8627
+ width,
8628
+ height
8589
8629
  } = props;
8590
8630
  const inputRef = useRef(null);
8591
8631
  const inputId = useId();
@@ -8628,7 +8668,7 @@ function BaseUploader(props) {
8628
8668
  };
8629
8669
  const showZone = multiple || files.length === 0;
8630
8670
  const acceptLabel = accept ? accept.split(",").map((s) => s.trim().toUpperCase()).join(", ") : "\uBAA8\uB4E0 \uD615\uC2DD";
8631
- 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: [
8632
8672
  /* @__PURE__ */ jsx(
8633
8673
  "input",
8634
8674
  {
@@ -8662,6 +8702,7 @@ function BaseUploader(props) {
8662
8702
  setIsDragging(false);
8663
8703
  },
8664
8704
  onDrop: handleDrop,
8705
+ style: { minHeight: typeof height === "number" ? `${height}px` : height ?? "7rem" },
8665
8706
  className: cn(
8666
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",
8667
8708
  disabled ? "cursor-not-allowed border-gray-200 bg-gray-100 opacity-60" : "cursor-pointer hover:bg-gray-50",
@@ -8707,7 +8748,7 @@ function BaseUploader(props) {
8707
8748
  var EXCEL_ACCEPT = ".xlsx,.xls,.csv";
8708
8749
  var MAX_EXCEL_BYTES = 10 * 1024 * 1024;
8709
8750
  function ExcelUploader(props) {
8710
- const { files, onChange, disabled, className } = props;
8751
+ const { files, onChange, disabled, className, width, height } = props;
8711
8752
  return /* @__PURE__ */ jsx(
8712
8753
  BaseUploader,
8713
8754
  {
@@ -8718,7 +8759,9 @@ function ExcelUploader(props) {
8718
8759
  maxSize: MAX_EXCEL_BYTES,
8719
8760
  disabled,
8720
8761
  placeholder: "\uC5D1\uC140 \uD30C\uC77C\uC744 \uD074\uB9AD\uD558\uAC70\uB098 \uB4DC\uB798\uADF8\uD558\uC138\uC694",
8721
- className
8762
+ className,
8763
+ width,
8764
+ height
8722
8765
  }
8723
8766
  );
8724
8767
  }
@@ -8815,7 +8858,7 @@ var compressImage = (file) => {
8815
8858
  }).catch(() => file);
8816
8859
  };
8817
8860
  function FileUploader(props) {
8818
- const { files, onChange, multiple = true, disabled = false, className } = props;
8861
+ const { files, onChange, multiple = true, disabled = false, className, width, height } = props;
8819
8862
  const inputRef = useRef(null);
8820
8863
  const containerRef = useRef(null);
8821
8864
  const [isDragging, setIsDragging] = useState(false);
@@ -8922,121 +8965,129 @@ function FileUploader(props) {
8922
8965
  setError("");
8923
8966
  };
8924
8967
  const isProcessing = processingCount > 0;
8925
- return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), children: [
8926
- /* @__PURE__ */ jsx(
8927
- "input",
8928
- {
8929
- ref: inputRef,
8930
- type: "file",
8931
- multiple,
8932
- accept: "image/jpeg,image/png,image/webp,image/heic,image/heif,application/pdf,.heic,.heif",
8933
- disabled,
8934
- className: "hidden",
8935
- onChange: (e) => {
8936
- handleFiles(e.target.files);
8937
- if (inputRef.current) inputRef.current.value = "";
8938
- }
8939
- }
8940
- ),
8941
- /* @__PURE__ */ jsxs(
8942
- "div",
8943
- {
8944
- ref: containerRef,
8945
- onClick: isProcessing || disabled ? void 0 : () => inputRef.current?.click(),
8946
- onDragOver: handleDragOver,
8947
- onDragEnter: handleDragOver,
8948
- onDragLeave: handleDragLeave,
8949
- onDrop: handleDrop,
8950
- className: cn(
8951
- "relative w-full rounded-lg bg-gray-50/50 border-[1.5px] border-dashed",
8952
- disabled ? "cursor-not-allowed border-gray-200 bg-gray-100 opacity-60" : isProcessing ? "cursor-default border-gray-300" : "cursor-pointer hover:bg-gray-50",
8953
- isDragging ? "border-blue-500 bg-blue-50" : "border-gray-300",
8954
- error && !isDragging ? "border-red-300 bg-red-50" : "",
8955
- 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
+ }
8956
8988
  ),
8957
- children: [
8958
- 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: [
8959
- /* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-blue-400 border-t-transparent" }),
8960
- /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: "\uCC98\uB9AC \uC911..." })
8961
- ] }),
8962
- files.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
8963
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3", children: files.map((file, idx) => {
8964
- const url = previewUrls[idx];
8965
- const isImage = file.type.startsWith("image/");
8966
- return /* @__PURE__ */ jsxs(
8967
- "div",
8968
- {
8969
- className: "group relative overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm transition-shadow hover:shadow-md",
8970
- children: [
8971
- /* @__PURE__ */ jsx(
8972
- "button",
8973
- {
8974
- type: "button",
8975
- onClick: (e) => {
8976
- e.stopPropagation();
8977
- viewer.open(idx);
8978
- },
8979
- className: "block w-full aspect-square cursor-pointer",
8980
- "aria-label": `${file.name} \uBBF8\uB9AC\uBCF4\uAE30`,
8981
- 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: [
8982
- /* @__PURE__ */ jsx(FileText, { className: "w-8 h-8" }),
8983
- /* @__PURE__ */ jsx("span", { className: "mt-1 max-w-full truncate px-1 text-center text-[10px]", children: file.name })
8984
- ] })
8985
- }
8986
- ),
8987
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-1 border-t border-gray-100 px-1.5 py-1", children: [
8988
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-[10px] text-gray-600", title: file.name, children: file.name }),
8989
- /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] text-gray-400", children: formatFileSize(file.size) })
8990
- ] }),
8991
- !disabled && /* @__PURE__ */ jsx(
8992
- "button",
8993
- {
8994
- type: "button",
8995
- onClick: (e) => {
8996
- e.stopPropagation();
8997
- removeFile(idx);
8998
- },
8999
- 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",
9000
- "aria-label": "\uD30C\uC77C \uC81C\uAC70",
9001
- children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
9002
- }
9003
- )
9004
- ]
9005
- },
9006
- `${file.name}-${idx}`
9007
- );
9008
- }) }),
9009
- /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center justify-between text-xs text-gray-500", children: [
9010
- /* @__PURE__ */ jsxs("span", { children: [
9011
- files.length,
9012
- "\uAC1C \uD30C\uC77C \uC120\uD0DD\uB428",
9013
- !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..." })
9014
9010
  ] }),
9015
- /* @__PURE__ */ jsxs("span", { children: [
9016
- "\uCD1D ",
9017
- formatFileSize(files.reduce((sum, f) => sum + f.size, 0))
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" })
9018
9082
  ] })
9019
- ] })
9020
- ] }) : isDragging ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-1 text-blue-500", children: [
9021
- /* @__PURE__ */ jsxs("p", { className: "text-sm font-semibold flex gap-1", children: [
9022
- /* @__PURE__ */ jsx(FileUp, { size: 15, className: "mt-[1px]" }),
9023
- "\uD30C\uC77C\uC744 \uC5EC\uAE30\uC5D0 \uB193\uC544\uC8FC\uC138\uC694"
9024
- ] }),
9025
- /* @__PURE__ */ jsx("p", { className: "text-xs font-medium", children: "\uB4DC\uB86D\uD558\uBA74 \uC790\uB3D9\uC73C\uB85C \uC5C5\uB85C\uB4DC\uB429\uB2C8\uB2E4." })
9026
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9027
- /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 flex gap-1", children: [
9028
- /* @__PURE__ */ jsx(FileUp, { size: 15, className: "text-gray-400 mt-[1px]" }),
9029
- " \uD074\uB9AD\uD558\uC5EC \uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uAC70\uB098 \uB4DC\uB798\uADF8\uD558\uC138\uC694"
9030
- ] }),
9031
- /* @__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)" }),
9032
- /* @__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" })
9033
- ] })
9034
- ]
9035
- }
9036
- ),
9037
- 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 }),
9038
- /* @__PURE__ */ jsx(FilePreviewViewer, { ...viewer.viewerProps, fileTypes, fileNames: files.map((f) => f.name) })
9039
- ] });
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
+ );
9040
9091
  }
9041
9092
  var VARIANT_STYLES2 = {
9042
9093
  light: {