@itwin/core-react 5.19.0 → 5.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/lib/core-react/UiCore.js +2 -1
  3. package/lib/core-react/UiCore.js.map +1 -1
  4. package/lib/core-react/autosuggest/AutoSuggest.js +86 -86
  5. package/lib/core-react/autosuggest/AutoSuggest.js.map +1 -1
  6. package/lib/core-react/contextmenu/ContextMenu.js +272 -269
  7. package/lib/core-react/contextmenu/ContextMenu.js.map +1 -1
  8. package/lib/core-react/contextmenu/ContextMenuItem.js +57 -55
  9. package/lib/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  10. package/lib/core-react/contextmenu/ContextSubMenu.js +70 -67
  11. package/lib/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  12. package/lib/core-react/contextmenu/GlobalContextMenu.js +23 -22
  13. package/lib/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  14. package/lib/core-react/contextmenu/TildeFinder.js +52 -52
  15. package/lib/core-react/contextmenu/TildeFinder.js.map +1 -1
  16. package/lib/core-react/dialog/Dialog.js +29 -29
  17. package/lib/core-react/dialog/Dialog.js.map +1 -1
  18. package/lib/core-react/dialog/GlobalDialog.js +24 -23
  19. package/lib/core-react/dialog/GlobalDialog.js.map +1 -1
  20. package/lib/core-react/expandable/ExpandableList.js +15 -15
  21. package/lib/core-react/expandable/ExpandableList.js.map +1 -1
  22. package/lib/core-react/focus/ItemKeyboardNavigator.js +7 -3
  23. package/lib/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  24. package/lib/core-react/hocs/withIsPressed.js +14 -17
  25. package/lib/core-react/hocs/withIsPressed.js.map +1 -1
  26. package/lib/core-react/hocs/withOnOutsideClick.js +38 -41
  27. package/lib/core-react/hocs/withOnOutsideClick.js.map +1 -1
  28. package/lib/core-react/hocs/withTimeout.js +2 -5
  29. package/lib/core-react/hocs/withTimeout.js.map +1 -1
  30. package/lib/core-react/icons/ConditionalIconItem.js +3 -0
  31. package/lib/core-react/icons/ConditionalIconItem.js.map +1 -1
  32. package/lib/core-react/imagecheckbox/ImageCheckBox.js +15 -18
  33. package/lib/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  34. package/lib/core-react/loading/LoadingBar.js +3 -3
  35. package/lib/core-react/loading/LoadingBar.js.map +1 -1
  36. package/lib/core-react/loading/LoadingPrompt.js +9 -9
  37. package/lib/core-react/loading/LoadingPrompt.js.map +1 -1
  38. package/lib/core-react/loading/LoadingSpinner.js +3 -3
  39. package/lib/core-react/loading/LoadingSpinner.js.map +1 -1
  40. package/lib/core-react/loading/LoadingStatus.js +4 -4
  41. package/lib/core-react/loading/LoadingStatus.js.map +1 -1
  42. package/lib/core-react/messagebox/MessageBox.js +6 -6
  43. package/lib/core-react/messagebox/MessageBox.js.map +1 -1
  44. package/lib/core-react/popup/Popup.js +209 -209
  45. package/lib/core-react/popup/Popup.js.map +1 -1
  46. package/lib/core-react/radialmenu/Annulus.js +19 -2
  47. package/lib/core-react/radialmenu/Annulus.js.map +1 -1
  48. package/lib/core-react/radialmenu/RadialMenu.js +56 -56
  49. package/lib/core-react/radialmenu/RadialMenu.js.map +1 -1
  50. package/lib/core-react/searchbox/SearchBox.js +60 -60
  51. package/lib/core-react/searchbox/SearchBox.js.map +1 -1
  52. package/lib/core-react/settings/SettingsManager.js +20 -22
  53. package/lib/core-react/settings/SettingsManager.js.map +1 -1
  54. package/lib/core-react/tabs/Tabs.js +14 -13
  55. package/lib/core-react/tabs/Tabs.js.map +1 -1
  56. package/lib/core-react/tree/Node.js +18 -18
  57. package/lib/core-react/tree/Node.js.map +1 -1
  58. package/lib/core-react/tree/Tree.js +1 -4
  59. package/lib/core-react/tree/Tree.js.map +1 -1
  60. package/lib/core-react/uistate/LocalStateStorage.js +1 -0
  61. package/lib/core-react/uistate/LocalStateStorage.js.map +1 -1
  62. package/lib/core-react/uistate/UiStateEntry.js +5 -0
  63. package/lib/core-react/uistate/UiStateEntry.js.map +1 -1
  64. package/lib/core-react/utils/Point.js +2 -0
  65. package/lib/core-react/utils/Point.js.map +1 -1
  66. package/lib/core-react/utils/Rectangle.js +4 -0
  67. package/lib/core-react/utils/Rectangle.js.map +1 -1
  68. package/lib/core-react/utils/ScrollPositionMaintainer.js +1 -0
  69. package/lib/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  70. package/lib/core-react/utils/Timer.js +5 -2
  71. package/lib/core-react/utils/Timer.js.map +1 -1
  72. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;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,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQrD,gBAAgB;AAChB,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAC7C,SAAS,CACV,CAAC;AAqFF;;;;GAIG;AACH,4DAA4D;AAC5D,MAAM,OAAO,KAAM,SAAQ,KAAK,CAAC,SAAiC;IAOhE,4DAA4D;IAC5D,YAAY,KAAiB;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;QARP,WAAM,GAAuB,IAAI,CAAC;QA4FlC,sBAAiB,GAAG,GAAG,EAAE;YAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;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B,mBAAmB,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAC3C,uBAAuB,EAAE,IAAI,IAE5B,IAAI,CAAC,KAAK,CAAC,QAAQ,CACV,CACE,CACZ,EACN,IAAI,CAAC,YAAY,EAAE,CACpB,CAAC;IACJ,CAAC;IAEO,YAAY;QAClB,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,YAAY;YACvB,IAAI,CAAC,OAAO;YACZ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAC1C,uCAAuC,CACxC;YACD,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAC/B,CAAC;IACJ,CAAC;;AAljBD,gBAAgB;AACO,iBAAW,GAAG,YAAY,AAAf,CAAgB;AAmBlD,4DAA4D;AAC9C,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,AARyB,CAQxB;AAwhBJ,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,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Popup\n */\n\nimport \"./Popup.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { FocusTrap } from \"../focustrap/FocusTrap.js\";\nimport type { CommonProps } from \"../utils/Props.js\";\nimport { Rectangle } from \"../utils/Rectangle.js\";\nimport { ThemeProvider } from \"@itwin/itwinui-react\";\n\n/** @internal */\ninterface PopupPoint {\n x: number;\n y: number;\n}\n\n/** @internal */\nexport const PopupContext = React.createContext<HTMLElement | undefined>(\n undefined\n);\n\n/** Properties for the [[Popup]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link Popup} component.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface PopupProps extends CommonProps {\n /** Show or hide the box shadow (defaults to true) */\n showShadow: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow: boolean;\n /** Indicates whether the popup is shown or not (defaults to false) */\n isOpen: boolean;\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\n position: RelativePosition;\n /** Top position (absolute positioning - defaults to 0) */\n top: number;\n /** Left position (absolute positioning - defaults to 0) */\n left: number;\n /** Function called when the popup is opened */\n onOpen?: () => void;\n /** Function called when user clicks outside the popup */\n onOutsideClick?: (e: MouseEvent) => void;\n /** Function called when the popup is closed */\n onClose?: () => void;\n /** Function called when the popup is closed on Enter */\n onEnter?: () => void;\n /** Function called when the wheel is used */\n onWheel?: (e: WheelEvent) => void;\n /** Function called when the right mouse button is pressed */\n onContextMenu?: (e: MouseEvent) => void;\n /** Offset from the parent (defaults to 4) */\n offset: number;\n /** Target element to position popup */\n target?: HTMLElement | null;\n /** Role - if not specified \"dialog\" is used */\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\n /** accessibility label */\n ariaLabel?: string;\n /** set focus to popup - default to not set focus */\n moveFocus?: boolean;\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. */\n focusTarget?: React.RefObject<HTMLElement | null> | string;\n /** Indicates whether the popup is pinned. */\n isPinned?: boolean;\n /** Indicates whether to use animation for open/close (defaults to true) */\n animate?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\n closeOnWheel?: boolean;\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\n closeOnContextMenu?: boolean;\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\n closeOnNestedPopupOutsideClick?: boolean;\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\n * children are unmounted each time the popup is closed. */\n keepContentsMounted?: boolean;\n\n /**\n * If true the popup will remain open and will be repositioned when window resize events occur, default to false.\n * @beta\n * */\n repositionOnResize?: boolean;\n\n /** Content */\n children?: React.ReactNode;\n\n /** Target that should be used when portaling popup.\n * @note This is needed in rare cases when {@link Popup} is nested inside the {@link https://itwinui.bentley.com/docs/popover iTwinUI Popover}.\n */\n portalTarget?: HTMLElement;\n}\n\ninterface PopupState {\n isOpen: boolean;\n top: number;\n left: number;\n position: RelativePosition;\n parentDocument: Document;\n animationEnded: boolean;\n portalContainer?: HTMLElement;\n}\n\n/** Popup React component displays a popup relative to an optional target element.\n * @note Avoid nesting {@link Popup} and {@link https://itwinui.bentley.com/docs/popover iTwinUI Popover} components.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/popover iTwinUI Popover} instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class Popup extends React.Component<PopupProps, PopupState> {\n private _popup: HTMLElement | null = null;\n /** @internal */\n public static override contextType = PopupContext;\n /** @internal */\n public declare context: React.ContextType<typeof PopupContext>;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n constructor(props: PopupProps) {\n super(props);\n const parentDocument = this.props.target?.ownerDocument ?? document;\n\n this.state = {\n animationEnded: false,\n isOpen: this.props.isOpen,\n top: 0,\n left: 0,\n position: this.props.position,\n parentDocument,\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static defaultProps: Partial<PopupProps> = {\n position: RelativePosition.Bottom,\n showShadow: true,\n showArrow: false,\n isOpen: false,\n offset: 4,\n top: -1,\n left: -1,\n };\n\n public override componentDidMount() {\n if (this.props.isOpen) {\n this._onShow();\n }\n }\n\n private getParentWindow() {\n return this.state.parentDocument.defaultView ?? window;\n }\n\n /** @internal */\n public override componentDidUpdate(\n previousProps: PopupProps, // eslint-disable-line @typescript-eslint/no-deprecated\n prevState: PopupState\n ) {\n if (this.state.position !== prevState.position) {\n this.setState({ animationEnded: false });\n }\n\n if (this.props.target !== previousProps.target) {\n {\n const parentDocument = this.props.target?.ownerDocument ?? document;\n if (parentDocument !== this.state.parentDocument) {\n this._unBindWindowEvents();\n this.setState({ parentDocument });\n }\n }\n }\n\n if (this.props.isOpen === previousProps.isOpen) {\n if (this.props.isOpen) {\n const position = this._toggleRelativePosition();\n const point = this._fitPopup(this._getPosition(position));\n if (\n Math.abs(this.state.left - point.x) < 3 &&\n Math.abs(this.state.top - point.y) < 3 &&\n this.state.position === position\n )\n return;\n\n this.setState({\n left: point.x,\n top: point.y,\n position,\n });\n }\n return;\n }\n\n if (this.props.isOpen) {\n this._onShow();\n } else {\n this._onClose();\n }\n }\n\n public override componentWillUnmount() {\n this._unBindWindowEvents();\n }\n\n private _bindWindowEvents = () => {\n const activeWindow = this.getParentWindow();\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\n activeWindow.addEventListener(\"resize\", this._resize);\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\n activeWindow.addEventListener(\"scroll\", this._hide);\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\n };\n\n private _unBindWindowEvents = () => {\n const activeWindow = this.getParentWindow();\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\n activeWindow.removeEventListener(\"resize\", this._resize);\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\n activeWindow.removeEventListener(\"scroll\", this._hide);\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\n };\n\n private _handleWheel = (event: WheelEvent) => {\n if (this._popup && this._popup.contains(event.target as Node)) return;\n\n if (this.props.onWheel) return this.props.onWheel(event);\n\n const closeOnWheel =\n this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\n if (closeOnWheel) this._hide();\n };\n\n private isInCorePopup(element: HTMLElement): boolean {\n if (element.nodeName === \"DIV\") {\n if (element.classList && element.classList.contains(\"core-popup\"))\n return true;\n if (element.parentElement && this.isInCorePopup(element.parentElement))\n return true;\n } else {\n if (element.parentElement && this.isInCorePopup(element.parentElement))\n return true;\n }\n return false;\n }\n\n private _handleOutsideClick = (event: MouseEvent): void => {\n if (this._popup && this._popup.contains(event.target as Node)) return;\n\n if (this.props.isPinned) return;\n\n if (\n !this.props.closeOnNestedPopupOutsideClick &&\n this.isInCorePopup(event.target as HTMLElement)\n )\n return;\n\n if (this.props.onOutsideClick) return this.props.onOutsideClick(event);\n\n if (this.props.target && this.props.target.contains(event.target as Node))\n return;\n\n this._onClose();\n };\n\n private _handleContextMenu = (event: MouseEvent) => {\n if (this._popup && this._popup.contains(event.target as Node)) return;\n\n if (this.props.onContextMenu) return this.props.onContextMenu(event);\n\n const closeOnContextMenu =\n this.props.closeOnContextMenu !== undefined\n ? this.props.closeOnContextMenu\n : true;\n if (closeOnContextMenu) this._hide();\n };\n\n private _handleKeyboard = (event: KeyboardEvent): void => {\n if (this.props.isPinned) return;\n\n if (\n event.key === Key.Escape.valueOf() ||\n event.key === Key.Enter.valueOf()\n ) {\n const closeOnEnter =\n this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\n if (event.key === Key.Enter.valueOf()) {\n if (closeOnEnter) this._onClose(true);\n else this.props.onEnter && this.props.onEnter();\n } else {\n this._onClose(false);\n }\n }\n };\n\n private _resize = () => {\n if (this.props.repositionOnResize) {\n const position = this._toggleRelativePosition();\n const point = this._fitPopup(this._getPosition(position));\n this.setState({ left: point.x, top: point.y, position });\n } else {\n this._hide(); // legacy behavior\n }\n };\n\n private _hide = () => {\n if (this.props.isPinned) return;\n\n this._onClose();\n };\n\n private _onShow() {\n this._bindWindowEvents();\n const position = this._toggleRelativePosition();\n const point = this._fitPopup(this._getPosition(position));\n\n this.setState(\n { left: point.x, top: point.y, isOpen: true, position },\n () => {\n if (this.props.onOpen) this.props.onOpen();\n }\n );\n }\n\n private _onClose(enterKey?: boolean) {\n if (!this.state.isOpen) return;\n\n this._unBindWindowEvents();\n\n this.setState({ isOpen: false }, () => {\n if (enterKey && this.props.onEnter) this.props.onEnter();\n if (this.props.onClose) this.props.onClose();\n });\n }\n\n private _isPositionAbsolute(): boolean {\n return this.props.top !== -1 && this.props.left !== -1;\n }\n\n private _getClassNameByPosition(position: RelativePosition): string {\n if (!this._isPositionAbsolute()) {\n switch (position) {\n case RelativePosition.TopLeft:\n return \"core-popup-top-left\";\n case RelativePosition.TopRight:\n return \"core-popup-top-right\";\n case RelativePosition.BottomLeft:\n return \"core-popup-bottom-left\";\n case RelativePosition.BottomRight:\n return \"core-popup-bottom-right\";\n case RelativePosition.Top:\n return \"core-popup-top\";\n case RelativePosition.Left:\n return \"core-popup-left\";\n case RelativePosition.Right:\n return \"core-popup-right\";\n case RelativePosition.Bottom:\n return \"core-popup-bottom\";\n case RelativePosition.LeftTop:\n return \"core-popup-left-top\";\n case RelativePosition.RightTop:\n return \"core-popup-right-top\";\n }\n }\n\n return \"\";\n }\n\n private _getPopupDimensions(): { popupWidth: number; popupHeight: number } {\n let popupWidth = 0;\n let popupHeight = 0;\n if (this._popup) {\n const activeWindow = this.getParentWindow();\n const style = activeWindow.getComputedStyle(this._popup);\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\n const borderRightWidth = parsePxString(style.borderRightWidth);\n const borderTopWidth = parsePxString(style.borderTopWidth);\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\n popupHeight =\n this._popup.clientHeight + borderTopWidth + borderBottomWidth;\n }\n\n return { popupWidth, popupHeight };\n }\n\n private _getPosition = (position: RelativePosition) => {\n const activeWindow = this.getParentWindow();\n const { target, offset, top, left } = this.props;\n const offsetArrow = this.props.showArrow ? 6 : 0;\n\n // absolute position\n if (this._isPositionAbsolute()) return { x: left, y: top };\n\n // sanity check\n const point = { x: 0, y: 0 };\n if (!this._popup || !target) return point;\n\n // relative position\n const scrollY = activeWindow.scrollY;\n const scrollX = activeWindow.scrollX;\n\n const container = this.getContainer();\n const containerBounds = container.getBoundingClientRect();\n const targetRect = Rectangle.create(target.getBoundingClientRect()).offset({\n x: -containerBounds.left,\n y: -containerBounds.top,\n });\n\n const { popupWidth, popupHeight } = this._getPopupDimensions();\n\n switch (position) {\n case RelativePosition.Top:\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\n point.x =\n scrollX +\n targetRect.left +\n targetRect.getWidth() / 2 -\n popupWidth / 2;\n break;\n\n case RelativePosition.TopLeft:\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\n point.x = scrollX + targetRect.left;\n break;\n\n case RelativePosition.TopRight:\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\n point.x = scrollX + targetRect.right - popupWidth;\n break;\n\n case RelativePosition.Bottom:\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\n point.x =\n scrollX +\n targetRect.left +\n targetRect.getWidth() / 2 -\n popupWidth / 2;\n break;\n\n case RelativePosition.BottomLeft:\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\n point.x = scrollX + targetRect.left;\n break;\n\n case RelativePosition.BottomRight:\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\n point.x = scrollX + targetRect.right - popupWidth;\n break;\n\n case RelativePosition.Left:\n point.y =\n scrollY +\n targetRect.top +\n targetRect.getHeight() / 2 -\n popupHeight / 2;\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\n break;\n\n case RelativePosition.LeftTop:\n point.y = scrollY + targetRect.top;\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\n break;\n\n case RelativePosition.Right:\n point.y =\n scrollY +\n targetRect.top +\n targetRect.getHeight() / 2 -\n popupHeight / 2;\n point.x = scrollX + targetRect.right + offset + offsetArrow;\n break;\n\n case RelativePosition.RightTop:\n point.y = scrollY + targetRect.top;\n point.x = scrollX + targetRect.right + offset + offsetArrow;\n break;\n }\n\n return point;\n };\n\n private _toggleRelativePosition(): RelativePosition {\n const { target, position, offset } = this.props;\n\n if (!this._popup || !target) return position;\n\n if (this._isPositionAbsolute()) return position;\n\n let newPosition = position;\n\n interface Rect {\n left: number;\n top: number;\n right: number;\n bottom: number;\n }\n\n const activeWindow = this.getParentWindow();\n\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\n const viewportRect: Rect = {\n left: activeWindow.scrollX,\n top: activeWindow.scrollY,\n right: activeWindow.scrollX + activeWindow.innerWidth,\n bottom: activeWindow.scrollY + activeWindow.innerHeight,\n };\n const targetRect = target.getBoundingClientRect();\n const { popupWidth, popupHeight } = this._getPopupDimensions();\n const containerStyle = activeWindow.getComputedStyle(target);\n const offsetArrow = this.props.showArrow ? 10 : 2;\n\n const bottomMargin = parseMargin(containerStyle.marginBottom);\n if (\n targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset >\n viewportRect.bottom\n ) {\n if (newPosition === RelativePosition.Bottom)\n newPosition = RelativePosition.Top;\n else if (newPosition === RelativePosition.BottomLeft)\n newPosition = RelativePosition.TopLeft;\n else if (newPosition === RelativePosition.BottomRight)\n newPosition = RelativePosition.TopRight;\n }\n\n const topMargin = parseMargin(containerStyle.marginTop);\n if (\n targetRect.top - popupHeight - topMargin - offsetArrow - offset <\n viewportRect.top\n ) {\n if (newPosition === RelativePosition.Top)\n newPosition = RelativePosition.Bottom;\n else if (newPosition === RelativePosition.TopLeft)\n newPosition = RelativePosition.BottomLeft;\n else if (newPosition === RelativePosition.TopRight)\n newPosition = RelativePosition.BottomRight;\n }\n\n const leftMargin = parseMargin(containerStyle.marginLeft);\n if (\n targetRect.left - popupWidth - leftMargin - offsetArrow - offset <\n viewportRect.left\n ) {\n if (newPosition === RelativePosition.Left)\n newPosition = RelativePosition.Right;\n else if (newPosition === RelativePosition.LeftTop)\n newPosition = RelativePosition.RightTop;\n }\n\n const rightMargin = parseMargin(containerStyle.marginRight);\n if (\n targetRect.right + popupWidth + rightMargin + offsetArrow + offset >\n viewportRect.right\n ) {\n if (newPosition === RelativePosition.Right)\n newPosition = RelativePosition.Left;\n else if (newPosition === RelativePosition.RightTop)\n newPosition = RelativePosition.LeftTop;\n }\n\n return newPosition;\n }\n\n // fit the popup within the extents of the view port\n private _fitPopup = (point: PopupPoint) => {\n const fittedPoint = point;\n\n if (!this._popup) {\n return fittedPoint;\n }\n\n const { popupWidth, popupHeight } = this._getPopupDimensions();\n const container = this.getContainer();\n const containerBounds = container.getBoundingClientRect();\n\n if (fittedPoint.y + popupHeight > containerBounds.height) {\n fittedPoint.y = containerBounds.height - popupHeight;\n }\n\n if (fittedPoint.x + popupWidth > containerBounds.width) {\n fittedPoint.x = containerBounds.width - popupWidth;\n }\n\n if (fittedPoint.y < 0) {\n fittedPoint.y = 0;\n }\n\n if (fittedPoint.x < 0) {\n fittedPoint.x = 0;\n }\n\n return fittedPoint;\n };\n\n private _handleAnimationEnd = (\n event: React.AnimationEvent<HTMLDivElement>\n ) => {\n if (event.target === this._popup) {\n this.setState({ animationEnded: true });\n }\n };\n\n private _handleThemeProviderRef = (el: HTMLDivElement | null) => {\n this.setState({ portalContainer: el ?? undefined });\n };\n\n public override render() {\n const animate =\n this.props.animate !== undefined ? this.props.animate : true;\n const className = classnames(\n \"core-popup\",\n this._getClassNameByPosition(this.state.position),\n this.props.showShadow && \"core-popup-shadow\",\n this.props.showArrow && \"arrow\",\n !animate && \"core-popup-animation-none\",\n this.props.className,\n this.state.animationEnded && \"core-animation-ended\",\n !this.props.isOpen &&\n this.props.keepContentsMounted &&\n \"core-popup-hidden\"\n );\n\n const style: React.CSSProperties = {\n top: this.state.top,\n left: this.state.left,\n ...this.props.style,\n };\n\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\n\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\n return null;\n }\n\n return ReactDOM.createPortal(\n <div\n className={className}\n data-testid=\"core-popup\"\n ref={(element) => {\n this._popup = element;\n }}\n style={style}\n role={role}\n aria-modal={true}\n tabIndex={-1}\n aria-label={this.props.ariaLabel}\n onAnimationEnd={this._handleAnimationEnd}\n >\n <ThemeProvider\n ref={this._handleThemeProviderRef}\n portalContainer={this.state.portalContainer}\n >\n <FocusTrap\n active={!!this.props.moveFocus}\n initialFocusElement={this.props.focusTarget}\n returnFocusOnDeactivate={true}\n >\n {this.props.children}\n </FocusTrap>\n </ThemeProvider>\n </div>,\n this.getContainer()\n );\n }\n\n private getContainer(): Element {\n return (\n this.props.portalTarget ??\n this.context ??\n this.state.parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ??\n this.state.parentDocument.body\n );\n }\n}\n\nfunction parsePxString(pxStr: string): number {\n const parsed = parseInt(pxStr, 10);\n return parsed || 0;\n}\n\nfunction parseMargin(value: string) {\n return value ? parseFloat(value) : 0;\n}\n"]}
