@itwin/core-react 3.0.0-dev.154 → 3.0.0-dev.159

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,6 +8,8 @@
8
8
  width: $uicore-icons-small;
9
9
  height: $uicore-icons-small;
10
10
  svg {
11
+ width: $uicore-icons-small;
12
+ height: $uicore-icons-small;
11
13
  fill: currentColor;
12
14
  }
13
15
  }
@@ -68,6 +68,7 @@ interface PopupState {
68
68
  left: number;
69
69
  position: RelativePosition;
70
70
  parentDocument: Document;
71
+ animationEnded: boolean;
71
72
  }
72
73
  /** Popup React component displays a popup relative to an optional target element.
73
74
  * @public
@@ -78,7 +79,7 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
78
79
  static defaultProps: Partial<PopupProps>;
79
80
  componentDidMount(): void;
80
81
  private getParentWindow;
81
- componentDidUpdate(previousProps: PopupProps): void;
82
+ componentDidUpdate(previousProps: PopupProps, prevState: PopupState): void;
82
83
  componentWillUnmount(): void;
83
84
  private _bindWindowEvents;
84
85
  private _unBindWindowEvents;
@@ -96,6 +97,7 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
96
97
  private _getPosition;
97
98
  private _toggleRelativePosition;
98
99
  private _fitPopup;
100
+ private _handleAnimationEnd;
99
101
  render(): React.ReactPortal | null;
100
102
  }
101
103
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAc,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAU7C;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,iDAAi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AAO,CAAC,KAAK,CAKX;IAEF,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,uBAAuB;IA6B/B,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,YAAY,CA2ElB;IAEF,OAAO,CAAC,uBAAuB;IAoE/B,OAAO,CAAC,SAAS,CAgCf;IAEF,OAAO,CAAC,mBAAmB,CAIzB;IAEc,MAAM;CA2CvB"}
@@ -179,8 +179,14 @@ class Popup extends React.Component {
179
179
  }
180
180
  return fittedPoint;
181
181
  };
182
+ this._handleAnimationEnd = (event) => {
183
+ if (event.target === this._popup) {
184
+ this.setState({ animationEnded: true });
185
+ }
186
+ };
182
187
  const parentDocument = (_b = (_a = this.props.target) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document;
183
188
  this.state = {
189
+ animationEnded: false,
184
190
  isOpen: this.props.isOpen,
185
191
  top: 0,
186
192
  left: 0,
@@ -198,8 +204,11 @@ class Popup extends React.Component {
198
204
  // istanbul ignore next
199
205
  return (_a = this.state.parentDocument.defaultView) !== null && _a !== void 0 ? _a : window;
200
206
  }
201
- componentDidUpdate(previousProps) {
207
+ componentDidUpdate(previousProps, prevState) {
202
208
  var _a, _b;
209
+ if (this.state.position !== prevState.position) {
210
+ this.setState({ animationEnded: false });
211
+ }
203
212
  if (this.props.target !== previousProps.target) {
204
213
  // istanbul ignore next
205
214
  {
@@ -367,7 +376,7 @@ class Popup extends React.Component {
367
376
  }
368
377
  render() {
369
378
  const animate = this.props.animate !== undefined ? this.props.animate : true;
370
- const className = (0, classnames_1.default)("core-popup", this._getClassNameByPosition(this.state.position), this.props.showShadow && "core-popup-shadow", this.props.showArrow && "arrow", !animate && "core-popup-animation-none", this.props.className, (!this.props.isOpen && this.props.keepContentsMounted) && "core-popup-hidden");
379
+ const className = (0, classnames_1.default)("core-popup", this._getClassNameByPosition(this.state.position), this.props.showShadow && "core-popup-shadow", this.props.showArrow && "arrow", !animate && "core-popup-animation-none", this.props.className, this.state.animationEnded && "core-animation-ended", (!this.props.isOpen && this.props.keepContentsMounted) && "core-popup-hidden");
371
380
  const style = {
372
381
  top: this.state.top,
373
382
  left: this.state.left,
@@ -377,7 +386,7 @@ class Popup extends React.Component {
377
386
  if (!this.props.isOpen && !this.props.keepContentsMounted) {
378
387
  return null;
379
388
  }
380
- return ReactDOM.createPortal((React.createElement("div", { className: className, "data-testid": "core-popup", ref: (element) => { this._popup = element; }, style: style, role: role, "aria-modal": true, tabIndex: -1, "aria-label": this.props.ariaLabel },
389
+ return ReactDOM.createPortal((React.createElement("div", { className: className, "data-testid": "core-popup", ref: (element) => { this._popup = element; }, style: style, role: role, "aria-modal": true, tabIndex: -1, "aria-label": this.props.ariaLabel, onAnimationEnd: this._handleAnimationEnd },
381
390
  React.createElement(FocusTrap_1.FocusTrap, { active: !!this.props.moveFocus, initialFocusElement: this.props.focusTarget, returnFocusOnDeactivate: true }, this.props.children))), this.state.parentDocument.body);
382
391
  }
383
392
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wBAAsB;AACtB,2CAAoC;AACpC,+BAA+B;AAC/B,sCAAsC;AACtC,0DAAqE;AACrE,sDAAmD;AA6EnD;;GAEG;AACH,MAAa,KAAM,SAAQ,KAAK,CAAC,SAAiC;IAGhE,YAAY,KAAiB;;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,WAAM,GAAuB,IAAI,CAAC;QA6ElC,sBAAiB,GAAG,GAAG,EAAE;YAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,YAAY,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EA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AC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,MAAM,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport \"./Popup.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n// cSpell:ignore focustrap focusable alertdialog\r\n\r\n/** @internal */\r\ninterface PopupPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\n/** Properties for the [[Popup]] component\r\n * @public\r\n */\r\nexport interface PopupProps extends CommonProps {\r\n /** Show or hide the box shadow (defaults to true) */\r\n showShadow: boolean;\r\n /** Show or hide the arrow (defaults to false) */\r\n showArrow: boolean;\r\n /** Indicates whether the popup is shown or not (defaults to false) */\r\n isOpen: boolean;\r\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\r\n position: RelativePosition;\r\n /** Top position (absolute positioning - defaults to 0) */\r\n top: number;\r\n /** Left position (absolute positioning - defaults to 0) */\r\n left: number;\r\n /** Function called when the popup is opened */\r\n onOpen?: () => void;\r\n /** Function called when user clicks outside the popup */\r\n onOutsideClick?: (e: MouseEvent) => void;\r\n /** Function called when the popup is closed */\r\n onClose?: () => void;\r\n /** Function called when the popup is closed on Enter */\r\n onEnter?: () => void;\r\n /** Function called when the wheel is used */\r\n onWheel?: (e: WheelEvent) => void;\r\n /** Function called when the right mouse button is pressed */\r\n onContextMenu?: (e: MouseEvent) => void;\r\n /** Offset from the parent (defaults to 4) */\r\n offset: number;\r\n /** Target element to position popup */\r\n target?: HTMLElement | null;\r\n /** Role - if not specified \"dialog\" is used */\r\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\r\n /** accessibility label */\r\n ariaLabel?: string;\r\n /** set focus to popup - default to not set focus */\r\n moveFocus?: boolean;\r\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\r\n focusTarget?: React.RefObject<HTMLElement> | string;\r\n /** Indicates whether the popup is pinned. */\r\n isPinned?: boolean;\r\n /** Indicates whether to use animation for open/close (defaults to true) */\r\n animate?: boolean;\r\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\r\n closeOnEnter?: boolean;\r\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\r\n closeOnWheel?: boolean;\r\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\r\n closeOnContextMenu?: boolean;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\r\n * children are unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface PopupState {\r\n isOpen: boolean;\r\n top: number;\r\n left: number;\r\n position: RelativePosition;\r\n parentDocument: Document;\r\n}\r\n\r\n/** Popup React component displays a popup relative to an optional target element.\r\n * @public\r\n */\r\nexport class Popup extends React.Component<PopupProps, PopupState> {\r\n private _popup: HTMLElement | null = null;\r\n\r\n constructor(props: PopupProps) {\r\n super(props);\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n\r\n this.state = {\r\n isOpen: this.props.isOpen,\r\n top: 0,\r\n left: 0,\r\n position: this.props.position,\r\n parentDocument,\r\n };\r\n }\r\n\r\n public static defaultProps: Partial<PopupProps> = {\r\n position: RelativePosition.Bottom,\r\n showShadow: true,\r\n showArrow: false,\r\n isOpen: false,\r\n offset: 4,\r\n top: -1,\r\n left: -1,\r\n };\r\n\r\n public override componentDidMount() {\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n }\r\n }\r\n\r\n private getParentWindow() {\r\n // istanbul ignore next\r\n return this.state.parentDocument.defaultView ?? window;\r\n }\r\n\r\n public override componentDidUpdate(previousProps: PopupProps) {\r\n if (this.props.target !== previousProps.target) {\r\n // istanbul ignore next\r\n {\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n if (parentDocument !== this.state.parentDocument) {\r\n this._unBindWindowEvents();\r\n this.setState({ parentDocument });\r\n }\r\n }\r\n }\r\n\r\n if (this.props.isOpen === previousProps.isOpen) {\r\n if (this.props.isOpen) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n if ((Math.abs(this.state.left - point.x) < 3) &&\r\n (Math.abs(this.state.top - point.y) < 3) &&\r\n this.state.position === position)\r\n return;\r\n\r\n this.setState({\r\n left: point.x,\r\n top: point.y,\r\n position,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n } else {\r\n this._onClose();\r\n }\r\n }\r\n\r\n public override componentWillUnmount() {\r\n this._unBindWindowEvents();\r\n }\r\n\r\n private _bindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.addEventListener(\"resize\", this._hide);\r\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.addEventListener(\"scroll\", this._hide);\r\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _unBindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.removeEventListener(\"resize\", this._hide);\r\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.removeEventListener(\"scroll\", this._hide);\r\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _handleWheel = (event: WheelEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onWheel)\r\n return this.props.onWheel(event);\r\n\r\n const closeOnWheel = this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\r\n if (closeOnWheel)\r\n this._hide();\r\n };\r\n\r\n private isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n private _handleOutsideClick = (event: MouseEvent): void => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(event.target as HTMLElement))\r\n return;\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(event);\r\n\r\n if (this.props.target && this.props.target.contains(event.target as Node))\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _handleContextMenu = (event: MouseEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onContextMenu)\r\n return this.props.onContextMenu(event);\r\n\r\n const closeOnContextMenu = this.props.closeOnContextMenu !== undefined ? this.props.closeOnContextMenu : true;\r\n if (closeOnContextMenu)\r\n this._hide();\r\n };\r\n\r\n private _handleKeyboard = (event: KeyboardEvent): void => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (event.key === SpecialKey.Escape || event.key === SpecialKey.Enter) {\r\n const closeOnEnter = this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\r\n if (event.key === SpecialKey.Enter) {\r\n if (closeOnEnter)\r\n this._onClose(true);\r\n else\r\n this.props.onEnter && this.props.onEnter();\r\n } else {\r\n this._onClose(false);\r\n }\r\n }\r\n };\r\n\r\n private _hide = () => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _onShow() {\r\n this._bindWindowEvents();\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n\r\n this.setState({ left: point.x, top: point.y, isOpen: true, position }, () => {\r\n if (this.props.onOpen)\r\n this.props.onOpen();\r\n });\r\n }\r\n\r\n private _onClose(enterKey?: boolean) {\r\n if (!this.state.isOpen)\r\n return;\r\n\r\n this._unBindWindowEvents();\r\n\r\n this.setState({ isOpen: false }, () => {\r\n if (enterKey && this.props.onEnter)\r\n this.props.onEnter();\r\n if (this.props.onClose)\r\n this.props.onClose();\r\n });\r\n }\r\n\r\n private _isPositionAbsolute(): boolean {\r\n return (this.props.top !== -1 && this.props.left !== -1);\r\n }\r\n\r\n private _getClassNameByPosition(position: RelativePosition): string {\r\n if (!this._isPositionAbsolute()) {\r\n switch (position) {\r\n case RelativePosition.TopLeft:\r\n return \"core-popup-top-left\";\r\n case RelativePosition.TopRight:\r\n return \"core-popup-top-right\";\r\n case RelativePosition.BottomLeft:\r\n return \"core-popup-bottom-left\";\r\n case RelativePosition.BottomRight:\r\n return \"core-popup-bottom-right\";\r\n case RelativePosition.Top:\r\n return \"core-popup-top\";\r\n case RelativePosition.Left:\r\n return \"core-popup-left\";\r\n case RelativePosition.Right:\r\n return \"core-popup-right\";\r\n case RelativePosition.Bottom:\r\n return \"core-popup-bottom\";\r\n case RelativePosition.LeftTop:\r\n return \"core-popup-left-top\";\r\n case RelativePosition.RightTop:\r\n return \"core-popup-right-top\";\r\n }\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n private _getPopupDimensions(): { popupWidth: number, popupHeight: number } {\r\n let popupWidth = 0;\r\n let popupHeight = 0;\r\n // istanbul ignore else\r\n if (this._popup) {\r\n const activeWindow = this.getParentWindow();\r\n const style = activeWindow.getComputedStyle(this._popup);\r\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\r\n const borderRightWidth = parsePxString(style.borderRightWidth);\r\n const borderTopWidth = parsePxString(style.borderTopWidth);\r\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\r\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\r\n popupHeight = this._popup.clientHeight + borderTopWidth + borderBottomWidth;\r\n }\r\n\r\n return { popupWidth, popupHeight };\r\n }\r\n\r\n private _getPosition = (position: RelativePosition) => {\r\n const activeWindow = this.getParentWindow();\r\n const { target, offset, top, left } = this.props;\r\n const offsetArrow = (this.props.showArrow) ? 6 : 0;\r\n\r\n // absolute position\r\n if (this._isPositionAbsolute())\r\n return { x: left, y: top };\r\n\r\n // sanity check\r\n const point = { x: 0, y: 0 };\r\n if (!this._popup || !target)\r\n return point;\r\n\r\n // relative position\r\n const scrollY = activeWindow.scrollY;\r\n const scrollX = activeWindow.scrollX;\r\n\r\n const targetRect = target.getBoundingClientRect();\r\n\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n\r\n switch (position) {\r\n case RelativePosition.Top:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.TopLeft:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.TopRight:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Bottom:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.BottomLeft:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.BottomRight:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Left:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.LeftTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.Right:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n\r\n case RelativePosition.RightTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n }\r\n\r\n return point;\r\n };\r\n\r\n private _toggleRelativePosition(): RelativePosition {\r\n const { target, position, offset } = this.props;\r\n\r\n if (!this._popup || !target)\r\n return position;\r\n\r\n // istanbul ignore if\r\n if (this._isPositionAbsolute())\r\n return position;\r\n\r\n let newPosition = position;\r\n\r\n interface Rect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n }\r\n\r\n const activeWindow = this.getParentWindow();\r\n\r\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\r\n const viewportRect: Rect = { left: activeWindow.scrollX, top: activeWindow.scrollY, right: activeWindow.scrollX + activeWindow.innerWidth, bottom: activeWindow.scrollY + activeWindow.innerHeight };\r\n const targetRect = target.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const containerStyle = activeWindow.getComputedStyle(target);\r\n const offsetArrow = this.props.showArrow ? /* istanbul ignore next */ 10 : 2;\r\n\r\n const bottomMargin = parseMargin(containerStyle.marginBottom);\r\n if ((targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset) > viewportRect.bottom) {\r\n if (newPosition === RelativePosition.Bottom)\r\n newPosition = RelativePosition.Top;\r\n else if (newPosition === RelativePosition.BottomLeft)\r\n newPosition = RelativePosition.TopLeft;\r\n else if (newPosition === RelativePosition.BottomRight)\r\n newPosition = RelativePosition.TopRight;\r\n }\r\n\r\n const topMargin = parseMargin(containerStyle.marginTop);\r\n if ((targetRect.top - popupHeight - topMargin - offsetArrow - offset) < viewportRect.top) {\r\n if (newPosition === RelativePosition.Top)\r\n newPosition = RelativePosition.Bottom;\r\n else if (newPosition === RelativePosition.TopLeft)\r\n newPosition = RelativePosition.BottomLeft;\r\n else if (newPosition === RelativePosition.TopRight)\r\n newPosition = RelativePosition.BottomRight;\r\n }\r\n\r\n const leftMargin = parseMargin(containerStyle.marginLeft);\r\n if ((targetRect.left - popupWidth - leftMargin - offsetArrow - offset) < viewportRect.left) {\r\n if (newPosition === RelativePosition.Left)\r\n newPosition = RelativePosition.Right;\r\n else if (newPosition === RelativePosition.LeftTop)\r\n newPosition = RelativePosition.RightTop;\r\n }\r\n\r\n const rightMargin = parseMargin(containerStyle.marginRight);\r\n if ((targetRect.right + popupWidth + rightMargin + offsetArrow + offset) > viewportRect.right) {\r\n if (newPosition === RelativePosition.Right)\r\n newPosition = RelativePosition.Left;\r\n else if (newPosition === RelativePosition.RightTop)\r\n newPosition = RelativePosition.LeftTop;\r\n }\r\n\r\n return newPosition;\r\n }\r\n\r\n // fit the popup within the extents of the view port\r\n private _fitPopup = (point: PopupPoint) => {\r\n const fittedPoint = point;\r\n\r\n // istanbul ignore if\r\n if (!this._popup) {\r\n return fittedPoint;\r\n }\r\n\r\n // const popupRect = this._popup.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const { innerWidth, innerHeight } = window;\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y + popupHeight > innerHeight) {\r\n fittedPoint.y = innerHeight - popupHeight;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.x + popupWidth > innerWidth) {\r\n fittedPoint.x = innerWidth - popupWidth;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y < 0) {\r\n fittedPoint.y = 0;\r\n }\r\n\r\n if (fittedPoint.x < 0) {\r\n fittedPoint.x = 0;\r\n }\r\n\r\n return fittedPoint;\r\n };\r\n\r\n public override render() {\r\n const animate = this.props.animate !== undefined ? this.props.animate : true;\r\n const className = classnames(\r\n \"core-popup\",\r\n this._getClassNameByPosition(this.state.position),\r\n this.props.showShadow && \"core-popup-shadow\",\r\n this.props.showArrow && \"arrow\",\r\n !animate && \"core-popup-animation-none\",\r\n this.props.className,\r\n (!this.props.isOpen && this.props.keepContentsMounted) && \"core-popup-hidden\"\r\n );\r\n\r\n const style: React.CSSProperties = {\r\n top: this.state.top,\r\n left: this.state.left,\r\n ...this.props.style,\r\n };\r\n\r\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\r\n\r\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\r\n return null;\r\n }\r\n\r\n return ReactDOM.createPortal(\r\n (\r\n <div\r\n className={className} data-testid=\"core-popup\"\r\n ref={(element) => { this._popup = element; }}\r\n style={style}\r\n role={role}\r\n aria-modal={true}\r\n tabIndex={-1}\r\n aria-label={this.props.ariaLabel}\r\n >\r\n <FocusTrap active={!!this.props.moveFocus} initialFocusElement={this.props.focusTarget} returnFocusOnDeactivate={true}>\r\n {this.props.children}\r\n </FocusTrap>\r\n </div>\r\n ), this.state.parentDocument.body);\r\n }\r\n}\r\n\r\nfunction parsePxString(pxStr: string): number {\r\n const parsed = parseInt(pxStr, 10);\r\n return parsed || 0;\r\n}\r\n\r\nfunction parseMargin(value: string) {\r\n return value ? /* istanbul ignore next */ parseFloat(value) : 0;\r\n}\r\n"]}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,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport \"./Popup.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n// cSpell:ignore focustrap focusable alertdialog\r\n\r\n/** @internal */\r\ninterface PopupPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\n/** Properties for the [[Popup]] component\r\n * @public\r\n */\r\nexport interface PopupProps extends CommonProps {\r\n /** Show or hide the box shadow (defaults to true) */\r\n showShadow: boolean;\r\n /** Show or hide the arrow (defaults to false) */\r\n showArrow: boolean;\r\n /** Indicates whether the popup is shown or not (defaults to false) */\r\n isOpen: boolean;\r\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\r\n position: RelativePosition;\r\n /** Top position (absolute positioning - defaults to 0) */\r\n top: number;\r\n /** Left position (absolute positioning - defaults to 0) */\r\n left: number;\r\n /** Function called when the popup is opened */\r\n onOpen?: () => void;\r\n /** Function called when user clicks outside the popup */\r\n onOutsideClick?: (e: MouseEvent) => void;\r\n /** Function called when the popup is closed */\r\n onClose?: () => void;\r\n /** Function called when the popup is closed on Enter */\r\n onEnter?: () => void;\r\n /** Function called when the wheel is used */\r\n onWheel?: (e: WheelEvent) => void;\r\n /** Function called when the right mouse button is pressed */\r\n onContextMenu?: (e: MouseEvent) => void;\r\n /** Offset from the parent (defaults to 4) */\r\n offset: number;\r\n /** Target element to position popup */\r\n target?: HTMLElement | null;\r\n /** Role - if not specified \"dialog\" is used */\r\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\r\n /** accessibility label */\r\n ariaLabel?: string;\r\n /** set focus to popup - default to not set focus */\r\n moveFocus?: boolean;\r\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\r\n focusTarget?: React.RefObject<HTMLElement> | string;\r\n /** Indicates whether the popup is pinned. */\r\n isPinned?: boolean;\r\n /** Indicates whether to use animation for open/close (defaults to true) */\r\n animate?: boolean;\r\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\r\n closeOnEnter?: boolean;\r\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\r\n closeOnWheel?: boolean;\r\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\r\n closeOnContextMenu?: boolean;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\r\n * children are unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface PopupState {\r\n isOpen: boolean;\r\n top: number;\r\n left: number;\r\n position: RelativePosition;\r\n parentDocument: Document;\r\n animationEnded: boolean;\r\n}\r\n\r\n/** Popup React component displays a popup relative to an optional target element.\r\n * @public\r\n */\r\nexport class Popup extends React.Component<PopupProps, PopupState> {\r\n private _popup: HTMLElement | null = null;\r\n\r\n constructor(props: PopupProps) {\r\n super(props);\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n\r\n this.state = {\r\n animationEnded: false,\r\n isOpen: this.props.isOpen,\r\n top: 0,\r\n left: 0,\r\n position: this.props.position,\r\n parentDocument,\r\n };\r\n }\r\n\r\n public static defaultProps: Partial<PopupProps> = {\r\n position: RelativePosition.Bottom,\r\n showShadow: true,\r\n showArrow: false,\r\n isOpen: false,\r\n offset: 4,\r\n top: -1,\r\n left: -1,\r\n };\r\n\r\n public override componentDidMount() {\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n }\r\n }\r\n\r\n private getParentWindow() {\r\n // istanbul ignore next\r\n return this.state.parentDocument.defaultView ?? window;\r\n }\r\n\r\n public override componentDidUpdate(previousProps: PopupProps, prevState: PopupState) {\r\n if (this.state.position !== prevState.position) {\r\n this.setState( { animationEnded: false });\r\n }\r\n\r\n if (this.props.target !== previousProps.target) {\r\n // istanbul ignore next\r\n {\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n if (parentDocument !== this.state.parentDocument) {\r\n this._unBindWindowEvents();\r\n this.setState({ parentDocument });\r\n }\r\n }\r\n }\r\n\r\n if (this.props.isOpen === previousProps.isOpen) {\r\n if (this.props.isOpen) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n if ((Math.abs(this.state.left - point.x) < 3) &&\r\n (Math.abs(this.state.top - point.y) < 3) &&\r\n this.state.position === position)\r\n return;\r\n\r\n this.setState({\r\n left: point.x,\r\n top: point.y,\r\n position,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n } else {\r\n this._onClose();\r\n }\r\n }\r\n\r\n public override componentWillUnmount() {\r\n this._unBindWindowEvents();\r\n }\r\n\r\n private _bindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.addEventListener(\"resize\", this._hide);\r\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.addEventListener(\"scroll\", this._hide);\r\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _unBindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.removeEventListener(\"resize\", this._hide);\r\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.removeEventListener(\"scroll\", this._hide);\r\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _handleWheel = (event: WheelEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onWheel)\r\n return this.props.onWheel(event);\r\n\r\n const closeOnWheel = this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\r\n if (closeOnWheel)\r\n this._hide();\r\n };\r\n\r\n private isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n private _handleOutsideClick = (event: MouseEvent): void => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(event.target as HTMLElement))\r\n return;\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(event);\r\n\r\n if (this.props.target && this.props.target.contains(event.target as Node))\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _handleContextMenu = (event: MouseEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onContextMenu)\r\n return this.props.onContextMenu(event);\r\n\r\n const closeOnContextMenu = this.props.closeOnContextMenu !== undefined ? this.props.closeOnContextMenu : true;\r\n if (closeOnContextMenu)\r\n this._hide();\r\n };\r\n\r\n private _handleKeyboard = (event: KeyboardEvent): void => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (event.key === SpecialKey.Escape || event.key === SpecialKey.Enter) {\r\n const closeOnEnter = this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\r\n if (event.key === SpecialKey.Enter) {\r\n if (closeOnEnter)\r\n this._onClose(true);\r\n else\r\n this.props.onEnter && this.props.onEnter();\r\n } else {\r\n this._onClose(false);\r\n }\r\n }\r\n };\r\n\r\n private _hide = () => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _onShow() {\r\n this._bindWindowEvents();\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n\r\n this.setState({ left: point.x, top: point.y, isOpen: true, position }, () => {\r\n if (this.props.onOpen)\r\n this.props.onOpen();\r\n });\r\n }\r\n\r\n private _onClose(enterKey?: boolean) {\r\n if (!this.state.isOpen)\r\n return;\r\n\r\n this._unBindWindowEvents();\r\n\r\n this.setState({ isOpen: false }, () => {\r\n if (enterKey && this.props.onEnter)\r\n this.props.onEnter();\r\n if (this.props.onClose)\r\n this.props.onClose();\r\n });\r\n }\r\n\r\n private _isPositionAbsolute(): boolean {\r\n return (this.props.top !== -1 && this.props.left !== -1);\r\n }\r\n\r\n private _getClassNameByPosition(position: RelativePosition): string {\r\n if (!this._isPositionAbsolute()) {\r\n switch (position) {\r\n case RelativePosition.TopLeft:\r\n return \"core-popup-top-left\";\r\n case RelativePosition.TopRight:\r\n return \"core-popup-top-right\";\r\n case RelativePosition.BottomLeft:\r\n return \"core-popup-bottom-left\";\r\n case RelativePosition.BottomRight:\r\n return \"core-popup-bottom-right\";\r\n case RelativePosition.Top:\r\n return \"core-popup-top\";\r\n case RelativePosition.Left:\r\n return \"core-popup-left\";\r\n case RelativePosition.Right:\r\n return \"core-popup-right\";\r\n case RelativePosition.Bottom:\r\n return \"core-popup-bottom\";\r\n case RelativePosition.LeftTop:\r\n return \"core-popup-left-top\";\r\n case RelativePosition.RightTop:\r\n return \"core-popup-right-top\";\r\n }\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n private _getPopupDimensions(): { popupWidth: number, popupHeight: number } {\r\n let popupWidth = 0;\r\n let popupHeight = 0;\r\n // istanbul ignore else\r\n if (this._popup) {\r\n const activeWindow = this.getParentWindow();\r\n const style = activeWindow.getComputedStyle(this._popup);\r\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\r\n const borderRightWidth = parsePxString(style.borderRightWidth);\r\n const borderTopWidth = parsePxString(style.borderTopWidth);\r\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\r\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\r\n popupHeight = this._popup.clientHeight + borderTopWidth + borderBottomWidth;\r\n }\r\n\r\n return { popupWidth, popupHeight };\r\n }\r\n\r\n private _getPosition = (position: RelativePosition) => {\r\n const activeWindow = this.getParentWindow();\r\n const { target, offset, top, left } = this.props;\r\n const offsetArrow = (this.props.showArrow) ? 6 : 0;\r\n\r\n // absolute position\r\n if (this._isPositionAbsolute())\r\n return { x: left, y: top };\r\n\r\n // sanity check\r\n const point = { x: 0, y: 0 };\r\n if (!this._popup || !target)\r\n return point;\r\n\r\n // relative position\r\n const scrollY = activeWindow.scrollY;\r\n const scrollX = activeWindow.scrollX;\r\n\r\n const targetRect = target.getBoundingClientRect();\r\n\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n\r\n switch (position) {\r\n case RelativePosition.Top:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.TopLeft:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.TopRight:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Bottom:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.BottomLeft:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.BottomRight:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Left:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.LeftTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.Right:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n\r\n case RelativePosition.RightTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n }\r\n\r\n return point;\r\n };\r\n\r\n private _toggleRelativePosition(): RelativePosition {\r\n const { target, position, offset } = this.props;\r\n\r\n if (!this._popup || !target)\r\n return position;\r\n\r\n // istanbul ignore if\r\n if (this._isPositionAbsolute())\r\n return position;\r\n\r\n let newPosition = position;\r\n\r\n interface Rect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n }\r\n\r\n const activeWindow = this.getParentWindow();\r\n\r\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\r\n const viewportRect: Rect = { left: activeWindow.scrollX, top: activeWindow.scrollY, right: activeWindow.scrollX + activeWindow.innerWidth, bottom: activeWindow.scrollY + activeWindow.innerHeight };\r\n const targetRect = target.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const containerStyle = activeWindow.getComputedStyle(target);\r\n const offsetArrow = this.props.showArrow ? /* istanbul ignore next */ 10 : 2;\r\n\r\n const bottomMargin = parseMargin(containerStyle.marginBottom);\r\n if ((targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset) > viewportRect.bottom) {\r\n if (newPosition === RelativePosition.Bottom)\r\n newPosition = RelativePosition.Top;\r\n else if (newPosition === RelativePosition.BottomLeft)\r\n newPosition = RelativePosition.TopLeft;\r\n else if (newPosition === RelativePosition.BottomRight)\r\n newPosition = RelativePosition.TopRight;\r\n }\r\n\r\n const topMargin = parseMargin(containerStyle.marginTop);\r\n if ((targetRect.top - popupHeight - topMargin - offsetArrow - offset) < viewportRect.top) {\r\n if (newPosition === RelativePosition.Top)\r\n newPosition = RelativePosition.Bottom;\r\n else if (newPosition === RelativePosition.TopLeft)\r\n newPosition = RelativePosition.BottomLeft;\r\n else if (newPosition === RelativePosition.TopRight)\r\n newPosition = RelativePosition.BottomRight;\r\n }\r\n\r\n const leftMargin = parseMargin(containerStyle.marginLeft);\r\n if ((targetRect.left - popupWidth - leftMargin - offsetArrow - offset) < viewportRect.left) {\r\n if (newPosition === RelativePosition.Left)\r\n newPosition = RelativePosition.Right;\r\n else if (newPosition === RelativePosition.LeftTop)\r\n newPosition = RelativePosition.RightTop;\r\n }\r\n\r\n const rightMargin = parseMargin(containerStyle.marginRight);\r\n if ((targetRect.right + popupWidth + rightMargin + offsetArrow + offset) > viewportRect.right) {\r\n if (newPosition === RelativePosition.Right)\r\n newPosition = RelativePosition.Left;\r\n else if (newPosition === RelativePosition.RightTop)\r\n newPosition = RelativePosition.LeftTop;\r\n }\r\n\r\n return newPosition;\r\n }\r\n\r\n // fit the popup within the extents of the view port\r\n private _fitPopup = (point: PopupPoint) => {\r\n const fittedPoint = point;\r\n\r\n // istanbul ignore if\r\n if (!this._popup) {\r\n return fittedPoint;\r\n }\r\n\r\n // const popupRect = this._popup.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const { innerWidth, innerHeight } = window;\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y + popupHeight > innerHeight) {\r\n fittedPoint.y = innerHeight - popupHeight;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.x + popupWidth > innerWidth) {\r\n fittedPoint.x = innerWidth - popupWidth;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y < 0) {\r\n fittedPoint.y = 0;\r\n }\r\n\r\n if (fittedPoint.x < 0) {\r\n fittedPoint.x = 0;\r\n }\r\n\r\n return fittedPoint;\r\n };\r\n\r\n private _handleAnimationEnd = (event: React.AnimationEvent<HTMLDivElement>) => {\r\n if (event.target === this._popup) {\r\n this.setState({ animationEnded: true });\r\n }\r\n };\r\n\r\n public override render() {\r\n const animate = this.props.animate !== undefined ? this.props.animate : true;\r\n const className = classnames(\r\n \"core-popup\",\r\n this._getClassNameByPosition(this.state.position),\r\n this.props.showShadow && \"core-popup-shadow\",\r\n this.props.showArrow && \"arrow\",\r\n !animate && \"core-popup-animation-none\",\r\n this.props.className,\r\n this.state.animationEnded && \"core-animation-ended\",\r\n (!this.props.isOpen && this.props.keepContentsMounted) && \"core-popup-hidden\"\r\n );\r\n\r\n const style: React.CSSProperties = {\r\n top: this.state.top,\r\n left: this.state.left,\r\n ...this.props.style,\r\n };\r\n\r\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\r\n\r\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\r\n return null;\r\n }\r\n\r\n return ReactDOM.createPortal(\r\n (\r\n <div\r\n className={className} data-testid=\"core-popup\"\r\n ref={(element) => { this._popup = element; }}\r\n style={style}\r\n role={role}\r\n aria-modal={true}\r\n tabIndex={-1}\r\n aria-label={this.props.ariaLabel}\r\n onAnimationEnd={this._handleAnimationEnd}\r\n >\r\n <FocusTrap active={!!this.props.moveFocus} initialFocusElement={this.props.focusTarget} returnFocusOnDeactivate={true}>\r\n {this.props.children}\r\n </FocusTrap>\r\n </div>\r\n ), this.state.parentDocument.body);\r\n }\r\n}\r\n\r\nfunction parsePxString(pxStr: string): number {\r\n const parsed = parseInt(pxStr, 10);\r\n return parsed || 0;\r\n}\r\n\r\nfunction parseMargin(value: string) {\r\n return value ? /* istanbul ignore next */ parseFloat(value) : 0;\r\n}\r\n"]}
@@ -4,6 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  @import "../inputs/variables";
6
6
  @import "../z-index";
7
+ @import "~@itwin/itwinui-css/scss/style/elevation";
7
8
 
8
9
  .core-popup {
9
10
  top: 0;
@@ -29,6 +30,10 @@
29
30
  &.core-popup-hidden {
30
31
  display: none;
31
32
  }
33
+
34
+ &.core-animation-ended {
35
+ animation-name: none;
36
+ }
32
37
  }
33
38
 
34
39
  .core-popup.arrow::after, .core-popup.arrow::before {
@@ -146,8 +151,8 @@
146
151
  }
147
152
 
148
153
  .core-popup-shadow {
149
- -webkit-box-shadow: 0 3px 6px $buic-popup-boxshadow;
150
- box-shadow: 0px 3px 6px $buic-popup-boxshadow;
154
+ -webkit-box-shadow: $iui-elevation-16;
155
+ box-shadow: $iui-elevation-16;
151
156
  background-clip: padding-box;
152
157
  }
153
158
 
@@ -8,6 +8,8 @@
8
8
  width: $uicore-icons-small;
9
9
  height: $uicore-icons-small;
10
10
  svg {
11
+ width: $uicore-icons-small;
12
+ height: $uicore-icons-small;
11
13
  fill: currentColor;
12
14
  }
13
15
  }
@@ -68,6 +68,7 @@ interface PopupState {
68
68
  left: number;
69
69
  position: RelativePosition;
70
70
  parentDocument: Document;
71
+ animationEnded: boolean;
71
72
  }
72
73
  /** Popup React component displays a popup relative to an optional target element.
73
74
  * @public
@@ -78,7 +79,7 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
78
79
  static defaultProps: Partial<PopupProps>;
79
80
  componentDidMount(): void;
80
81
  private getParentWindow;
81
- componentDidUpdate(previousProps: PopupProps): void;
82
+ componentDidUpdate(previousProps: PopupProps, prevState: PopupState): void;
82
83
  componentWillUnmount(): void;
83
84
  private _bindWindowEvents;
84
85
  private _unBindWindowEvents;
@@ -96,6 +97,7 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
96
97
  private _getPosition;
97
98
  private _toggleRelativePosition;
98
99
  private _fitPopup;
100
+ private _handleAnimationEnd;
99
101
  render(): React.ReactPortal | null;
100
102
  }
101
103
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAc,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAU7C;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,iDAAiD;IACjD,SAAS,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAC;IAChB,6FAA6F;IAC7F,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,6DAA6D;IAC7D,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,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CAAC,UAAU,EAAE,UAAU,CAAC;IAChE,OAAO,CAAC,MAAM,CAA4B;gBAE9B,KAAK,EAAE,UAAU;IAc7B,OAAc,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAQ7C;IAEc,iBAAiB;IAMjC,OAAO,CAAC,eAAe;IAKP,kBAAkB,CAAC,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU;IAyCnE,oBAAoB;IAIpC,OAAO,CAAC,iBAAiB,CAQvB;IAEF,OAAO,CAAC,mBAAmB,CAQzB;IAEF,OAAO,CAAC,YAAY,CAUlB;IAEF,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,mBAAmB,CAiBzB;IAEF,OAAO,CAAC,kBAAkB,CAUxB;IAEF,OAAO,CAAC,eAAe,CAerB;IAEF,OAAO,CAAC,KAAK,CAKX;IAEF,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,uBAAuB;IA6B/B,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,YAAY,CA2ElB;IAEF,OAAO,CAAC,uBAAuB;IAoE/B,OAAO,CAAC,SAAS,CAgCf;IAEF,OAAO,CAAC,mBAAmB,CAIzB;IAEc,MAAM;CA2CvB"}
@@ -176,8 +176,14 @@ export class Popup extends React.Component {
176
176
  }
177
177
  return fittedPoint;
178
178
  };
179
+ this._handleAnimationEnd = (event) => {
180
+ if (event.target === this._popup) {
181
+ this.setState({ animationEnded: true });
182
+ }
183
+ };
179
184
  const parentDocument = (_b = (_a = this.props.target) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document;
180
185
  this.state = {
186
+ animationEnded: false,
181
187
  isOpen: this.props.isOpen,
182
188
  top: 0,
183
189
  left: 0,
@@ -195,8 +201,11 @@ export class Popup extends React.Component {
195
201
  // istanbul ignore next
196
202
  return (_a = this.state.parentDocument.defaultView) !== null && _a !== void 0 ? _a : window;
197
203
  }
198
- componentDidUpdate(previousProps) {
204
+ componentDidUpdate(previousProps, prevState) {
199
205
  var _a, _b;
206
+ if (this.state.position !== prevState.position) {
207
+ this.setState({ animationEnded: false });
208
+ }
200
209
  if (this.props.target !== previousProps.target) {
201
210
  // istanbul ignore next
202
211
  {
@@ -364,7 +373,7 @@ export class Popup extends React.Component {
364
373
  }
365
374
  render() {
366
375
  const animate = this.props.animate !== undefined ? this.props.animate : true;
367
- const className = classnames("core-popup", this._getClassNameByPosition(this.state.position), this.props.showShadow && "core-popup-shadow", this.props.showArrow && "arrow", !animate && "core-popup-animation-none", this.props.className, (!this.props.isOpen && this.props.keepContentsMounted) && "core-popup-hidden");
376
+ const className = classnames("core-popup", this._getClassNameByPosition(this.state.position), this.props.showShadow && "core-popup-shadow", this.props.showArrow && "arrow", !animate && "core-popup-animation-none", this.props.className, this.state.animationEnded && "core-animation-ended", (!this.props.isOpen && this.props.keepContentsMounted) && "core-popup-hidden");
368
377
  const style = {
369
378
  top: this.state.top,
370
379
  left: this.state.left,
@@ -374,7 +383,7 @@ export class Popup extends React.Component {
374
383
  if (!this.props.isOpen && !this.props.keepContentsMounted) {
375
384
  return null;
376
385
  }
377
- return ReactDOM.createPortal((React.createElement("div", { className: className, "data-testid": "core-popup", ref: (element) => { this._popup = element; }, style: style, role: role, "aria-modal": true, tabIndex: -1, "aria-label": this.props.ariaLabel },
386
+ return ReactDOM.createPortal((React.createElement("div", { className: className, "data-testid": "core-popup", ref: (element) => { this._popup = element; }, style: style, role: role, "aria-modal": true, tabIndex: -1, "aria-label": this.props.ariaLabel, onAnimationEnd: this._handleAnimationEnd },
378
387
  React.createElement(FocusTrap, { active: !!this.props.moveFocus, initialFocusElement: this.props.focusTarget, returnFocusOnDeactivate: true }, this.props.children))), this.state.parentDocument.body);
379
388
  }
380
389
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAAA;;;+F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AAC,CAAC,gBACA,IAAI,CAAC,KAAK,CAAC,SAAS;YAEhC,oBAAC,SAAS,IAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,uBAAuB,EAAE,IAAI,IAClH,IAAI,CAAC,KAAK,CAAC,QAAQ,CACV,CACR,CACP,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;;AA1ca,kBAAY,GAAwB;IAChD,QAAQ,EAAE,gBAAgB,CAAC,MAAM;IACjC,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC,CAAC;IACP,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAqcJ,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,MAAM,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport \"./Popup.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n// cSpell:ignore focustrap focusable alertdialog\r\n\r\n/** @internal */\r\ninterface PopupPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\n/** Properties for the [[Popup]] component\r\n * @public\r\n */\r\nexport interface PopupProps extends CommonProps {\r\n /** Show or hide the box shadow (defaults to true) */\r\n showShadow: boolean;\r\n /** Show or hide the arrow (defaults to false) */\r\n showArrow: boolean;\r\n /** Indicates whether the popup is shown or not (defaults to false) */\r\n isOpen: boolean;\r\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\r\n position: RelativePosition;\r\n /** Top position (absolute positioning - defaults to 0) */\r\n top: number;\r\n /** Left position (absolute positioning - defaults to 0) */\r\n left: number;\r\n /** Function called when the popup is opened */\r\n onOpen?: () => void;\r\n /** Function called when user clicks outside the popup */\r\n onOutsideClick?: (e: MouseEvent) => void;\r\n /** Function called when the popup is closed */\r\n onClose?: () => void;\r\n /** Function called when the popup is closed on Enter */\r\n onEnter?: () => void;\r\n /** Function called when the wheel is used */\r\n onWheel?: (e: WheelEvent) => void;\r\n /** Function called when the right mouse button is pressed */\r\n onContextMenu?: (e: MouseEvent) => void;\r\n /** Offset from the parent (defaults to 4) */\r\n offset: number;\r\n /** Target element to position popup */\r\n target?: HTMLElement | null;\r\n /** Role - if not specified \"dialog\" is used */\r\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\r\n /** accessibility label */\r\n ariaLabel?: string;\r\n /** set focus to popup - default to not set focus */\r\n moveFocus?: boolean;\r\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\r\n focusTarget?: React.RefObject<HTMLElement> | string;\r\n /** Indicates whether the popup is pinned. */\r\n isPinned?: boolean;\r\n /** Indicates whether to use animation for open/close (defaults to true) */\r\n animate?: boolean;\r\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\r\n closeOnEnter?: boolean;\r\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\r\n closeOnWheel?: boolean;\r\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\r\n closeOnContextMenu?: boolean;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\r\n * children are unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface PopupState {\r\n isOpen: boolean;\r\n top: number;\r\n left: number;\r\n position: RelativePosition;\r\n parentDocument: Document;\r\n}\r\n\r\n/** Popup React component displays a popup relative to an optional target element.\r\n * @public\r\n */\r\nexport class Popup extends React.Component<PopupProps, PopupState> {\r\n private _popup: HTMLElement | null = null;\r\n\r\n constructor(props: PopupProps) {\r\n super(props);\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n\r\n this.state = {\r\n isOpen: this.props.isOpen,\r\n top: 0,\r\n left: 0,\r\n position: this.props.position,\r\n parentDocument,\r\n };\r\n }\r\n\r\n public static defaultProps: Partial<PopupProps> = {\r\n position: RelativePosition.Bottom,\r\n showShadow: true,\r\n showArrow: false,\r\n isOpen: false,\r\n offset: 4,\r\n top: -1,\r\n left: -1,\r\n };\r\n\r\n public override componentDidMount() {\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n }\r\n }\r\n\r\n private getParentWindow() {\r\n // istanbul ignore next\r\n return this.state.parentDocument.defaultView ?? window;\r\n }\r\n\r\n public override componentDidUpdate(previousProps: PopupProps) {\r\n if (this.props.target !== previousProps.target) {\r\n // istanbul ignore next\r\n {\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n if (parentDocument !== this.state.parentDocument) {\r\n this._unBindWindowEvents();\r\n this.setState({ parentDocument });\r\n }\r\n }\r\n }\r\n\r\n if (this.props.isOpen === previousProps.isOpen) {\r\n if (this.props.isOpen) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n if ((Math.abs(this.state.left - point.x) < 3) &&\r\n (Math.abs(this.state.top - point.y) < 3) &&\r\n this.state.position === position)\r\n return;\r\n\r\n this.setState({\r\n left: point.x,\r\n top: point.y,\r\n position,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n } else {\r\n this._onClose();\r\n }\r\n }\r\n\r\n public override componentWillUnmount() {\r\n this._unBindWindowEvents();\r\n }\r\n\r\n private _bindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.addEventListener(\"resize\", this._hide);\r\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.addEventListener(\"scroll\", this._hide);\r\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _unBindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.removeEventListener(\"resize\", this._hide);\r\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.removeEventListener(\"scroll\", this._hide);\r\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _handleWheel = (event: WheelEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onWheel)\r\n return this.props.onWheel(event);\r\n\r\n const closeOnWheel = this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\r\n if (closeOnWheel)\r\n this._hide();\r\n };\r\n\r\n private isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n private _handleOutsideClick = (event: MouseEvent): void => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(event.target as HTMLElement))\r\n return;\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(event);\r\n\r\n if (this.props.target && this.props.target.contains(event.target as Node))\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _handleContextMenu = (event: MouseEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onContextMenu)\r\n return this.props.onContextMenu(event);\r\n\r\n const closeOnContextMenu = this.props.closeOnContextMenu !== undefined ? this.props.closeOnContextMenu : true;\r\n if (closeOnContextMenu)\r\n this._hide();\r\n };\r\n\r\n private _handleKeyboard = (event: KeyboardEvent): void => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (event.key === SpecialKey.Escape || event.key === SpecialKey.Enter) {\r\n const closeOnEnter = this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\r\n if (event.key === SpecialKey.Enter) {\r\n if (closeOnEnter)\r\n this._onClose(true);\r\n else\r\n this.props.onEnter && this.props.onEnter();\r\n } else {\r\n this._onClose(false);\r\n }\r\n }\r\n };\r\n\r\n private _hide = () => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _onShow() {\r\n this._bindWindowEvents();\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n\r\n this.setState({ left: point.x, top: point.y, isOpen: true, position }, () => {\r\n if (this.props.onOpen)\r\n this.props.onOpen();\r\n });\r\n }\r\n\r\n private _onClose(enterKey?: boolean) {\r\n if (!this.state.isOpen)\r\n return;\r\n\r\n this._unBindWindowEvents();\r\n\r\n this.setState({ isOpen: false }, () => {\r\n if (enterKey && this.props.onEnter)\r\n this.props.onEnter();\r\n if (this.props.onClose)\r\n this.props.onClose();\r\n });\r\n }\r\n\r\n private _isPositionAbsolute(): boolean {\r\n return (this.props.top !== -1 && this.props.left !== -1);\r\n }\r\n\r\n private _getClassNameByPosition(position: RelativePosition): string {\r\n if (!this._isPositionAbsolute()) {\r\n switch (position) {\r\n case RelativePosition.TopLeft:\r\n return \"core-popup-top-left\";\r\n case RelativePosition.TopRight:\r\n return \"core-popup-top-right\";\r\n case RelativePosition.BottomLeft:\r\n return \"core-popup-bottom-left\";\r\n case RelativePosition.BottomRight:\r\n return \"core-popup-bottom-right\";\r\n case RelativePosition.Top:\r\n return \"core-popup-top\";\r\n case RelativePosition.Left:\r\n return \"core-popup-left\";\r\n case RelativePosition.Right:\r\n return \"core-popup-right\";\r\n case RelativePosition.Bottom:\r\n return \"core-popup-bottom\";\r\n case RelativePosition.LeftTop:\r\n return \"core-popup-left-top\";\r\n case RelativePosition.RightTop:\r\n return \"core-popup-right-top\";\r\n }\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n private _getPopupDimensions(): { popupWidth: number, popupHeight: number } {\r\n let popupWidth = 0;\r\n let popupHeight = 0;\r\n // istanbul ignore else\r\n if (this._popup) {\r\n const activeWindow = this.getParentWindow();\r\n const style = activeWindow.getComputedStyle(this._popup);\r\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\r\n const borderRightWidth = parsePxString(style.borderRightWidth);\r\n const borderTopWidth = parsePxString(style.borderTopWidth);\r\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\r\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\r\n popupHeight = this._popup.clientHeight + borderTopWidth + borderBottomWidth;\r\n }\r\n\r\n return { popupWidth, popupHeight };\r\n }\r\n\r\n private _getPosition = (position: RelativePosition) => {\r\n const activeWindow = this.getParentWindow();\r\n const { target, offset, top, left } = this.props;\r\n const offsetArrow = (this.props.showArrow) ? 6 : 0;\r\n\r\n // absolute position\r\n if (this._isPositionAbsolute())\r\n return { x: left, y: top };\r\n\r\n // sanity check\r\n const point = { x: 0, y: 0 };\r\n if (!this._popup || !target)\r\n return point;\r\n\r\n // relative position\r\n const scrollY = activeWindow.scrollY;\r\n const scrollX = activeWindow.scrollX;\r\n\r\n const targetRect = target.getBoundingClientRect();\r\n\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n\r\n switch (position) {\r\n case RelativePosition.Top:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.TopLeft:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.TopRight:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Bottom:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.BottomLeft:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.BottomRight:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Left:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.LeftTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.Right:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n\r\n case RelativePosition.RightTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n }\r\n\r\n return point;\r\n };\r\n\r\n private _toggleRelativePosition(): RelativePosition {\r\n const { target, position, offset } = this.props;\r\n\r\n if (!this._popup || !target)\r\n return position;\r\n\r\n // istanbul ignore if\r\n if (this._isPositionAbsolute())\r\n return position;\r\n\r\n let newPosition = position;\r\n\r\n interface Rect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n }\r\n\r\n const activeWindow = this.getParentWindow();\r\n\r\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\r\n const viewportRect: Rect = { left: activeWindow.scrollX, top: activeWindow.scrollY, right: activeWindow.scrollX + activeWindow.innerWidth, bottom: activeWindow.scrollY + activeWindow.innerHeight };\r\n const targetRect = target.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const containerStyle = activeWindow.getComputedStyle(target);\r\n const offsetArrow = this.props.showArrow ? /* istanbul ignore next */ 10 : 2;\r\n\r\n const bottomMargin = parseMargin(containerStyle.marginBottom);\r\n if ((targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset) > viewportRect.bottom) {\r\n if (newPosition === RelativePosition.Bottom)\r\n newPosition = RelativePosition.Top;\r\n else if (newPosition === RelativePosition.BottomLeft)\r\n newPosition = RelativePosition.TopLeft;\r\n else if (newPosition === RelativePosition.BottomRight)\r\n newPosition = RelativePosition.TopRight;\r\n }\r\n\r\n const topMargin = parseMargin(containerStyle.marginTop);\r\n if ((targetRect.top - popupHeight - topMargin - offsetArrow - offset) < viewportRect.top) {\r\n if (newPosition === RelativePosition.Top)\r\n newPosition = RelativePosition.Bottom;\r\n else if (newPosition === RelativePosition.TopLeft)\r\n newPosition = RelativePosition.BottomLeft;\r\n else if (newPosition === RelativePosition.TopRight)\r\n newPosition = RelativePosition.BottomRight;\r\n }\r\n\r\n const leftMargin = parseMargin(containerStyle.marginLeft);\r\n if ((targetRect.left - popupWidth - leftMargin - offsetArrow - offset) < viewportRect.left) {\r\n if (newPosition === RelativePosition.Left)\r\n newPosition = RelativePosition.Right;\r\n else if (newPosition === RelativePosition.LeftTop)\r\n newPosition = RelativePosition.RightTop;\r\n }\r\n\r\n const rightMargin = parseMargin(containerStyle.marginRight);\r\n if ((targetRect.right + popupWidth + rightMargin + offsetArrow + offset) > viewportRect.right) {\r\n if (newPosition === RelativePosition.Right)\r\n newPosition = RelativePosition.Left;\r\n else if (newPosition === RelativePosition.RightTop)\r\n newPosition = RelativePosition.LeftTop;\r\n }\r\n\r\n return newPosition;\r\n }\r\n\r\n // fit the popup within the extents of the view port\r\n private _fitPopup = (point: PopupPoint) => {\r\n const fittedPoint = point;\r\n\r\n // istanbul ignore if\r\n if (!this._popup) {\r\n return fittedPoint;\r\n }\r\n\r\n // const popupRect = this._popup.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const { innerWidth, innerHeight } = window;\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y + popupHeight > innerHeight) {\r\n fittedPoint.y = innerHeight - popupHeight;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.x + popupWidth > innerWidth) {\r\n fittedPoint.x = innerWidth - popupWidth;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y < 0) {\r\n fittedPoint.y = 0;\r\n }\r\n\r\n if (fittedPoint.x < 0) {\r\n fittedPoint.x = 0;\r\n }\r\n\r\n return fittedPoint;\r\n };\r\n\r\n public override render() {\r\n const animate = this.props.animate !== undefined ? this.props.animate : true;\r\n const className = classnames(\r\n \"core-popup\",\r\n this._getClassNameByPosition(this.state.position),\r\n this.props.showShadow && \"core-popup-shadow\",\r\n this.props.showArrow && \"arrow\",\r\n !animate && \"core-popup-animation-none\",\r\n this.props.className,\r\n (!this.props.isOpen && this.props.keepContentsMounted) && \"core-popup-hidden\"\r\n );\r\n\r\n const style: React.CSSProperties = {\r\n top: this.state.top,\r\n left: this.state.left,\r\n ...this.props.style,\r\n };\r\n\r\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\r\n\r\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\r\n return null;\r\n }\r\n\r\n return ReactDOM.createPortal(\r\n (\r\n <div\r\n className={className} data-testid=\"core-popup\"\r\n ref={(element) => { this._popup = element; }}\r\n style={style}\r\n role={role}\r\n aria-modal={true}\r\n tabIndex={-1}\r\n aria-label={this.props.ariaLabel}\r\n >\r\n <FocusTrap active={!!this.props.moveFocus} initialFocusElement={this.props.focusTarget} returnFocusOnDeactivate={true}>\r\n {this.props.children}\r\n </FocusTrap>\r\n </div>\r\n ), this.state.parentDocument.body);\r\n }\r\n}\r\n\r\nfunction parsePxString(pxStr: string): number {\r\n const parsed = parseInt(pxStr, 10);\r\n return parsed || 0;\r\n}\r\n\r\nfunction parseMargin(value: string) {\r\n return value ? /* istanbul ignore next */ parseFloat(value) : 0;\r\n}\r\n"]}
1
+ {"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,cAAc,CAAC;AACtB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AA8EnD;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,KAAK,CAAC,SAAiC;IAGhE,YAAY,KAAiB;;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,WAAM,GAAuB,IAAI,CAAC;QAkFlC,sBAAiB,GAAG,GAAG,EAAE;YAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAA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AAC,mBAAmB;YAExC,oBAAC,SAAS,IAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,uBAAuB,EAAE,IAAI,IAClH,IAAI,CAAC,KAAK,CAAC,QAAQ,CACV,CACR,CACP,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;;AAtda,kBAAY,GAAwB;IAChD,QAAQ,EAAE,gBAAgB,CAAC,MAAM;IACjC,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC,CAAC;IACP,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAidJ,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,MAAM,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport \"./Popup.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n// cSpell:ignore focustrap focusable alertdialog\r\n\r\n/** @internal */\r\ninterface PopupPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\n/** Properties for the [[Popup]] component\r\n * @public\r\n */\r\nexport interface PopupProps extends CommonProps {\r\n /** Show or hide the box shadow (defaults to true) */\r\n showShadow: boolean;\r\n /** Show or hide the arrow (defaults to false) */\r\n showArrow: boolean;\r\n /** Indicates whether the popup is shown or not (defaults to false) */\r\n isOpen: boolean;\r\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\r\n position: RelativePosition;\r\n /** Top position (absolute positioning - defaults to 0) */\r\n top: number;\r\n /** Left position (absolute positioning - defaults to 0) */\r\n left: number;\r\n /** Function called when the popup is opened */\r\n onOpen?: () => void;\r\n /** Function called when user clicks outside the popup */\r\n onOutsideClick?: (e: MouseEvent) => void;\r\n /** Function called when the popup is closed */\r\n onClose?: () => void;\r\n /** Function called when the popup is closed on Enter */\r\n onEnter?: () => void;\r\n /** Function called when the wheel is used */\r\n onWheel?: (e: WheelEvent) => void;\r\n /** Function called when the right mouse button is pressed */\r\n onContextMenu?: (e: MouseEvent) => void;\r\n /** Offset from the parent (defaults to 4) */\r\n offset: number;\r\n /** Target element to position popup */\r\n target?: HTMLElement | null;\r\n /** Role - if not specified \"dialog\" is used */\r\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\r\n /** accessibility label */\r\n ariaLabel?: string;\r\n /** set focus to popup - default to not set focus */\r\n moveFocus?: boolean;\r\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\r\n focusTarget?: React.RefObject<HTMLElement> | string;\r\n /** Indicates whether the popup is pinned. */\r\n isPinned?: boolean;\r\n /** Indicates whether to use animation for open/close (defaults to true) */\r\n animate?: boolean;\r\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\r\n closeOnEnter?: boolean;\r\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\r\n closeOnWheel?: boolean;\r\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\r\n closeOnContextMenu?: boolean;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\r\n * children are unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface PopupState {\r\n isOpen: boolean;\r\n top: number;\r\n left: number;\r\n position: RelativePosition;\r\n parentDocument: Document;\r\n animationEnded: boolean;\r\n}\r\n\r\n/** Popup React component displays a popup relative to an optional target element.\r\n * @public\r\n */\r\nexport class Popup extends React.Component<PopupProps, PopupState> {\r\n private _popup: HTMLElement | null = null;\r\n\r\n constructor(props: PopupProps) {\r\n super(props);\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n\r\n this.state = {\r\n animationEnded: false,\r\n isOpen: this.props.isOpen,\r\n top: 0,\r\n left: 0,\r\n position: this.props.position,\r\n parentDocument,\r\n };\r\n }\r\n\r\n public static defaultProps: Partial<PopupProps> = {\r\n position: RelativePosition.Bottom,\r\n showShadow: true,\r\n showArrow: false,\r\n isOpen: false,\r\n offset: 4,\r\n top: -1,\r\n left: -1,\r\n };\r\n\r\n public override componentDidMount() {\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n }\r\n }\r\n\r\n private getParentWindow() {\r\n // istanbul ignore next\r\n return this.state.parentDocument.defaultView ?? window;\r\n }\r\n\r\n public override componentDidUpdate(previousProps: PopupProps, prevState: PopupState) {\r\n if (this.state.position !== prevState.position) {\r\n this.setState( { animationEnded: false });\r\n }\r\n\r\n if (this.props.target !== previousProps.target) {\r\n // istanbul ignore next\r\n {\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n if (parentDocument !== this.state.parentDocument) {\r\n this._unBindWindowEvents();\r\n this.setState({ parentDocument });\r\n }\r\n }\r\n }\r\n\r\n if (this.props.isOpen === previousProps.isOpen) {\r\n if (this.props.isOpen) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n if ((Math.abs(this.state.left - point.x) < 3) &&\r\n (Math.abs(this.state.top - point.y) < 3) &&\r\n this.state.position === position)\r\n return;\r\n\r\n this.setState({\r\n left: point.x,\r\n top: point.y,\r\n position,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n } else {\r\n this._onClose();\r\n }\r\n }\r\n\r\n public override componentWillUnmount() {\r\n this._unBindWindowEvents();\r\n }\r\n\r\n private _bindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.addEventListener(\"resize\", this._hide);\r\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.addEventListener(\"scroll\", this._hide);\r\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _unBindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.removeEventListener(\"resize\", this._hide);\r\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.removeEventListener(\"scroll\", this._hide);\r\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _handleWheel = (event: WheelEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onWheel)\r\n return this.props.onWheel(event);\r\n\r\n const closeOnWheel = this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\r\n if (closeOnWheel)\r\n this._hide();\r\n };\r\n\r\n private isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n private _handleOutsideClick = (event: MouseEvent): void => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(event.target as HTMLElement))\r\n return;\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(event);\r\n\r\n if (this.props.target && this.props.target.contains(event.target as Node))\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _handleContextMenu = (event: MouseEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onContextMenu)\r\n return this.props.onContextMenu(event);\r\n\r\n const closeOnContextMenu = this.props.closeOnContextMenu !== undefined ? this.props.closeOnContextMenu : true;\r\n if (closeOnContextMenu)\r\n this._hide();\r\n };\r\n\r\n private _handleKeyboard = (event: KeyboardEvent): void => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (event.key === SpecialKey.Escape || event.key === SpecialKey.Enter) {\r\n const closeOnEnter = this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\r\n if (event.key === SpecialKey.Enter) {\r\n if (closeOnEnter)\r\n this._onClose(true);\r\n else\r\n this.props.onEnter && this.props.onEnter();\r\n } else {\r\n this._onClose(false);\r\n }\r\n }\r\n };\r\n\r\n private _hide = () => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _onShow() {\r\n this._bindWindowEvents();\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n\r\n this.setState({ left: point.x, top: point.y, isOpen: true, position }, () => {\r\n if (this.props.onOpen)\r\n this.props.onOpen();\r\n });\r\n }\r\n\r\n private _onClose(enterKey?: boolean) {\r\n if (!this.state.isOpen)\r\n return;\r\n\r\n this._unBindWindowEvents();\r\n\r\n this.setState({ isOpen: false }, () => {\r\n if (enterKey && this.props.onEnter)\r\n this.props.onEnter();\r\n if (this.props.onClose)\r\n this.props.onClose();\r\n });\r\n }\r\n\r\n private _isPositionAbsolute(): boolean {\r\n return (this.props.top !== -1 && this.props.left !== -1);\r\n }\r\n\r\n private _getClassNameByPosition(position: RelativePosition): string {\r\n if (!this._isPositionAbsolute()) {\r\n switch (position) {\r\n case RelativePosition.TopLeft:\r\n return \"core-popup-top-left\";\r\n case RelativePosition.TopRight:\r\n return \"core-popup-top-right\";\r\n case RelativePosition.BottomLeft:\r\n return \"core-popup-bottom-left\";\r\n case RelativePosition.BottomRight:\r\n return \"core-popup-bottom-right\";\r\n case RelativePosition.Top:\r\n return \"core-popup-top\";\r\n case RelativePosition.Left:\r\n return \"core-popup-left\";\r\n case RelativePosition.Right:\r\n return \"core-popup-right\";\r\n case RelativePosition.Bottom:\r\n return \"core-popup-bottom\";\r\n case RelativePosition.LeftTop:\r\n return \"core-popup-left-top\";\r\n case RelativePosition.RightTop:\r\n return \"core-popup-right-top\";\r\n }\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n private _getPopupDimensions(): { popupWidth: number, popupHeight: number } {\r\n let popupWidth = 0;\r\n let popupHeight = 0;\r\n // istanbul ignore else\r\n if (this._popup) {\r\n const activeWindow = this.getParentWindow();\r\n const style = activeWindow.getComputedStyle(this._popup);\r\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\r\n const borderRightWidth = parsePxString(style.borderRightWidth);\r\n const borderTopWidth = parsePxString(style.borderTopWidth);\r\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\r\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\r\n popupHeight = this._popup.clientHeight + borderTopWidth + borderBottomWidth;\r\n }\r\n\r\n return { popupWidth, popupHeight };\r\n }\r\n\r\n private _getPosition = (position: RelativePosition) => {\r\n const activeWindow = this.getParentWindow();\r\n const { target, offset, top, left } = this.props;\r\n const offsetArrow = (this.props.showArrow) ? 6 : 0;\r\n\r\n // absolute position\r\n if (this._isPositionAbsolute())\r\n return { x: left, y: top };\r\n\r\n // sanity check\r\n const point = { x: 0, y: 0 };\r\n if (!this._popup || !target)\r\n return point;\r\n\r\n // relative position\r\n const scrollY = activeWindow.scrollY;\r\n const scrollX = activeWindow.scrollX;\r\n\r\n const targetRect = target.getBoundingClientRect();\r\n\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n\r\n switch (position) {\r\n case RelativePosition.Top:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.TopLeft:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.TopRight:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Bottom:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.BottomLeft:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.BottomRight:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Left:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.LeftTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.Right:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n\r\n case RelativePosition.RightTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n }\r\n\r\n return point;\r\n };\r\n\r\n private _toggleRelativePosition(): RelativePosition {\r\n const { target, position, offset } = this.props;\r\n\r\n if (!this._popup || !target)\r\n return position;\r\n\r\n // istanbul ignore if\r\n if (this._isPositionAbsolute())\r\n return position;\r\n\r\n let newPosition = position;\r\n\r\n interface Rect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n }\r\n\r\n const activeWindow = this.getParentWindow();\r\n\r\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\r\n const viewportRect: Rect = { left: activeWindow.scrollX, top: activeWindow.scrollY, right: activeWindow.scrollX + activeWindow.innerWidth, bottom: activeWindow.scrollY + activeWindow.innerHeight };\r\n const targetRect = target.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const containerStyle = activeWindow.getComputedStyle(target);\r\n const offsetArrow = this.props.showArrow ? /* istanbul ignore next */ 10 : 2;\r\n\r\n const bottomMargin = parseMargin(containerStyle.marginBottom);\r\n if ((targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset) > viewportRect.bottom) {\r\n if (newPosition === RelativePosition.Bottom)\r\n newPosition = RelativePosition.Top;\r\n else if (newPosition === RelativePosition.BottomLeft)\r\n newPosition = RelativePosition.TopLeft;\r\n else if (newPosition === RelativePosition.BottomRight)\r\n newPosition = RelativePosition.TopRight;\r\n }\r\n\r\n const topMargin = parseMargin(containerStyle.marginTop);\r\n if ((targetRect.top - popupHeight - topMargin - offsetArrow - offset) < viewportRect.top) {\r\n if (newPosition === RelativePosition.Top)\r\n newPosition = RelativePosition.Bottom;\r\n else if (newPosition === RelativePosition.TopLeft)\r\n newPosition = RelativePosition.BottomLeft;\r\n else if (newPosition === RelativePosition.TopRight)\r\n newPosition = RelativePosition.BottomRight;\r\n }\r\n\r\n const leftMargin = parseMargin(containerStyle.marginLeft);\r\n if ((targetRect.left - popupWidth - leftMargin - offsetArrow - offset) < viewportRect.left) {\r\n if (newPosition === RelativePosition.Left)\r\n newPosition = RelativePosition.Right;\r\n else if (newPosition === RelativePosition.LeftTop)\r\n newPosition = RelativePosition.RightTop;\r\n }\r\n\r\n const rightMargin = parseMargin(containerStyle.marginRight);\r\n if ((targetRect.right + popupWidth + rightMargin + offsetArrow + offset) > viewportRect.right) {\r\n if (newPosition === RelativePosition.Right)\r\n newPosition = RelativePosition.Left;\r\n else if (newPosition === RelativePosition.RightTop)\r\n newPosition = RelativePosition.LeftTop;\r\n }\r\n\r\n return newPosition;\r\n }\r\n\r\n // fit the popup within the extents of the view port\r\n private _fitPopup = (point: PopupPoint) => {\r\n const fittedPoint = point;\r\n\r\n // istanbul ignore if\r\n if (!this._popup) {\r\n return fittedPoint;\r\n }\r\n\r\n // const popupRect = this._popup.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const { innerWidth, innerHeight } = window;\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y + popupHeight > innerHeight) {\r\n fittedPoint.y = innerHeight - popupHeight;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.x + popupWidth > innerWidth) {\r\n fittedPoint.x = innerWidth - popupWidth;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y < 0) {\r\n fittedPoint.y = 0;\r\n }\r\n\r\n if (fittedPoint.x < 0) {\r\n fittedPoint.x = 0;\r\n }\r\n\r\n return fittedPoint;\r\n };\r\n\r\n private _handleAnimationEnd = (event: React.AnimationEvent<HTMLDivElement>) => {\r\n if (event.target === this._popup) {\r\n this.setState({ animationEnded: true });\r\n }\r\n };\r\n\r\n public override render() {\r\n const animate = this.props.animate !== undefined ? this.props.animate : true;\r\n const className = classnames(\r\n \"core-popup\",\r\n this._getClassNameByPosition(this.state.position),\r\n this.props.showShadow && \"core-popup-shadow\",\r\n this.props.showArrow && \"arrow\",\r\n !animate && \"core-popup-animation-none\",\r\n this.props.className,\r\n this.state.animationEnded && \"core-animation-ended\",\r\n (!this.props.isOpen && this.props.keepContentsMounted) && \"core-popup-hidden\"\r\n );\r\n\r\n const style: React.CSSProperties = {\r\n top: this.state.top,\r\n left: this.state.left,\r\n ...this.props.style,\r\n };\r\n\r\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\r\n\r\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\r\n return null;\r\n }\r\n\r\n return ReactDOM.createPortal(\r\n (\r\n <div\r\n className={className} data-testid=\"core-popup\"\r\n ref={(element) => { this._popup = element; }}\r\n style={style}\r\n role={role}\r\n aria-modal={true}\r\n tabIndex={-1}\r\n aria-label={this.props.ariaLabel}\r\n onAnimationEnd={this._handleAnimationEnd}\r\n >\r\n <FocusTrap active={!!this.props.moveFocus} initialFocusElement={this.props.focusTarget} returnFocusOnDeactivate={true}>\r\n {this.props.children}\r\n </FocusTrap>\r\n </div>\r\n ), this.state.parentDocument.body);\r\n }\r\n}\r\n\r\nfunction parsePxString(pxStr: string): number {\r\n const parsed = parseInt(pxStr, 10);\r\n return parsed || 0;\r\n}\r\n\r\nfunction parseMargin(value: string) {\r\n return value ? /* istanbul ignore next */ parseFloat(value) : 0;\r\n}\r\n"]}
@@ -4,6 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  @import "../inputs/variables";
6
6
  @import "../z-index";
7
+ @import "~@itwin/itwinui-css/scss/style/elevation";
7
8
 
8
9
  .core-popup {
9
10
  top: 0;
@@ -29,6 +30,10 @@
29
30
  &.core-popup-hidden {
30
31
  display: none;
31
32
  }
33
+
34
+ &.core-animation-ended {
35
+ animation-name: none;
36
+ }
32
37
  }
33
38
 
34
39
  .core-popup.arrow::after, .core-popup.arrow::before {
@@ -146,8 +151,8 @@
146
151
  }
147
152
 
148
153
  .core-popup-shadow {
149
- -webkit-box-shadow: 0 3px 6px $buic-popup-boxshadow;
150
- box-shadow: 0px 3px 6px $buic-popup-boxshadow;
154
+ -webkit-box-shadow: $iui-elevation-16;
155
+ box-shadow: $iui-elevation-16;
151
156
  background-clip: padding-box;
152
157
  }
153
158
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-react",
3
- "version": "3.0.0-dev.154",
3
+ "version": "3.0.0-dev.159",
4
4
  "description": "iTwin.js UI core components",
5
5
  "main": "lib/cjs/core-react.js",
6
6
  "module": "lib/esm/core-react.js",
@@ -23,8 +23,8 @@
23
23
  "url": "http://www.bentley.com"
24
24
  },
25
25
  "peerDependencies": {
26
- "@itwin/appui-abstract": "^3.0.0-dev.154",
27
- "@itwin/core-bentley": "^3.0.0-dev.154",
26
+ "@itwin/appui-abstract": "^3.0.0-dev.159",
27
+ "@itwin/core-bentley": "^3.0.0-dev.159",
28
28
  "react": "^17.0.0",
29
29
  "react-dom": "^17.0.0"
30
30
  },
@@ -33,12 +33,12 @@
33
33
  "NOTE: All tools used by scripts in this package must be listed as devDependencies"
34
34
  ],
