@mlw-packages/react-components 1.10.19 → 1.10.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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
  import * as React32 from 'react';
3
- import React32__default, { forwardRef, useState, useEffect, createContext, useRef, useCallback, memo, useMemo, useId, useContext, useLayoutEffect } from 'react';
3
+ import React32__default, { forwardRef, useState, useEffect, createContext, memo, useMemo, useRef, useCallback, useId, useContext, useLayoutEffect } from 'react';
4
4
  import { Slot } from '@radix-ui/react-slot';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import { clsx } from 'clsx';
@@ -3816,7 +3816,7 @@ var FileUploader = React32.forwardRef(
3816
3816
  showPreview = true,
3817
3817
  dropzoneText = "Arraste arquivos aqui ou clique para selecionar",
3818
3818
  dropzoneSubtext,
3819
- animate: animate2 = true,
3819
+ animate: animate3 = true,
3820
3820
  ...props
3821
3821
  }, ref) => {
3822
3822
  const [isDragging, setIsDragging] = React32.useState(false);
@@ -3969,7 +3969,7 @@ var FileUploader = React32.forwardRef(
3969
3969
  motion.p,
3970
3970
  {
3971
3971
  className: "mb-2 text-xs font-semibold text-foreground",
3972
- initial: animate2 ? { opacity: 0, y: -10 } : false,
3972
+ initial: animate3 ? { opacity: 0, y: -10 } : false,
3973
3973
  animate: { opacity: 1, y: 0 },
3974
3974
  transition: { delay: 0.1 },
3975
3975
  children: dropzoneText
@@ -3979,7 +3979,7 @@ var FileUploader = React32.forwardRef(
3979
3979
  motion.p,
3980
3980
  {
3981
3981
  className: "text-xs text-muted-foreground",
3982
- initial: animate2 ? { opacity: 0, y: -10 } : false,
3982
+ initial: animate3 ? { opacity: 0, y: -10 } : false,
3983
3983
  animate: { opacity: 1, y: 0 },
3984
3984
  transition: { delay: 0.2 },
3985
3985
  children: defaultSubtext
@@ -3989,7 +3989,7 @@ var FileUploader = React32.forwardRef(
3989
3989
  motion.div,
3990
3990
  {
3991
3991
  className: "py-2 w-full",
3992
- initial: animate2 ? { opacity: 0, y: 10 } : false,
3992
+ initial: animate3 ? { opacity: 0, y: 10 } : false,
3993
3993
  animate: { opacity: 1, y: 0 },
3994
3994
  transition: { delay: 0.3 },
3995
3995
  children: [
@@ -4004,7 +4004,7 @@ var FileUploader = React32.forwardRef(
4004
4004
  motion.div,
4005
4005
  {
4006
4006
  layout: true,
4007
- initial: animate2 ? { opacity: 0, x: -20 } : false,
4007
+ initial: animate3 ? { opacity: 0, x: -20 } : false,
4008
4008
  animate: { opacity: 1, x: 0 },
4009
4009
  exit: {
4010
4010
  opacity: 0,
@@ -4012,7 +4012,7 @@ var FileUploader = React32.forwardRef(
4012
4012
  transition: { duration: 0.2 }
4013
4013
  },
4014
4014
  transition: {
4015
- delay: animate2 ? index * 0.05 : 0,
4015
+ delay: animate3 ? index * 0.05 : 0,
4016
4016
  layout: { duration: 0.2 }
4017
4017
  },
4018
4018
  className: cn(
@@ -16583,6 +16583,13 @@ var useIsTruncated = (ref) => {
16583
16583
  }, [ref]);
16584
16584
  return truncated;
16585
16585
  };
16586
+ var SNAP_HEIGHTS = {
16587
+ collapsed: "80px",
16588
+ peek: "42dvh",
16589
+ full: "85dvh"
16590
+ };
16591
+ var VELOCITY_THRESHOLD = 500;
16592
+ var CLOSE_THRESHOLD = 50;
16586
16593
  var CopyData = ({ value }) => {
16587
16594
  const [copied, setCopied] = useState(false);
16588
16595
  const handleCopy = useCallback(() => {
@@ -16616,26 +16623,56 @@ var propertyLabels = {
16616
16623
  Destino: "Destino",
16617
16624
  Origem: "Origem"
16618
16625
  };
16619
- var IntegrationCard = ({ title, details }) => {
16626
+ var LongPressTooltip = ({ content, isMobile, children }) => {
16627
+ const [open, setOpen] = useState(false);
16628
+ const timerRef = useRef(null);
16629
+ const handleTouchStart = useCallback(() => {
16630
+ timerRef.current = setTimeout(() => setOpen(true), 1e3);
16631
+ }, []);
16632
+ const handleTouchEnd = useCallback(() => {
16633
+ if (timerRef.current) clearTimeout(timerRef.current);
16634
+ setTimeout(() => setOpen(false), 1500);
16635
+ }, []);
16636
+ useEffect(
16637
+ () => () => {
16638
+ if (timerRef.current) clearTimeout(timerRef.current);
16639
+ },
16640
+ []
16641
+ );
16642
+ return /* @__PURE__ */ jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxs(
16643
+ TooltipBase,
16644
+ {
16645
+ open: isMobile ? open : void 0,
16646
+ onOpenChange: isMobile ? setOpen : void 0,
16647
+ children: [
16648
+ /* @__PURE__ */ jsx(TooltipTriggerBase, { asChild: true, children: isMobile ? React32__default.cloneElement(children, {
16649
+ onTouchStart: handleTouchStart,
16650
+ onTouchEnd: handleTouchEnd,
16651
+ onTouchCancel: handleTouchEnd
16652
+ }) : children }),
16653
+ /* @__PURE__ */ jsx(TooltipContentBase, { sideOffset: 6, className: "z-[10001]", children: content })
16654
+ ]
16655
+ }
16656
+ ) });
16657
+ };
16658
+ var IntegrationCard = ({ title, details, isMobile }) => {
16620
16659
  const titleRef = useRef(null);
16621
16660
  const isTitleTruncated = useIsTruncated(titleRef);
16622
16661
  const blackList = ["id", "elementId", "identity"];
16623
16662
  const entries = details ? Object.entries(details).filter(
16624
16663
  ([key, value]) => value !== void 0 && value !== null && value !== "" && !blackList.includes(key)
16625
16664
  ) : [];
16665
+ const titleSpan = /* @__PURE__ */ jsx(
16666
+ "span",
16667
+ {
16668
+ ref: titleRef,
16669
+ className: "text-sm font-bold text-foreground truncate flex-1 min-w-0 cursor-default",
16670
+ children: title
16671
+ }
16672
+ );
16626
16673
  return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-border/40 bg-muted/20 overflow-hidden", children: [
16627
16674
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border/30", children: [
16628
- /* @__PURE__ */ jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxs(TooltipBase, { children: [
16629
- /* @__PURE__ */ jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsx(
16630
- "span",
16631
- {
16632
- ref: titleRef,
16633
- className: "text-sm font-bold text-foreground truncate flex-1 min-w-0 cursor-default",
16634
- children: title
16635
- }
16636
- ) }),
16637
- isTitleTruncated && /* @__PURE__ */ jsx(TooltipContentBase, { sideOffset: 6, className: "z-[10001]", children: title })
16638
- ] }) }),
16675
+ isTitleTruncated ? /* @__PURE__ */ jsx(LongPressTooltip, { content: title, isMobile, children: titleSpan }) : titleSpan,
16639
16676
  entries.length > 0 && /* @__PURE__ */ jsx(
16640
16677
  CopyData,
16641
16678
  {
@@ -16655,69 +16692,59 @@ var IntegrationCard = ({ title, details }) => {
16655
16692
  }) })
16656
16693
  ] });
16657
16694
  };
16658
- var Name = ({
16659
- name,
16660
- description
16661
- }) => {
16695
+ var Name = ({ name, description, isMobile }) => {
16662
16696
  const nameRef = useRef(null);
16663
16697
  const descRef = useRef(null);
16664
16698
  const isNameTruncated = useIsTruncated(nameRef);
16665
16699
  const isDescTruncated = useIsTruncated(descRef);
16666
16700
  const showTooltip = isNameTruncated || isDescTruncated;
16667
- return /* @__PURE__ */ jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxs(TooltipBase, { children: [
16668
- /* @__PURE__ */ jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "cursor-default min-w-0", children: [
16669
- /* @__PURE__ */ jsx(
16670
- "h3",
16671
- {
16672
- ref: nameRef,
16673
- className: "text-xl font-bold text-foreground tracking-tight truncate",
16674
- children: name
16675
- }
16676
- ),
16677
- description && /* @__PURE__ */ jsx(
16678
- "p",
16679
- {
16680
- ref: descRef,
16681
- className: "text-xs text-foreground/70 truncate mt-0.5",
16682
- children: description
16683
- }
16684
- )
16685
- ] }) }),
16686
- showTooltip && /* @__PURE__ */ jsxs(TooltipContentBase, { sideOffset: 8, className: "z-[10001]", children: [
16687
- /* @__PURE__ */ jsx("p", { className: "font-semibold", children: name }),
16688
- description && /* @__PURE__ */ jsx("p", { className: "text-xs text-foreground/70 mt-0.5", children: description })
16689
- ] })
16690
- ] }) });
16701
+ const content = /* @__PURE__ */ jsxs("div", { className: "cursor-default min-w-0", children: [
16702
+ /* @__PURE__ */ jsx(
16703
+ "h3",
16704
+ {
16705
+ ref: nameRef,
16706
+ className: "text-xl font-bold text-foreground tracking-tight truncate",
16707
+ children: name
16708
+ }
16709
+ ),
16710
+ description && /* @__PURE__ */ jsx("p", { ref: descRef, className: "text-xs text-foreground/70 truncate mt-0.5", children: description })
16711
+ ] });
16712
+ if (!showTooltip) return content;
16713
+ return /* @__PURE__ */ jsx(
16714
+ LongPressTooltip,
16715
+ {
16716
+ content: /* @__PURE__ */ jsxs(Fragment, { children: [
16717
+ /* @__PURE__ */ jsx("p", { className: "font-semibold", children: name }),
16718
+ description && /* @__PURE__ */ jsx("p", { className: "text-xs text-foreground/70 mt-0.5", children: description })
16719
+ ] }),
16720
+ isMobile,
16721
+ children: content
16722
+ }
16723
+ );
16691
16724
  };
