@mlw-packages/react-components 1.10.9 → 1.10.10

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.d.mts CHANGED
@@ -65,9 +65,10 @@ declare const useTheme: () => ThemeProviderState;
65
65
  type ModeToggleBaseProps = {
66
66
  themes?: Theme[];
67
67
  className?: string;
68
+ directToggle?: boolean;
68
69
  variant?: "default" | "outline" | "link" | "destructive" | "secondary" | "ghost";
69
70
  };
70
- declare function ModeToggleBase({ themes, className, variant, }: ModeToggleBaseProps): react_jsx_runtime.JSX.Element;
71
+ declare function ModeToggleBase({ themes, className, directToggle, variant, }: ModeToggleBaseProps): react_jsx_runtime.JSX.Element;
71
72
 
72
73
  declare const AvatarBase: React$1.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React$1.RefAttributes<HTMLSpanElement>, "ref"> & React$1.RefAttributes<HTMLSpanElement>>;
73
74
  declare const AvatarImageBase: React$1.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React$1.RefAttributes<HTMLImageElement>, "ref"> & React$1.RefAttributes<HTMLImageElement>>;
package/dist/index.d.ts CHANGED
@@ -65,9 +65,10 @@ declare const useTheme: () => ThemeProviderState;
65
65
  type ModeToggleBaseProps = {
66
66
  themes?: Theme[];
67
67
  className?: string;
68
+ directToggle?: boolean;
68
69
  variant?: "default" | "outline" | "link" | "destructive" | "secondary" | "ghost";
69
70
  };
70
- declare function ModeToggleBase({ themes, className, variant, }: ModeToggleBaseProps): react_jsx_runtime.JSX.Element;
71
+ declare function ModeToggleBase({ themes, className, directToggle, variant, }: ModeToggleBaseProps): react_jsx_runtime.JSX.Element;
71
72
 
72
73
  declare const AvatarBase: React$1.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React$1.RefAttributes<HTMLSpanElement>, "ref"> & React$1.RefAttributes<HTMLSpanElement>>;
73
74
  declare const AvatarImageBase: React$1.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React$1.RefAttributes<HTMLImageElement>, "ref"> & React$1.RefAttributes<HTMLImageElement>>;
package/dist/index.js CHANGED
@@ -3481,6 +3481,7 @@ var ThemeIcon = ({ theme }) => {
3481
3481
  function ModeToggleBase({
3482
3482
  themes = ["light", "dark", "system"],
3483
3483
  className,
3484
+ directToggle = false,
3484
3485
  variant = "ghost"
3485
3486
  }) {
3486
3487
  const [mounted, setMounted] = React32.useState(false);
@@ -3531,6 +3532,40 @@ function ModeToggleBase({
3531
3532
  setTheme(newTheme);
3532
3533
  }
3533
3534
  };
3535
+ const handleDirectToggle = () => {
3536
+ const currentIndex = themes.indexOf(currentTheme);
3537
+ const nextIndex = (currentIndex + 1) % themes.length;
3538
+ toggleTheme(themes[nextIndex]);
3539
+ };
3540
+ if (directToggle) {
3541
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3542
+ ButtonBase,
3543
+ {
3544
+ ref: buttonRef,
3545
+ variant,
3546
+ size: "icon",
3547
+ className: cn("relative overflow-hidden group", className),
3548
+ onClick: handleDirectToggle,
3549
+ children: [
3550
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3551
+ /* @__PURE__ */ jsxRuntime.jsx(
3552
+ react.SunIcon,
3553
+ {
3554
+ className: `h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-90 scale-0 opacity-0" : "rotate-0 scale-100 opacity-100 group-hover:rotate-12"}`
3555
+ }
3556
+ ),
3557
+ /* @__PURE__ */ jsxRuntime.jsx(
3558
+ react.MoonIcon,
3559
+ {
3560
+ className: `absolute h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-0 scale-100 opacity-100 group-hover:-rotate-12" : "rotate-90 scale-0 opacity-0"}`
3561
+ }
3562
+ )
3563
+ ] }),
3564
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle theme" })
3565
+ ]
3566
+ }
3567
+ );
3568
+ }
3534
3569
  return /* @__PURE__ */ jsxRuntime.jsxs(DropDownMenuBase, { children: [
3535
3570
  /* @__PURE__ */ jsxRuntime.jsx(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
3536
3571
  ButtonBase,
@@ -16649,23 +16684,35 @@ var Name = ({
16649
16684
  ] })
16650
16685
  ] }) });
16651
16686
  };
