@humu-tech/ui 0.1.25 → 0.1.26

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
@@ -1648,6 +1648,16 @@ var import_react18 = require("react");
1648
1648
  var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
1649
1649
  var import_react19 = require("@phosphor-icons/react");
1650
1650
 
1651
+ // src/lib/keepOpenOnToast.ts
1652
+ function keepOpenOnToast(onInteractOutside) {
1653
+ return (event) => {
1654
+ onInteractOutside?.(event);
1655
+ if (event.target instanceof Element && event.target.closest("[data-sonner-toaster]")) {
1656
+ event.preventDefault();
1657
+ }
1658
+ };
1659
+ }
1660
+
1651
1661
  // src/primitives/Dialog/Dialog.styles.ts
1652
1662
  var import_class_variance_authority7 = require("class-variance-authority");
1653
1663
  var dialogContentStyles = (0, import_class_variance_authority7.cva)(
@@ -1675,28 +1685,31 @@ var Trigger4 = (0, import_react18.forwardRef)((props, ref) => /* @__PURE__ */ (0
1675
1685
  Trigger4.displayName = "Dialog.Trigger";
1676
1686
  var Close4 = (0, import_react18.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogPrimitive.Close, { ref, ...props }));
1677
1687
  Close4.displayName = "Dialog.Close";
1678
- var Content4 = (0, import_react18.forwardRef)(({ size, hideCloseButton, className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogPrimitive.Portal, { children: [
1679
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogPrimitive.Overlay, { className: "bg-v2-canvas/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:animate-none" }),
1680
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1681
- DialogPrimitive.Content,
1682
- {
1683
- ref,
1684
- className: cn(dialogContentStyles({ size }), className),
1685
- ...props,
1686
- children: [
1687
- children,
1688
- !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1689
- DialogPrimitive.Close,
1690
- {
1691
- "aria-label": "Fechar",
1692
- className: "absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-v2-md text-v2-fg-subtle opacity-70 transition-opacity hover:bg-v2-raised hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-focus-ring/30 disabled:pointer-events-none motion-reduce:transition-none",
1693
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react19.X, { size: 16, weight: "bold", "aria-hidden": "true" })
1694
- }
1695
- )
1696
- ]
1697
- }
1698
- )
1699
- ] }));
1688
+ var Content4 = (0, import_react18.forwardRef)(
1689
+ ({ size, hideCloseButton, className, children, onInteractOutside, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogPrimitive.Portal, { children: [
1690
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogPrimitive.Overlay, { className: "bg-v2-canvas/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:animate-none" }),
1691
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1692
+ DialogPrimitive.Content,
1693
+ {
1694
+ ref,
1695
+ className: cn(dialogContentStyles({ size }), className),
1696
+ onInteractOutside: keepOpenOnToast(onInteractOutside),
1697
+ ...props,
1698
+ children: [
1699
+ children,
1700
+ !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1701
+ DialogPrimitive.Close,
1702
+ {
1703
+ "aria-label": "Fechar",
1704
+ className: "absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-v2-md text-v2-fg-subtle opacity-70 transition-opacity hover:bg-v2-raised hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-focus-ring/30 disabled:pointer-events-none motion-reduce:transition-none",
1705
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react19.X, { size: 16, weight: "bold", "aria-hidden": "true" })
1706
+ }
1707
+ )
1708
+ ]
1709
+ }
1710
+ )
1711
+ ] })
1712
+ );
1700
1713
  Content4.displayName = "Dialog.Content";