16692
- var SystemNode = React32__default.forwardRef(
16693
- ({ label }, ref) => {
16694
- const innerRef = useRef(null);
16695
- const truncated = label.length > 9 ? label.substring(0, 9) + "\u2026" : label;
16696
- const needsTooltip = label.length > 9;
16697
- const setRefs = useCallback(
16698
- (node) => {
16699
- innerRef.current = node;
16700
- if (typeof ref === "function") ref(node);
16701
- else if (ref)
16702
- ref.current = node;
16703
- },
16704
- [ref]
16705
- );
16706
- const circle = /* @__PURE__ */ jsx(
16725
+ function SystemNodeInner({ label, isMobile }, ref) {
16726
+ const truncated = label.length > 9 ? label.substring(0, 9) + "\u2026" : label;
16727
+ const needsTooltip = label.length > 9;
16728
+ if (!needsTooltip) {
16729
+ return /* @__PURE__ */ jsx(
16707
16730
  "div",
16708
16731
  {
16709
- ref: setRefs,
16732
+ ref,
16710
16733
  className: "w-[76px] h-[76px] rounded-full bg-primary flex items-center justify-center shrink-0 z-10 cursor-default",
16711
16734
  children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-primary-foreground text-center px-2 leading-tight select-none", children: truncated })
16712
16735
  }
16713
16736
  );
16714
- if (!needsTooltip) return circle;
16715
- return /* @__PURE__ */ jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxs(TooltipBase, { children: [
16716
- /* @__PURE__ */ jsx(TooltipTriggerBase, { asChild: true, children: circle }),
16717
- /* @__PURE__ */ jsx(TooltipContentBase, { sideOffset: 8, className: "z-[10001]", children: label })
16718
- ] }) });
16719
16737
  }
16720
- );
16738
+ return /* @__PURE__ */ jsx(LongPressTooltip, { content: label, isMobile, children: /* @__PURE__ */ jsx(
16739
+ "div",
16740
+ {
16741
+ ref,
16742
+ className: "w-[76px] h-[76px] rounded-full bg-primary flex items-center justify-center shrink-0 z-10 cursor-default",
16743
+ children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-primary-foreground text-center px-2 leading-tight select-none", children: truncated })
16744
+ }
16745
+ ) });
16746
+ }
16747
+ var SystemNode = React32__default.forwardRef(SystemNodeInner);
16721
16748
  SystemNode.displayName = "SystemNode";