16652
- var SystemNode = React32__namespace.default.forwardRef(({ label }, ref) => {
16653
- const truncated = label.length > 9 ? label.substring(0, 9) + "\u2026" : label;
16654
- const needsTooltip = label.length > 9;
16655
- const circle = /* @__PURE__ */ jsxRuntime.jsx(
16656
- "div",
16657
- {
16658
- ref,
16659
- className: "w-[76px] h-[76px] rounded-full bg-primary flex items-center justify-center shrink-0 z-10 cursor-default",
16660
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-primary-foreground text-center px-2 leading-tight select-none", children: truncated })
16661
- }
16662
- );
16663
- if (!needsTooltip) return circle;
16664
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
16665
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: circle }),
16666
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContentBase, { sideOffset: 8, className: "z-[10001]", children: label })
16667
- ] }) });
16668
- });
16687
+ var SystemNode = React32__namespace.default.forwardRef(
16688
+ ({ label }, ref) => {
16689
+ const innerRef = React32.useRef(null);
16690
+ const truncated = label.length > 9 ? label.substring(0, 9) + "\u2026" : label;
16691
+ const needsTooltip = label.length > 9;
16692
+ const setRefs = React32.useCallback(
16693
+ (node) => {
16694
+ innerRef.current = node;
16695
+ if (typeof ref === "function") ref(node);
16696
+ else if (ref)
16697
+ ref.current = node;
16698
+ },
16699
+ [ref]
16700
+ );
16701
+ const circle = /* @__PURE__ */ jsxRuntime.jsx(
16702
+ "div",
16703
+ {
16704
+ ref: setRefs,
16705
+ className: "w-[76px] h-[76px] rounded-full bg-primary flex items-center justify-center shrink-0 z-10 cursor-default",
16706
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-primary-foreground text-center px-2 leading-tight select-none", children: truncated })
16707
+ }
16708
+ );
16709
+ if (!needsTooltip) return circle;
16710
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
16711
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: circle }),
16712
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContentBase, { sideOffset: 8, className: "z-[10001]", children: label })
16713
+ ] }) });
16714
+ }
16715
+ );
16669
16716
  SystemNode.displayName = "SystemNode";
16670
16717
  var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16671
16718
  const gradientId = React32.useId();
