@mlw-packages/react-components 1.10.3 → 1.10.4

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
@@ -1575,7 +1575,7 @@ var TooltipContentBase = React32__namespace.forwardRef(
1575
1575
  ...props,
1576
1576
  children: [
1577
1577
  props.children,
1578
- /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Arrow, { className: "fill-primary" })
1578
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Arrow, { className: "fill-primary h-1.5 w-3" })
1579
1579
  ]
1580
1580
  }
1581
1581
  ) });
@@ -2366,7 +2366,7 @@ function ComboboxBase({
2366
2366
  "aria-disabled": disabled || void 0,
2367
2367
  disabled,
2368
2368
  className: cn(
2369
- `flex items-center gap-2 justify-between [&>div]:line-clamp-1 relative h-9 no-active-animation`,
2369
+ `flex items-center gap-2 justify-between [&>div]:line-clamp-1 relative h-9 no-active-animation font-light`,
2370
2370
  error && "border-red-500"
2371
2371
  ),
2372
2372
  "data-testid": testIds.trigger ?? "combobox-trigger",
@@ -2508,7 +2508,7 @@ function Combobox({
2508
2508
  className: cn(
2509
2509
  "truncate",
2510
2510
  disabled && "opacity-60 cursor-not-allowed",
2511
- !selectedItem && "text-gray-500"
2511
+ !selectedItem && "text-muted-foreground"
2512
2512
  ),
2513
2513
  children: selectedItem?.label ?? placeholder ?? "Selecione uma op\xE7\xE3o..."
2514
2514
  }
@@ -2718,46 +2718,48 @@ function MultiSelectValueBase({
2718
2718
  if (valueRef.current == null) return;
2719
2719
  const containerElement = valueRef.current;
2720
2720
  const overflowElement = overflowRef.current;
2721
- const items2 = containerElement.querySelectorAll(
2721
+ const badgeItems = containerElement.querySelectorAll(
2722
2722
  "[data-selected-item]"
2723
2723
  );
2724
2724
  if (overflowElement != null) overflowElement.style.display = "none";
2725
- items2.forEach((child) => child.style.removeProperty("display"));
2725
+ badgeItems.forEach((child) => child.style.removeProperty("display"));
2726
+ if (shouldWrap) {
2727
+ setOverflowAmount(0);
2728
+ return;
2729
+ }
2726
2730
  let amount = 0;
2727
- for (let i = items2.length - 1; i >= 0; i--) {
2728
- const child = items2[i];
2729
- if (containerElement.scrollWidth <= containerElement.clientWidth) {
2730
- break;
2731
- }
2732
- amount = items2.length - i;
2731
+ for (let i = badgeItems.length - 1; i >= 0; i--) {
2732
+ if (containerElement.scrollWidth <= containerElement.clientWidth) break;
2733
+ const child = badgeItems[i];
2734
+ amount = badgeItems.length - i;
2733
2735
  child.style.display = "none";
2734
- overflowElement?.style.removeProperty("display");
2736
+ if (overflowElement != null) {
2737
+ overflowElement.style.removeProperty("display");
2738
+ }
2735
2739
  }
2736
2740
  setOverflowAmount(amount);
2741
+ }, [shouldWrap]);
2742
+ React32.useEffect(() => {
2743
+ if (overflowRef.current) {
2744
+ overflowRef.current.style.display = "none";
2745
+ }
2737
2746
  }, []);
2747
+ React32.useEffect(() => {
2748
+ checkOverflow();
2749
+ }, [open, shouldWrap, checkOverflow]);
2738
2750
  const handleResize = React32.useCallback(
2739
2751
  (node) => {
2740
2752
  if (node == null) {
2741
2753
  valueRef.current = null;
2742
- if (resizeObserverRef.current) {
2743
- resizeObserverRef.current.disconnect();
2744
- resizeObserverRef.current = null;
2745
- }
2746
- if (mutationObserverRef.current) {
2747
- mutationObserverRef.current.disconnect();
2748
- mutationObserverRef.current = null;
2749
- }
2750
- return;
2751
- }
2752
- valueRef.current = node;
2753
- if (resizeObserverRef.current) {
2754
- resizeObserverRef.current.disconnect();
2754
+ resizeObserverRef.current?.disconnect();
2755
2755
  resizeObserverRef.current = null;
2756
- }
2757
- if (mutationObserverRef.current) {
2758
- mutationObserverRef.current.disconnect();
2756
+ mutationObserverRef.current?.disconnect();
2759
2757
  mutationObserverRef.current = null;
2758
+ return;
2760
2759
  }
2760
+ valueRef.current = node;
2761
+ resizeObserverRef.current?.disconnect();
2762
+ mutationObserverRef.current?.disconnect();
2761
2763
  const mo = new MutationObserver(checkOverflow);
2762
2764
  const ro = new ResizeObserver(debounce(checkOverflow, 100));
2763
2765
  mutationObserverRef.current = mo;
@@ -2772,6 +2774,7 @@ function MultiSelectValueBase({
2772
2774
  },
2773
2775
  [checkOverflow]
2774
2776
  );
2777
+ const [overflowHovered, setOverflowHovered] = React32.useState(false);
2775
2778
  const visibleSelected = [...selectedValues].filter((value) => items.has(value)).sort((a, b) => {
2776
2779
  const aNode = items.get(a);
2777
2780
  const bNode = items.get(b);
@@ -2799,7 +2802,7 @@ function MultiSelectValueBase({
2799
2802
  {
2800
2803
  "data-selected-item": true,
2801
2804
  size: "sm",
2802
- className: "group flex items-center gap-1 border-border",
2805
+ className: "group flex items-center gap-1 border-border shrink-0",
2803
2806
  onClick: clickToRemove ? (e) => {
2804
2807
  e.stopPropagation();
2805
2808
  toggleValue(value);
@@ -2811,19 +2814,38 @@ function MultiSelectValueBase({
2811
2814
  },
2812
2815
  value
2813
2816
  )),
2814
- /* @__PURE__ */ jsxRuntime.jsxs(
2815
- Badge,
2816
- {
2817
- style: {
2818
- display: overflowAmount > 0 && !shouldWrap ? "block" : "none"
2819
- },
2820
- ref: overflowRef,
2821
- children: [
2822
- "+",
2823
- overflowAmount
2824
- ]
2825
- }
2826
- )
2817
+ overflowAmount > 0 && /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { open: overflowHovered, children: [
2818
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2819
+ "div",
2820
+ {
2821
+ ref: overflowRef,
2822
+ className: "inline-flex",
2823
+ onMouseEnter: () => setOverflowHovered(true),
2824
+ onMouseLeave: () => setOverflowHovered(false),
2825
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Badge, { size: "sm", className: "shrink-0 cursor-default", children: [
2826
+ "+",
2827
+ overflowAmount
2828
+ ] })
2829
+ }
2830
+ ) }),
2831
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { className: "p-2 max-w-xs", children: [
2832
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs font-medium text-primary-foreground/60 mb-1.5 px-1", children: [
2833
+ overflowAmount,
2834
+ " item",
2835
+ overflowAmount > 1 ? "s" : "",
2836
+ " oculto",
2837
+ overflowAmount > 1 ? "s" : ""
2838
+ ] }),
2839
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: visibleSelected.slice(visibleSelected.length - overflowAmount).map((value) => /* @__PURE__ */ jsxRuntime.jsx(
2840
+ "span",
2841
+ {
2842
+ className: "inline-flex items-center rounded-md bg-primary-foreground/15 px-2 py-0.5 text-xs font-medium text-primary-foreground",
2843
+ children: typeof items.get(value) === "string" ? items.get(value) : value
2844
+ },
2845
+ value
2846
+ )) })
2847
+ ] })
2848
+ ] }) })
2827
2849
  ]