16722
16749
  var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16723
16750
  const gradientId = useId();
@@ -16725,6 +16752,7 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16725
16752
  const [svgSize, setSvgSize] = useState({ w: 0, h: 0 });
16726
16753
  useEffect(() => {
16727
16754
  let rafId;
16755
+ let running = true;
16728
16756
  const update = () => {
16729
16757
  const container = containerRef.current;
16730
16758
  const left = leftRef.current;
@@ -16737,39 +16765,31 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16737
16765
  const cy1 = lr.top - cr.top + lr.height / 2;
16738
16766
  const cx2 = rr.left - cr.left + rr.width / 2;
16739
16767
  const cy2 = rr.top - cr.top + rr.height / 2;
16740
- const dx = cx2 - cx1, dy = cy2 - cy1;
16768
+ const dx = cx2 - cx1;
16769
+ const dy = cy2 - cy1;
16741
16770
  const dist = Math.sqrt(dx * dx + dy * dy);
16742
16771
  if (dist === 0) return;
16743
- const ux = dx / dist, uy = dy / dist;
16772
+ const ux = dx / dist;
16773
+ const uy = dy / dist;
16744
16774
  const r1 = lr.width / 2;
16745
16775
  const r2 = rr.width / 2;
16746
- setSvgSize({ w: cr.width, h: cr.height });
16747
- setPathD(
16748
- `M ${cx1 + ux * r1},${cy1 + uy * r1} L ${cx2 - ux * r2},${cy2 - uy * r2}`
16776
+ const newW = cr.width;
16777
+ const newH = cr.height;
16778
+ const newPath = `M ${cx1 + ux * r1},${cy1 + uy * r1} L ${cx2 - ux * r2},${cy2 - uy * r2}`;
16779
+ setSvgSize(
16780
+ (prev) => prev.w !== newW || prev.h !== newH ? { w: newW, h: newH } : prev
16749
16781
  );
16782
+ setPathD((prev) => prev !== newPath ? newPath : prev);
16750
16783
  };
16751
- const schedule = () => {
16752
- cancelAnimationFrame(rafId);
16753
- rafId = requestAnimationFrame(update);
16784
+ const loop = () => {
16785
+ if (!running) return;
16786
+ update();
16787
+ rafId = requestAnimationFrame(loop);
16754
16788
  };
16755
- requestAnimationFrame(() => requestAnimationFrame(update));
16756
- schedule();
16757
- const ro = new ResizeObserver(schedule);
16758
- if (containerRef.current) ro.observe(containerRef.current);
16759
- if (leftRef.current) ro.observe(leftRef.current);
16760
- if (rightRef.current) ro.observe(rightRef.current);
16761
- const mo = new MutationObserver(schedule);
16762
- if (containerRef.current) {
16763
- mo.observe(containerRef.current, {
16764
- attributes: true,
16765
- attributeFilter: ["class", "style"],
16766
- subtree: true
16767
- });
16768
- }
16789
+ rafId = requestAnimationFrame(loop);
16769
16790
  return () => {
16791
+ running = false;
16770
16792
  cancelAnimationFrame(rafId);
16771
- ro.disconnect();
16772
- mo.disconnect();
16773
16793
  };
16774
16794
  }, [containerRef, leftRef, rightRef]);
16775
16795
  const animX1 = isInput ? ["90%", "-10%"] : ["10%", "110%"];
@@ -16835,7 +16855,7 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16835
16855
  }
16836
16856
  );