@@ -16726,7 +16773,7 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16726
16773
  return /* @__PURE__ */ jsxRuntime.jsxs(
16727
16774
  "svg",
16728
16775
  {
16729
- className: "pointer-events-none absolute left-0 top-0 right-0",
16776
+ className: "pointer-events-none absolute",
16730
16777
  width: svgSize.w,
16731
16778
  height: svgSize.h,
16732
16779
  fill: "none",
@@ -16746,7 +16793,7 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16746
16793
  {
16747
16794
  d: pathD,
16748
16795
  stroke: `url(#${gradientId})`,
16749
- strokeWidth: 2,
16796
+ strokeWidth: 4,
16750
16797
  strokeLinecap: "round",
16751
16798
  initial: { strokeOpacity: 0 },
16752
16799
  animate: { strokeOpacity: 1 },
@@ -16766,7 +16813,7 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16766
16813
  y2: ["0%", "0%"]
16767
16814
  },
16768
16815
  transition: {
16769
- duration: 4,
16816
+ duration: 2,
16770
16817
  ease: [0.16, 1, 0.3, 1],
16771
16818
  repeat: Infinity,
16772
16819
  repeatDelay: 0
@@ -16793,8 +16840,20 @@ var SystemsDiagram = ({ isInput, currentSystem, externalSystem }) => {
16793
16840
  ref: containerRef,
16794
16841
  className: "relative flex items-center justify-between py-1",
16795
16842
  children: [
16796
- /* @__PURE__ */ jsxRuntime.jsx(SystemNode, { ref: leftRef, label: isInput ? externalSystem : currentSystem }),
16797
- /* @__PURE__ */ jsxRuntime.jsx(SystemNode, { ref: rightRef, label: isInput ? currentSystem : externalSystem }),
16843
+ /* @__PURE__ */ jsxRuntime.jsx(
16844
+ SystemNode,
16845
+ {
16846
+ ref: leftRef,
16847
+ label: isInput ? externalSystem : currentSystem
16848
+ }
16849
+ ),
16850
+ /* @__PURE__ */ jsxRuntime.jsx(
16851
+ SystemNode,
16852
+ {
16853
+ ref: rightRef,
16854
+ label: isInput ? currentSystem : externalSystem
16855
+ }
16856
+ ),
16798
16857
  /* @__PURE__ */ jsxRuntime.jsx(
16799
16858
  Beam,
16800
16859
  {
@@ -16813,7 +16872,6 @@ var BodyComponent = ({ data, isLoading, connections, isInput, externalSystem })
16813
16872
  /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-6 w-3/4" }),
16814
16873
  /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-3.5 w-1/2" })
16815
16874
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(Name, { name: data.name, description: data.description }),
16816
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border/20" }),
16817
16875
  isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
16818
16876
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between py-1", children: [
16819
16877
  /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "w-[76px] h-[76px] rounded-full" }),
@@ -16840,7 +16898,6 @@ var BodyComponent = ({ data, isLoading, connections, isInput, externalSystem })
16840
16898
  externalSystem
16841
16899
  }
16842
16900
  ),
16843
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border/20" }),
16844
16901
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntime.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" }) }),
16845
16902
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: connections.map((conn) => /* @__PURE__ */ jsxRuntime.jsx(
16846
16903
  IntegrationCard,
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, useMemo, useRef, useCallback, useId, useContext, useLayoutEffect } from 'react';
3
+ import React32__default, { forwardRef, useState, useEffect, createContext, useRef, useCallback, useMemo, 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';
@@ -3438,6 +3438,7 @@ var ThemeIcon = ({ theme }) => {
3438
3438
  function ModeToggleBase({
3439
3439
  themes = ["light", "dark", "system"],
3440
3440
  className,
3441
+ directToggle = false,
3441
3442
  variant = "ghost"
3442
3443
  }) {
3443
3444
  const [mounted, setMounted] = useState(false);
@@ -3488,6 +3489,40 @@ function ModeToggleBase({
3488
3489
  setTheme(newTheme);
3489
3490
  }
3490
3491
  };
3492
+ const handleDirectToggle = () => {
3493
+ const currentIndex = themes.indexOf(currentTheme);
3494
+ const nextIndex = (currentIndex + 1) % themes.length;
3495
+ toggleTheme(themes[nextIndex]);
3496
+ };
3497
+ if (directToggle) {
3498
+ return /* @__PURE__ */ jsxs(
3499
+ ButtonBase,
3500
+ {
3501
+ ref: buttonRef,
3502
+ variant,
3503
+ size: "icon",
3504
+ className: cn("relative overflow-hidden group", className),
3505
+ onClick: handleDirectToggle,
3506
+ children: [
3507
+ /* @__PURE__ */ jsxs(Fragment, { children: [
3508
+ /* @__PURE__ */ jsx(
3509
+ SunIcon,
3510
+ {
3511
+ className: `h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-90 scale-0 opacity-0" : "rotate-0 scale-100 opacity-100 group-hover:rotate-12"}`
3512
+ }
3513
+ ),
3514
+ /* @__PURE__ */ jsx(
3515
+ MoonIcon,
3516
+ {
3517
+ className: `absolute h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-0 scale-100 opacity-100 group-hover:-rotate-12" : "rotate-90 scale-0 opacity-0"}`
3518
+ }
3519
+ )
3520
+ ] }),
3521
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle theme" })
3522
+ ]
3523
+ }
3524
+ );
3525
+ }
3491
3526
  return /* @__PURE__ */ jsxs(DropDownMenuBase, { children: [
3492
3527
  /* @__PURE__ */ jsx(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs(
3493
3528
  ButtonBase,
@@ -16606,23 +16641,35 @@ var Name = ({
16606
16641
  ] })
16607
16642
  ] }) });
16608
16643
  };
16609
- var SystemNode = React32__default.forwardRef(({ label }, ref) => {
16610
- const truncated = label.length > 9 ? label.substring(0, 9) + "\u2026" : label;
16611
- const needsTooltip = label.length > 9;
16612
- const circle = /* @__PURE__ */ jsx(
16613
- "div",
16614
- {
16615
- ref,
16616
- className: "w-[76px] h-[76px] rounded-full bg-primary flex items-center justify-center shrink-0 z-10 cursor-default",
16617
- children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-primary-foreground text-center px-2 leading-tight select-none", children: truncated })
16618
- }
16619
- );
16620
- if (!needsTooltip) return circle;
16621
- return /* @__PURE__ */ jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxs(TooltipBase, { children: [
16622
- /* @__PURE__ */ jsx(TooltipTriggerBase, { asChild: true, children: circle }),
16623
- /* @__PURE__ */ jsx(TooltipContentBase, { sideOffset: 8, className: "z-[10001]", children: label })
16624
- ] }) });
16625
- });
16644
+ var SystemNode = React32__default.forwardRef(
16645
+ ({ label }, ref) => {
16646
+ const innerRef = useRef(null);
16647
+ const truncated = label.length > 9 ? label.substring(0, 9) + "\u2026" : label;
16648
+ const needsTooltip = label.length > 9;
16649
+ const setRefs = useCallback(
16650
+ (node) => {
16651
+ innerRef.current = node;
16652
+ if (typeof ref === "function") ref(node);
16653
+ else if (ref)
16654
+ ref.current = node;
16655
+ },
16656
+ [ref]
16657
+ );
16658
+ const circle = /* @__PURE__ */ jsx(
16659
+ "div",
16660
+ {
16661
+ ref: setRefs,
16662
+ className: "w-[76px] h-[76px] rounded-full bg-primary flex items-center justify-center shrink-0 z-10 cursor-default",
16663
+ children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-primary-foreground text-center px-2 leading-tight select-none", children: truncated })
16664
+ }
16665
+ );
16666
+ if (!needsTooltip) return circle;
16667
+ return /* @__PURE__ */ jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxs(TooltipBase, { children: [
16668
+ /* @__PURE__ */ jsx(TooltipTriggerBase, { asChild: true, children: circle }),
16669
+ /* @__PURE__ */ jsx(TooltipContentBase, { sideOffset: 8, className: "z-[10001]", children: label })
16670
+ ] }) });
16671
+ }
16672
+ );
16626
16673
  SystemNode.displayName = "SystemNode";
16627
16674
  var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16628
16675
  const gradientId = useId();
@@ -16683,7 +16730,7 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16683
16730
  return /* @__PURE__ */ jsxs(
16684
16731
  "svg",
16685
16732
  {
16686
- className: "pointer-events-none absolute left-0 top-0 right-0",
16733
+ className: "pointer-events-none absolute",
16687
16734
  width: svgSize.w,
16688
16735
  height: svgSize.h,
16689
16736
  fill: "none",
@@ -16703,7 +16750,7 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16703
16750
  {
16704
16751
  d: pathD,
16705
16752
  stroke: `url(#${gradientId})`,
16706
- strokeWidth: 2,
16753
+ strokeWidth: 4,
16707
16754
  strokeLinecap: "round",
16708
16755
  initial: { strokeOpacity: 0 },
16709
16756
  animate: { strokeOpacity: 1 },
@@ -16723,7 +16770,7 @@ var Beam = ({ isInput, containerRef, leftRef, rightRef }) => {
16723
16770
  y2: ["0%", "0%"]
16724
16771
  },
16725
16772
  transition: {
16726
- duration: 4,
16773
+ duration: 2,
16727
16774
  ease: [0.16, 1, 0.3, 1],
16728
16775
  repeat: Infinity,
16729
16776
  repeatDelay: 0
@@ -16750,8 +16797,20 @@ var SystemsDiagram = ({ isInput, currentSystem, externalSystem }) => {
16750
16797
  ref: containerRef,
16751
16798
  className: "relative flex items-center justify-between py-1",
16752
16799
  children: [
16753
- /* @__PURE__ */ jsx(SystemNode, { ref: leftRef, label: isInput ? externalSystem : currentSystem }),
16754
- /* @__PURE__ */ jsx(SystemNode, { ref: rightRef, label: isInput ? currentSystem : externalSystem }),
16800
+ /* @__PURE__ */ jsx(
16801
+ SystemNode,
16802
+ {
16803
+ ref: leftRef,
16804
+ label: isInput ? externalSystem : currentSystem
16805
+ }
16806
+ ),
16807
+ /* @__PURE__ */ jsx(
16808
+ SystemNode,
16809
+ {
16810
+ ref: rightRef,
16811
+ label: isInput ? currentSystem : externalSystem
16812
+ }
16813
+ ),
16755
16814
  /* @__PURE__ */ jsx(
16756
16815
  Beam,
16757
16816
  {
@@ -16770,7 +16829,6 @@ var BodyComponent = ({ data, isLoading, connections, isInput, externalSystem })
16770
16829
  /* @__PURE__ */ jsx(SkeletonBase, { className: "h-6 w-3/4" }),
16771
16830
  /* @__PURE__ */ jsx(SkeletonBase, { className: "h-3.5 w-1/2" })
16772
16831
  ] }) : /* @__PURE__ */ jsx(Name, { name: data.name, description: data.description }),
16773
- /* @__PURE__ */ jsx("div", { className: "border-t border-border/20" }),
16774
16832
  isLoading ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
16775
16833
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between py-1", children: [
16776
16834
  /* @__PURE__ */ jsx(SkeletonBase, { className: "w-[76px] h-[76px] rounded-full" }),
@@ -16797,7 +16855,6 @@ var BodyComponent = ({ data, isLoading, connections, isInput, externalSystem })
16797
16855
  externalSystem
16798
16856
  }
16799
16857
  ),
16800
- /* @__PURE__ */ jsx("div", { className: "border-t border-border/20" }),
16801
16858
  /* @__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" }) }),
16802
16859
  /* @__PURE__ */ jsx("div", { children: connections.map((conn) => /* @__PURE__ */ jsx(
16803
16860
  IntegrationCard,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "access": "public",
6
6
  "type":"module"
7
7
  },
8
- "version": "1.10.9",
8
+ "version": "1.10.10",
9
9
  "homepage": "https://main--68e80310a069c2f10b546ef3.chromatic.com/",
10
10
  "repository": {
11
11
  "type": "git",