1
+ {"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;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,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B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ACnC,OAAO,MAAM,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Popup\n */\n\nimport \"./Popup.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { FocusTrap } from \"../focustrap/FocusTrap.js\";\nimport type { CommonProps } from \"../utils/Props.js\";\nimport { Rectangle } from \"../utils/Rectangle.js\";\nimport { ThemeProvider } from \"@itwin/itwinui-react\";\n\n/** @internal */\ninterface PopupPoint {\n x: number;\n y: number;\n}\n\n/** @internal */\nexport const PopupContext = React.createContext<HTMLElement | undefined>(\n undefined\n);\n\n/** Properties for the [[Popup]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link Popup} component.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface PopupProps extends CommonProps {\n /** Show or hide the box shadow (defaults to true) */\n showShadow: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow: boolean;\n /** Indicates whether the popup is shown or not (defaults to false) */\n isOpen: boolean;\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\n position: RelativePosition;\n /** Top position (absolute positioning - defaults to 0) */\n top: number;\n /** Left position (absolute positioning - defaults to 0) */\n left: number;\n /** Function called when the popup is opened */\n onOpen?: () => void;\n /** Function called when user clicks outside the popup */\n onOutsideClick?: (e: MouseEvent) => void;\n /** Function called when the popup is closed */\n onClose?: () => void;\n /** Function called when the popup is closed on Enter */\n onEnter?: () => void;\n /** Function called when the wheel is used */\n onWheel?: (e: WheelEvent) => void;\n /** Function called when the right mouse button is pressed */\n onContextMenu?: (e: MouseEvent) => void;\n /** Offset from the parent (defaults to 4) */\n offset: number;\n /** Target element to position popup */\n target?: HTMLElement | null;\n /** Role - if not specified \"dialog\" is used */\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\n /** accessibility label */\n ariaLabel?: string;\n /** set focus to popup - default to not set focus */\n moveFocus?: boolean;\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. */\n focusTarget?: React.RefObject<HTMLElement | null> | string;\n /** Indicates whether the popup is pinned. */\n isPinned?: boolean;\n /** Indicates whether to use animation for open/close (defaults to true) */\n animate?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\n closeOnWheel?: boolean;\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\n closeOnContextMenu?: boolean;\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\n closeOnNestedPopupOutsideClick?: boolean;\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\n * children are unmounted each time the popup is closed. */\n keepContentsMounted?: boolean;\n\n /**\n * If true the popup will remain open and will be repositioned when window resize events occur, default to false.\n * @beta\n * */\n repositionOnResize?: boolean;\n\n /** Content */\n children?: React.ReactNode;\n\n /** Target that should be used when portaling popup.\n * @note This is needed in rare cases when {@link Popup} is nested inside the {@link https://itwinui.bentley.com/docs/popover iTwinUI Popover}.\n */\n portalTarget?: HTMLElement;\n}\n\ninterface PopupState {\n isOpen: boolean;\n top: number;\n left: number;\n position: RelativePosition;\n parentDocument: Document;\n animationEnded: boolean;\n portalContainer?: HTMLElement;\n}\n\n/** Popup React component displays a popup relative to an optional target element.\n * @note Avoid nesting {@link Popup} and {@link https://itwinui.bentley.com/docs/popover iTwinUI Popover} components.\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/popover iTwinUI Popover} instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class Popup extends React.Component<PopupProps, PopupState> {\n private _popup: HTMLElement | null = null;\n /** @internal */\n public static override contextType = PopupContext;\n /** @internal */\n public declare context: React.ContextType<typeof PopupContext>;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n constructor(props: PopupProps) {\n super(props);\n const parentDocument = this.props.target?.ownerDocument ?? document;\n\n this.state = {\n animationEnded: false,\n isOpen: this.props.isOpen,\n top: 0,\n left: 0,\n position: this.props.position,\n parentDocument,\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static defaultProps: Partial<PopupProps> = {\n position: RelativePosition.Bottom,\n showShadow: true,\n showArrow: false,\n isOpen: false,\n offset: 4,\n top: -1,\n left: -1,\n };\n\n public override componentDidMount() {\n if (this.props.isOpen) {\n this._onShow();\n }\n }\n\n private getParentWindow() {\n return this.state.parentDocument.defaultView ?? window;\n }\n\n /** @internal */\n public override componentDidUpdate(\n previousProps: PopupProps, // eslint-disable-line @typescript-eslint/no-deprecated\n prevState: PopupState\n ) {\n if (this.state.position !== prevState.position) {\n this.setState({ animationEnded: false });\n }\n\n if (this.props.target !== previousProps.target) {\n {\n const parentDocument = this.props.target?.ownerDocument ?? document;\n if (parentDocument !== this.state.parentDocument) {\n this._unBindWindowEvents();\n this.setState({ parentDocument });\n }\n }\n }\n\n if (this.props.isOpen === previousProps.isOpen) {\n if (this.props.isOpen) {\n const position = this._toggleRelativePosition();\n const point = this._fitPopup(this._getPosition(position));\n if (\n Math.abs(this.state.left - point.x) < 3 &&\n Math.abs(this.state.top - point.y) < 3 &&\n this.state.position === position\n )\n return;\n\n this.setState({\n left: point.x,\n top: point.y,\n position,\n });\n }\n return;\n }\n\n if (this.props.isOpen) {\n this._onShow();\n } else {\n this._onClose();\n }\n }\n\n public override componentWillUnmount() {\n this._unBindWindowEvents();\n }\n\n private _bindWindowEvents = () => {\n const activeWindow = this.getParentWindow();\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\n activeWindow.addEventListener(\"resize\", this._resize);\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\n activeWindow.addEventListener(\"scroll\", this._hide);\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\n };\n\n private _unBindWindowEvents = () => {\n const activeWindow = this.getParentWindow();\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\n activeWindow.removeEventListener(\"resize\", this._resize);\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\n activeWindow.removeEventListener(\"scroll\", this._hide);\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\n };\n\n private _handleWheel = (event: WheelEvent) => {\n if (this._popup && this._popup.contains(event.target as Node)) return;\n\n if (this.props.onWheel) return this.props.onWheel(event);\n\n const closeOnWheel =\n this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\n if (closeOnWheel) this._hide();\n };\n\n private isInCorePopup(element: HTMLElement): boolean {\n if (element.nodeName === \"DIV\") {\n if (element.classList && element.classList.contains(\"core-popup\"))\n return true;\n if (element.parentElement && this.isInCorePopup(element.parentElement))\n return true;\n } else {\n if (element.parentElement && this.isInCorePopup(element.parentElement))\n return true;\n }\n return false;\n }\n\n private _handleOutsideClick = (event: MouseEvent): void => {\n if (this._popup && this._popup.contains(event.target as Node)) return;\n\n if (this.props.isPinned) return;\n\n if (\n !this.props.closeOnNestedPopupOutsideClick &&\n this.isInCorePopup(event.target as HTMLElement)\n )\n return;\n\n if (this.props.onOutsideClick) return this.props.onOutsideClick(event);\n\n if (this.props.target && this.props.target.contains(event.target as Node))\n return;\n\n this._onClose();\n };\n\n private _handleContextMenu = (event: MouseEvent) => {\n if (this._popup && this._popup.contains(event.target as Node)) return;\n\n if (this.props.onContextMenu) return this.props.onContextMenu(event);\n\n const closeOnContextMenu =\n this.props.closeOnContextMenu !== undefined\n ? this.props.closeOnContextMenu\n : true;\n if (closeOnContextMenu) this._hide();\n };\n\n private _handleKeyboard = (event: KeyboardEvent): void => {\n if (this.props.isPinned) return;\n\n if (\n event.key === Key.Escape.valueOf() ||\n event.key === Key.Enter.valueOf()\n ) {\n const closeOnEnter =\n this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\n if (event.key === Key.Enter.valueOf()) {\n if (closeOnEnter) this._onClose(true);\n else this.props.onEnter && this.props.onEnter();\n } else {\n this._onClose(false);\n }\n }\n };\n\n private _resize = () => {\n if (this.props.repositionOnResize) {\n const position = this._toggleRelativePosition();\n const point = this._fitPopup(this._getPosition(position));\n this.setState({ left: point.x, top: point.y, position });\n } else {\n this._hide(); // legacy behavior\n }\n };\n\n private _hide = () => {\n if (this.props.isPinned) return;\n\n this._onClose();\n };\n\n private _onShow() {\n this._bindWindowEvents();\n const position = this._toggleRelativePosition();\n const point = this._fitPopup(this._getPosition(position));\n\n this.setState(\n { left: point.x, top: point.y, isOpen: true, position },\n () => {\n if (this.props.onOpen) this.props.onOpen();\n }\n );\n }\n\n private _onClose(enterKey?: boolean) {\n if (!this.state.isOpen) return;\n\n this._unBindWindowEvents();\n\n this.setState({ isOpen: false }, () => {\n if (enterKey && this.props.onEnter) this.props.onEnter();\n if (this.props.onClose) this.props.onClose();\n });\n }\n\n private _isPositionAbsolute(): boolean {\n return this.props.top !== -1 && this.props.left !== -1;\n }\n\n private _getClassNameByPosition(position: RelativePosition): string {\n if (!this._isPositionAbsolute()) {\n switch (position) {\n case RelativePosition.TopLeft:\n return \"core-popup-top-left\";\n case RelativePosition.TopRight:\n return \"core-popup-top-right\";\n case RelativePosition.BottomLeft:\n return \"core-popup-bottom-left\";\n case RelativePosition.BottomRight:\n return \"core-popup-bottom-right\";\n case RelativePosition.Top:\n return \"core-popup-top\";\n case RelativePosition.Left:\n return \"core-popup-left\";\n case RelativePosition.Right:\n return \"core-popup-right\";\n case RelativePosition.Bottom:\n return \"core-popup-bottom\";\n case RelativePosition.LeftTop:\n return \"core-popup-left-top\";\n case RelativePosition.RightTop:\n return \"core-popup-right-top\";\n }\n }\n\n return \"\";\n }\n\n private _getPopupDimensions(): { popupWidth: number; popupHeight: number } {\n let popupWidth = 0;\n let popupHeight = 0;\n if (this._popup) {\n const activeWindow = this.getParentWindow();\n const style = activeWindow.getComputedStyle(this._popup);\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\n const borderRightWidth = parsePxString(style.borderRightWidth);\n const borderTopWidth = parsePxString(style.borderTopWidth);\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\n popupHeight =\n this._popup.clientHeight + borderTopWidth + borderBottomWidth;\n }\n\n return { popupWidth, popupHeight };\n }\n\n private _getPosition = (position: RelativePosition) => {\n const activeWindow = this.getParentWindow();\n const { target, offset, top, left } = this.props;\n const offsetArrow = this.props.showArrow ? 6 : 0;\n\n // absolute position\n if (this._isPositionAbsolute()) return { x: left, y: top };\n\n // sanity check\n const point = { x: 0, y: 0 };\n if (!this._popup || !target) return point;\n\n // relative position\n const scrollY = activeWindow.scrollY;\n const scrollX = activeWindow.scrollX;\n\n const container = this.getContainer();\n const containerBounds = container.getBoundingClientRect();\n const targetRect = Rectangle.create(target.getBoundingClientRect()).offset({\n x: -containerBounds.left,\n y: -containerBounds.top,\n });\n\n const { popupWidth, popupHeight } = this._getPopupDimensions();\n\n switch (position) {\n case RelativePosition.Top:\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\n point.x =\n scrollX +\n targetRect.left +\n targetRect.getWidth() / 2 -\n popupWidth / 2;\n break;\n\n case RelativePosition.TopLeft:\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\n point.x = scrollX + targetRect.left;\n break;\n\n case RelativePosition.TopRight:\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\n point.x = scrollX + targetRect.right - popupWidth;\n break;\n\n case RelativePosition.Bottom:\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\n point.x =\n scrollX +\n targetRect.left +\n targetRect.getWidth() / 2 -\n popupWidth / 2;\n break;\n\n case RelativePosition.BottomLeft:\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\n point.x = scrollX + targetRect.left;\n break;\n\n case RelativePosition.BottomRight:\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\n point.x = scrollX + targetRect.right - popupWidth;\n break;\n\n case RelativePosition.Left:\n point.y =\n scrollY +\n targetRect.top +\n targetRect.getHeight() / 2 -\n popupHeight / 2;\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\n break;\n\n case RelativePosition.LeftTop:\n point.y = scrollY + targetRect.top;\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\n break;\n\n case RelativePosition.Right:\n point.y =\n scrollY +\n targetRect.top +\n targetRect.getHeight() / 2 -\n popupHeight / 2;\n point.x = scrollX + targetRect.right + offset + offsetArrow;\n break;\n\n case RelativePosition.RightTop:\n point.y = scrollY + targetRect.top;\n point.x = scrollX + targetRect.right + offset + offsetArrow;\n break;\n }\n\n return point;\n };\n\n private _toggleRelativePosition(): RelativePosition {\n const { target, position, offset } = this.props;\n\n if (!this._popup || !target) return position;\n\n if (this._isPositionAbsolute()) return position;\n\n let newPosition = position;\n\n interface Rect {\n left: number;\n top: number;\n right: number;\n bottom: number;\n }\n\n const activeWindow = this.getParentWindow();\n\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\n const viewportRect: Rect = {\n left: activeWindow.scrollX,\n top: activeWindow.scrollY,\n right: activeWindow.scrollX + activeWindow.innerWidth,\n bottom: activeWindow.scrollY + activeWindow.innerHeight,\n };\n const targetRect = target.getBoundingClientRect();\n const { popupWidth, popupHeight } = this._getPopupDimensions();\n const containerStyle = activeWindow.getComputedStyle(target);\n const offsetArrow = this.props.showArrow ? 10 : 2;\n\n const bottomMargin = parseMargin(containerStyle.marginBottom);\n if (\n targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset >\n viewportRect.bottom\n ) {\n if (newPosition === RelativePosition.Bottom)\n newPosition = RelativePosition.Top;\n else if (newPosition === RelativePosition.BottomLeft)\n newPosition = RelativePosition.TopLeft;\n else if (newPosition === RelativePosition.BottomRight)\n newPosition = RelativePosition.TopRight;\n }\n\n const topMargin = parseMargin(containerStyle.marginTop);\n if (\n targetRect.top - popupHeight - topMargin - offsetArrow - offset <\n viewportRect.top\n ) {\n if (newPosition === RelativePosition.Top)\n newPosition = RelativePosition.Bottom;\n else if (newPosition === RelativePosition.TopLeft)\n newPosition = RelativePosition.BottomLeft;\n else if (newPosition === RelativePosition.TopRight)\n newPosition = RelativePosition.BottomRight;\n }\n\n const leftMargin = parseMargin(containerStyle.marginLeft);\n if (\n targetRect.left - popupWidth - leftMargin - offsetArrow - offset <\n viewportRect.left\n ) {\n if (newPosition === RelativePosition.Left)\n newPosition = RelativePosition.Right;\n else if (newPosition === RelativePosition.LeftTop)\n newPosition = RelativePosition.RightTop;\n }\n\n const rightMargin = parseMargin(containerStyle.marginRight);\n if (\n targetRect.right + popupWidth + rightMargin + offsetArrow + offset >\n viewportRect.right\n ) {\n if (newPosition === RelativePosition.Right)\n newPosition = RelativePosition.Left;\n else if (newPosition === RelativePosition.RightTop)\n newPosition = RelativePosition.LeftTop;\n }\n\n return newPosition;\n }\n\n // fit the popup within the extents of the view port\n private _fitPopup = (point: PopupPoint) => {\n const fittedPoint = point;\n\n if (!this._popup) {\n return fittedPoint;\n }\n\n const { popupWidth, popupHeight } = this._getPopupDimensions();\n const container = this.getContainer();\n const containerBounds = container.getBoundingClientRect();\n\n if (fittedPoint.y + popupHeight > containerBounds.height) {\n fittedPoint.y = containerBounds.height - popupHeight;\n }\n\n if (fittedPoint.x + popupWidth > containerBounds.width) {\n fittedPoint.x = containerBounds.width - popupWidth;\n }\n\n if (fittedPoint.y < 0) {\n fittedPoint.y = 0;\n }\n\n if (fittedPoint.x < 0) {\n fittedPoint.x = 0;\n }\n\n return fittedPoint;\n };\n\n private _handleAnimationEnd = (\n event: React.AnimationEvent<HTMLDivElement>\n ) => {\n if (event.target === this._popup) {\n this.setState({ animationEnded: true });\n }\n };\n\n private _handleThemeProviderRef = (el: HTMLDivElement | null) => {\n this.setState({ portalContainer: el ?? undefined });\n };\n\n public override render() {\n const animate =\n this.props.animate !== undefined ? this.props.animate : true;\n const className = classnames(\n \"core-popup\",\n this._getClassNameByPosition(this.state.position),\n this.props.showShadow && \"core-popup-shadow\",\n this.props.showArrow && \"arrow\",\n !animate && \"core-popup-animation-none\",\n this.props.className,\n this.state.animationEnded && \"core-animation-ended\",\n !this.props.isOpen &&\n this.props.keepContentsMounted &&\n \"core-popup-hidden\"\n );\n\n const style: React.CSSProperties = {\n top: this.state.top,\n left: this.state.left,\n ...this.props.style,\n };\n\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\n\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\n return null;\n }\n\n return ReactDOM.createPortal(\n <div\n className={className}\n data-testid=\"core-popup\"\n ref={(element) => {\n this._popup = element;\n }}\n style={style}\n role={role}\n aria-modal={true}\n tabIndex={-1}\n aria-label={this.props.ariaLabel}\n onAnimationEnd={this._handleAnimationEnd}\n >\n <ThemeProvider\n ref={this._handleThemeProviderRef}\n portalContainer={this.state.portalContainer}\n >\n <FocusTrap\n active={!!this.props.moveFocus}\n initialFocusElement={this.props.focusTarget}\n returnFocusOnDeactivate={true}\n >\n {this.props.children}\n </FocusTrap>\n </ThemeProvider>\n </div>,\n this.getContainer()\n );\n }\n\n private getContainer(): Element {\n return (\n this.props.portalTarget ??\n this.context ??\n this.state.parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ??\n this.state.parentDocument.body\n );\n }\n}\n\nfunction parsePxString(pxStr: string): number {\n const parsed = parseInt(pxStr, 10);\n return parsed || 0;\n}\n\nfunction parseMargin(value: string) {\n return value ? parseFloat(value) : 0;\n}\n"]}
@@ -10,17 +10,21 @@ import { Point } from "../utils/Point.js";
10
10
  * @internal