16837
16857
  };
16838
- var SystemsDiagram = ({ isInput, currentSystem, externalSystem }) => {
16858
+ var SystemsDiagram = ({ isInput, currentSystem, externalSystem, isMobile }) => {
16839
16859
  const containerRef = useRef(null);
16840
16860
  const leftRef = useRef(null);
16841
16861
  const rightRef = useRef(null);
@@ -16849,14 +16869,16 @@ var SystemsDiagram = ({ isInput, currentSystem, externalSystem }) => {
16849
16869
  SystemNode,
16850
16870
  {
16851
16871
  ref: leftRef,
16852
- label: isInput ? externalSystem : currentSystem
16872
+ label: isInput ? externalSystem : currentSystem,
16873
+ isMobile
16853
16874
  }
16854
16875
  ),
16855
16876
  /* @__PURE__ */ jsx(
16856
16877
  SystemNode,
16857
16878
  {
16858
16879
  ref: rightRef,
16859
- label: isInput ? currentSystem : externalSystem
16880
+ label: isInput ? currentSystem : externalSystem,
16881
+ isMobile
16860
16882
  }
16861
16883
  ),
16862
16884
  /* @__PURE__ */ jsx(
@@ -16872,47 +16894,84 @@ var SystemsDiagram = ({ isInput, currentSystem, externalSystem }) => {
16872
16894
  }
16873
16895
  );
16874
16896
  };
16875
- var BodyComponent = ({ data, isLoading, connections, isInput, externalSystem }) => /* @__PURE__ */ jsxs("div", { className: "px-3 py-3 space-y-3 max-h-[460px] overflow-y-auto [&::-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: [
16876
- isLoading ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
16877
- /* @__PURE__ */ jsx(SkeletonBase, { className: "h-6 w-3/4" }),
16878
- /* @__PURE__ */ jsx(SkeletonBase, { className: "h-3.5 w-1/2" })
16879
- ] }) : /* @__PURE__ */ jsx(Name, { name: data.name, description: data.description }),
16880
- isLoading ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
16881
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between py-1", children: [
16882
- /* @__PURE__ */ jsx(SkeletonBase, { className: "w-[76px] h-[76px] rounded-full" }),
16883
- /* @__PURE__ */ jsx(SkeletonBase, { className: "w-[76px] h-[76px] rounded-full" })
16884
- ] }),
16885
- /* @__PURE__ */ jsx("div", { className: "border-t border-border/20" }),
16886
- [1, 2].map((i) => /* @__PURE__ */ jsxs(
16887
- "div",
16888
- {
16889
- className: "rounded-lg border border-border/20 overflow-hidden",
16890
- children: [
16891
- /* @__PURE__ */ jsx(SkeletonBase, { className: "h-8 w-full" }),
16892
- [1, 2, 3].map((j) => /* @__PURE__ */ jsx(SkeletonBase, { className: "h-7 w-full mt-px" }, j))
16893
- ]
16897
+ var BodyComponent = ({
16898
+ data,
16899
+ isLoading,
16900
+ connections,
16901
+ isInput,
16902
+ externalSystem,
16903
+ isMobile,
16904
+ scrollable
16905
+ }) => /* @__PURE__ */ jsxs("div", { className: "relative min-h-0 flex-1 overflow-hidden", children: [
16906
+ /* @__PURE__ */ jsx("div", { className: "absolute top-0 left-0 right-0 h-5 bg-gradient-to-b from-card to-transparent z-10 pointer-events-none" }),
16907
+ /* @__PURE__ */ jsxs(
16908
+ "div",
16909
+ {
16910
+ className: [
16911
+ "px-3 py-3 space-y-3",
16912
+ scrollable ? "overflow-y-auto overscroll-contain [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-primary/20 [&::-webkit-scrollbar-thumb]:rounded-full" : "overflow-hidden",
16913
+ isMobile ? "max-h-[calc(85dvh-80px)]" : "max-h [&::-webkit-scrollbar]:hidden"
16914
+ ].join(" "),
16915
+ onPointerDownCapture: (e) => {
16916
+ if (scrollable) e.stopPropagation();
16894
16917
  },
16895
- i
16896
- ))
16897
- ] }) : connections.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground text-center", children: "Nenhuma conex\xE3o encontrada" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
16898
- /* @__PURE__ */ jsx(
16899
- SystemsDiagram,
16900
- {
16901
- isInput,
16902
- currentSystem: data.name,
16903
- externalSystem
16904
- }
16905
- ),
16906
- /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase -mb-2", children: isInput ? "Informa\xE7\xF5es de Entrada" : "Informa\xE7\xF5es de Sa\xEDda" }) }),
16907
- /* @__PURE__ */ jsx("div", { children: connections.map((conn) => /* @__PURE__ */ jsx(
16908
- IntegrationCard,
16909
- {
16910
- title: conn.name,
16911
- details: conn.integration
16918
+ onTouchStartCapture: (e) => {
16919
+ if (scrollable) e.stopPropagation();
16912
16920
  },
16913
- conn.id
16914
- )) })
16915
- ] })
16921
+ children: [
16922
+ isLoading ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
16923
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "h-6 w-3/4" }),
16924
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "h-3.5 w-1/2" })
16925
+ ] }) : /* @__PURE__ */ jsx(
16926
+ Name,
16927
+ {
16928
+ name: data.name,
16929
+ description: data.description,
16930
+ isMobile
16931
+ }
16932
+ ),
16933
+ isLoading ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
16934
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between py-1", children: [
16935
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "w-[76px] h-[76px] rounded-full" }),
16936
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "w-[76px] h-[76px] rounded-full" })
16937
+ ] }),
16938
+ /* @__PURE__ */ jsx("div", { className: "border-t border-border/20" }),
16939
+ [1, 2].map((i) => /* @__PURE__ */ jsxs(
16940
+ "div",
16941
+ {
16942
+ className: "rounded-lg border border-border/20 overflow-hidden",
16943
+ children: [
16944
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "h-8 w-full" }),
16945
+ [1, 2, 3].map((j) => /* @__PURE__ */ jsx(SkeletonBase, { className: "h-7 w-full mt-px" }, j))
16946
+ ]
16947
+ },
16948
+ i
16949
+ ))
16950
+ ] }) : connections.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground text-center", children: "Nenhuma conex\xE3o encontrada" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
16951
+ /* @__PURE__ */ jsx(
16952
+ SystemsDiagram,
16953
+ {
16954
+ isInput,
16955
+ currentSystem: data.name,
16956
+ externalSystem,
16957
+ isMobile
16958
+ }
16959
+ ),
16960
+ /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase -mb-2", children: isInput ? "Informa\xE7\xF5es de Entrada" : "Informa\xE7\xF5es de Sa\xEDda" }) }),
16961
+ /* @__PURE__ */ jsx("div", { className: "space-y-2", children: connections.map((conn) => /* @__PURE__ */ jsx(
16962
+ IntegrationCard,
16963
+ {
16964
+ title: conn.name,
16965
+ details: conn.integration,
16966
+ isMobile
16967
+ },
16968
+ conn.id
16969
+ )) })
16970
+ ] })
16971
+ ]
16972
+ }
16973
+ ),
16974
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 right-0 h-5 bg-gradient-to-t from-card to-transparent z-10 pointer-events-none" })
16916
16975
  ] });