2828
2850
  }
2829
2851
  );
@@ -2885,7 +2907,7 @@ function MultiSelectItemBase({
2885
2907
  ...props
2886
2908
  }) {
2887
2909
  const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
2888
- const isSelected = selectedValues.has(value);
2910
+ const [hovered, setHovered] = React32.useState(false);
2889
2911
  React32.useEffect(() => {
2890
2912
  onItemAdded(value, badgeLabel ?? children);
2891
2913
  }, [value, children, onItemAdded, badgeLabel]);
@@ -2897,17 +2919,35 @@ function MultiSelectItemBase({
2897
2919
  toggleValue(value);
2898
2920
  onSelect?.(value);
2899
2921
  },
2900
- children: /* @__PURE__ */ jsxRuntime.jsxs(framerMotion.motion.div, { transition: { duration: 0.1 }, children: [
2901
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
2902
- framerMotion.motion.div,
2922
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
2923
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children }),
2924
+ /* @__PURE__ */ jsxRuntime.jsx(
2925
+ "div",
2903
2926
  {
2904
- initial: { scale: 0 },
2905
- animate: { scale: isSelected ? 1 : 0 },
2906
- transition: { type: "spring", stiffness: 500, damping: 30 },
2907
- children: /* @__PURE__ */ jsxRuntime.jsx(react.CheckIcon, { className: "size-4" })
2927
+ className: "relative flex h-4 w-4 shrink-0 items-center justify-center",
2928
+ onMouseEnter: () => setHovered(true),
2929
+ onMouseLeave: () => setHovered(false),
2930
+ children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: selectedValues.has(value) && (hovered ? /* @__PURE__ */ jsxRuntime.jsx(
2931
+ framerMotion.motion.div,
2932
+ {
2933
+ initial: { scale: 0, rotate: -90, opacity: 0 },
2934
+ animate: { scale: 1, rotate: 0, opacity: 1 },
2935
+ transition: { duration: 0.05, ease: "easeOut" },
2936
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { className: "size-4 text-destructive" })
2937
+ },
2938
+ "x"
2939
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2940
+ framerMotion.motion.div,
2941
+ {
2942
+ initial: { scale: 0, rotate: 90, opacity: 0 },
2943
+ animate: { scale: 1, rotate: 0, opacity: 1 },
2944
+ transition: { duration: 0.05, ease: "easeOut" },
2945
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.CheckIcon, { className: "size-4" })
2946
+ },
2947
+ "check"
2948
+ )) })
2908
2949
  }
2909
- ) }),
2910
- children
2950
+ )
2911
2951
  ] })
2912
2952
  }
2913
2953
  );
@@ -3689,14 +3729,14 @@ var CardFooterBase = React32__namespace.forwardRef(({ className, testid: dataTes
3689
3729
  }
3690
3730
  ));