35
35
  "devDependencies": {
36
- "@itwin/appui-abstract": "3.0.0-dev.154",
37
- "@itwin/build-tools": "3.0.0-dev.154",
38
- "@itwin/core-bentley": "3.0.0-dev.154",
39
- "@itwin/core-common": "3.0.0-dev.154",
40
- "@itwin/core-i18n": "3.0.0-dev.154",
41
- "@itwin/eslint-plugin": "3.0.0-dev.154",
36
+ "@itwin/appui-abstract": "3.0.0-dev.159",
37
+ "@itwin/build-tools": "3.0.0-dev.159",
38
+ "@itwin/core-bentley": "3.0.0-dev.159",
39
+ "@itwin/core-common": "3.0.0-dev.159",
40
+ "@itwin/core-i18n": "3.0.0-dev.159",
41
+ "@itwin/eslint-plugin": "3.0.0-dev.159",
42
42
  "@testing-library/react": "^12.0.0",
43
43
  "@testing-library/react-hooks": "^7.0.2",
44
44
  "@testing-library/user-event": "^13.2.1",
@@ -51,7 +51,7 @@
51
51
  "@types/lodash": "^4.14.0",
52
52
  "@types/mocha": "^8.2.2",
53
53
  "@types/node": "14.14.31",
54
- "@types/react": "17.0.31",
54
+ "@types/react": "^17.0.37",
55
55
  "@types/react-autosuggest": "10.1.2",
56
56
  "@types/react-dom": "^17.0.0",
57
57
  "@types/react-select": "3.0.26",