16917
16976
  var Body = React32__default.memo(BodyComponent);
16918
16977
  var modalVariants = {
@@ -16932,6 +16991,25 @@ var modalVariants = {
16932
16991
  transition: { type: "spring", stiffness: 400, damping: 28 }
16933
16992
  }
16934
16993
  };
16994
+ function resolveSnapPx(snap) {
16995
+ const vh = typeof window !== "undefined" ? window.innerHeight : 800;
16996
+ if (snap === "collapsed") return 80;
16997
+ if (snap === "peek") return vh * 0.42;
16998
+ return vh * 0.85;
16999
+ }
17000
+ function nearestSnap(heightPx) {
17001
+ const snaps = ["collapsed", "peek", "full"];
17002
+ let best = "peek";
17003
+ let bestDist = Infinity;
17004
+ for (const s of snaps) {
17005
+ const dist = Math.abs(resolveSnapPx(s) - heightPx);
17006
+ if (dist < bestDist) {
17007
+ bestDist = dist;
17008
+ best = s;
17009
+ }
17010
+ }
17011
+ return best;
17012
+ }
16935
17013
  var IntegrationModal = ({
16936
17014
  id,
16937
17015
  data,
@@ -17026,6 +17104,66 @@ var IntegrationModal = ({
17026
17104
  },
17027
17105
  [id, onMouseDown]
17028
17106
  );
17107
+ const [snap, setSnap] = useState("peek");
17108
+ const sheetHeight = useMotionValue(SNAP_HEIGHTS.peek);
17109
+ const snapTo = useCallback(
17110
+ (target) => {
17111
+ setSnap(target);
17112
+ animate(sheetHeight, SNAP_HEIGHTS[target], {
17113
+ type: "spring",
17114
+ stiffness: 320,
17115
+ damping: 36
17116
+ });
17117
+ },
17118
+ [sheetHeight]
17119
+ );
17120
+ useEffect(() => {
17121
+ if (isMobile) {
17122
+ sheetHeight.set("0px");
17123
+ animate(sheetHeight, SNAP_HEIGHTS.peek, {
17124
+ type: "spring",
17125
+ stiffness: 320,
17126
+ damping: 36
17127
+ });
17128
+ }
17129
+ }, [isMobile, sheetHeight]);
17130
+ const handleDragEnd = useCallback(
17131
+ (_, info) => {
17132
+ const vy = info.velocity.y;
17133
+ const dy = info.offset.y;
17134
+ const currentHeightStr = sheetHeight.get();
17135
+ const currentHeightPx = typeof currentHeightStr === "string" && currentHeightStr.endsWith("dvh") ? parseFloat(currentHeightStr) / 100 * window.innerHeight : parseFloat(currentHeightStr);
17136
+ const draggedHeightPx = currentHeightPx - dy;
17137
+ const collapsedPx = resolveSnapPx("collapsed");
17138
+ if (draggedHeightPx < collapsedPx - CLOSE_THRESHOLD || snap === "collapsed" && vy > VELOCITY_THRESHOLD) {
17139
+ onClose(id);
17140
+ return;
17141
+ }
17142
+ if (vy < -VELOCITY_THRESHOLD) {
17143
+ if (snap === "collapsed") {
17144
+ snapTo("peek");
17145
+ return;
17146
+ }
17147
+ if (snap === "peek") {
17148
+ snapTo("full");
17149
+ return;
17150
+ }
17151
+ }
17152
+ if (vy > VELOCITY_THRESHOLD) {
17153
+ if (snap === "full") {
17154
+ snapTo("peek");
17155
+ return;
17156
+ }
17157
+ if (snap === "peek") {
17158
+ snapTo("collapsed");
17159
+ return;
17160
+ }
17161
+ }
17162
+ const nearest = nearestSnap(draggedHeightPx);
17163
+ snapTo(nearest);
17164
+ },
17165
+ [id, onClose, snap, snapTo, sheetHeight]
17166
+ );
17029
17167
  const inputConnections = useMemo(
17030
17168
  () => data.connections.filter((c) => c.type === "entrada"),
17031
17169
  [data.connections]
@@ -17040,19 +17178,19 @@ var IntegrationModal = ({
17040
17178
  const header = /* @__PURE__ */ jsxs(
17041
17179
  "div",
17042
17180
  {
17043
- className: "flex items-center justify-between py-1 border-b border-border shrink-0 max-w-lg",
17044
- onMouseDown: handleMouseDownLocal,
17045
- onTouchStart: handleTouchStartLocal,
17181
+ className: "flex items-center justify-between py-1 border-b border-border shrink-0",
17182
+ onMouseDown: !isMobile ? handleMouseDownLocal : void 0,
17183
+ onTouchStart: !isMobile ? handleTouchStartLocal : void 0,
17046
17184
  style: {
17047
- touchAction: "none",
17048
- cursor: dragging ? "grabbing" : "grab"
17185
+ touchAction: isMobile ? "auto" : "none",
17186
+ cursor: isMobile ? "default" : dragging ? "grabbing" : "grab"
17049
17187
  },
17050
17188
  children: [
17051
17189
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3", children: [
17052
- /* @__PURE__ */ jsx(DotsSixVerticalIcon, { size: 16, className: "text-primary" }),
17190
+ !isMobile && /* @__PURE__ */ jsx(DotsSixVerticalIcon, { size: 16, className: "text-primary" }),
17053
17191
  /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: title })
17054
17192
  ] }),
17055
- /* @__PURE__ */ jsx(
17193
+ !isMobile && /* @__PURE__ */ jsx(
17056
17194
  ButtonBase,
17057
17195
  {
17058
17196
  variant: "ghost",
@@ -17066,7 +17204,15 @@ var IntegrationModal = ({
17066
17204
  ]
17067
17205
  }
17068
17206
  );
17069
- const bodyProps = { data, isLoading, connections, isInput, externalSystem };
17207
+ const bodyProps = {
17208
+ data,
17209
+ isLoading,
17210
+ connections,
17211
+ isInput,
17212
+ externalSystem,
17213
+ isMobile,
17214
+ scrollable: isMobile ? snap === "full" : true
17215
+ };
17070
17216
  if (isMobile) {
17071
17217
  return /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
17072
17218
  /* @__PURE__ */ jsx(
@@ -17083,17 +17229,42 @@ var IntegrationModal = ({
17083
17229
  /* @__PURE__ */ jsxs(
17084
17230
  motion.div,
17085
17231
  {
17086
- className: "fixed bottom-0 left-0 right-0 z-[10000] bg-card border-t border-border/50 rounded-t-2xl shadow-2xl flex flex-col min-h-0",
17087
- style: { maxHeight: "85dvh" },
17088
- initial: { y: "100%" },
17089
- animate: { y: 0 },
17090
- exit: { y: "100%" },
17091
- transition: { type: "spring", stiffness: 320, damping: 36 },
17232
+ className: [
17233
+ "fixed bottom-0 left-0 right-0 z-[10000] bg-card border-t border-border/50 shadow-2xl flex flex-col",
17234
+ snap === "full" ? "rounded-t-[10px]" : "rounded-t-2xl"
17235
+ ].join(" "),
17236
+ style: {
17237
+ height: sheetHeight,
17238
+ touchAction: "none",
17239
+ overscrollBehavior: "none",
17240
+ boxShadow: snap === "full" ? "0 -8px 40px 0 rgba(0,0,0,0.32), 0 -1px 0 0 hsl(var(--border))" : void 0
17241
+ },
17242
+ drag: "y",
17243
+ dragConstraints: { top: 0, bottom: 0 },
17244
+ dragElastic: { top: 0.05, bottom: 0.25 },
17245
+ dragMomentum: false,
17246
+ onDragEnd: handleDragEnd,
17247
+ exit: { height: 0, opacity: 0, transition: { duration: 0.25 } },
17092
17248
  onClick: (e) => e.stopPropagation(),
17093
17249
  children: [
17094
- /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-2.5 pb-1 shrink-0", children: /* @__PURE__ */ jsx("div", { className: "w-10 h-1 rounded-full bg-border" }) }),
17250
+ snap !== "full" && /* @__PURE__ */ jsx(
17251
+ "div",
17252
+ {
17253
+ className: "flex justify-center pt-3 pb-1 shrink-0 touch-none",
17254
+ style: { touchAction: "none" },
17255
+ children: /* @__PURE__ */ jsx("div", { className: "w-10 h-1 rounded-full bg-muted-foreground/30" })
17256
+ }
17257
+ ),
17258
+ snap === "full" && /* @__PURE__ */ jsx(
17259
+ "div",
17260
+ {
17261
+ className: "flex items-center justify-between px-4 pt-3 pb-2 shrink-0 touch-none",
17262
+ style: { touchAction: "none" },
17263
+ children: /* @__PURE__ */ jsx("div", { className: "w-10 h-1 rounded-full bg-muted-foreground/30 mx-auto" })
17264
+ }
17265
+ ),
17095
17266
  header,
17096
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto [&::-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: /* @__PURE__ */ jsx(Body, { ...bodyProps }) })
17267
+ /* @__PURE__ */ jsx(Body, { ...bodyProps })
17097
17268
  ]
17098
17269
  },
17099
17270
  `sheet-${id}`
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "access": "public",
6
6
  "type": "module"
7
7
  },
8
- "version": "1.10.19",
8
+ "version": "1.10.20",
9
9
  "homepage": "https://main--68e80310a069c2f10b546ef3.chromatic.com/",
10
10
  "repository": {
11
11
  "type": "git",