3691
3731
  CardFooterBase.displayName = "CardFooter";
3692
- var FileTypes = {
3693
- Image: ["image/*", ".jpeg", ".jpg", ".png", ".gif", ".webp", ".svg"],
3694
- Document: [".pdf", ".doc", ".docx", ".txt", ".rtf"],
3695
- Spreadsheet: [".xls", ".xlsx", ".csv"],
3696
- Presentation: [".ppt", ".pptx"],
3697
- Video: ["video/*", ".mp4", ".webm", ".mkv", ".avi"],
3698
- Audio: ["audio/*", ".mp3", ".wav", ".ogg"],
3699
- All: []
3732
+ var FileAccept = {
3733
+ Image: "image/*",
3734
+ Document: "pdf,doc,docx,txt,rtf",
3735
+ Spreadsheet: "xls,xlsx,csv",
3736
+ Presentation: "ppt,pptx",
3737
+ Video: "video/*",
3738
+ Audio: "audio/*",
3739
+ All: "*"
3700
3740
  };
3701
3741
  var formatFileSize = (bytes) => {
3702
3742
  if (bytes === 0) return "0 Bytes";
@@ -3705,66 +3745,62 @@ var formatFileSize = (bytes) => {
3705
3745
  const i = Math.floor(Math.log(bytes) / Math.log(k));
3706
3746
  return Math.round(bytes / Math.pow(k, i) * 100) / 100 + " " + sizes[i];
3707
3747
  };
3708
- var getFileExtension = (filename) => {
3709
- return filename.slice((filename.lastIndexOf(".") - 1 >>> 0) + 2);
3748
+ var getFileExtension = (filename) => filename.slice((filename.lastIndexOf(".") - 1 >>> 0) + 2);
3749
+ var parseAcceptTokens = (accept) => accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
3750
+ var validateFileAgainstAccept = (file, accept) => {
3751
+ if (!accept || accept === "*") return true;
3752
+ const tokens = parseAcceptTokens(accept);
3753
+ const ext = getFileExtension(file.name).toLowerCase();
3754
+ const mime = file.type.toLowerCase();
3755
+ return tokens.some((token) => {
3756
+ if (token.endsWith("/*")) return mime.startsWith(token.replace("/*", ""));
3757
+ const tokenExt = token.startsWith(".") ? token.substring(1) : token;
3758
+ if (!token.includes("/")) return ext === tokenExt;
3759
+ return mime === token;
3760
+ });
3761
+ };
3762
+ var formatAcceptForInput = (accept) => {
3763
+ if (!accept || accept === "*") return void 0;
3764
+ return parseAcceptTokens(accept).map((t) => t.includes("/") || t.startsWith(".") ? t : `.${t}`).join(",");
3710
3765
  };
3711
3766
  var getFileTypeIcon = (file) => {
3712
3767
  const extension = getFileExtension(file.name).toLowerCase();
3713
3768
  const mimeType = file.type.toLowerCase();
3714
- if (extension === "pdf" || mimeType === "application/pdf") {
3769
+ if (extension === "pdf" || mimeType === "application/pdf")
3715
3770
  return /* @__PURE__ */ jsxRuntime.jsx(react.FilePdfIcon, { size: 20, className: "text-red-500" });
3716
- }
3717
- if (["doc", "docx"].includes(extension) || mimeType.includes("word")) {
3771
+ if (["doc", "docx"].includes(extension) || mimeType.includes("word"))
3718
3772
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileDocIcon, { size: 20, className: "text-blue-500" });
3719
- }
3720
- if (["xls", "xlsx"].includes(extension) || mimeType.includes("sheet")) {
3773
+ if (["xls", "xlsx"].includes(extension) || mimeType.includes("sheet"))
3721
3774
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileXlsIcon, { size: 20, className: "text-green-500" });
3722
- }
3723
- if (["ppt", "pptx"].includes(extension) || mimeType.includes("presentation")) {
3775
+ if (["ppt", "pptx"].includes(extension) || mimeType.includes("presentation"))
3724
3776
  return /* @__PURE__ */ jsxRuntime.jsx(react.FilePptIcon, { size: 20, className: "text-orange-500" });
3725
- }
3726
- if (extension === "csv" || mimeType === "text/csv") {
3777
+ if (extension === "csv" || mimeType === "text/csv")
3727
3778
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileCsvIcon, { size: 20, className: "text-green-600" });
3728
- }
3729
3779
  if (["txt", "md", "json", "xml", "js", "ts", "html", "css"].includes(
3730
3780
  extension
3731
- ) || mimeType.includes("text")) {
3781
+ ) || mimeType.includes("text"))
3732
3782
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileTextIcon, { size: 20, className: "text-gray-500" });
3733
- }
3734
- if (mimeType.startsWith("image/")) {
3783
+ if (mimeType.startsWith("image/"))
3735
3784
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileImageIcon, { size: 20, className: "text-purple-500" });
3736
- }
3737
- if (mimeType.startsWith("video/")) {
3785
+ if (mimeType.startsWith("video/"))
3738
3786
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileVideoIcon, { size: 20, className: "text-pink-500" });
3739
- }
3740
- if (mimeType.startsWith("audio/")) {
3787
+ if (mimeType.startsWith("audio/"))
3741
3788
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileAudioIcon, { size: 20, className: "text-indigo-500" });
3742
- }
3743
- if (["zip", "rar", "7z", "tar", "gz"].includes(extension)) {
3789
+ if (["zip", "rar", "7z", "tar", "gz"].includes(extension))
3744
3790
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileZipIcon, { size: 20, className: "text-yellow-600" });
3745
- }
3746
3791
  return /* @__PURE__ */ jsxRuntime.jsx(react.FileIcon, { size: 20, className: "text-muted-foreground" });
