@cupcodev/ui 1.2.3 → 1.2.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.cjs CHANGED
@@ -2675,9 +2675,54 @@ var NavbarCupcode = ({
2675
2675
  className
2676
2676
  }) => {
2677
2677
  const [isOpen, setIsOpen] = React10.useState(false);
2678
+ const navRef = React10.useRef(null);
2679
+ const mobileMenuId = React10.useId();
2680
+ React10.useEffect(() => {
2681
+ if (!isOpen) return;
2682
+ const handlePointerDown = (event) => {
2683
+ var _a65;
2684
+ const target = event.target;
2685
+ if (!(target instanceof Node)) return;
2686
+ if (!((_a65 = navRef.current) == null ? void 0 : _a65.contains(target))) {
2687
+ setIsOpen(false);
2688
+ }
2689
+ };
2690
+ const handleEscape = (event) => {
2691
+ if (event.key === "Escape") {
2692
+ setIsOpen(false);
2693
+ }
2694
+ };
2695
+ document.addEventListener("pointerdown", handlePointerDown);
2696
+ document.addEventListener("keydown", handleEscape);
2697
+ return () => {
2698
+ document.removeEventListener("pointerdown", handlePointerDown);
2699
+ document.removeEventListener("keydown", handleEscape);
2700
+ };
2701
+ }, [isOpen]);
2702
+ React10.useEffect(() => {
2703
+ if (!isOpen) return;
2704
+ const { style } = document.body;
2705
+ const previousOverflow = style.overflow;
2706
+ style.overflow = "hidden";
2707
+ return () => {
2708
+ style.overflow = previousOverflow;
2709
+ };
2710
+ }, [isOpen]);
2711
+ React10.useEffect(() => {
2712
+ const handleResize = () => {
2713
+ if (window.innerWidth >= 768) {
2714
+ setIsOpen(false);
2715
+ }
2716
+ };
2717
+ window.addEventListener("resize", handleResize);
2718
+ return () => {
2719
+ window.removeEventListener("resize", handleResize);
2720
+ };
2721
+ }, []);
2678
2722
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2679
2723
  "nav",
2680
2724
  {
2725
+ ref: navRef,
2681
2726
  className: cn(
2682
2727
  "fixed top-0 left-0 right-0 z-[200] pointer-events-auto",
2683
2728
  "glass border-b border-border",
@@ -2736,38 +2781,49 @@ var NavbarCupcode = ({
2736
2781
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2737
2782
  "button",
2738
2783
  {
2784
+ type: "button",
2739
2785
  onClick: () => setIsOpen(!isOpen),
2740
- className: "md:hidden p-2 rounded-lg hover:bg-primary/10 transition-colors",
2741
- children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react5.X, { className: "h-6 w-6 text-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react5.Menu, { className: "h-6 w-6 text-foreground" })
2786
+ "aria-controls": mobileMenuId,
2787
+ "aria-expanded": isOpen,
2788
+ "aria-label": isOpen ? "Fechar menu de navega\xE7\xE3o" : "Abrir menu de navega\xE7\xE3o",
2789
+ className: "md:hidden inline-flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
2790
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react5.Menu, { className: cn("h-6 w-6 text-foreground", isOpen && "text-primary") })
2742
2791
  }
2743
2792
  )
2744
2793
  ] }),
2745
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "md:hidden py-4 space-y-3 animate-slide-up", children: [
2746
- items.map((item, index) => {
2747
- const key = `${item.label}-${index}`;
2748
- const isActive = item.isActive;
2749
- const classes = cn(
2750
- "flex items-center gap-2 px-4 py-2 text-sm font-semibold text-foreground hover:bg-primary/10 rounded-lg transition-colors",
2751
- isActive && "text-primary"
2752
- );
2753
- const handleClick = (event) => {
2754
- var _a65;
2755
- (_a65 = item.onClick) == null ? void 0 : _a65.call(item, event);
2756
- setIsOpen(false);
2757
- };
2758
- if (item.href.startsWith("#")) {
2759
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { href: item.href, className: classes, onClick: handleClick, children: [
2760
- item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.icon }),
2761
- item.label
2762
- ] }, key);
2763
- }
2764
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { href: item.href, className: classes, onClick: handleClick, children: [
2765
- item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.icon }),
2766
- item.label
2767
- ] }, key);
2768
- }),
2769
- actions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "px-4 pt-2", children: actions })
2770
- ] })
2794
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2795
+ "div",
2796
+ {
2797
+ id: mobileMenuId,
2798
+ className: "md:hidden max-h-[calc(100dvh-4rem)] space-y-3 overflow-y-auto border-t border-border/60 py-4 animate-slide-up",
2799
+ children: [
2800
+ items.map((item, index) => {
2801
+ const key = `${item.label}-${index}`;
2802
+ const isActive = item.isActive;
2803
+ const classes = cn(
2804
+ "flex min-h-11 items-center gap-2 rounded-lg px-4 py-2.5 text-sm font-semibold text-foreground transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
2805
+ isActive && "text-primary"
2806
+ );
2807
+ const handleClick = (event) => {
2808
+ var _a65;
2809
+ (_a65 = item.onClick) == null ? void 0 : _a65.call(item, event);
2810
+ setIsOpen(false);
2811
+ };
2812
+ if (item.href.startsWith("#")) {
2813
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { href: item.href, className: classes, onClick: handleClick, children: [
2814
+ item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.icon }),
2815
+ item.label
2816
+ ] }, key);
2817
+ }
2818
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { href: item.href, className: classes, onClick: handleClick, children: [
2819
+ item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.icon }),
2820
+ item.label
2821
+ ] }, key);
2822
+ }),
2823
+ actions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "px-4 pb-[max(env(safe-area-inset-bottom),0.5rem)] pt-2", children: actions })
2824
+ ]
2825
+ }
2826
+ )
2771
2827
  ] })
