@loomhq/lens 11.5.1 → 11.6.0

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  declare const ModalCardWrapper: import("@emotion/styled").StyledComponent<React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>, ModalCardProps, object>;
3
- export declare const ModalCard: ({ children, onCloseClick, isOpen, maxWidth, maxHeight, placement, ariaLabel, ref, ...props }: ModalCardProps & React.ComponentProps<typeof ModalCardWrapper>) => React.JSX.Element;
3
+ export declare const ModalCard: ({ children, onCloseClick, isOpen, maxWidth, maxHeight, placement, ariaLabel, ref, removeClose, ...props }: ModalCardProps & React.ComponentProps<typeof ModalCardWrapper>) => React.JSX.Element;
4
4
  declare const Modal: React.ForwardRefExoticComponent<Omit<ModalProps & {
5
5
  isOpen?: boolean;
6
6
  children?: React.ReactNode;
@@ -47,5 +47,10 @@ type ModalCardProps = {
47
47
  maxHeight?: number | string;
48
48
  maxWidth?: number | string;
49
49
  ariaLabel?: string;
50
+ /**
51
+ * Use sparingly, and always provide a way for the user to continue or close out.
52
+ * Useful for cases where there are mandatory steps.
53
+ */
54
+ removeClose?: boolean;
50
55
  };
51
56
  export default Modal;
package/dist/index.js CHANGED
@@ -3541,7 +3541,8 @@ var ModalCard = (_a) => {
3541
3541
  maxHeight = "70vh",
3542
3542
  placement = "center",
3543
3543
  ariaLabel,
3544
- ref
3544
+ ref,
3545
+ removeClose
3545
3546
  } = _b, props = __objRest(_b, [
3546
3547
  "children",
3547
3548
  "onCloseClick",
@@ -3550,13 +3551,16 @@ var ModalCard = (_a) => {
3550
3551
  "maxHeight",
3551
3552
  "placement",
3552
3553
  "ariaLabel",
3553
- "ref"
3554
+ "ref",
3555
+ "removeClose"
3554
3556
  ]);
3555
3557
  useEffect3(() => {
3556
3558
  const keyListener = (e) => {
3557
3559
  if (e.key === "Escape") {
3558
3560
  e.preventDefault();
3559
- onCloseClick(e);
3561
+ if (!removeClose) {
3562
+ onCloseClick(e);
3563
+ }
3560
3564
  }
3561
3565
  };
3562
3566
  window.addEventListener("keydown", keyListener);
@@ -3585,7 +3589,7 @@ var ModalCard = (_a) => {
3585
3589
  ref,
3586
3590
  "aria-label": ariaLabel
3587
3591
  }, props),
3588
- onCloseClick && /* @__PURE__ */ React25.createElement(CloseIconSection, null, /* @__PURE__ */ React25.createElement(
3592
+ !removeClose && onCloseClick && /* @__PURE__ */ React25.createElement(CloseIconSection, null, /* @__PURE__ */ React25.createElement(
3589
3593
  icon_button_default,
3590
3594
  {
3591
3595
  altText: "Close",
@@ -3593,7 +3597,13 @@ var ModalCard = (_a) => {
3593
3597
  onClick: onCloseClick
3594
3598
  }
3595
3599
  )),
3596
- /* @__PURE__ */ React25.createElement(ModalCardChildrenSection, null, children)
3600
+ /* @__PURE__ */ React25.createElement(
3601
+ ModalCardChildrenSection,
3602
+ {
3603
+ tabIndex: removeClose ? 0 : -1
3604
+ },
3605
+ children
3606
+ )
3597
3607
  )
3598
3608
  );
3599
3609
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "11.5.1",
3
+ "version": "11.6.0",
4
4
  "engines": {
5
5
  "pnpm": "^8.9.2"
6
6
  },