11
11
  */
12
12
  export class Line {
13
+ p1;
14
+ p2;
13
15
  constructor(p1, p2) {
14
- /** checks for equality with the components of this, and line parameter */
15
- this.equals = (line) => this.p1.equals(line.p1) && this.p2.equals(line.p2);
16
16
  this.p1 = p1 || new Point();
17
17
  this.p2 = p2 || new Point();
18
18
  }
19
+ /** checks for equality with the components of this, and line parameter */
20
+ equals = (line) => this.p1.equals(line.p1) && this.p2.equals(line.p2);
19
21
  }
20
22
  /** 2D Circle.
21
23
  * @internal
22
24
  */
23
25
  export class Circle {
26
+ center;
27
+ radius;
24
28
  constructor(center, radius) {
25
29
  this.center = center || new Point();
26
30
  this.radius = radius || 0;
@@ -30,6 +34,9 @@ export class Circle {
30
34
  * @internal
31
35
  */
32
36
  export class Annulus {
37
+ center;
38
+ inner;
39
+ outer;
33
40
  constructor(center, innerRadius, outerRadius) {
34
41
  this.center = center || new Point();
35
42
  this.inner = new Circle(center, innerRadius);
@@ -40,6 +47,16 @@ export class Annulus {
40
47
  * @internal
41
48
  */
42
49
  export class AnnularSector {
50
+ parent;
51
+ startAngle;
52
+ endAngle;
53
+ path;
54
+ innerStart;
55
+ outerStart;
56
+ start;
57
+ innerEnd;
58
+ outerEnd;
59
+ end;
43
60
  /**
44
61
  * initialize AnnularSector on parent annulus, and generate SVG Path to store in this.path
45
62
  * @param parent parent annulus to initialize sector on.
@@ -1 +1 @@
1
- {"version":3,"file":"Annulus.js","sourceRoot":"","sources":["../../../src/core-react/radialmenu/Annulus.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,IAAI;IAIf,YAAY,EAAU,EAAE,EAAU;QAKlC,0EAA0E;QACnE,WAAM,GAAG,CAAC,IAAU,EAAE,EAAE,CAC7B,IAAI,CAAC,EAAE,CAAC,M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CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC5E,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC5E,cAAc,CAAC,IAAI,CACjB,IAAI,KAAK,IAAI,KAAK,MAAM,QAAQ,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAC3E,CAAC,CAAC,QAAQ;QACX,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QACxE,cAAc,CAAC,IAAI,CACjB,IAAI,KAAK,IAAI,KAAK,MAAM,QAAQ,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAC/E,CAAC,CAAC,QAAQ;QACX,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY;QAEtC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RadialMenu\n */\n\nimport { Point } from \"../utils/Point.js\";\n\n/** 2D Line consisting of a start point, and an end point\n * @internal\n */\nexport class Line {\n public p1: Point;\n public p2: Point;\n\n constructor(p1?: Point, p2?: Point) {\n this.p1 = p1 || new Point();\n this.p2 = p2 || new Point();\n }\n\n /** checks for equality with the components of this, and line parameter */\n public equals = (line: Line) =>\n this.p1.equals(line.p1) && this.p2.equals(line.p2);\n}\n\n/** 2D Circle.\n * @internal\n */\nexport class Circle {\n public center: Point;\n public radius: number;\n constructor(center?: Point, radius?: number) {\n this.center = center || new Point();\n this.radius = radius || 0;\n }\n}\n\n/** 2D Annulus (2D doughnut shape/flattened torus) defined by an inner and outer circle with a shared center point.\n * @internal\n */\nexport class Annulus {\n public center: Point;\n public inner: Circle;\n public outer: Circle;\n\n constructor(center?: Point, innerRadius?: number, outerRadius?: number) {\n this.center = center || new Point();\n\n this.inner = new Circle(center, innerRadius);\n this.outer = new Circle(center, outerRadius);\n }\n}\n\n/** 2D Sector of an Annulus, defined by both a parent annulus, a startAngle, and an endAngle.\n * @internal\n */\nexport class AnnularSector {\n public parent: Annulus;\n public startAngle: number;\n public endAngle: number;\n\n public path: string;\n\n public innerStart: Point;\n public outerStart: Point;\n public start: Line;\n public innerEnd: Point;\n public outerEnd: Point;\n public end: Line;\n\n /**\n * initialize AnnularSector on parent annulus, and generate SVG Path to store in this.path\n * @param parent parent annulus to initialize sector on.\n * @param startAngle angle to begin the annular sector on.\n * @param endAngle angle to end the annular sector on.\n */\n constructor(parent: Annulus, startAngle: number, endAngle: number) {\n this.parent = parent;\n this.startAngle = startAngle;\n this.endAngle = endAngle;\n\n // adapted from https://gist.github.com/buschtoens/4190516\n const { x: cx, y: cy } = parent.center;\n const inner = parent.inner.radius;\n const outer = parent.outer.radius;\n\n this.innerStart = new Point(\n cx + inner * Math.cos(startAngle),\n cy + inner * Math.sin(startAngle)\n );\n this.outerStart = new Point(\n cx + outer * Math.cos(startAngle),\n cy + outer * Math.sin(startAngle)\n );\n this.start = new Line(this.innerStart, this.outerStart);\n\n this.outerEnd = new Point(\n cx + outer * Math.cos(endAngle),\n cy + outer * Math.sin(endAngle)\n );\n this.innerEnd = new Point(\n cx + inner * Math.cos(endAngle),\n cy + inner * Math.sin(endAngle)\n );\n this.end = new Line(this.outerEnd, this.innerEnd);\n\n const angleDiff = endAngle - startAngle;\n const largeArc = angleDiff % (Math.PI * 2) > Math.PI ? 1 : 0;\n\n const sectorCommands = [];\n\n sectorCommands.push(`M${this.innerStart.x},${this.innerStart.y}`); // moveTo\n sectorCommands.push(`L${this.outerStart.x},${this.outerStart.y}`); // lineTo\n sectorCommands.push(\n `A${outer},${outer} 0 ${largeArc} 1 ${this.outerEnd.x},${this.outerEnd.y}`\n ); // arcTo\n sectorCommands.push(`L${this.innerEnd.x},${this.innerEnd.y}`); // lineTo\n sectorCommands.push(\n `A${inner},${inner} 0 ${largeArc} 0 ${this.innerStart.x},${this.innerStart.y}`\n ); // arcTo\n sectorCommands.push(`z`); // closePath\n\n this.path = sectorCommands.join(\" \");\n }\n}\n"]}
1
+ {"version":3,"file":"Annulus.js","sourceRoot":"","sources":["../../../src/core-react/radialmenu/Annulus.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,IAAI;IACR,EAAE,CAAQ;IACV,EAAE,CAAQ;IAEjB,YAAY,EAAU,EAAE,EAAU;QAChC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,IAAI,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,IAAI,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,0EAA0E;IACnE,MAAM,GAAG,CAAC,IAAU,EAAE,EAAE,CAC7B,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,OAAO,MAAM;IACV,MAAM,CAAQ;IACd,MAAM,CAAS;IACtB,YAAY,MAAc,EAAE,MAAe;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,KAAK,E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AAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC5E,cAAc,CAAC,IAAI,CACjB,IAAI,KAAK,IAAI,KAAK,MAAM,QAAQ,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAC3E,CAAC,CAAC,QAAQ;QACX,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QACxE,cAAc,CAAC,IAAI,CACjB,IAAI,KAAK,IAAI,KAAK,MAAM,QAAQ,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAC/E,CAAC,CAAC,QAAQ;QACX,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY;QAEtC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RadialMenu\n */\n\nimport { Point } from \"../utils/Point.js\";\n\n/** 2D Line consisting of a start point, and an end point\n * @internal\n */\nexport class Line {\n public p1: Point;\n public p2: Point;\n\n constructor(p1?: Point, p2?: Point) {\n this.p1 = p1 || new Point();\n this.p2 = p2 || new Point();\n }\n\n /** checks for equality with the components of this, and line parameter */\n public equals = (line: Line) =>\n this.p1.equals(line.p1) && this.p2.equals(line.p2);\n}\n\n/** 2D Circle.\n * @internal\n */\nexport class Circle {\n public center: Point;\n public radius: number;\n constructor(center?: Point, radius?: number) {\n this.center = center || new Point();\n this.radius = radius || 0;\n }\n}\n\n/** 2D Annulus (2D doughnut shape/flattened torus) defined by an inner and outer circle with a shared center point.\n * @internal\n */\nexport class Annulus {\n public center: Point;\n public inner: Circle;\n public outer: Circle;\n\n constructor(center?: Point, innerRadius?: number, outerRadius?: number) {\n this.center = center || new Point();\n\n this.inner = new Circle(center, innerRadius);\n this.outer = new Circle(center, outerRadius);\n }\n}\n\n/** 2D Sector of an Annulus, defined by both a parent annulus, a startAngle, and an endAngle.\n * @internal\n */\nexport class AnnularSector {\n public parent: Annulus;\n public startAngle: number;\n public endAngle: number;\n\n public path: string;\n\n public innerStart: Point;\n public outerStart: Point;\n public start: Line;\n public innerEnd: Point;\n public outerEnd: Point;\n public end: Line;\n\n /**\n * initialize AnnularSector on parent annulus, and generate SVG Path to store in this.path\n * @param parent parent annulus to initialize sector on.\n * @param startAngle angle to begin the annular sector on.\n * @param endAngle angle to end the annular sector on.\n */\n constructor(parent: Annulus, startAngle: number, endAngle: number) {\n this.parent = parent;\n this.startAngle = startAngle;\n this.endAngle = endAngle;\n\n // adapted from https://gist.github.com/buschtoens/4190516\n const { x: cx, y: cy } = parent.center;\n const inner = parent.inner.radius;\n const outer = parent.outer.radius;\n\n this.innerStart = new Point(\n cx + inner * Math.cos(startAngle),\n cy + inner * Math.sin(startAngle)\n );\n this.outerStart = new Point(\n cx + outer * Math.cos(startAngle),\n cy + outer * Math.sin(startAngle)\n );\n this.start = new Line(this.innerStart, this.outerStart);\n\n this.outerEnd = new Point(\n cx + outer * Math.cos(endAngle),\n cy + outer * Math.sin(endAngle)\n );\n this.innerEnd = new Point(\n cx + inner * Math.cos(endAngle),\n cy + inner * Math.sin(endAngle)\n );\n this.end = new Line(this.outerEnd, this.innerEnd);\n\n const angleDiff = endAngle - startAngle;\n const largeArc = angleDiff % (Math.PI * 2) > Math.PI ? 1 : 0;\n\n const sectorCommands = [];\n\n sectorCommands.push(`M${this.innerStart.x},${this.innerStart.y}`); // moveTo\n sectorCommands.push(`L${this.outerStart.x},${this.outerStart.y}`); // lineTo\n sectorCommands.push(\n `A${outer},${outer} 0 ${largeArc} 1 ${this.outerEnd.x},${this.outerEnd.y}`\n ); // arcTo\n sectorCommands.push(`L${this.innerEnd.x},${this.innerEnd.y}`); // lineTo\n sectorCommands.push(\n `A${inner},${inner} 0 ${largeArc} 0 ${this.innerStart.x},${this.innerStart.y}`\n ); // arcTo\n sectorCommands.push(`z`); // closePath\n\n this.path = sectorCommands.join(\" \");\n }\n}\n"]}
@@ -17,42 +17,17 @@ import { AnnularSector, Annulus } from "./Annulus.js";
17
17
  * @deprecated in 4.14.0. Use {@link ContextMenu} or {@link https://itwinui.bentley.com/docs/dropdownmenu iTwinUI dropdown menu} instead.
18
18
  */
19
19
  export class RadialMenu extends React.Component {
20
+ _root = null;
21
+ _selectedButton = null;
22
+ static defaultProps = {
23
+ labelRotate: false,
24
+ selected: -1,
25
+ };
26
+ state = {
27
+ sectors: [],
28
+ };
20
29
  constructor(props) {
21
30
  super(props);
22
- this._root = null;
23
- this._selectedButton = null;
24
- this.state = {
25
- sectors: [],
26
- };
27
- this._handleKeyUp = (event) => {
28
- if (event.key === Key.Escape.valueOf() && this.props.onEsc)
29
- this.props.onEsc(event);
30
- };
31
- this._handleClick = (event) => {
32
- if (event.target instanceof HTMLElement &&
33
- this._root &&
34
- !event.target.contains(this._root) &&
35
- this.props.onBlur)
36
- this.props.onBlur(event);
37
- };
38
- /** Manually call onSelect of highlighted button. */
39
- this.select = () => {
40
- if (this._selectedButton)
41
- this._selectedButton.select();
42
- };
43
- this._generateAnnularSectors = () => {
44
- const n = React.Children.count(this.props.children);
45
- const angle = (2 * Math.PI) / n;
46
- const outer = this.props.outerRadius;
47
- const inner = this.props.innerRadius;
48
- const offset = -Math.PI / 8;
49
- const annulus = new Annulus(new Point(outer + 1, outer + 1), inner + 1, outer - 1);
50
- const sectors = [];
51
- for (let i = 0; i < n; i++) {
52
- sectors.push(new AnnularSector(annulus, angle * i + offset, angle * (i + 1) + offset));
53
- }
54
- this.setState({ sectors });
55
- };
56
31
  }
57
32
  render() {
58
33
  const width = 2 * (this.props.outerRadius + 1);
@@ -114,36 +89,46 @@ export class RadialMenu extends React.Component {
114
89
  this._generateAnnularSectors();
115
90
  }
116
91
  }
92
+ _handleKeyUp = (event) => {
93
+ if (event.key === Key.Escape.valueOf() && this.props.onEsc)
94
+ this.props.onEsc(event);
95
+ };
96
+ _handleClick = (event) => {
97
+ if (event.target instanceof HTMLElement &&
98
+ this._root &&
99
+ !event.target.contains(this._root) &&
100
+ this.props.onBlur)
101
+ this.props.onBlur(event);
102
+ };
103
+ /** Manually call onSelect of highlighted button. */
104
+ select = () => {
105
+ if (this._selectedButton)
106
+ this._selectedButton.select();
107
+ };
108
+ _generateAnnularSectors = () => {
109
+ const n = React.Children.count(this.props.children);
110
+ const angle = (2 * Math.PI) / n;
111
+ const outer = this.props.outerRadius;
112
+ const inner = this.props.innerRadius;
113
+ const offset = -Math.PI / 8;
114
+ const annulus = new Annulus(new Point(outer + 1, outer + 1), inner + 1, outer - 1);
115
+ const sectors = [];
116
+ for (let i = 0; i < n; i++) {
117
+ sectors.push(new AnnularSector(annulus, angle * i + offset, angle * (i + 1) + offset));
118
+ }
119
+ this.setState({ sectors });
120
+ };
117
121
  }
118
- RadialMenu.defaultProps = {
119
- labelRotate: false,
120
- selected: -1,
121
- };
122
122
  /** Button for use within a [[RadialMenu]]
123
123
  * @public
124
124
  * @deprecated in 4.14.0. Component used in a deprecated component {@link RadialMenu}.
125
125
  */
126
126
  export class RadialButton extends React.Component {
127
+ state = {
128
+ hover: this.props.selected || false,
129
+ };
127
130
  constructor(props) {
128
131
  super(props);
129
- this.state = {
130
- hover: this.props.selected || false,
131
- };
132
- /** Manually call this.props.onSelect */
133
- this.select = () => {
134
- if (this.props.onSelect)
135
- this.props.onSelect(undefined);
136
- };
137
- this._handleClick = (event) => {
138
- if (this.props.onSelect)
139
- this.props.onSelect(event);
140
- };
141
- this._handleMouseOver = (_event) => {
142
- this.setState({ hover: true });
143
- };
144
- this._handleMouseOut = (_event) => {
145
- this.setState({ hover: false });
146
- };
147
132
  }
148
133
  render() {
149
134
  const sector = this.props.annularSector;
@@ -180,5 +165,20 @@ export class RadialButton extends React.Component {
180
165
  React.createElement(Icon, { iconSpec: this.props.icon })),
181
166
  React.createElement("div", { className: "core-radial-menu-button-content" }, this.props.children)))));
182
167
  }
168
+ /** Manually call this.props.onSelect */
169
+ select = () => {
170
+ if (this.props.onSelect)
171
+ this.props.onSelect(undefined);
172
+ };
173
+ _handleClick = (event) => {
174
+ if (this.props.onSelect)
175
+ this.props.onSelect(event);
176
+ };
177
+ _handleMouseOver = (_event) => {
178
+ this.setState({ hover: true });
179
+ };
180
+ _handleMouseOut = (_event) => {
181
+ this.setState({ hover: false });
182
+ };
183
183
  }
184
184
  //# sourceMappingURL=RadialMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadialMenu.js","sourceRoot":"","sources":["../../../src/core-react/radialmenu/RadialMenu.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAsCtD;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAGrC;IAYC,YAAY,KAAsB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAC;QAZP,UAAK,GAA0B,IAAI,CAAC;QACpC,oBAAe,GAAwB,IAAI,CAAC;QAM3B,UAAK,GAA8B;YAC1D,OAAO,EAAE,EAAE;SACZ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C,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,EACjB,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,EACX,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,6BAA6B;gBAExC,6BACQ,KAAK,EAAE,8BAA8B,EAC3C,SAAS,EAAE,mCAAmC;oBAE9C,6BAAK,SAAS,EAAC,8BAA8B;wBAC3C,oBAAC,IAAI,IAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAI,CAC/B;oBACN,6BAAK,SAAS,EAAE,iCAAiC,IAC9C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAChB,CACF,CACQ,CACd,CACL,CAAC;IACJ,CAAC;CAkBF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RadialMenu\n */\n\nimport \"./RadialMenu.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { IconSpec } from \"../icons/IconComponent.js\";\nimport { Icon } from \"../icons/IconComponent.js\";\nimport { Point } from \"../utils/Point.js\";\nimport type { CommonProps } from \"../utils/Props.js\";\nimport { AnnularSector, Annulus } from \"./Annulus.js\";\nimport type { ContextMenu } from \"../contextmenu/ContextMenu.js\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** Properties for [[RadialMenu]]\n * @public\n * @deprecated in 4.14.0. Props of deprecated component {@link RadialMenu}.\n */\nexport interface RadialMenuProps extends CommonProps {\n /** Whether to show RadialMenu */\n opened: boolean;\n /** Radius of inner portion of RadialMenu */\n innerRadius: number;\n /** Radius of outer portion of RadialMenu */\n outerRadius: number;\n /** Optional parameter to specify left position in viewport. */\n left?: number | string;\n /** Optional parameter to specify top position in viewport. */\n top?: number | string;\n /** Whether to rotate labels according to location on the RadialMenu, or to keep labels upright.\n * Default: false\n */\n labelRotate?: boolean;\n /** Which child RadialButton to highlight */\n selected?: number;\n /** triggered in case of onClick events anywhere other than radial menu */\n onBlur?: (event: any) => any;\n /** triggered onKeyUp for <Esc> key */\n onEsc?: (event: any) => any;\n /** Content */\n children?: React.ReactNode;\n}\n\ninterface RadialMenuState {\n sectors: AnnularSector[];\n}\n\n/** A context menu arranged in a radial layout.\n * @public\n * @deprecated in 4.14.0. Use {@link ContextMenu} or {@link https://itwinui.bentley.com/docs/dropdownmenu iTwinUI dropdown menu} instead.\n */\nexport class RadialMenu extends React.Component<\n RadialMenuProps,\n RadialMenuState\n> {\n private _root: HTMLDivElement | null = null;\n private _selectedButton: RadialButton | null = null;\n public static defaultProps: Partial<RadialMenuProps> = {\n labelRotate: false,\n selected: -1,\n };\n\n public override readonly state: Readonly<RadialMenuState> = {\n sectors: [],\n };\n\n constructor(props: RadialMenuProps) {\n super(props);\n }\n\n public override render(): React.ReactElement {\n const width = 2 * (this.props.outerRadius + 1);\n let x = this.props.left,\n y = this.props.top;\n\n if (\n this.props.left &&\n this.props.top &&\n typeof this.props.left === \"number\" &&\n typeof this.props.top === \"number\"\n ) {\n x = this.props.left;\n y = this.props.top;\n\n if (x < 0) x = 0;\n if (x > window.innerWidth - width) x = window.innerWidth - width;\n if (y < 0) y = 0;\n if (y > window.innerHeight - width) y = window.innerHeight - width;\n }\n\n const divStyle: React.CSSProperties = {\n left: x,\n top: y,\n ...this.props.style,\n };\n\n return (\n <div\n ref={(el) => {\n this._root = el;\n }}\n className={classnames(\n \"core-radial-menu\",\n { opened: this.props.opened },\n this.props.className\n )}\n style={divStyle}\n data-testid=\"core-radial-menu\"\n >\n <svg\n xmlns=\"http://w3.org/2000/svg\"\n version=\"1.1\"\n width={width}\n height={width}\n className={\"core-radial-menu-container\"}\n >\n {React.Children.map(\n this.props.children,\n (child, index): React.ReactNode => {\n if (!child || typeof child !== \"object\" || !(\"props\" in child))\n return child;\n\n const childElement = child as React.ReactElement<any>;\n return React.cloneElement(childElement, {\n key: index,\n ref: (el: any) => {\n if (this.props.selected === index) this._selectedButton = el;\n },\n selected: index === this.props.selected,\n labelRotate:\n childElement.props.labelRotate || this.props.labelRotate,\n annularSector: this.state.sectors[index],\n });\n }\n )}\n </svg>\n </div>\n );\n }\n\n public override componentDidMount() {\n this._generateAnnularSectors();\n\n setTimeout(() => {\n window.addEventListener(\"keyup\", this._handleKeyUp);\n window.addEventListener(\"mouseup\", this._handleClick);\n });\n }\n\n public override componentWillUnmount() {\n window.removeEventListener(\"keyup\", this._handleKeyUp);\n window.removeEventListener(\"mouseup\", this._handleClick);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: RadialMenuProps) {\n if (\n prevProps.innerRadius !== this.props.innerRadius ||\n prevProps.outerRadius !== this.props.outerRadius\n ) {\n this._generateAnnularSectors();\n }\n }\n\n private _handleKeyUp = (event: KeyboardEvent) => {\n if (event.key === Key.Escape.valueOf() && this.props.onEsc)\n this.props.onEsc(event);\n };\n\n private _handleClick = (event: MouseEvent) => {\n if (\n event.target instanceof HTMLElement &&\n this._root &&\n !event.target.contains(this._root) &&\n this.props.onBlur\n )\n this.props.onBlur(event);\n };\n\n /** Manually call onSelect of highlighted button. */\n public select = () => {\n if (this._selectedButton) this._selectedButton.select();\n };\n\n private _generateAnnularSectors = () => {\n const n = React.Children.count(this.props.children);\n const angle = (2 * Math.PI) / n;\n const outer = this.props.outerRadius;\n const inner = this.props.innerRadius;\n\n const offset = -Math.PI / 8;\n const annulus = new Annulus(\n new Point(outer + 1, outer + 1),\n inner + 1,\n outer - 1\n );\n const sectors: AnnularSector[] = [];\n for (let i = 0; i < n; i++) {\n sectors.push(\n new AnnularSector(annulus, angle * i + offset, angle * (i + 1) + offset)\n );\n }\n this.setState({ sectors });\n };\n}\n\n/** Properties for [[RadialButton]] component\n * @public\n * @deprecated in 4.14.0. Props of deprecated component {@link RadialButton}.\n */\nexport interface RadialButtonProps extends CommonProps {\n /** Whether label is rotated to radial menu. Default: Inherit */\n labelRotate?: boolean;\n /** which icon to display in on the menu button */\n icon?: IconSpec;\n /** @internal */\n annularSector?: AnnularSector;\n /** listens to any onClick event, or any select event, which can be triggered by the select() method. */\n onSelect?: (e: any) => any;\n /** Whether item is highlighted */\n selected?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\ninterface RadialButtonState {\n hover: boolean;\n}\n\n/** Button for use within a [[RadialMenu]]\n * @public\n * @deprecated in 4.14.0. Component used in a deprecated component {@link RadialMenu}.\n */\nexport class RadialButton extends React.Component<\n RadialButtonProps,\n RadialButtonState\n> {\n public override readonly state: Readonly<RadialButtonState> = {\n hover: this.props.selected || false,\n };\n\n constructor(props: RadialButtonProps) {\n super(props);\n }\n\n public override render(): React.ReactElement {\n const sector = this.props.annularSector;\n let p = new Point();\n let size = 0;\n let t = \"\";\n let path = \"\";\n\n if (sector) {\n size = sector.start.p1.getDistanceTo(sector.end.p2) * 2;\n path = sector.path;\n\n const parent = sector.parent;\n const { x: cx, y: cy } = parent.center;\n const r = (parent.inner.radius + parent.outer.radius) / 2;\n const angle = (sector.startAngle + sector.endAngle) / 2;\n p = new Point(cx + r * Math.cos(angle), cy + r * Math.sin(angle));\n\n if (this.props.labelRotate) {\n let a = (angle * 180) / Math.PI + 90;\n while (a > 180) a -= 360;\n while (a < -180) a += 360;\n if (a > 90) a -= 180;\n if (a < -90) a += 180;\n t = `rotate(${a} ${p.x}, ${p.y})`;\n }\n }\n\n return (\n <g\n onMouseOver={this._handleMouseOver}\n onMouseOut={this._handleMouseOut}\n onClick={this._handleClick}\n >\n <path\n className={classnames(\n \"core-radial-menu-sector\",\n { selected: this.state.hover },\n this.props.className\n )}\n style={this.props.style}\n d={path}\n ></path>\n <foreignObject\n transform={t}\n x={p.x - size / 2}\n y={p.y - 16}\n width={size}\n height={size}\n className={\"core-radial-menu-button-svg\"}\n >\n <div\n {...{ xmlns: \"http://www.w3.org/1999/xhtml\" }}\n className={\"core-radial-menu-button-container\"}\n >\n <div className=\"core-radial-menu-button-icon\">\n <Icon iconSpec={this.props.icon} />\n </div>\n <div className={\"core-radial-menu-button-content\"}>\n {this.props.children}\n </div>\n </div>\n </foreignObject>\n </g>\n );\n }\n\n /** Manually call this.props.onSelect */\n public select = () => {\n if (this.props.onSelect) this.props.onSelect(undefined);\n };\n\n private _handleClick = (event: React.MouseEvent<SVGElement>) => {\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<SVGElement>) => {\n this.setState({ hover: true });\n };\n\n private _handleMouseOut = (_event: React.MouseEvent<SVGElement>) => {\n this.setState({ hover: false });\n };\n}\n"]}
1
+ {"version":3,"file":"RadialMenu.js","sourceRoot":"","sources":["../../../src/core-react/radialmenu/RadialMenu.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAsCtD;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAGrC;IACS,KAAK,GAA0B,IAAI,CAAC;IACpC,eAAe,GAAwB,IAAI,CAAC;IAC7C,MAAM,CAAC,YAAY,GAA6B;QACrD,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,CAAC,CAAC;KACb,CAAC;IAEuB,KAAK,GAA8B;QAC1D,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,YAAY,KAAsB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAEe,MAAM;QACpB,MAAM,K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KAAK,CAAC,CAAC;IACtD,CAAC,CAAC;IAEM,gBAAgB,GAAG,CAAC,MAAoC,EAAE,EAAE;QAClE,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjC,CAAC,CAAC;IAEM,eAAe,GAAG,CAAC,MAAoC,EAAE,EAAE;QACjE,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC,CAAC;CACH","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RadialMenu\n */\n\nimport \"./RadialMenu.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { IconSpec } from \"../icons/IconComponent.js\";\nimport { Icon } from \"../icons/IconComponent.js\";\nimport { Point } from \"../utils/Point.js\";\nimport type { CommonProps } from \"../utils/Props.js\";\nimport { AnnularSector, Annulus } from \"./Annulus.js\";\nimport type { ContextMenu } from \"../contextmenu/ContextMenu.js\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** Properties for [[RadialMenu]]\n * @public\n * @deprecated in 4.14.0. Props of deprecated component {@link RadialMenu}.\n */\nexport interface RadialMenuProps extends CommonProps {\n /** Whether to show RadialMenu */\n opened: boolean;\n /** Radius of inner portion of RadialMenu */\n innerRadius: number;\n /** Radius of outer portion of RadialMenu */\n outerRadius: number;\n /** Optional parameter to specify left position in viewport. */\n left?: number | string;\n /** Optional parameter to specify top position in viewport. */\n top?: number | string;\n /** Whether to rotate labels according to location on the RadialMenu, or to keep labels upright.\n * Default: false\n */\n labelRotate?: boolean;\n /** Which child RadialButton to highlight */\n selected?: number;\n /** triggered in case of onClick events anywhere other than radial menu */\n onBlur?: (event: any) => any;\n /** triggered onKeyUp for <Esc> key */\n onEsc?: (event: any) => any;\n /** Content */\n children?: React.ReactNode;\n}\n\ninterface RadialMenuState {\n sectors: AnnularSector[];\n}\n\n/** A context menu arranged in a radial layout.\n * @public\n * @deprecated in 4.14.0. Use {@link ContextMenu} or {@link https://itwinui.bentley.com/docs/dropdownmenu iTwinUI dropdown menu} instead.\n */\nexport class RadialMenu extends React.Component<\n RadialMenuProps,\n RadialMenuState\n> {\n private _root: HTMLDivElement | null = null;\n private _selectedButton: RadialButton | null = null;\n public static defaultProps: Partial<RadialMenuProps> = {\n labelRotate: false,\n selected: -1,\n };\n\n public override readonly state: Readonly<RadialMenuState> = {\n sectors: [],\n };\n\n constructor(props: RadialMenuProps) {\n super(props);\n }\n\n public override render(): React.ReactElement {\n const width = 2 * (this.props.outerRadius + 1);\n let x = this.props.left,\n y = this.props.top;\n\n if (\n this.props.left &&\n this.props.top &&\n typeof this.props.left === \"number\" &&\n typeof this.props.top === \"number\"\n ) {\n x = this.props.left;\n y = this.props.top;\n\n if (x < 0) x = 0;\n if (x > window.innerWidth - width) x = window.innerWidth - width;\n if (y < 0) y = 0;\n if (y > window.innerHeight - width) y = window.innerHeight - width;\n }\n\n const divStyle: React.CSSProperties = {\n left: x,\n top: y,\n ...this.props.style,\n };\n\n return (\n <div\n ref={(el) => {\n this._root = el;\n }}\n className={classnames(\n \"core-radial-menu\",\n { opened: this.props.opened },\n this.props.className\n )}\n style={divStyle}\n data-testid=\"core-radial-menu\"\n >\n <svg\n xmlns=\"http://w3.org/2000/svg\"\n version=\"1.1\"\n width={width}\n height={width}\n className={\"core-radial-menu-container\"}\n >\n {React.Children.map(\n this.props.children,\n (child, index): React.ReactNode => {\n if (!child || typeof child !== \"object\" || !(\"props\" in child))\n return child;\n\n const childElement = child as React.ReactElement<any>;\n return React.cloneElement(childElement, {\n key: index,\n ref: (el: any) => {\n if (this.props.selected === index) this._selectedButton = el;\n },\n selected: index === this.props.selected,\n labelRotate:\n childElement.props.labelRotate || this.props.labelRotate,\n annularSector: this.state.sectors[index],\n });\n }\n )}\n </svg>\n </div>\n );\n }\n\n public override componentDidMount() {\n this._generateAnnularSectors();\n\n setTimeout(() => {\n window.addEventListener(\"keyup\", this._handleKeyUp);\n window.addEventListener(\"mouseup\", this._handleClick);\n });\n }\n\n public override componentWillUnmount() {\n window.removeEventListener(\"keyup\", this._handleKeyUp);\n window.removeEventListener(\"mouseup\", this._handleClick);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: RadialMenuProps) {\n if (\n prevProps.innerRadius !== this.props.innerRadius ||\n prevProps.outerRadius !== this.props.outerRadius\n ) {\n this._generateAnnularSectors();\n }\n }\n\n private _handleKeyUp = (event: KeyboardEvent) => {\n if (event.key === Key.Escape.valueOf() && this.props.onEsc)\n this.props.onEsc(event);\n };\n\n private _handleClick = (event: MouseEvent) => {\n if (\n event.target instanceof HTMLElement &&\n this._root &&\n !event.target.contains(this._root) &&\n this.props.onBlur\n )\n this.props.onBlur(event);\n };\n\n /** Manually call onSelect of highlighted button. */\n public select = () => {\n if (this._selectedButton) this._selectedButton.select();\n };\n\n private _generateAnnularSectors = () => {\n const n = React.Children.count(this.props.children);\n const angle = (2 * Math.PI) / n;\n const outer = this.props.outerRadius;\n const inner = this.props.innerRadius;\n\n const offset = -Math.PI / 8;\n const annulus = new Annulus(\n new Point(outer + 1, outer + 1),\n inner + 1,\n outer - 1\n );\n const sectors: AnnularSector[] = [];\n for (let i = 0; i < n; i++) {\n sectors.push(\n new AnnularSector(annulus, angle * i + offset, angle * (i + 1) + offset)\n );\n }\n this.setState({ sectors });\n };\n}\n\n/** Properties for [[RadialButton]] component\n * @public\n * @deprecated in 4.14.0. Props of deprecated component {@link RadialButton}.\n */\nexport interface RadialButtonProps extends CommonProps {\n /** Whether label is rotated to radial menu. Default: Inherit */\n labelRotate?: boolean;\n /** which icon to display in on the menu button */\n icon?: IconSpec;\n /** @internal */\n annularSector?: AnnularSector;\n /** listens to any onClick event, or any select event, which can be triggered by the select() method. */\n onSelect?: (e: any) => any;\n /** Whether item is highlighted */\n selected?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\ninterface RadialButtonState {\n hover: boolean;\n}\n\n/** Button for use within a [[RadialMenu]]\n * @public\n * @deprecated in 4.14.0. Component used in a deprecated component {@link RadialMenu}.\n */\nexport class RadialButton extends React.Component<\n RadialButtonProps,\n RadialButtonState\n> {\n public override readonly state: Readonly<RadialButtonState> = {\n hover: this.props.selected || false,\n };\n\n constructor(props: RadialButtonProps) {\n super(props);\n }\n\n public override render(): React.ReactElement {\n const sector = this.props.annularSector;\n let p = new Point();\n let size = 0;\n let t = \"\";\n let path = \"\";\n\n if (sector) {\n size = sector.start.p1.getDistanceTo(sector.end.p2) * 2;\n path = sector.path;\n\n const parent = sector.parent;\n const { x: cx, y: cy } = parent.center;\n const r = (parent.inner.radius + parent.outer.radius) / 2;\n const angle = (sector.startAngle + sector.endAngle) / 2;\n p = new Point(cx + r * Math.cos(angle), cy + r * Math.sin(angle));\n\n if (this.props.labelRotate) {\n let a = (angle * 180) / Math.PI + 90;\n while (a > 180) a -= 360;\n while (a < -180) a += 360;\n if (a > 90) a -= 180;\n if (a < -90) a += 180;\n t = `rotate(${a} ${p.x}, ${p.y})`;\n }\n }\n\n return (\n <g\n onMouseOver={this._handleMouseOver}\n onMouseOut={this._handleMouseOut}\n onClick={this._handleClick}\n >\n <path\n className={classnames(\n \"core-radial-menu-sector\",\n { selected: this.state.hover },\n this.props.className\n )}\n style={this.props.style}\n d={path}\n ></path>\n <foreignObject\n transform={t}\n x={p.x - size / 2}\n y={p.y - 16}\n width={size}\n height={size}\n className={\"core-radial-menu-button-svg\"}\n >\n <div\n {...{ xmlns: \"http://www.w3.org/1999/xhtml\" }}\n className={\"core-radial-menu-button-container\"}\n >\n <div className=\"core-radial-menu-button-icon\">\n <Icon iconSpec={this.props.icon} />\n </div>\n <div className={\"core-radial-menu-button-content\"}>\n {this.props.children}\n </div>\n </div>\n </foreignObject>\n </g>\n );\n }\n\n /** Manually call this.props.onSelect */\n public select = () => {\n if (this.props.onSelect) this.props.onSelect(undefined);\n };\n\n private _handleClick = (event: React.MouseEvent<SVGElement>) => {\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<SVGElement>) => {\n this.setState({ hover: true });\n };\n\n private _handleMouseOut = (_event: React.MouseEvent<SVGElement>) => {\n this.setState({ hover: false });\n };\n}\n"]}