@stfrigerio/sito-template 0.1.101 → 0.1.103

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.
@@ -22,6 +22,8 @@ export interface ModalProps {
22
22
  mobileVariant?: 'sheet' | 'center';
23
23
  /** When the modal is in sheet mode on mobile, allow the user to swipe the header down to dismiss. Defaults to true. */
24
24
  draggable?: boolean;
25
+ /** When false, clicking the backdrop does not close the modal — useful for forms where an accidental click would discard input. Escape and the X button still close. Defaults to true. */
26
+ closeOnBackdrop?: boolean;
25
27
  }
26
28
  export declare const Modal: React.FC<ModalProps>;
27
29
  //# sourceMappingURL=Modal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAMtE;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,6CAA6C;IAC7C,IAAI,EAAE,OAAO,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,gGAAgG;IAChG,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,0FAA0F;IAC1F,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+HAA+H;IAC/H,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACnC,uHAAuH;IACvH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAqBD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA+GtC,CAAC"}
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAMtE;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,6CAA6C;IAC7C,IAAI,EAAE,OAAO,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,gGAAgG;IAChG,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,0FAA0F;IAC1F,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+HAA+H;IAC/H,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACnC,uHAAuH;IACvH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0LAA0L;IAC1L,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAqBD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAgHtC,CAAC"}
package/dist/index.esm.js CHANGED
@@ -741,7 +741,7 @@ const useIsMobile = () => {
741
741
  }, []);
742
742
  return isMobile;
743
743
  };
744
- const Modal = ({ open, title, onClose, children, size = 'default', actions, padding = true, mobileVariant = 'sheet', draggable = true, }) => {
744
+ const Modal = ({ open, title, onClose, children, size = 'default', actions, padding = true, mobileVariant = 'sheet', draggable = true, closeOnBackdrop = true, }) => {
745
745
  const isMobile = useIsMobile();
746
746
  const dragControls = useDragControls();
747
747
  const headerRef = useRef(null);
@@ -777,7 +777,7 @@ const Modal = ({ open, title, onClose, children, size = 'default', actions, padd
777
777
  animate: { opacity: 1, scale: 1, y: 0 },
778
778
  exit: { opacity: 0, scale: 0.96, y: 8 },
779
779
  };
780
- return createPortal(jsx(AnimatePresence, { children: open && (jsx(motion.div, { className: backdropClass, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, onClick: onClose, "aria-hidden": "true", children: jsxs(motion.div, { className: dialogClass, role: "dialog", "aria-modal": "true", "aria-label": title, ...enteringAnimation, transition: isSheet
780
+ return createPortal(jsx(AnimatePresence, { children: open && (jsx(motion.div, { className: backdropClass, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, onClick: closeOnBackdrop ? onClose : undefined, "aria-hidden": "true", children: jsxs(motion.div, { className: dialogClass, role: "dialog", "aria-modal": "true", "aria-label": title, ...enteringAnimation, transition: isSheet
781
781
  ? { type: 'spring', stiffness: 320, damping: 32 }
782
782
  : { duration: 0.15, ease: 'easeOut' }, onClick: (e) => e.stopPropagation(), drag: isDraggable ? 'y' : false, dragControls: isDraggable ? dragControls : undefined, dragConstraints: { top: 0 }, dragElastic: { top: 0, bottom: 0.3 }, dragListener: false, onDragEnd: (_, info) => {
783
783
  if (info.offset.y > 80)