@loomhq/lens 10.51.0 → 10.51.2

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.
@@ -8,7 +8,7 @@ declare const Modal: React.ForwardRefExoticComponent<Pick<ModalProps & {
8
8
  backgroundColor?: string;
9
9
  } & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
10
10
  theme?: object;
11
- }, "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "backgroundColor" | "maxWidth" | "zIndex" | "theme" | "isOpen" | "onCloseClick" | "hasDividers" | "mainButton" | "secondaryButton" | "alternativeButton" | "onBackgroundClick"> & React.RefAttributes<HTMLDialogElement>>;
11
+ }, "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "backgroundColor" | "maxWidth" | "zIndex" | "theme" | "isOpen" | "onCloseClick" | "hasDividers" | "noPadding" | "mainButton" | "secondaryButton" | "alternativeButton" | "onBackgroundClick"> & React.RefAttributes<HTMLDialogElement>>;
12
12
  declare type ModalProps = {
13
13
  children?: React.ReactNode;
14
14
  isOpen?: boolean;
@@ -21,11 +21,13 @@ declare type ModalProps = {
21
21
  onKeyDown?: React.ReactEventHandler;
22
22
  hasDividers?: boolean;
23
23
  maxWidth?: number | string;
24
+ noPadding?: boolean;
24
25
  zIndex?: number;
25
26
  };
26
27
  declare type ModalCardProps = {
27
28
  children?: React.ReactNode;
28
29
  isOpen?: boolean;
30
+ onKeyDown?: React.ReactEventHandler;
29
31
  onCloseClick?: React.ReactEventHandler;
30
32
  maxWidth?: number | string;
31
33
  };
@@ -11,10 +11,10 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import FocusTrap from 'focus-trap-react';
13
13
  import { getColorValue, getRadius, getShadow, getSize, u, } from '../../utilities';
14
+ import React, { useEffect } from 'react';
14
15
  import Backdrop from '../backdrop/backdrop';
15
16
  import Container from '../container/container';
16
17
  import IconButton from '../icon-button/icon-button';
17
- import React, { useEffect } from 'react';
18
18
  import Spacer from '../spacer/spacer';
19
19
  import { SvgClose } from '../icon/available-icons';
20
20
  import Text from '../text/text';
@@ -77,10 +77,18 @@ const ChildrenSection = styled.div `
77
77
  display: flex;
78
78
  flex-direction: column;
79
79
  overflow: auto;
80
- padding-top: ${props => (props.hasTitle ? 0 : 'var(--lns-space-xlarge)')};
81
- padding-bottom: ${props => props.hasButtons ? 0 : 'var(--lns-space-xlarge)'};
82
- padding-left: var(--lns-space-xlarge);
83
- padding-right: var(--lns-space-xlarge);
80
+ padding-top: ${props => props.hasTitle && !props.noPadding
81
+ ? 0
82
+ : !props.hasTitle && !props.noPadding
83
+ ? 'var(--lns-space-xlarge)'
84
+ : 0};
85
+ padding-bottom: ${props => props.hasButtons && !props.noPadding
86
+ ? 0
87
+ : !props.hasButtons && !props.noPadding
88
+ ? 'var(--lns-space-xlarge)'
89
+ : 0};
90
+ padding-left: ${props => (props.noPadding ? 0 : 'var(--lns-space-xlarge)')};
91
+ padding-right: ${props => (props.noPadding ? 0 : 'var(--lns-space-xlarge)')};
84
92
  border-style: solid;
85
93
  border-color: ${getColorValue('border')};
86
94
  border-width: ${props => (props.hasDividers ? '1px 0' : '0')};
@@ -102,7 +110,6 @@ export const ModalCard = (_a) => {
102
110
  }
103
111
  const keyListener = e => {
104
112
  if (e.key === 'Escape') {
105
- e.preventDefault();
106
113
  onCloseClick(e);
107
114
  }
108
115
  };
@@ -111,17 +118,28 @@ export const ModalCard = (_a) => {
111
118
  window.removeEventListener('keydown', keyListener);
112
119
  };
113
120
  }, [isOpen, onCloseClick]);
114
- return (React.createElement(FocusTrap, { active: isOpen },
121
+ return (React.createElement(FocusTrap, { active: isOpen, focusTrapOptions: {
122
+ clickOutsideDeactivates: false,
123
+ allowOutsideClick: true,
124
+ } },
115
125
  React.createElement(ModalCardWrapper, Object.assign({ open: isOpen, maxWidth: maxWidth, onClick: e => e.stopPropagation(), ref: ref }, props),
116
126
  onCloseClick && (React.createElement(CloseIconSection, null,
117
127
  React.createElement(IconButton, { altText: "Close", icon: React.createElement(SvgClose, null), onClick: onCloseClick }))),
118
128
  React.createElement(ModalCardChildrenSection, null, children))));
119
129
  };
120
130
  const Modal = React.forwardRef((_a, ref) => {
121
- var { children, isOpen, mainButton, secondaryButton, alternativeButton, title, onCloseClick, onBackgroundClick, onKeyDown, hasDividers, maxWidth = 60, zIndex = 1000 } = _a, props = __rest(_a, ["children", "isOpen", "mainButton", "secondaryButton", "alternativeButton", "title", "onCloseClick", "onBackgroundClick", "onKeyDown", "hasDividers", "maxWidth", "zIndex"]);
131
+ var { children, isOpen, mainButton, secondaryButton, alternativeButton, title, noPadding, onCloseClick, onBackgroundClick, onKeyDown, hasDividers, maxWidth = 60, zIndex = 1000 } = _a, props = __rest(_a, ["children", "isOpen", "mainButton", "secondaryButton", "alternativeButton", "title", "noPadding", "onCloseClick", "onBackgroundClick", "onKeyDown", "hasDividers", "maxWidth", "zIndex"]);
122
132
  const hasButtons = mainButton || secondaryButton || alternativeButton ? true : false;
133
+ const closeClickHandler = e => {
134
+ if (onBackgroundClick) {
135
+ e.stopPropagation();
136
+ onBackgroundClick(e);
137
+ return;
138
+ }
139
+ onCloseClick(e);
140
+ };
123
141
  return (React.createElement(Backdrop, Object.assign({ isOpen: isOpen, zIndex: zIndex }, props),
124
- React.createElement(Container, { height: "100%", onClick: onBackgroundClick, onKeyDown: onKeyDown },
142
+ React.createElement(Container, { height: "100%", onClick: closeClickHandler, onKeyDown: onKeyDown },
125
143
  React.createElement(ModalCard, { ref: ref,
126
144
  // TODO: LNS-148: Add aria labelling for screenreader support
127
145
  // ariaLabelledBy={title}
@@ -131,7 +149,7 @@ const Modal = React.forwardRef((_a, ref) => {
131
149
  ? 'var(--lns-space-medium)'
132
150
  : 'var(--lns-space-xlarge)' },
133
151
  React.createElement(Text, { variant: "title" }, title))),
134
- React.createElement(ChildrenSection, { hasDividers: hasDividers, hasTitle: Boolean(title), hasButtons: hasButtons }, children && children),
152
+ React.createElement(ChildrenSection, { noPadding: noPadding, hasDividers: hasDividers, hasTitle: Boolean(title), hasButtons: hasButtons }, children && children),
135
153
  hasButtons && (React.createElement(ButtonsSection, { top: children ? 'var(--lns-space-xlarge)' : 0, hasDividers: hasDividers },
136
154
  alternativeButton,
137
155
  React.createElement(RightButtonsSection, null,
@@ -84,7 +84,7 @@ const Tooltip = (_a) => {
84
84
  auto: true,
85
85
  });
86
86
  return (React.createElement(React.Fragment, null,
87
- React.createElement(TooltipChildren, Object.assign({}, triggerProps, hoverProps, { isInline: isInline, verticalAlign: verticalAlign, tabIndex: 0, ref: mergeRefs(triggerProps.ref, focusRef) }), children),
87
+ React.createElement(TooltipChildren, Object.assign({}, triggerProps, hoverProps, { isInline: isInline, verticalAlign: verticalAlign, tabIndex: isDisabled ? -1 : 0, ref: mergeRefs(triggerProps.ref, focusRef) }), children),
88
88
  isOpen &&
89
89
  renderLayer(React.createElement("div", Object.assign({}, layerProps, { style: Object.assign(Object.assign({}, layerProps.style), { zIndex }) }),
90
90
  React.createElement(TooltipBox, Object.assign({ maxWidth: maxWidth, onMouseEnter: () => setIsOverTooltip(true), onMouseLeave: () => setIsOverTooltip(false) }, rest), content)))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.51.0",
3
+ "version": "10.51.2",
4
4
  "scripts": {
5
5
  "dev": "next",
6
6
  "build:next": "next build",