cr-ui-lib 1.1.118 → 1.1.120

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
@@ -511,15 +511,16 @@ declare const NavBar: ({ children, wrapperClassName, innerClassName, ...rest }:
511
511
 
512
512
  declare type ModalProps = {
513
513
  isOpen: boolean;
514
- type?: "left" | "right" | "center";
514
+ type?: 'left' | 'right' | 'center';
515
515
  onClose?: () => void;
516
516
  widthClassName?: string;
517
517
  children?: React.ReactNode;
518
518
  overlayClassName?: string;
519
519
  modalClassName?: string;
520
520
  stayMounted?: boolean;
521
+ closeOnOverlayClick?: boolean;
521
522
  };
522
- declare const Modal: ({ isOpen, type, onClose, widthClassName, children, overlayClassName, modalClassName, stayMounted, }: ModalProps) => JSX.Element | null;
523
+ declare const Modal: ({ isOpen, type, onClose, widthClassName, children, overlayClassName, modalClassName, stayMounted, closeOnOverlayClick, }: ModalProps) => JSX.Element | null;
523
524
 
524
525
  declare type PopupWrapperProps = {
525
526
  children?: React.ReactNode;
package/dist/index.d.ts CHANGED
@@ -511,15 +511,16 @@ declare const NavBar: ({ children, wrapperClassName, innerClassName, ...rest }:
511
511
 
512
512
  declare type ModalProps = {
513
513
  isOpen: boolean;
514
- type?: "left" | "right" | "center";
514
+ type?: 'left' | 'right' | 'center';
515
515
  onClose?: () => void;
516
516
  widthClassName?: string;
517
517
  children?: React.ReactNode;
518
518
  overlayClassName?: string;
519
519
  modalClassName?: string;
520
520
  stayMounted?: boolean;
521
+ closeOnOverlayClick?: boolean;
521
522
  };
522
- declare const Modal: ({ isOpen, type, onClose, widthClassName, children, overlayClassName, modalClassName, stayMounted, }: ModalProps) => JSX.Element | null;
523
+ declare const Modal: ({ isOpen, type, onClose, widthClassName, children, overlayClassName, modalClassName, stayMounted, closeOnOverlayClick, }: ModalProps) => JSX.Element | null;
523
524
 
524
525
  declare type PopupWrapperProps = {
525
526
  children?: React.ReactNode;
package/dist/index.js CHANGED
@@ -2315,6 +2315,13 @@ var DateRangePicker = ({
2315
2315
  }
2316
2316
  };
2317
2317
  const handleDateClick = (date, isLeftCalendar) => {
2318
+ if (startDate !== null && endDate !== null && startDate === date) {
2319
+ setEndDate(date);
2320
+ }
2321
+ if (startDate !== null && endDate === null && isLeftCalendar) {
2322
+ setEndDate(date);
2323
+ return;
2324
+ }
2318
2325
  if (startDate !== null && endDate === null && isLeftCalendar || startDate !== null && endDate !== null && (startDate == null ? void 0 : startDate.getTime()) === (endDate == null ? void 0 : endDate.getTime()) && isLeftCalendar) {
2319
2326
  setStartDate(null);
2320
2327
  setEndDate(null);
@@ -5526,7 +5533,8 @@ var Modal = ({
5526
5533
  children,
5527
5534
  overlayClassName,
5528
5535
  modalClassName,
5529
- stayMounted = false
5536
+ stayMounted = false,
5537
+ closeOnOverlayClick = false
5530
5538
  }) => {
5531
5539
  if (!stayMounted && !isOpen) return null;
5532
5540
  let positionClasses = "";
@@ -5535,8 +5543,13 @@ var Modal = ({
5535
5543
  } else if (type === "right") {
5536
5544
  positionClasses = "right-0 top-0 h-full";
5537
5545
  } else if (type === "center") {
5538
- positionClasses = "top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2";
5546
+ positionClasses = "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2";
5539
5547
  }
5548
+ const handleOverlayClick = () => {
5549
+ if (closeOnOverlayClick) {
5550
+ onClose == null ? void 0 : onClose();
5551
+ }
5552
+ };
5540
5553
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5541
5554
  /* @__PURE__ */ jsxRuntime.jsx(
5542
5555
  "div",
@@ -5546,7 +5559,7 @@ var Modal = ({
5546
5559
  stayMounted ? isOpen ? "block" : "hidden" : "block",
5547
5560
  overlayClassName
5548
5561
  ),
5549
- onClick: onClose,
5562
+ onClick: handleOverlayClick,
5550
5563
  "aria-hidden": !isOpen
5551
5564
  }
5552
5565
  ),
@@ -5561,6 +5574,7 @@ var Modal = ({
5561
5574
  ),
5562
5575
  role: "dialog",
5563
5576
  "aria-modal": "true",
5577
+ onClick: (e) => e.stopPropagation(),
5564
5578
  children
5565
5579
  }
5566
5580
  )