2772
2828
  }
2773
2829
  );
@@ -10118,7 +10174,7 @@ var UserMenuCupcode = ({
10118
10174
  type: "button",
10119
10175
  onClick: () => openChatPanel(),
10120
10176
  className: cn(
10121
- "relative z-0 inline-flex h-9 min-w-[2.55rem] origin-right items-center justify-center rounded-[12px] border border-border/70 bg-background/80 px-2.5 text-foreground shadow-[0_10px_22px_-18px_rgba(0,0,0,0.75)] transition-[transform,opacity] duration-[260ms] will-change-transform",
10177
+ "relative z-0 inline-flex h-9 min-w-[2.55rem] origin-right items-center justify-center rounded-[12px] border border-border/70 bg-background/80 px-2.5 text-foreground shadow-[0_10px_22px_-18px_rgba(0,0,0,0.75)] transition-[transform,opacity] [transition-duration:260ms] will-change-transform",
10122
10178
  prefersReducedMotion ? isChatIndicatorVisible ? "opacity-100" : "opacity-0" : isChatIndicatorVisible ? "translate-x-0 opacity-100" : "translate-x-[10px] opacity-0"
10123
10179
  ),
10124
10180
  style: {
@@ -10131,7 +10187,7 @@ var UserMenuCupcode = ({
10131
10187
  "span",
10132
10188
  {
10133
10189
  className: cn(
10134
- "relative inline-flex transition-[transform,opacity] duration-[220ms]",
10190
+ "relative inline-flex transition-[transform,opacity] [transition-duration:220ms]",
10135
10191
  prefersReducedMotion ? isChatIndicatorVisible ? "scale-100 opacity-100" : "scale-100 opacity-0" : isChatIndicatorVisible ? isChatIndicatorIntroAnimating ? "scale-[1.08] opacity-100" : "scale-100 opacity-100" : "scale-[0.84] opacity-0"
10136
10192
  ),
10137
10193
  style: {
@@ -10144,7 +10200,7 @@ var UserMenuCupcode = ({
10144
10200
  "span",
10145
10201
  {
10146
10202
  className: cn(
10147
- "absolute -right-1 -top-1 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full border border-background bg-destructive px-1 text-[9px] font-bold text-destructive-foreground transition-[transform,opacity] duration-[180ms]",
10203
+ "absolute -right-1 -top-1 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full border border-background bg-destructive px-1 text-[9px] font-bold text-destructive-foreground transition-[transform,opacity] [transition-duration:180ms]",
10148
10204
  prefersReducedMotion ? isChatIndicatorVisible ? "scale-100 opacity-100" : "scale-100 opacity-0" : isChatIndicatorVisible ? isChatBadgePulsing ? "scale-[1.14] opacity-100" : "scale-100 opacity-100" : "scale-[0.72] opacity-0"
10149
10205
  ),
10150
10206
  style: {
@@ -26363,14 +26419,31 @@ var sheetVariants = (0, import_class_variance_authority6.cva)(
26363
26419
  }
26364
26420
  );
26365
26421
  var SheetContent = React56.forwardRef(
26366
- ({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(SheetPortal, { children: [
26422
+ ({
26423
+ side = "right",
26424
+ className,
26425
+ children,
26426
+ showCloseButton = false,
26427
+ closeButtonClassName,
26428
+ closeButtonLabel = "Close",
26429
+ ...props
26430
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(SheetPortal, { children: [
26367
26431
  /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(SheetOverlay, {}),
26368
26432
  /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(SheetPrimitive.Content, { ref, className: cn(sheetVariants({ side }), className), ...props, children: [
26369
26433
  children,
26370
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none", children: [
26371
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_lucide_react28.X, { className: "h-4 w-4" }),
26372
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "sr-only", children: "Close" })
26373
- ] })
26434
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
26435
+ SheetPrimitive.Close,
26436
+ {
26437
+ className: cn(
26438
+ "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",
26439
+ closeButtonClassName
26440
+ ),
26441
+ children: [
26442
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_lucide_react28.X, { className: "h-4 w-4" }),
26443
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "sr-only", children: closeButtonLabel })
26444
+ ]
26445
+ }
26446
+ ) : null
26374
26447
  ] })
26375
26448
  ] })
26376
26449
  );
@@ -26501,7 +26574,7 @@ var Sidebar = React58.forwardRef(({ side = "left", variant = "sidebar", collapsi
26501
26574
  {
26502
26575
  "data-sidebar": "sidebar",
26503
26576
  "data-mobile": "true",
26504
- className: "w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
26577
+ className: "w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground",
26505
26578
  style: {
26506
26579
  "--sidebar-width": SIDEBAR_WIDTH_MOBILE
26507
26580
  },
package/dist/index.d.cts CHANGED
@@ -1308,6 +1308,9 @@ declare const sheetVariants: (props?: ({
1308
1308
  side?: "top" | "right" | "bottom" | "left" | null | undefined;
1309
1309
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1310
1310
  interface SheetContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
1311
+ showCloseButton?: boolean;
1312
+ closeButtonClassName?: string;
1313
+ closeButtonLabel?: string;
1311
1314
  }
1312
1315
  declare const SheetContent: React$1.ForwardRefExoticComponent<SheetContentProps & React$1.RefAttributes<HTMLDivElement>>;
1313
1316
  declare const SheetHeader: {
package/dist/index.d.ts CHANGED
@@ -1308,6 +1308,9 @@ declare const sheetVariants: (props?: ({
1308
1308
  side?: "top" | "right" | "bottom" | "left" | null | undefined;
1309
1309
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1310
1310
  interface SheetContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
1311
+ showCloseButton?: boolean;
1312
+ closeButtonClassName?: string;
1313
+ closeButtonLabel?: string;
1311
1314
  }
1312
1315
  declare const SheetContent: React$1.ForwardRefExoticComponent<SheetContentProps & React$1.RefAttributes<HTMLDivElement>>;
1313
1316
  declare const SheetHeader: {