3747
3792
  };
3748
- var createImagePreview = (file) => {
3749
- return new Promise((resolve) => {
3750
- if (!file.type.startsWith("image/")) {
3751
- resolve(null);
3752
- return;
3753
- }
3754
- const reader = new FileReader();
3755
- reader.onload = (e) => {
3756
- resolve(e.target?.result);
3757
- };
3758
- reader.onerror = () => {
3759
- resolve(null);
3760
- };
3761
- reader.readAsDataURL(file);
3762
- });
3763
- };
3793
+ var createImagePreview = (file) => new Promise((resolve) => {
3794
+ if (!file.type.startsWith("image/")) return resolve(null);
3795
+ const reader = new FileReader();
3796
+ reader.onload = (e) => resolve(e.target?.result);
3797
+ reader.onerror = () => resolve(null);
3798
+ reader.readAsDataURL(file);
3799
+ });
3764
3800
  var FileUploader = React32__namespace.forwardRef(
3765
3801
  ({
3766
3802
  className,
3767
- accept = FileTypes.All,
3803
+ accept = "*",
3768
3804
  maxSize = 10,
3769
3805
  maxFiles = 1,
3770
3806
  disabled = false,
@@ -3787,72 +3823,49 @@ var FileUploader = React32__namespace.forwardRef(
3787
3823
  }, [value]);
3788
3824
  React32__namespace.useEffect(() => {
3789
3825
  return () => {
3790
- files.forEach((file) => {
3791
- if (file.preview) {
3792
- URL.revokeObjectURL(file.preview);
3793
- }
3826
+ files.forEach((f) => {
3827
+ if (f.preview) URL.revokeObjectURL(f.preview);
3794
3828
  });
3795
3829
  };
3796
3830
  }, [files]);
3797
3831
  const validateFile = (file) => {
3798
- const maxSizeBytes = maxSize * 1024 * 1024;
3799
- if (file.size > maxSizeBytes) {
3800
- return `Arquivo muito grande. M\xE1ximo: ${maxSize} MB`;
3801
- }
3802
- if (accept.length > 0) {
3803
- const fileExtension = `.${getFileExtension(file.name)}`;
3804
- const fileType = file.type;
3805
- const isAccepted = accept.some((acceptItem) => {
3806
- if (acceptItem.startsWith(".")) {
3807
- return fileExtension.toLowerCase() === acceptItem.toLowerCase();
3808
- }
3809
- if (acceptItem.endsWith("/*")) {
3810
- return fileType.startsWith(acceptItem.replace("/*", ""));
3811
- }
3812
- return fileType === acceptItem;
3813
- });
3814
- if (!isAccepted) {
3815
- return `Tipo de arquivo n\xE3o permitido. Aceitos: ${accept.join(", ")}`;
3816
- }
3817
- }
3832
+ if (file.size > maxSize * 1024 * 1024)
3833
+ return `Arquivo muito grande. M\xE1ximo: ${maxSize}MB`;
3834
+ if (!validateFileAgainstAccept(file, accept))
3835
+ return `Tipo n\xE3o permitido. Aceitos: ${accept}`;
3818
3836
  return null;
3819
3837
  };
3820
3838
  const createFileWithPreview = async (file) => {
3821
- const fileWithPreview = file;
3822
- fileWithPreview.id = `${file.name}-${Date.now()}-${Math.random()}`;
3823
- const error = validateFile(file);
3824
- if (error) {
3825
- fileWithPreview.error = error;
3826
- }
3827
- if (file.type.startsWith("image/")) {
3839
+ const f = file;
3840
+ f.id = `${file.name}-${Date.now()}-${Math.random()}`;
3841
+ f.error = validateFile(file) ?? void 0;
3842
+ if (!f.error && file.type.startsWith("image/")) {
3828
3843
  try {
3829
3844
  const preview = await createImagePreview(file);
3830
- if (preview) {
3831
- fileWithPreview.preview = preview;
3832
- }
3833
- } catch (error2) {
3834
- console.warn("Erro ao criar preview da imagem:", error2);
3845
+ if (preview) f.preview = preview;
3846
+ } catch (err) {
3847
+ console.warn("Erro ao criar preview:", err);
3835
3848
  }
3836
3849
  }
3837
- return fileWithPreview;
3850
+ return f;
3838
3851
  };
3839
3852
  const handleFiles = async (newFiles) => {
3840
3853
  if (disabled) return;
3841
- const availableSlots = maxFiles - files.length;
3842
- const filesToAdd = multiple ? newFiles.slice(0, availableSlots) : [newFiles[0]];
3843
- const filesWithPreview = await Promise.all(
3844
- filesToAdd.map((file) => createFileWithPreview(file))
3854
+ const slots = maxFiles - files.length;
3855
+ const filesToAdd = multiple ? newFiles.slice(0, slots) : [newFiles[0]];
3856
+ const processed = await Promise.all(
3857
+ filesToAdd.map(createFileWithPreview)
3845
3858
  );
3846
- const updatedFiles = multiple ? [...files, ...filesWithPreview] : filesWithPreview;
3847
- setFiles(updatedFiles);
3848
- onValueChange(updatedFiles);
3859
+ const updated = multiple ? [...files, ...processed] : processed;
3860
+ setFiles(updated);
3861
+ onValueChange(updated);
3849
3862
  if (onUpload) {
3850
- const validFiles = filesWithPreview.filter((f) => !f.error);
3851
- if (validFiles.length > 0) {
3863
+ const valid = processed.filter((f) => !f.error);
3864
+ if (valid.length > 0) {
3852
3865
  try {
3853
- await onUpload(validFiles);
3854
- } catch (error) {
3855
- console.error("Erro no upload:", error);
3866
+ await onUpload(valid);
3867
+ } catch (err) {
3868
+ console.error("Erro no upload:", err);
3856
3869
  }
3857
3870
  }
3858
3871
  }
@@ -3861,17 +3874,12 @@ var FileUploader = React32__namespace.forwardRef(
3861
3874
  e.preventDefault();
3862
3875
  e.stopPropagation();
3863
3876
  dragCounterRef.current++;
3864
- if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
3865
- setIsDragging(true);
3866
- }
3877
+ if (e.dataTransfer.items?.length > 0) setIsDragging(true);
3867
3878
  };
3868
3879
  const handleDragLeave = (e) => {
3869
3880
  e.preventDefault();
3870
3881
  e.stopPropagation();
3871
- dragCounterRef.current--;
3872
- if (dragCounterRef.current === 0) {
3873
- setIsDragging(false);
3874
- }
3882
+ if (--dragCounterRef.current === 0) setIsDragging(false);
3875
3883
  };
3876
3884
  const handleDragOver = (e) => {
3877
3885
  e.preventDefault();
@@ -3882,43 +3890,19 @@ var FileUploader = React32__namespace.forwardRef(
3882
3890
  e.stopPropagation();
3883
3891
  setIsDragging(false);
3884
3892
  dragCounterRef.current = 0;
3885
- if (disabled) return;
3886
- const droppedFiles = Array.from(e.dataTransfer.files);
3887
- handleFiles(droppedFiles);
3893
+ if (!disabled) handleFiles(Array.from(e.dataTransfer.files));
3888
3894
  };
3889
3895
  const handleInputChange = (e) => {
3890
- if (e.target.files) {
3891
- const selectedFiles = Array.from(e.target.files);
3892
- handleFiles(selectedFiles);
3893
- }
3896
+ if (e.target.files) handleFiles(Array.from(e.target.files));
3894
3897
  };
3895
3898
  const handleRemoveFile = (fileId) => {
3896
- const fileToRemove = files.find((f) => f.id === fileId);
3897
- if (fileToRemove?.preview) {
3898
- URL.revokeObjectURL(fileToRemove.preview);
3899
- }
3900
- const updatedFiles = files.filter((f) => f.id !== fileId);
3901
- setFiles(updatedFiles);
3902
- onValueChange(updatedFiles);
3903
- };
3904
- const handleClick = () => {
3905
- if (!disabled) {
3906
- inputRef.current?.click();
3907
- }
3899
+ const target = files.find((f) => f.id === fileId);
3900
+ if (target?.preview) URL.revokeObjectURL(target.preview);
3901
+ const updated = files.filter((f) => f.id !== fileId);
3902
+ setFiles(updated);
3903
+ onValueChange(updated);
3908
3904
  };
3909
- const acceptString = accept.join(",");
3910
- const getFormatText = () => {
3911
- if (accept === FileTypes.All || accept.length === 0)
3912
- return "Qualquer formato";
3913
- if (accept === FileTypes.Image) return "Apenas imagens";
3914
- if (accept === FileTypes.Document) return "Apenas documentos";
3915
- if (accept === FileTypes.Video) return "Apenas v\xEDdeos";
3916
- if (accept === FileTypes.Audio) return "Apenas \xE1udio";
3917
- if (accept === FileTypes.Spreadsheet) return "Apenas planilhas";
3918
- if (accept === FileTypes.Presentation) return "Apenas apresenta\xE7\xF5es";
3919
- return "Formatos espec\xEDficos v\xE1lidos";
3920
- };
3921
- const defaultSubtext = dropzoneSubtext || `${getFormatText()} (M\xE1x: ${maxSize}MB)`;
3905
+ const defaultSubtext = dropzoneSubtext ?? `${accept === "*" ? "Qualquer formato" : accept} (M\xE1x: ${maxSize}MB)`;
3922
3906
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
3923
3907
  framerMotion.motion.div,
3924
3908
  {
@@ -3932,7 +3916,7 @@ var FileUploader = React32__namespace.forwardRef(
3932
3916
  onDragOver: handleDragOver,
3933
3917
  onDragLeave: handleDragLeave,
3934
3918
  onDrop: handleDrop,
3935
- onClick: handleClick,
3919
+ onClick: () => !disabled && inputRef.current?.click(),
3936
3920
  whileTap: !disabled ? { scale: 0.99 } : void 0,
3937
3921
  animate: isDragging ? {
3938
3922
  borderColor: `hsl(var(--primary))`,
@@ -3943,12 +3927,7 @@ var FileUploader = React32__namespace.forwardRef(
3943
3927
  backgroundColor: `hsl(var(--background))`,
3944
3928
  scale: 1
3945
3929
  },
3946
- transition: {
3947
- type: "spring",
3948
- stiffness: 300,
3949
- damping: 25,
3950
- duration: 0.3
3951
- },
3930
+ transition: { type: "spring", stiffness: 300, damping: 25 },
3952
3931
  children: [
3953
3932
  /* @__PURE__ */ jsxRuntime.jsx(
3954
3933
  "input",
@@ -3956,7 +3935,7 @@ var FileUploader = React32__namespace.forwardRef(
3956
3935
  ref: inputRef,
3957
3936
  type: "file",
3958
3937
  className: "hidden",
3959
- accept: acceptString,
3938
+ accept: formatAcceptForInput(accept),
3960
3939
  multiple,
3961
3940
  disabled,
3962
3941
  onChange: handleInputChange
@@ -3966,20 +3945,11 @@ var FileUploader = React32__namespace.forwardRef(
3966
3945
  framerMotion.motion.div,
3967
3946
  {
3968
3947
  animate: isDragging ? { scale: 1.2, rotate: 10 } : { scale: 1, rotate: 0 },
3969
- transition: {
3970
- type: "spring",
3971
- stiffness: 300,
3972
- damping: 20,
3973
- duration: 0.3
3974
- },
3948
+ transition: { type: "spring", stiffness: 300, damping: 20 },
3975
3949
  children: /* @__PURE__ */ jsxRuntime.jsx(
3976
3950
  framerMotion.motion.div,
3977
3951
  {
3978
- className: cn(
3979
- "mb-4 h-16 w-16 text-muted-foreground transition-colors duration-300 drop-shadow-lg flex items-center justify-center",
3980
- isDragging && "text-primary"
3981
- ),
3982
- initial: false,
3952
+ className: "mb-4 h-16 w-16 drop-shadow-lg flex items-center justify-center",
3983
3953
  animate: {
3984
3954
  color: isDragging ? `hsl(var(--primary))` : `hsl(var(--muted-foreground))`
3985
3955
  },
@@ -4009,14 +3979,14 @@ var FileUploader = React32__namespace.forwardRef(
4009
3979
  children: defaultSubtext
4010
3980
  }
4011
3981
  ),
4012
- showPreview && files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
3982
+ showPreview && files.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4013
3983
  framerMotion.motion.div,
4014
3984
  {
4015
3985
  className: "py-2 w-full",
4016
3986
  initial: animate ? { opacity: 0, y: 10 } : false,
4017
3987
  animate: { opacity: 1, y: 0 },
4018
3988
  transition: { delay: 0.3 },
4019
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3989
+ children: [
4020
3990
  /* @__PURE__ */ jsxRuntime.jsxs("h4", { className: "text-xs font-medium text-muted-foreground pb-0.5", children: [
4021
3991
  "Arquivos selecionados (",
4022
3992
  files.length,
@@ -4095,7 +4065,7 @@ var FileUploader = React32__namespace.forwardRef(
4095
4065
  },
4096
4066
  file.id
4097
4067
  )) }) })
4098
- ] })
4068
+ ]
4099
4069
  }
4100
4070
  )
4101
4071
  ]
@@ -9949,6 +9919,7 @@ function Select({
9949
9919
  {
9950
9920
  className: cn(
9951
9921
  "flex items-center gap-2 justify-between [&>div]:line-clamp-1 [&>span]:line-clamp-1 relative",
9922
+ !selected && "text-muted-foreground",
9952
9923
  error && "border-red-500",
9953
9924
  className
9954
9925
  ),
@@ -14522,6 +14493,7 @@ function MultiSelect({
14522
14493
  {
14523
14494
  className: cn(
14524
14495
  "flex items-center gap-2 justify-between hover:bg-muted transition-all duration-150",
14496
+ !selected && "text-muted-foreground",
14525
14497
  error && "border-red-500",
14526
14498
  className
14527
14499
  ),
@@ -16860,7 +16832,7 @@ var IntegrationCard = ({ title, details }) => {
16860
16832
  }) })
16861
16833
  ] });
16862
16834
  };
16863
- var TooltipBodyComponent = ({ data, isLoading, connections, isInput, externalSystem }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-3 space-y-3 overflow-y-auto flex-1 [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/40 transition-colors", children: [
16835
+ var TooltipBodyComponent = ({ data, isLoading, connections, isInput, externalSystem }) => /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaBase, { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-3 space-y-3", children: [
16864
16836
  isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
16865
16837
  /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-6 w-3/4" }),
16866
16838
  /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-3.5 w-1/2" })
@@ -16903,7 +16875,7 @@ var TooltipBodyComponent = ({ data, isLoading, connections, isInput, externalSys
16903
16875
  conn.id
16904
16876
  )) })
16905
16877
  ] })
16906
- ] });
16878
+ ] }) });
16907
16879
  var TooltipBody = React32__namespace.default.memo(TooltipBodyComponent);