1701
1714
  var Header2 = (0, import_react18.forwardRef)(
1702
1715
  ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
@@ -2615,6 +2628,7 @@ var Content6 = (0, import_react26.forwardRef)(
2615
2628
  hideCloseButton,
2616
2629
  className,
2617
2630
  children,
2631
+ onInteractOutside,
2618
2632
  ...props
2619
2633
  }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogPrimitive2.Portal, { children: [
2620
2634
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogPrimitive2.Overlay, { className: "bg-v2-canvas/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:animate-none" }),
@@ -2623,6 +2637,7 @@ var Content6 = (0, import_react26.forwardRef)(
2623
2637
  {
2624
2638
  ref,
2625
2639
  className: cn(drawerContentStyles({ side, size }), className),
2640
+ onInteractOutside: keepOpenOnToast(onInteractOutside),
2626
2641
  ...props,
2627
2642
  children: [
2628
2643
  children,
package/dist/index.mjs CHANGED
@@ -1526,6 +1526,16 @@ import {
1526
1526
  import * as DialogPrimitive from "@radix-ui/react-dialog";
1527
1527
  import { X as X2 } from "@phosphor-icons/react";
1528
1528
 
1529
+ // src/lib/keepOpenOnToast.ts
1530
+ function keepOpenOnToast(onInteractOutside) {
1531
+ return (event) => {
1532
+ onInteractOutside?.(event);
1533
+ if (event.target instanceof Element && event.target.closest("[data-sonner-toaster]")) {
1534
+ event.preventDefault();
1535
+ }
1536
+ };
1537
+ }
1538
+
1529
1539
  // src/primitives/Dialog/Dialog.styles.ts
1530
1540
  import { cva as cva7 } from "class-variance-authority";
1531
1541
  var dialogContentStyles = cva7(
@@ -1553,28 +1563,31 @@ var Trigger4 = forwardRef13((props, ref) => /* @__PURE__ */ jsx18(DialogPrimitiv
1553
1563
  Trigger4.displayName = "Dialog.Trigger";
1554
1564
  var Close4 = forwardRef13((props, ref) => /* @__PURE__ */ jsx18(DialogPrimitive.Close, { ref, ...props }));
1555
1565
  Close4.displayName = "Dialog.Close";
1556
- var Content4 = forwardRef13(({ size, hideCloseButton, className, children, ...props }, ref) => /* @__PURE__ */ jsxs10(DialogPrimitive.Portal, { children: [
1557
- /* @__PURE__ */ jsx18(DialogPrimitive.Overlay, { className: "bg-v2-canvas/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:animate-none" }),
1558
- /* @__PURE__ */ jsxs10(
1559
- DialogPrimitive.Content,
1560
- {
1561
- ref,
1562
- className: cn(dialogContentStyles({ size }), className),
1563
- ...props,
1564
- children: [
1565
- children,
1566
- !hideCloseButton && /* @__PURE__ */ jsx18(
1567
- DialogPrimitive.Close,
1568
- {
1569
- "aria-label": "Fechar",
1570
- className: "absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-v2-md text-v2-fg-subtle opacity-70 transition-opacity hover:bg-v2-raised hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-focus-ring/30 disabled:pointer-events-none motion-reduce:transition-none",
1571
- children: /* @__PURE__ */ jsx18(X2, { size: 16, weight: "bold", "aria-hidden": "true" })
1572
- }
1573
- )
1574
- ]
1575
- }
1576
- )
1577
- ] }));
1566
+ var Content4 = forwardRef13(
1567
+ ({ size, hideCloseButton, className, children, onInteractOutside, ...props }, ref) => /* @__PURE__ */ jsxs10(DialogPrimitive.Portal, { children: [
1568
+ /* @__PURE__ */ jsx18(DialogPrimitive.Overlay, { className: "bg-v2-canvas/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:animate-none" }),
1569
+ /* @__PURE__ */ jsxs10(
1570
+ DialogPrimitive.Content,
1571
+ {
1572
+ ref,
1573
+ className: cn(dialogContentStyles({ size }), className),
1574
+ onInteractOutside: keepOpenOnToast(onInteractOutside),
1575
+ ...props,
1576
+ children: [
1577
+ children,
1578
+ !hideCloseButton && /* @__PURE__ */ jsx18(
1579
+ DialogPrimitive.Close,
1580
+ {
1581
+ "aria-label": "Fechar",
1582
+ className: "absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-v2-md text-v2-fg-subtle opacity-70 transition-opacity hover:bg-v2-raised hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-focus-ring/30 disabled:pointer-events-none motion-reduce:transition-none",
1583
+ children: /* @__PURE__ */ jsx18(X2, { size: 16, weight: "bold", "aria-hidden": "true" })
1584
+ }
1585
+ )
1586
+ ]
1587
+ }
1588
+ )
1589
+ ] })
1590
+ );
1578
1591
  Content4.displayName = "Dialog.Content";
1579
1592
  var Header2 = forwardRef13(
1580
1593
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
@@ -2502,6 +2515,7 @@ var Content6 = forwardRef16(
2502
2515
  hideCloseButton,
2503
2516
  className,
2504
2517
  children,
2518
+ onInteractOutside,
2505
2519
  ...props
2506
2520
  }, ref) => /* @__PURE__ */ jsxs14(DialogPrimitive2.Portal, { children: [
2507
2521
  /* @__PURE__ */ jsx23(DialogPrimitive2.Overlay, { className: "bg-v2-canvas/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:animate-none" }),
@@ -2510,6 +2524,7 @@ var Content6 = forwardRef16(
2510
2524
  {
2511
2525
  ref,
2512
2526
  className: cn(drawerContentStyles({ side, size }), className),
2527
+ onInteractOutside: keepOpenOnToast(onInteractOutside),
2513
2528
  ...props,
2514
2529
  children: [
2515
2530
  children,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humu-tech/ui",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Design System V2 da Humu — 51 primitives e 32 patterns em React 18, com tema claro/escuro, preset Tailwind e TypeScript.",
5
5
  "keywords": [
6
6
  "design-system",