16908
16880
  var tooltipVariants3 = {
16909
16881
  hidden: {
@@ -20294,44 +20266,6 @@ var Lens = ({
20294
20266
  }
20295
20267
  );
20296
20268
  };
20297
- var carouselThemes = {
20298
- malwee: {
20299
- foreground: "text-[#222222]",
20300
- primary: "bg-[#0b5430]",
20301
- primaryForeground: "text-white",
20302
- muted: "bg-[#f0eacc]",
20303
- mutedForeground: "text-[#6b665c]",
20304
- border: "!border-[#0b5430]",
20305
- font: "font-[family-name:var(--font-playfair)]"
20306
- },
20307
- enfim: {
20308
- foreground: "text-black",
20309
- primary: "bg-black",
20310
- primaryForeground: "text-white",
20311
- muted: "bg-gray-100",
20312
- mutedForeground: "text-gray-600",
20313
- border: "!border-black",
20314
- font: "font-[family-name:var(--font-libre-caslon)]"
20315
- },
20316
- carinhoso: {
20317
- foreground: "text-[#222222]",
20318
- primary: "bg-[#d9d0c0]",
20319
- primaryForeground: "text-[#222222]",
20320
- muted: "bg-[#e2ddd6]",
20321
- mutedForeground: "text-[#5e5b56]",
20322
- border: "!border-[#d9d0c0]",
20323
- font: "font-[family-name:var(--font-josefin)]"
20324
- },
20325
- "malwee-kids": {
20326
- foreground: "text-[#005bbf]",
20327
- primary: "bg-[#005bbf]",
20328
- primaryForeground: "text-white",
20329
- muted: "bg-[#fcf5c2]",
20330
- mutedForeground: "text-[#004a9e]",
20331
- border: "!border-[#005bbf]",
20332
- font: "font-[family-name:var(--font-poppins)]"
20333
- }
20334
- };
20335
20269
  function CarouselSkeleton({ className }) {
20336
20270
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full h-full lg:p-10 sm:p-4 p-2", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden rounded-lg h-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full h-full min-h-[300px] bg-muted rounded-lg overflow-hidden relative", children: [
20337
20271
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -20412,7 +20346,8 @@ function CarouselBase({
20412
20346
  zoomEffect = null,
20413
20347
  download = false,
20414
20348
  isLoading = false,
20415
- onChange
20349
+ onChange,
20350
+ fernando
20416
20351
  }) {
20417
20352
  const isMobile = useIsMobile();
20418
20353
  const [index, setIndex] = React32.useState(0);
@@ -20434,9 +20369,6 @@ function CarouselBase({
20434
20369
  emblaApi.off("reInit", onSelect);
20435
20370
  };
20436
20371
  }, [emblaApi, onChange]);
20437
- const currentItem = items[index];
20438
- const themeKey = currentItem?.theme || "malwee";
20439
- const currentTheme = carouselThemes[themeKey] || carouselThemes.malwee;
20440
20372
  React32.useEffect(() => {
20441
20373
  if (!autoPlay || items.length <= 1 || !emblaApi) return;
20442
20374
  const interval = setInterval(() => {
@@ -20448,14 +20380,14 @@ function CarouselBase({
20448
20380
  if (isDownloading) return;
20449
20381
  setIsDownloading(true);
20450
20382
  setDownloadSuccess(false);
20451
- const currentItem2 = items[index];
20383
+ const currentItem = items[index];
20452
20384
  try {
20453
- const response = await fetch(currentItem2.url);
20385
+ const response = await fetch(currentItem.url);
20454
20386
  const blob = await response.blob();
20455
20387
  const url = window.URL.createObjectURL(blob);
20456
20388
  const link = document.createElement("a");
20457
20389
  link.href = url;
20458
- link.download = currentItem2.title || "image";
20390
+ link.download = currentItem.title || "image";
20459
20391
  document.body.appendChild(link);
20460
20392
  link.click();
20461
20393
  document.body.removeChild(link);
@@ -20491,8 +20423,6 @@ function CarouselBase({
20491
20423
  transition: { duration: 0.4 },
20492
20424
  className: cn(
20493
20425
  "w-full lg:p-10 sm:p-4 p-2 transition-colors duration-500",
20494
- currentTheme.foreground,
20495
- currentTheme.font,
20496
20426
  className
20497
20427
  ),
20498
20428
  style: { width },
@@ -20546,7 +20476,8 @@ function CarouselBase({
20546
20476
  onMouseDown: (e) => e.stopPropagation(),
20547
20477
  className: cn(
20548
20478
  "absolute top-4 right-4 z-50 p-2 rounded-full text-white transition-colors border border-white/10",
20549
- downloadSuccess ? "bg-green-500 hover:bg-green-600" : "bg-black/50 hover:bg-black/70"
20479
+ downloadSuccess ? "bg-green-500 hover:bg-green-600" : "bg-black/50 hover:bg-black/70",
20480
+ className
20550
20481
  ),
20551
20482
  title: "Download image",
20552
20483
  initial: false,
@@ -20632,9 +20563,10 @@ function CarouselBase({
20632
20563
  className: cn(
20633
20564
  "absolute left-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full flex items-center justify-center shadow-lg transition-all z-50",
20634
20565
  !emblaApi?.canScrollPrev() ? "opacity-40 cursor-not-allowed" : "hover:scale-110 hover:opacity-100 opacity-70",
20635
- currentTheme.primary,
20636
- currentTheme.primaryForeground
20566
+ "bg-primary text-primary-foreground",
20567
+ className
20637
20568
  ),
20569
+ style: fernando ? { backgroundColor: fernando } : void 0,
20638
20570
  children: /* @__PURE__ */ jsxRuntime.jsx(
20639
20571
  "svg",
20640
20572
  {
@@ -20666,9 +20598,10 @@ function CarouselBase({
20666
20598
  className: cn(
20667
20599
  "absolute right-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full flex items-center justify-center shadow-lg transition-all z-50",
20668
20600
  !emblaApi?.canScrollNext() ? "opacity-40 cursor-not-allowed" : "hover:scale-110 hover:opacity-100 opacity-70",
20669
- currentTheme.primary,
20670
- currentTheme.primaryForeground
20601
+ "bg-primary text-primary-foreground",
20602
+ className
20671
20603
  ),
20604
+ style: fernando ? { backgroundColor: fernando } : void 0,
20672
20605
  children: /* @__PURE__ */ jsxRuntime.jsx(
20673
20606
  "svg",
20674
20607
  {
@@ -20699,12 +20632,10 @@ function CarouselBase({
20699
20632
  onMouseDown: (e) => e.stopPropagation(),
20700
20633
  className: cn(
20701
20634
  "h-2 rounded-full transition-all duration-300",
20702
- i === index ? cn("w-8", currentTheme.primary) : cn(
20703
- "w-2 hover:opacity-80",
20704
- currentTheme.primary,
20705
- "opacity-40"
20706
- )
20707
- )
20635
+ i === index ? cn("w-8 bg-primary") : cn("w-2 hover:opacity-80 bg-primary opacity-40"),
20636
+ className
20637
+ ),
20638
+ style: fernando ? { backgroundColor: fernando } : void 0
20708
20639
  },
20709
20640
  i
20710
20641
  )) })
@@ -20893,9 +20824,9 @@ function RadialMenu({
20893
20824
  }
20894
20825
  function ControlledCombobox({
20895
20826
  items,
20896
- renderSelected,
20897
- handleSelection,
20898
- checkIsSelected,
20827
+ value,
20828
+ onChange,
20829
+ placeholder = "Selecione uma op\xE7\xE3o",
20899
20830
  disabled = false,
20900
20831
  keepOpen = false,
20901
20832
  searchPlaceholder,
@@ -20905,7 +20836,6 @@ function ControlledCombobox({
20905
20836
  labelClassname,
20906
20837
  testIds = {},
20907
20838
  onClear,
20908
- hasSelected = false,
20909
20839
  hideClear = false,
20910
20840
  onSearchChange,
20911
20841
  search,
@@ -20913,6 +20843,11 @@ function ControlledCombobox({
20913
20843
  loading = false
20914
20844
  }) {
20915
20845
  const [open, setOpen] = React32.useState(false);
20846
+ const selectedItem = items.find((item) => item.value === value);
20847
+ const renderSelected = selectedItem?.label ?? placeholder;
20848
+ const hasSelected = Boolean(value);
20849
+ const checkIsSelected = (v) => v === value;
20850
+ const handleSelection = (v) => onChange?.(v);
20916
20851
  return /* @__PURE__ */ jsxRuntime.jsxs(
20917
20852
  "div",
20918
20853
  {
@@ -20985,9 +20920,9 @@ function ControlledCombobox({
20985
20920
  {
20986
20921
  className: "dark:text-white hover:bg-rsecondary focus:ring-0 focus:outline-none",
20987
20922
  "data-testid": testIds.command ?? "combobox-command",
20988
- filter: onSearchChange ? () => 1 : (value, search2) => {
20989
- const label2 = items.find((item) => item.value === value)?.label || value;
20990
- if (label2.toLowerCase().includes(search2.toLowerCase()))
20923
+ filter: onSearchChange ? () => 1 : (itemValue, search2) => {
20924
+ const itemLabel = items.find((item) => item.value === itemValue)?.label || itemValue;
20925
+ if (itemLabel.toLowerCase().includes(search2.toLowerCase()))
20991
20926
  return 1;
20992
20927
  return 0;
20993
20928
  },
@@ -21019,9 +20954,9 @@ function ControlledCombobox({
21019
20954
  {
21020
20955
  keywords: [item.label],
21021
20956
  value: item.value,
21022
- onSelect: (value) => {
20957
+ onSelect: (v) => {
21023
20958
  if (disabled) return;
21024
- handleSelection(value);
20959
+ handleSelection(v);
21025
20960
  if (!keepOpen) setOpen(false);
21026
20961
  },
21027
20962
  disabled,
@@ -21038,7 +20973,7 @@ function ControlledCombobox({
21038
20973
  stiffness: 500,
21039
20974
  damping: 30
21040
20975
  },
21041
- className: "ml-auto ",
20976
+ className: "ml-auto",
21042
20977
  children: /* @__PURE__ */ jsxRuntime.jsx(
21043
20978
  react.CheckIcon,
21044
20979
  {
@@ -21226,7 +21161,7 @@ exports.EventItem = EventItem;
21226
21161
  exports.EventItemAgenda = EventItemAgenda;
21227
21162
  exports.EventsPopup = EventsPopup;
21228
21163
  exports.FavoriteButton = FavoriteButton;
21229
- exports.FileTypes = FileTypes;
21164
+ exports.FileAccept = FileAccept;
21230
21165
  exports.FileUploader = FileUploader;
21231
21166
  exports.FilterButton = FilterButton;
21232
21167
  exports.HideButton = HideButton;