@itwin/core-react 4.10.0 → 4.11.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 (108) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/lib/cjs/core-react/UiCore.d.ts +1 -1
  3. package/lib/cjs/core-react/UiCore.js +2 -4
  4. package/lib/cjs/core-react/UiCore.js.map +1 -1
  5. package/lib/cjs/core-react/badge/BadgeUtilities.d.ts +10 -2
  6. package/lib/cjs/core-react/badge/BadgeUtilities.d.ts.map +1 -1
  7. package/lib/cjs/core-react/badge/BadgeUtilities.js +9 -5
  8. package/lib/cjs/core-react/badge/BadgeUtilities.js.map +1 -1
  9. package/lib/cjs/core-react/base/Gap.js +1 -1
  10. package/lib/cjs/core-react/base/Gap.js.map +1 -1
  11. package/lib/cjs/core-react/contextmenu/ContextMenu.js +2 -1
  12. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  13. package/lib/cjs/core-react/contextmenu/ContextMenu.scss +0 -1
  14. package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts +1 -1
  15. package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
  16. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  17. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +5 -3
  18. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  19. package/lib/cjs/core-react/dialog/Dialog.js +2 -2
  20. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  21. package/lib/cjs/core-react/dialog/GlobalDialog.js +2 -1
  22. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  23. package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
  24. package/lib/cjs/core-react/elementseparator/ElementSeparator.js +5 -5
  25. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  26. package/lib/cjs/core-react/hocs/withOnOutsideClick.js +2 -1
  27. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  28. package/lib/cjs/core-react/icons/IconComponent.js +1 -1
  29. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  30. package/lib/cjs/core-react/inputs/input-label.scss +1 -2
  31. package/lib/cjs/core-react/inputs/variables.scss +0 -2
  32. package/lib/cjs/core-react/listbox/Listbox.js +3 -2
  33. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  34. package/lib/cjs/core-react/notification/MessageRenderer.js +1 -1
  35. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  36. package/lib/cjs/core-react/popup/Popup.js +8 -4
  37. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  38. package/lib/cjs/core-react/tabs/tabs.scss +1 -1
  39. package/lib/cjs/core-react/tree/Node.js +2 -1
  40. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  41. package/lib/cjs/core-react/useTranslation.d.ts +10 -0
  42. package/lib/cjs/core-react/useTranslation.d.ts.map +1 -0
  43. package/lib/cjs/core-react/useTranslation.js +20 -0
  44. package/lib/cjs/core-react/useTranslation.js.map +1 -0
  45. package/lib/cjs/core-react/utils/IconWebComponent.js +1 -1
  46. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  47. package/lib/cjs/core-react/utils/getCssVariable.js +1 -1
  48. package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
  49. package/lib/cjs/core-react/utils/getObjectClassName.js +3 -2
  50. package/lib/cjs/core-react/utils/getObjectClassName.js.map +1 -1
  51. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js +2 -1
  52. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  53. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +14 -8
  54. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  55. package/lib/esm/core-react/UiCore.d.ts +1 -1
  56. package/lib/esm/core-react/UiCore.js +2 -4
  57. package/lib/esm/core-react/UiCore.js.map +1 -1
  58. package/lib/esm/core-react/badge/BadgeUtilities.d.ts +10 -2
  59. package/lib/esm/core-react/badge/BadgeUtilities.d.ts.map +1 -1
  60. package/lib/esm/core-react/badge/BadgeUtilities.js +6 -2
  61. package/lib/esm/core-react/badge/BadgeUtilities.js.map +1 -1
  62. package/lib/esm/core-react/base/Gap.js +1 -1
  63. package/lib/esm/core-react/base/Gap.js.map +1 -1
  64. package/lib/esm/core-react/contextmenu/ContextMenu.js +2 -1
  65. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  66. package/lib/esm/core-react/contextmenu/ContextMenu.scss +0 -1
  67. package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts +1 -1
  68. package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
  69. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  70. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +5 -3
  71. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  72. package/lib/esm/core-react/dialog/Dialog.js +2 -2
  73. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  74. package/lib/esm/core-react/dialog/GlobalDialog.js +2 -1
  75. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  76. package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
  77. package/lib/esm/core-react/elementseparator/ElementSeparator.js +5 -5
  78. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  79. package/lib/esm/core-react/hocs/withOnOutsideClick.js +2 -1
  80. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  81. package/lib/esm/core-react/icons/IconComponent.js +1 -1
  82. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  83. package/lib/esm/core-react/inputs/input-label.scss +1 -2
  84. package/lib/esm/core-react/inputs/variables.scss +0 -2
  85. package/lib/esm/core-react/listbox/Listbox.js +3 -2
  86. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  87. package/lib/esm/core-react/notification/MessageRenderer.js +1 -1
  88. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  89. package/lib/esm/core-react/popup/Popup.js +8 -4
  90. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  91. package/lib/esm/core-react/tabs/tabs.scss +1 -1
  92. package/lib/esm/core-react/tree/Node.js +2 -1
  93. package/lib/esm/core-react/tree/Node.js.map +1 -1
  94. package/lib/esm/core-react/useTranslation.d.ts +10 -0
  95. package/lib/esm/core-react/useTranslation.d.ts.map +1 -0
  96. package/lib/esm/core-react/useTranslation.js +16 -0
  97. package/lib/esm/core-react/useTranslation.js.map +1 -0
  98. package/lib/esm/core-react/utils/IconWebComponent.js +1 -1
  99. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  100. package/lib/esm/core-react/utils/getCssVariable.js +1 -1
  101. package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
  102. package/lib/esm/core-react/utils/getObjectClassName.js +3 -2
  103. package/lib/esm/core-react/utils/getObjectClassName.js.map +1 -1
  104. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js +2 -1
  105. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  106. package/lib/esm/core-react/utils/hooks/useResizeObserver.js +14 -8
  107. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  108. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useResizeObserver.tsx"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,+BAA+B;AAC/B,qEAA0D;AAC1D,iDAA8C;AAC9C,uCAAoC;AAEpC;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,QAAkD;IAElD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EA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ACtC,KAAK,EAAE,KAAK,IAEX,WAAW,IAAI,QAAQ,CACpB,CACP,CAAC;AACJ,CAAC;AAjDD,gEAiDC","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 Utilities\n */\nimport * as React from \"react\";\nimport { ResizeObserver } from \"./ResizeObserverPolyfill\";\nimport { useRefEffect } from \"./useRefEffect\";\nimport { useRefs } from \"./useRefs\";\n\n/** Uses ResizeObserver API to notify about element bound changes.\n * @internal\n */\nexport function useResizeObserver<T extends Element>(\n onResize?: (width: number, height: number) => void\n) {\n const bounds = React.useRef({ width: 0, height: 0 });\n const resizeObserver = React.useRef<ResizeObserver | null>(null);\n const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active\n const isMountedRef = React.useRef(false);\n const owningWindowRef = React.useRef<any>(null);\n\n // istanbul ignore next\n const resizeObserverCleanup = () => {\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n\n React.useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n owningWindowRef.current?.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n };\n }, []);\n\n const processResize = React.useCallback(\n (target: HTMLElement) => {\n const newBounds = target.getBoundingClientRect();\n // istanbul ignore else\n if (\n isMountedRef.current &&\n (bounds.current.width !== newBounds.width ||\n bounds.current.height !== newBounds.height)\n ) {\n bounds.current = newBounds;\n onResize && onResize(newBounds.width, newBounds.height);\n }\n },\n [onResize]\n );\n\n const handleResize = React.useCallback(\n (entries: any[]) => {\n // istanbul ignore if\n if (\n !isMountedRef.current ||\n !Array.isArray(entries) ||\n 0 === entries.length\n ) {\n return;\n }\n const target = entries[0].target as HTMLElement;\n // istanbul ignore next\n owningWindowRef.current &&\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n\n owningWindowRef.current = target.ownerDocument.defaultView;\n // istanbul ignore else\n if (owningWindowRef.current) {\n owningWindowRef.current.addEventListener(\n \"unload\",\n resizeObserverCleanup\n );\n\n // using requestAnimationFrame to stop the \"ResizeObserver loop completed with undelivered notifications.\" and\n // \"ResizeObserver loop limit exceeded\" messages reported to window.onError\n rafRef.current = owningWindowRef.current.requestAnimationFrame(() =>\n processResize(target)\n );\n }\n },\n [processResize]\n );\n\n const observerRef = useRefEffect(\n (instance: T | null) => {\n resizeObserver.current = new ResizeObserver(handleResize);\n if (instance) {\n resizeObserver.current.observe(instance);\n const newBounds = instance.getBoundingClientRect();\n onResize && onResize(newBounds.width, newBounds.height);\n bounds.current = newBounds;\n }\n\n return () => {\n instance &&\n /* istanbul ignore next */ resizeObserver.current?.unobserve(\n instance\n );\n resizeObserver.current = null;\n };\n },\n [handleResize, onResize]\n );\n\n const handleRef = React.useCallback(\n (instance: Element | null) => {\n const newBounds = instance && instance.getBoundingClientRect();\n // istanbul ignore if\n if (\n newBounds &&\n (bounds.current.width !== newBounds.width ||\n bounds.current.height !== newBounds.height)\n ) {\n bounds.current = newBounds;\n onResize && onResize(newBounds.width, newBounds.height);\n }\n },\n [onResize]\n );\n\n const ref = useRefs(handleRef, observerRef);\n return ref;\n}\n\n/** React hook that uses ResizeObserver API to notify about element bound changes. Note: to work similar to ReactResizeDetector\n * width and height are initialized as undefined and only set during after mount if bounds are non-zero. This implementation properly\n * handles observing element in pop-out/child windows.\n * @internal\n */\nexport function useLayoutResizeObserver(\n inElement: HTMLElement | null,\n onResize?: (width?: number, height?: number) => void\n) {\n const inBoundingRect = inElement?.getBoundingClientRect();\n const [bounds, setBounds] = React.useState<{\n width?: number;\n height?: number;\n }>({ width: inBoundingRect?.width, height: inBoundingRect?.height });\n const [watchedElement, setWatchedElement] = React.useState(inElement);\n const resizeObserver = React.useRef<ResizeObserver | null>(null);\n const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active\n const isMountedRef = React.useRef(false);\n const owningWindowRef = React.useRef<any>(null);\n\n // istanbul ignore next\n const resizeObserverCleanup = () => {\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n\n React.useEffect(() => {\n isMountedRef.current = true;\n setWatchedElement(inElement);\n\n // istanbul ignore next\n if (inElement) {\n const newBounds = inElement.getBoundingClientRect();\n onResize && onResize(newBounds.width, newBounds.height);\n setBounds(newBounds);\n }\n\n return () => {\n isMountedRef.current = false;\n rafRef.current &&\n owningWindowRef.current &&\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n owningWindowRef.current &&\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n };\n }, [onResize, inElement]);\n\n const processResize = React.useCallback(\n (target: HTMLElement) => {\n const newBounds = target.getBoundingClientRect();\n // istanbul ignore next\n if (\n isMountedRef.current &&\n (bounds.width !== newBounds.width || bounds.height !== newBounds.height)\n ) {\n onResize && onResize(newBounds.width, newBounds.height);\n setBounds(newBounds);\n }\n },\n [bounds.height, bounds.width, onResize]\n );\n\n const handleResize = React.useCallback(\n (entries: any[]) => {\n // istanbul ignore next\n if (\n !isMountedRef.current ||\n !Array.isArray(entries) ||\n 0 === entries.length\n ) {\n return;\n }\n const target = entries[0].target as HTMLElement;\n // istanbul ignore next\n if (owningWindowRef.current)\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n\n owningWindowRef.current = target.ownerDocument.defaultView;\n // istanbul ignore else\n if (owningWindowRef.current) {\n owningWindowRef.current.addEventListener(\n \"unload\",\n resizeObserverCleanup\n );\n\n // using requestAnimationFrame to stop the \"ResizeObserver loop completed with undelivered notifications.\" and\n // \"ResizeObserver loop limit exceeded\" messages reported to window.onError\n rafRef.current = owningWindowRef.current.requestAnimationFrame(() =>\n processResize(target)\n );\n }\n },\n [processResize]\n );\n\n React.useLayoutEffect(() => {\n if (!watchedElement) {\n return;\n }\n resizeObserver.current = new ResizeObserver(handleResize);\n resizeObserver.current.observe(watchedElement);\n return () => {\n // istanbul ignore next\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n }, [handleResize, watchedElement]);\n\n return [bounds.width, bounds.height];\n}\n\n/** Prop the ElementResizeObserver sends to the render function.\n * @public\n */\nexport interface RenderPropsArgs {\n width?: number;\n height?: number;\n}\n\n/** ElementResizeObserver provides functionality similar to ReactResizeDetector when a render function is specified. This implementation properly handles\n * observing element in pop-out/child windows.\n * @public\n */\nexport function ElementResizeObserver({\n watchedElement,\n render,\n}: {\n watchedElement: HTMLElement | null;\n render: (props: RenderPropsArgs) => React.ReactElement;\n}) {\n const [width, height] = useLayoutResizeObserver(watchedElement);\n return render({ width, height });\n}\n\n/** ResizableContainerObserver is a component that provides the functionality similar to the ReactResizeDetector option that call a function when\n * the observed element is resized. This implementation properly handles observing element in pop-out/child windows. If children nodes are defined then\n * the div added by the component is considered the container whose size will be observed. If no children are provided then the component will report\n * size changes from its parent container.\n * @public\n */\nexport function ResizableContainerObserver({\n onResize,\n children,\n}: {\n onResize: (width: number, height: number) => void;\n children?: React.ReactNode;\n}) {\n const containerRef = React.useRef<HTMLDivElement>(null); // set to non-zero when requestAnimationFrame processing is active\n const [containerElement, setContainerElement] =\n React.useState<HTMLElement | null>(null);\n const isMountedRef = React.useRef(false);\n const hasChildren = React.Children.count(children) !== 0;\n\n // if no children are specified then monitor size of parent element.\n React.useEffect(() => {\n // istanbul ignore next\n if (!isMountedRef.current && containerRef.current) {\n isMountedRef.current = true;\n const hasParent = !!containerRef.current.parentElement;\n setContainerElement(\n hasChildren && hasParent\n ? containerRef.current\n : containerRef.current.parentElement\n );\n }\n }, [hasChildren]);\n\n const processResize = React.useCallback(\n (width?: number, height?: number) => {\n // istanbul ignore next\n onResize(width ?? 0, height ?? 0);\n },\n [onResize]\n );\n\n useLayoutResizeObserver(containerElement, processResize);\n const style: React.CSSProperties = hasChildren\n ? { width: \"100%\", height: \"100%\" }\n : { display: \"none\" };\n\n return (\n <div\n ref={containerRef}\n className=\"uicore-resizable-container\"\n style={style}\n >\n {hasChildren && children}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useResizeObserver.tsx"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,+BAA+B;AAC/B,qEAA0D;AAC1D,iDAA8C;AAC9C,uCAAoC;AAEpC;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,QAAkD;IAElD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,kEAAkE;IAClG,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAM,IAAI,CAAC,CAAC;IAEhD,uBAAuB;IACvB,MAAM,qBAAqB,GAAG,GAAG,EAAE;;QACjC,IAAI,MAAM,CAAC,OAAO;YAChB,eAAe,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE/D,MAAA,cAAc,CAAC,OAAO,0CAAE,UAAU,EAAE,CAAC;QACrC,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC;IAChC,CAAC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;QAC5B,OAAO,GAAG,EAAE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B,CACjB,WAAW,IAAI,SAAS;gBACtB,CAAC,CAAC,YAAY,CAAC,OAAO;gBACtB,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CACvC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CACrC,CAAC,KAAc,EAAE,MAAe,EAAE,EAAE;QAClC,uBAAuB;QACvB,QAAQ,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,CAAC,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,CAAC,CAAC,CAAC;IACpC,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,uBAAuB,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IACzD,MAAM,KAAK,GAAwB,WAAW;QAC5C,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;QACnC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAExB,OAAO,CACL,6BACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE,KAAK,IAEX,WAAW,IAAI,QAAQ,CACpB,CACP,CAAC;AACJ,CAAC;AAjDD,gEAiDC","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 Utilities\n */\nimport * as React from \"react\";\nimport { ResizeObserver } from \"./ResizeObserverPolyfill\";\nimport { useRefEffect } from \"./useRefEffect\";\nimport { useRefs } from \"./useRefs\";\n\n/** Uses ResizeObserver API to notify about element bound changes.\n * @internal\n */\nexport function useResizeObserver<T extends Element>(\n onResize?: (width: number, height: number) => void\n) {\n const bounds = React.useRef({ width: 0, height: 0 });\n const resizeObserver = React.useRef<ResizeObserver | null>(null);\n const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active\n const isMountedRef = React.useRef(false);\n const owningWindowRef = React.useRef<any>(null);\n\n // istanbul ignore next\n const resizeObserverCleanup = () => {\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n\n React.useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n owningWindowRef.current?.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n };\n }, []);\n\n const processResize = React.useCallback(\n (target: HTMLElement) => {\n const newBounds = target.getBoundingClientRect();\n // istanbul ignore else\n if (\n isMountedRef.current &&\n (bounds.current.width !== newBounds.width ||\n bounds.current.height !== newBounds.height)\n ) {\n bounds.current = newBounds;\n onResize && onResize(newBounds.width, newBounds.height);\n }\n },\n [onResize]\n );\n\n const handleResize = React.useCallback(\n (entries: any[]) => {\n // istanbul ignore if\n if (\n !isMountedRef.current ||\n !Array.isArray(entries) ||\n 0 === entries.length\n ) {\n return;\n }\n const target = entries[0].target as HTMLElement;\n // istanbul ignore next\n owningWindowRef.current &&\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n\n owningWindowRef.current = target.ownerDocument.defaultView;\n // istanbul ignore else\n if (owningWindowRef.current) {\n owningWindowRef.current.addEventListener(\n \"unload\",\n resizeObserverCleanup\n );\n\n // using requestAnimationFrame to stop the \"ResizeObserver loop completed with undelivered notifications.\" and\n // \"ResizeObserver loop limit exceeded\" messages reported to window.onError\n rafRef.current = owningWindowRef.current.requestAnimationFrame(() =>\n processResize(target)\n );\n }\n },\n [processResize]\n );\n\n const observerRef = useRefEffect(\n (instance: T | null) => {\n resizeObserver.current = new ResizeObserver(handleResize);\n if (instance) {\n resizeObserver.current.observe(instance);\n const newBounds = instance.getBoundingClientRect();\n onResize && onResize(newBounds.width, newBounds.height);\n bounds.current = newBounds;\n }\n\n return () => {\n instance &&\n /* istanbul ignore next */ resizeObserver.current?.unobserve(\n instance\n );\n resizeObserver.current = null;\n };\n },\n [handleResize, onResize]\n );\n\n const handleRef = React.useCallback(\n (instance: Element | null) => {\n const newBounds = instance && instance.getBoundingClientRect();\n // istanbul ignore if\n if (\n newBounds &&\n (bounds.current.width !== newBounds.width ||\n bounds.current.height !== newBounds.height)\n ) {\n bounds.current = newBounds;\n onResize && onResize(newBounds.width, newBounds.height);\n }\n },\n [onResize]\n );\n\n const ref = useRefs(handleRef, observerRef);\n return ref;\n}\n\n/** React hook that uses ResizeObserver API to notify about element bound changes. Note: to work similar to ReactResizeDetector\n * width and height are initialized as undefined and only set during after mount if bounds are non-zero. This implementation properly\n * handles observing element in pop-out/child windows.\n * @internal\n */\nexport function useLayoutResizeObserver(\n inElement: HTMLElement | null,\n onResize?: (width?: number, height?: number) => void\n) {\n const inBoundingRect = inElement?.getBoundingClientRect();\n const [bounds, setBounds] = React.useState<{\n width?: number;\n height?: number;\n }>({ width: inBoundingRect?.width, height: inBoundingRect?.height });\n const [watchedElement, setWatchedElement] = React.useState(inElement);\n const resizeObserver = React.useRef<ResizeObserver | null>(null);\n const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active\n const isMountedRef = React.useRef(false);\n const owningWindowRef = React.useRef<any>(null);\n\n // istanbul ignore next\n const resizeObserverCleanup = () => {\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n\n React.useEffect(() => {\n isMountedRef.current = true;\n setWatchedElement(inElement);\n\n // istanbul ignore next\n if (inElement) {\n const newBounds = inElement.getBoundingClientRect();\n onResize && onResize(newBounds.width, newBounds.height);\n setBounds(newBounds);\n }\n\n return () => {\n isMountedRef.current = false;\n rafRef.current &&\n owningWindowRef.current &&\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n owningWindowRef.current &&\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n };\n }, [onResize, inElement]);\n\n const processResize = React.useCallback(\n (target: HTMLElement) => {\n const newBounds = target.getBoundingClientRect();\n // istanbul ignore next\n if (\n isMountedRef.current &&\n (bounds.width !== newBounds.width || bounds.height !== newBounds.height)\n ) {\n onResize && onResize(newBounds.width, newBounds.height);\n setBounds(newBounds);\n }\n },\n [bounds.height, bounds.width, onResize]\n );\n\n const handleResize = React.useCallback(\n (entries: any[]) => {\n // istanbul ignore next\n if (\n !isMountedRef.current ||\n !Array.isArray(entries) ||\n 0 === entries.length\n ) {\n return;\n }\n const target = entries[0].target as HTMLElement;\n // istanbul ignore next\n if (owningWindowRef.current)\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n\n owningWindowRef.current = target.ownerDocument.defaultView;\n // istanbul ignore else\n if (owningWindowRef.current) {\n owningWindowRef.current.addEventListener(\n \"unload\",\n resizeObserverCleanup\n );\n\n // using requestAnimationFrame to stop the \"ResizeObserver loop completed with undelivered notifications.\" and\n // \"ResizeObserver loop limit exceeded\" messages reported to window.onError\n rafRef.current = owningWindowRef.current.requestAnimationFrame(() =>\n processResize(target)\n );\n }\n },\n [processResize]\n );\n\n React.useLayoutEffect(() => {\n if (!watchedElement) {\n return;\n }\n resizeObserver.current = new ResizeObserver(handleResize);\n resizeObserver.current.observe(watchedElement);\n return () => {\n // istanbul ignore next\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n }, [handleResize, watchedElement]);\n\n return [bounds.width, bounds.height];\n}\n\n/** Prop the ElementResizeObserver sends to the render function.\n * @public\n */\nexport interface RenderPropsArgs {\n width?: number;\n height?: number;\n}\n\n/** ElementResizeObserver provides functionality similar to ReactResizeDetector when a render function is specified. This implementation properly handles\n * observing element in pop-out/child windows.\n * @public\n */\nexport function ElementResizeObserver({\n watchedElement,\n render,\n}: {\n watchedElement: HTMLElement | null;\n render: (props: RenderPropsArgs) => React.ReactElement;\n}) {\n const [width, height] = useLayoutResizeObserver(watchedElement);\n return render({ width, height });\n}\n\n/** ResizableContainerObserver is a component that provides the functionality similar to the ReactResizeDetector option that call a function when\n * the observed element is resized. This implementation properly handles observing element in pop-out/child windows. If children nodes are defined then\n * the div added by the component is considered the container whose size will be observed. If no children are provided then the component will report\n * size changes from its parent container.\n * @public\n */\nexport function ResizableContainerObserver({\n onResize,\n children,\n}: {\n onResize: (width: number, height: number) => void;\n children?: React.ReactNode;\n}) {\n const containerRef = React.useRef<HTMLDivElement>(null); // set to non-zero when requestAnimationFrame processing is active\n const [containerElement, setContainerElement] =\n React.useState<HTMLElement | null>(null);\n const isMountedRef = React.useRef(false);\n const hasChildren = React.Children.count(children) !== 0;\n\n // if no children are specified then monitor size of parent element.\n React.useEffect(() => {\n // istanbul ignore next\n if (!isMountedRef.current && containerRef.current) {\n isMountedRef.current = true;\n const hasParent = !!containerRef.current.parentElement;\n setContainerElement(\n hasChildren && hasParent\n ? containerRef.current\n : containerRef.current.parentElement\n );\n }\n }, [hasChildren]);\n\n const processResize = React.useCallback(\n (width?: number, height?: number) => {\n // istanbul ignore next\n onResize(width ?? 0, height ?? 0);\n },\n [onResize]\n );\n\n useLayoutResizeObserver(containerElement, processResize);\n const style: React.CSSProperties = hasChildren\n ? { width: \"100%\", height: \"100%\" }\n : { display: \"none\" };\n\n return (\n <div\n ref={containerRef}\n className=\"uicore-resizable-container\"\n style={style}\n >\n {hasChildren && children}\n </div>\n );\n}\n"]}
@@ -29,7 +29,7 @@ export declare class UiCore {
29
29
  static get localization(): Localization;
30
30
  /** The internationalization service namespace. */
31
31
  static get localizationNamespace(): string;
32
- /** Calls localization.getLocalizedStringWithNamespace with the "UiCore" namespace. Do NOT include the namespace in the key.
32
+ /** Calls localization.getLocalizedString with the "UiCore" namespace. Do NOT include the namespace in the key.
33
33
  * @internal
34
34
  */
35
35
  static translate(key: string | string[]): string;
@@ -61,7 +61,7 @@ class UiCore {
61
61
  static get localizationNamespace() {
62
62
  return "UiCore";
63
63
  }
64
- /** Calls localization.getLocalizedStringWithNamespace with the "UiCore" namespace. Do NOT include the namespace in the key.
64
+ /** Calls localization.getLocalizedString with the "UiCore" namespace. Do NOT include the namespace in the key.
65
65
  * @internal
66
66
  */
67
67
  static translate(key) {
@@ -69,9 +69,7 @@ class UiCore {
69
69
  Logger.logError(UiCore.loggerCategory(this), `translate: UiCore must be initialize with a localization provider. Returning blank string.`);
70
70
  return "";
71
71
  }
72
- return UiCore._localization.getLocalizedString(key, {
73
- ns: UiCore.localizationNamespace,
74
- });
72
+ return UiCore._localization.getLocalizedString(`${UiCore.localizationNamespace}:${key}`);
75
73
  }
76
74
  /** @internal */
77
75
  static get packageName() {
@@ -1 +1 @@
1
- {"version":3,"file":"UiCore.js","sourceRoot":"","sources":["../../../src/core-react/UiCore.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,4EAA4E;AAC5E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,2CAA2C;AAE3C;;;GAGG;AACH,MAAa,MAAM;IAIjB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAA0B;QACvD,IAAI,MAAM,CAAC,YAAY,EAAE;YACvB,MAAM,CAAC,OAAO,CACZ,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAC7B,kCAAkC,CACnC,CAAC;YACF,OAAO;SACR;QAED,MAAM,CAAC,aAAa,GAAG,YAAY,CAAC;QACpC,MAAM,MAAM,CAAC,aA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AC,qBAAqB;SACjC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzE,OAAO,QAAQ,CAAC;IAClB,CAAC;;AApFc,mBAAY,GAAG,KAAK,CAAC;SADzB,MAAM","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 Utilities\n */\n\n/** Import color variables, layout variables and Sass classes barrel file */\nimport \"./colorthemes.scss\";\nimport \"./colorvariables.scss\";\nimport \"./layout-variables.scss\";\nimport \"./classes.scss\";\n\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { Localization } from \"@itwin/core-common\";\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { IconWebComponent } from \"./utils/IconWebComponent\";\nimport { getObjectClassName } from \"./utils/getObjectClassName\";\n// cSpell:ignore colorthemes colorvariables\n\n/**\n * Manages the Localization service for the core-react package.\n * @public\n */\nexport class UiCore {\n private static _initialized = false;\n private static _localization?: Localization;\n\n /**\n * Registers the Localization service namespace for UiCore.\n * @param localization The internationalization service created by the host application.\n */\n public static async initialize(localization: Localization): Promise<void> {\n if (UiCore._initialized) {\n Logger.logInfo(\n UiCore.loggerCategory(UiCore),\n `UiCore.initialize already called`\n );\n return;\n }\n\n UiCore._localization = localization;\n await UiCore._localization.registerNamespace(UiCore.localizationNamespace);\n if (window.customElements.get(\"svg-loader\") === undefined)\n window.customElements.define(\"svg-loader\", IconWebComponent);\n\n UiCore._initialized = true;\n }\n\n /** Unregisters the UiCore localization namespace */\n public static terminate() {\n if (UiCore._localization)\n UiCore._localization.unregisterNamespace(UiCore.localizationNamespace);\n UiCore._localization = undefined;\n\n UiCore._initialized = false;\n }\n\n /** Determines if UiCore has been initialized */\n public static get initialized(): boolean {\n return UiCore._initialized;\n }\n\n /** The internationalization service created by the host application.\n * @internal\n */\n public static get localization(): Localization {\n // istanbul ignore else\n if (!UiCore._localization)\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiCore.loggerCategory(this),\n \"localization: UiCore.initialize has not been called. Unable to return Localization object.\"\n );\n // istanbul ignore next\n return UiCore._localization;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiCore\";\n }\n\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiCore\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiCore._localization) {\n Logger.logError(\n UiCore.loggerCategory(this),\n `translate: UiCore must be initialize with a localization provider. Returning blank string.`\n );\n return \"\";\n }\n return UiCore._localization.getLocalizedString(key, {\n ns: UiCore.localizationNamespace,\n });\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"core-react\";\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getObjectClassName(obj);\n const category = UiCore.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n}\n"]}
1
+ {"version":3,"file":"UiCore.js","sourceRoot":"","sources":["../../../src/core-react/UiCore.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,4EAA4E;AAC5E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,O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OAAO,MAAM,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;YACzB,MAAM,CAAC,QAAQ,CACb,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAC3B,4FAA4F,CAC7F,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QACD,OAAO,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAC5C,GAAG,MAAM,CAAC,qBAAqB,IAAI,GAAG,EAAE,CACzC,CAAC;IACJ,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzE,OAAO,QAAQ,CAAC;IAClB,CAAC;;AApFc,mBAAY,GAAG,KAAK,CAAC;SADzB,MAAM","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 Utilities\n */\n\n/** Import color variables, layout variables and Sass classes barrel file */\nimport \"./colorthemes.scss\";\nimport \"./colorvariables.scss\";\nimport \"./layout-variables.scss\";\nimport \"./classes.scss\";\n\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { Localization } from \"@itwin/core-common\";\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { IconWebComponent } from \"./utils/IconWebComponent\";\nimport { getObjectClassName } from \"./utils/getObjectClassName\";\n// cSpell:ignore colorthemes colorvariables\n\n/**\n * Manages the Localization service for the core-react package.\n * @public\n */\nexport class UiCore {\n private static _initialized = false;\n private static _localization?: Localization;\n\n /**\n * Registers the Localization service namespace for UiCore.\n * @param localization The internationalization service created by the host application.\n */\n public static async initialize(localization: Localization): Promise<void> {\n if (UiCore._initialized) {\n Logger.logInfo(\n UiCore.loggerCategory(UiCore),\n `UiCore.initialize already called`\n );\n return;\n }\n\n UiCore._localization = localization;\n await UiCore._localization.registerNamespace(UiCore.localizationNamespace);\n if (window.customElements.get(\"svg-loader\") === undefined)\n window.customElements.define(\"svg-loader\", IconWebComponent);\n\n UiCore._initialized = true;\n }\n\n /** Unregisters the UiCore localization namespace */\n public static terminate() {\n if (UiCore._localization)\n UiCore._localization.unregisterNamespace(UiCore.localizationNamespace);\n UiCore._localization = undefined;\n\n UiCore._initialized = false;\n }\n\n /** Determines if UiCore has been initialized */\n public static get initialized(): boolean {\n return UiCore._initialized;\n }\n\n /** The internationalization service created by the host application.\n * @internal\n */\n public static get localization(): Localization {\n // istanbul ignore else\n if (!UiCore._localization)\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiCore.loggerCategory(this),\n \"localization: UiCore.initialize has not been called. Unable to return Localization object.\"\n );\n // istanbul ignore next\n return UiCore._localization;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiCore\";\n }\n\n /** Calls localization.getLocalizedString with the \"UiCore\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiCore._localization) {\n Logger.logError(\n UiCore.loggerCategory(this),\n `translate: UiCore must be initialize with a localization provider. Returning blank string.`\n );\n return \"\";\n }\n return UiCore._localization.getLocalizedString(\n `${UiCore.localizationNamespace}:${key}`\n );\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"core-react\";\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getObjectClassName(obj);\n const category = UiCore.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n}\n"]}
@@ -2,8 +2,16 @@
2
2
  * @module Utilities
3
3
  */
4
4
  import * as React from "react";
5
- import { BadgeType } from "@itwin/appui-abstract";
6
- /** Converts BetaType to Badge React component
5
+ import { BadgeType as _BadgeType } from "@itwin/appui-abstract";
6
+ /** Specifies type of badge, if any, that should be overlaid on UI component.
7
+ * @public
8
+ */
9
+ export type BadgeType = _BadgeType;
10
+ /** Specifies type of badge, if any, that should be overlaid on UI component.
11
+ * @public
12
+ */
13
+ export declare const BadgeType: typeof _BadgeType;
14
+ /** Converts BadgeType to Badge React component
7
15
  * @internal
8
16
  */
9
17
  export declare class BadgeUtilities {
@@ -1 +1 @@
1
- {"version":3,"file":"BadgeUtilities.d.ts","sourceRoot":"","sources":["../../../../src/core-react/badge/BadgeUtilities.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD;;GAEG;AACH,qBAAa,cAAc;IACzB,iDAAiD;WACnC,wBAAwB,CACpC,SAAS,CAAC,EAAE,SAAS,GACpB,KAAK,CAAC,SAAS;CAmBnB"}
1
+ {"version":3,"file":"BadgeUtilities.d.ts","sourceRoot":"","sources":["../../../../src/core-react/badge/BadgeUtilities.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIhE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,SAAS,mBAAa,CAAC;AAEpC;;GAEG;AACH,qBAAa,cAAc;IACzB,iDAAiD;WACnC,wBAAwB,CACpC,SAAS,CAAC,EAAE,SAAS,GACpB,KAAK,CAAC,SAAS;CAmBnB"}
@@ -6,10 +6,14 @@
6
6
  * @module Utilities
7
7
  */
8
8
  import * as React from "react";
9
- import { BadgeType } from "@itwin/appui-abstract";
9
+ import { BadgeType as _BadgeType } from "@itwin/appui-abstract";
10
10
  import { BetaBadge } from "./BetaBadge";
11
11
  import { NewBadge } from "./NewBadge";
12
- /** Converts BetaType to Badge React component
12
+ /** Specifies type of badge, if any, that should be overlaid on UI component.
13
+ * @public
14
+ */
15
+ export const BadgeType = _BadgeType; // eslint-disable-line @typescript-eslint/no-redeclare, deprecation/deprecation
16
+ /** Converts BadgeType to Badge React component
13
17
  * @internal
14
18
  */
15
19
  export class BadgeUtilities {
@@ -1 +1 @@
1
- {"version":3,"file":"BadgeUtilities.js","sourceRoot":"","sources":["../../../../src/core-react/badge/BadgeUtilities.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,iDAAiD;IAC1C,MAAM,CAAC,wBAAwB,CACpC,SAAqB;QAErB,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAE9C,IAAI,SAA0B,CAAC;QAE/B,QAAQ,SAAS,EAAE;YACjB,KAAK,SAAS,CAAC,gBAAgB;gBAC7B,SAAS,GAAG,oBAAC,SAAS,OAAG,CAAC;gBAC1B,MAAM;YACR,KAAK,SAAS,CAAC,GAAG;gBAChB,SAAS,GAAG,oBAAC,QAAQ,OAAG,CAAC;gBACzB,MAAM;YACR,KAAK,SAAS,CAAC,IAAI;gBACjB,SAAS,GAAG,SAAS,CAAC;gBACtB,MAAM;SACT;QAED,OAAO,SAAS,CAAC;IACnB,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 Utilities\n */\n\nimport * as React from \"react\";\nimport { BadgeType } from \"@itwin/appui-abstract\";\nimport { BetaBadge } from \"./BetaBadge\";\nimport { NewBadge } from \"./NewBadge\";\n\n/** Converts BetaType to Badge React component\n * @internal\n */\nexport class BadgeUtilities {\n /** Converts BetaType to Badge React component */\n public static getComponentForBadgeType(\n badgeType?: BadgeType\n ): React.ReactNode {\n if (badgeType === undefined) return undefined;\n\n let component: React.ReactNode;\n\n switch (badgeType) {\n case BadgeType.TechnicalPreview:\n component = <BetaBadge />;\n break;\n case BadgeType.New:\n component = <NewBadge />;\n break;\n case BadgeType.None:\n component = undefined;\n break;\n }\n\n return component;\n }\n}\n"]}
1
+ {"version":3,"file":"BadgeUtilities.js","sourceRoot":"","sources":["../../../../src/core-react/badge/BadgeUtilities.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,+EAA+E;AAEpH;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,iDAAiD;IAC1C,MAAM,CAAC,wBAAwB,CACpC,SAAqB;QAErB,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAE9C,IAAI,SAA0B,CAAC;QAE/B,QAAQ,SAAS,EAAE;YACjB,KAAK,SAAS,CAAC,gBAAgB;gBAC7B,SAAS,GAAG,oBAAC,SAAS,OAAG,CAAC;gBAC1B,MAAM;YACR,KAAK,SAAS,CAAC,GAAG;gBAChB,SAAS,GAAG,oBAAC,QAAQ,OAAG,CAAC;gBACzB,MAAM;YACR,KAAK,SAAS,CAAC,IAAI;gBACjB,SAAS,GAAG,SAAS,CAAC;gBACtB,MAAM;SACT;QAED,OAAO,SAAS,CAAC;IACnB,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 Utilities\n */\n\nimport * as React from \"react\";\nimport { BadgeType as _BadgeType } from \"@itwin/appui-abstract\";\nimport { BetaBadge } from \"./BetaBadge\";\nimport { NewBadge } from \"./NewBadge\";\n\n/** Specifies type of badge, if any, that should be overlaid on UI component.\n * @public\n */\nexport type BadgeType = _BadgeType; // eslint-disable-line deprecation/deprecation\n\n/** Specifies type of badge, if any, that should be overlaid on UI component.\n * @public\n */\nexport const BadgeType = _BadgeType; // eslint-disable-line @typescript-eslint/no-redeclare, deprecation/deprecation\n\n/** Converts BadgeType to Badge React component\n * @internal\n */\nexport class BadgeUtilities {\n /** Converts BetaType to Badge React component */\n public static getComponentForBadgeType(\n badgeType?: BadgeType\n ): React.ReactNode {\n if (badgeType === undefined) return undefined;\n\n let component: React.ReactNode;\n\n switch (badgeType) {\n case BadgeType.TechnicalPreview:\n component = <BetaBadge />;\n break;\n case BadgeType.New:\n component = <NewBadge />;\n break;\n case BadgeType.None:\n component = undefined;\n break;\n }\n\n return component;\n }\n}\n"]}
@@ -11,7 +11,7 @@ import * as React from "react";
11
11
  */
12
12
  export function Gap(props) {
13
13
  const { size, style, ...rest } = props;
14
- const paddingLeft = size ?? "10px";
14
+ const paddingLeft = size !== null && size !== void 0 ? size : "10px";
15
15
  return React.createElement("span", { style: { ...style, paddingLeft }, ...rest });
16
16
  }
17
17
  //# sourceMappingURL=Gap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Gap.js","sourceRoot":"","sources":["../../../../src/core-react/base/Gap.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,WAAW,GAAG,IAAI,IAAI,MAAM,CAAC;IAEnC,OAAO,8BAAM,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,WAAW,EAAE,KAAM,IAAI,GAAI,CAAC;AAC9D,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 Base\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"../utils/Props\";\n\n/** Properties for the [[Gap]] component.\n * @public\n */\nexport interface GapProps extends CommonProps {\n size?: string;\n}\n\n/** Horizontal gap or space React component. Defaults to 10px.\n * @public\n */\nexport function Gap(props: GapProps) {\n const { size, style, ...rest } = props;\n const paddingLeft = size ?? \"10px\";\n\n return <span style={{ ...style, paddingLeft }} {...rest} />;\n}\n"]}
1
+ {"version":3,"file":"Gap.js","sourceRoot":"","sources":["../../../../src/core-react/base/Gap.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,WAAW,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,MAAM,CAAC;IAEnC,OAAO,8BAAM,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,WAAW,EAAE,KAAM,IAAI,GAAI,CAAC;AAC9D,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 Base\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"../utils/Props\";\n\n/** Properties for the [[Gap]] component.\n * @public\n */\nexport interface GapProps extends CommonProps {\n size?: string;\n}\n\n/** Horizontal gap or space React component. Defaults to 10px.\n * @public\n */\nexport function Gap(props: GapProps) {\n const { size, style, ...rest } = props;\n const paddingLeft = size ?? \"10px\";\n\n return <span style={{ ...style, paddingLeft }} {...rest} />;\n}\n"]}
@@ -221,12 +221,13 @@ class ContextMenu extends React.PureComponent {
221
221
  React.createElement("div", { ref: this._menuRef, role: "menu", tabIndex: 0, "data-testid": "core-context-menu-container", className: classnames("core-context-menu-container", opened && "core-context-menu-opened", floating && "core-context-menu-floating", ContextMenu.getCSSClassNameFromDirection(renderDirection)) }, this._injectedChildren))));
222
222
  }
223
223
  getWindow() {
224
+ var _a;
224
225
  const el = this._rootElement
225
226
  ? this._rootElement
226
227
  : /* istanbul ignore next */ this._menuElement;
227
228
  const parentDocument = el.ownerDocument;
228
229
  // istanbul ignore next
229
- return parentDocument.defaultView ?? window;
230
+ return (_a = parentDocument.defaultView) !== null && _a !== void 0 ? _a : window;
230
231
  }
231
232
  /** @internal */
232
233
  componentDidMount() {
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenu.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GA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,GAAG,wBAAwB,CAAC;YACrC,MAAM;QACR,KAAK,oBAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,oBAAoB,CAAC,KAAK;YAC7B,SAAS,GAAG,yBAAyB,CAAC;YACtC,MAAM;QACR,KAAK,oBAAoB,CAAC,UAAU;YAClC,SAAS,GAAG,iDAAiD,CAAC;YAC9D,MAAM;QACR,KAAK,oBAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,oBAAoB,CAAC,WAAW;YACnC,SAAS,GAAG,kDAAkD,CAAC;YAC/D,MAAM;KACT;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,AAzCyC,CAyCxC;SA7NS,WAAW","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 ContextMenu\n */\n\nimport \"./ContextMenu.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport type { ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextMenuItem } from \"./ContextMenuItem\";\nimport type { ContextSubMenuProps } from \"./ContextSubMenu\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\n\n/** Properties for the [[ContextMenu]] component\n * @public\n */\nexport interface ContextMenuProps extends CommonProps {\n /** Whether ContextMenu is currently opened. */\n opened: boolean;\n /** Which direction the menu opens. Default: ContextMenuDirection.BottomRight */\n direction?: ContextMenuDirection;\n /** When click is registered outside of ContextMenu. */\n onOutsideClick?: (event: MouseEvent) => any;\n /** When list item or submenu is selected */\n onSelect?: (event: any) => any;\n /** when Escape button is pressed */\n onEsc?: (data: any) => any;\n /** Whether menu flips directions based on screen edge. Default: true */\n autoflip?: boolean;\n /** Whether menu hugs screen edge when autoflip is off. Default: true */\n edgeLimit?: boolean;\n /** Whether Hotkey press selects item, or just highlights item. Default: true */\n hotkeySelect?: boolean;\n /** starting menu item selected index Default: -1 */\n selectedIndex?: number;\n /** whether menu floats on the viewport, or the page. When false, container elements can clip menu with overflow: hidden; Default: true */\n floating?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n /** @internal */\n parentSubmenu?: ContextSubMenu;\n /** @internal */\n ignoreNextKeyUp?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\ninterface ContextMenuState {\n selectedIndex: number;\n direction: ContextMenuDirection;\n ignoreNextKeyUp: boolean;\n}\n\n/**\n * A context menu populated with [[ContextMenuItem]] components.\n * Can be nested using [[ContextSubMenu]] component.\n * @public\n */\nexport class ContextMenu extends React.PureComponent<\n ContextMenuProps,\n ContextMenuState\n> {\n private _rootElement: HTMLElement | null = null;\n private _menuElement: HTMLElement | null = null;\n private _selectedElement: ContextMenuItem | ContextSubMenu | null = null;\n private _length: number = 0;\n private _hotKeyMap: Map<number, string> = new Map();\n\n private _lastChildren: React.ReactNode;\n private _lastDirection: ContextMenuDirection | undefined =\n ContextMenuDirection.BottomRight;\n private _lastSelectedIndex: number = 0;\n private _injectedChildren: React.ReactNode;\n private _parentWindowHeight: number = 0;\n private _parentWindowWidth: number = 0;\n\n public static defaultProps: Partial<ContextMenuProps> = {\n direction: ContextMenuDirection.BottomRight,\n autoflip: true,\n edgeLimit: true,\n hotkeySelect: true,\n selectedIndex: -1,\n floating: true,\n };\n\n /** @internal */\n public override readonly state: Readonly<ContextMenuState>;\n constructor(props: ContextMenuProps) {\n super(props);\n this.state = {\n selectedIndex: this.props.selectedIndex!,\n direction: props.direction!,\n ignoreNextKeyUp: props.ignoreNextKeyUp!,\n };\n }\n\n /** @internal */\n public static autoFlip = (\n dir: ContextMenuDirection,\n rect: DOMRectReadOnly,\n windowWidth: number,\n windowHeight: number\n ): ContextMenuDirection => {\n if (rect.right > windowWidth) {\n switch (dir) {\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Right:\n dir = ContextMenuDirection.Left;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.BottomLeft;\n break;\n }\n }\n if (rect.left < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.TopRight;\n break;\n case ContextMenuDirection.Left:\n dir = ContextMenuDirection.Right;\n break;\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n if (rect.bottom > windowHeight) {\n switch (dir) {\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Bottom:\n dir = ContextMenuDirection.Top;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.TopRight;\n break;\n }\n }\n if (rect.top < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.BottomLeft;\n break;\n case ContextMenuDirection.Top:\n dir = ContextMenuDirection.Bottom;\n break;\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n return dir;\n };\n\n private _handleHotKeyParsed = (index: number, hotKey: string) => {\n this._hotKeyMap.set(index, hotKey);\n };\n\n // istanbul ignore next\n private _handleOnOutsideClick = (event: MouseEvent): void => {\n if (this.props.opened && this.props.onOutsideClick)\n this.props.onOutsideClick(event);\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n direction,\n onOutsideClick,\n onSelect,\n onEsc,\n autoflip,\n edgeLimit,\n hotkeySelect,\n selectedIndex,\n floating,\n parentMenu,\n parentSubmenu,\n children,\n className,\n ignoreNextKeyUp,\n ...props\n } = this.props;\n const renderDirection =\n parentMenu === undefined ? this.state.direction : direction;\n\n if (\n this._lastChildren !== children ||\n this._lastDirection !== renderDirection ||\n this._lastSelectedIndex !== this.state.selectedIndex\n ) {\n this._injectedChildren = this._injectMenuItemProps(\n children,\n renderDirection,\n this.state.selectedIndex\n );\n this._lastChildren = children;\n this._lastDirection = renderDirection;\n this._lastSelectedIndex = this.state.selectedIndex;\n }\n\n const classNames = classnames(\"core-context-menu\", className);\n\n return (\n <div\n role=\"presentation\"\n className={classNames}\n onKeyUp={this._handleKeyUp}\n onClick={this._handleClick}\n data-testid=\"core-context-menu-root\"\n {...props}\n ref={this._rootRef}\n >\n <DivWithOutsideClick onOutsideClick={this._handleOnOutsideClick}>\n <div\n ref={this._menuRef}\n role=\"menu\"\n tabIndex={0}\n data-testid=\"core-context-menu-container\"\n className={classnames(\n \"core-context-menu-container\",\n opened && \"core-context-menu-opened\",\n floating && \"core-context-menu-floating\",\n ContextMenu.getCSSClassNameFromDirection(renderDirection)\n )}\n >\n {this._injectedChildren}\n </div>\n </DivWithOutsideClick>\n </div>\n );\n }\n\n /** @internal */\n public static getCSSClassNameFromDirection = (\n direction?: ContextMenuDirection\n ): string => {\n let className = \"\";\n\n // istanbul ignore next\n if (direction === undefined) direction = ContextMenuDirection.BottomRight;\n\n if (direction === ContextMenuDirection.None) return \"\";\n\n switch (direction) {\n case ContextMenuDirection.TopLeft:\n className = \"core-context-menu-top core-context-menu-left\";\n break;\n case ContextMenuDirection.Top:\n className = \"core-context-menu-top\";\n break;\n case ContextMenuDirection.TopRight:\n className = \"core-context-menu-top core-context-menu-right\";\n break;\n case ContextMenuDirection.Left:\n className = \"core-context-menu-left\";\n break;\n case ContextMenuDirection.Center:\n className = \"core-context-menu-center\";\n break;\n case ContextMenuDirection.Right:\n className = \"core-context-menu-right\";\n break;\n case ContextMenuDirection.BottomLeft:\n className = \"core-context-menu-bottom core-context-menu-left\";\n break;\n case ContextMenuDirection.Bottom:\n className = \"core-context-menu-bottom\";\n break;\n case ContextMenuDirection.BottomRight:\n className = \"core-context-menu-bottom core-context-menu-right\";\n break;\n }\n\n return className;\n };\n\n private _injectMenuItemProps = (\n children: React.ReactNode,\n direction: ContextMenuDirection | undefined,\n selectedIndex: number\n ) => {\n let index = 0;\n // add inheritance data to submenu children\n const ch = React.Children.map(children, (child: React.ReactNode) => {\n // Capture only ContextSubMenus and ContextMenuItems.\n if (\n child &&\n typeof child === \"object\" &&\n \"props\" in child &&\n (child.type === ContextSubMenu || child.type === ContextMenuItem) &&\n !ConditionalBooleanValue.getValue(child.props.disabled) &&\n !ConditionalBooleanValue.getValue(child.props.hidden)\n ) {\n const id = index; // get separate id variable so value stays the same when onHover is called later.\n const onHover = () => {\n this.setState({ selectedIndex: id });\n this.focus();\n };\n const ref = (el: ContextSubMenu | ContextMenuItem | null) => {\n if (selectedIndex === id)\n // only save to this._selectedElement if previously captured bool is true\n this._selectedElement = el;\n };\n const boundHandleHotKeyParse = this._handleHotKeyParsed.bind(this, id); // bind local callback for specific index\n const childProps: Partial<\n ContextSubMenuProps & ContextMenuItemProps & { ref: typeof ref }\n > = {\n parentMenu: this,\n ref,\n onHover,\n isSelected: selectedIndex === id,\n onHotKeyParsed: boundHandleHotKeyParse,\n };\n if (child.type === ContextSubMenu) {\n // add direction only to sub-menus\n childProps.direction =\n child.props.direction || /* istanbul ignore next */ direction;\n }\n index++;\n return React.cloneElement(child, childProps);\n } else return child; // Else, pass through unmodified\n });\n this._length = index;\n return ch;\n };\n\n private _rootRef = (el: HTMLDivElement | null) => {\n this._rootElement = el;\n };\n\n private _menuRef = (el: HTMLDivElement | null) => {\n this._menuElement = el;\n };\n\n private getWindow() {\n const el = this._rootElement\n ? this._rootElement\n : /* istanbul ignore next */ this._menuElement;\n const parentDocument = el!.ownerDocument;\n // istanbul ignore next\n return parentDocument.defaultView ?? window;\n }\n\n /** @internal */\n public override componentDidMount() {\n const parentWindow = this.getWindow();\n parentWindow.addEventListener(\"focus\", this._handleFocusChange);\n parentWindow.addEventListener(\"mouseup\", this._handleFocusChange);\n\n this.checkRenderDirection();\n\n if (this.props.opened) this.focus();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n const parentWindow = this.getWindow();\n parentWindow.removeEventListener(\"focus\", this._handleFocusChange);\n parentWindow.removeEventListener(\"mouseup\", this._handleFocusChange);\n }\n\n private checkRenderDirection() {\n const { direction, autoflip, parentMenu } = this.props;\n const parentWindow = this.getWindow();\n\n let renderDirection =\n parentMenu === undefined ? this.state.direction : direction;\n\n if (\n parentWindow.innerHeight === this._parentWindowHeight &&\n parentWindow.innerWidth === this._parentWindowWidth\n )\n return;\n this._parentWindowHeight = parentWindow.innerHeight;\n this._parentWindowWidth = parentWindow.innerWidth;\n\n // check if menu should flip\n if (parentWindow && autoflip && parentMenu === undefined) {\n const menuRect = this.getRect();\n renderDirection = ContextMenu.autoFlip(\n renderDirection!,\n menuRect,\n parentWindow.innerWidth,\n parentWindow.innerHeight\n );\n // istanbul ignore next\n if (renderDirection !== this.state.direction)\n this.setState({ direction: renderDirection });\n }\n }\n\n public focus = () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.focus();\n };\n\n public blur = () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.blur();\n };\n\n public getRect = (): DOMRect => {\n let clientRect = DOMRect.fromRect({ x: 0, y: 0, width: 0, height: 0 });\n\n // istanbul ignore else\n if (this._menuElement) {\n clientRect = this._menuElement.getBoundingClientRect();\n }\n return clientRect;\n };\n\n private _handleFocusChange = (event: any): void => {\n // istanbul ignore else\n if (\n this._rootElement &&\n this.props.opened &&\n event.target instanceof Node &&\n this.props.onOutsideClick &&\n !this._rootElement.contains(event.target)\n )\n this.props.onOutsideClick(event);\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (this.state.ignoreNextKeyUp) {\n this.setState({ ignoreNextKeyUp: false });\n return;\n }\n\n // istanbul ignore else\n if (event.key) {\n for (const [key, value] of this._hotKeyMap) {\n if (!this.props.hotkeySelect! && key > this.state.selectedIndex) {\n // Start search at current index.\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key });\n return;\n }\n }\n }\n for (const [key, value] of this._hotKeyMap) {\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key }, () => {\n if (this.props.hotkeySelect && this._selectedElement) {\n this._selectedElement.select();\n }\n });\n event.stopPropagation();\n return;\n }\n }\n }\n\n if (event.key === Key.ArrowLeft.valueOf()) {\n event.stopPropagation();\n if (this.props.parentMenu && this.props.parentSubmenu) {\n this.props.parentSubmenu.close();\n this.props.parentMenu.focus();\n }\n if (this.props.onEsc) this.props.onEsc(event);\n }\n\n if (event.key === Key.Escape.valueOf()) {\n // istanbul ignore else\n if (this.props.onEsc) this.props.onEsc(event);\n }\n\n if (\n (event.key === Key.Enter.valueOf() ||\n event.key === Key.ArrowRight.valueOf()) &&\n this._selectedElement\n ) {\n event.stopPropagation();\n\n // istanbul ignore else\n if (\n event.key === Key.Enter.valueOf() ||\n /* istanbul ignore next */ this._selectedElement instanceof\n ContextSubMenu\n ) {\n // istanbul ignore else\n if (this._selectedElement.select) this._selectedElement.select();\n }\n }\n\n let { selectedIndex } = this.state;\n if (\n event.key === Key.ArrowUp.valueOf() ||\n event.key === Key.ArrowDown.valueOf()\n ) {\n event.stopPropagation();\n if (selectedIndex === -1) {\n selectedIndex = 0;\n } else {\n if (event.key === Key.ArrowUp.valueOf()) {\n if (this.state.selectedIndex === 0) selectedIndex = this._length - 1;\n else selectedIndex--;\n }\n if (event.key === Key.ArrowDown.valueOf()) {\n if (this.state.selectedIndex === this._length - 1) selectedIndex = 0;\n else selectedIndex++;\n }\n }\n }\n this.setState({ selectedIndex });\n };\n\n public override componentDidUpdate(prevProps: ContextMenuProps) {\n if (prevProps.selectedIndex !== this.props.selectedIndex) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!prevProps.opened && this.props.opened) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!this.props.parentMenu) {\n // const direction = this.props.direction!;\n // if ((!this.props.opened && prevProps.opened && direction !== this.state.direction) || prevProps.direction !== direction)\n this.checkRenderDirection();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenu.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA2ClD;;;;GAIG;AACH,MAAa,WAAY,SAAQ,KAAK,CAAC,aAGtC;IA0BC,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QA1BP,iBAAY,GAAuB,IAAI,CAAC;QACxC,iBAAY,GAAuB,IAAI,CAAC;QACxC,qBAAgB,GAA4C,IAAI,CAAC;QACjE,YAAO,GAAW,CAAC,CAAC;QACpB,eAAU,GAAwB,IAAI,GAAG,EAAE,CAAC;QAG5C,mBAAc,GACpB,oBAAoB,CAAC,WAAW,CAAC;QAC3B,uBAAkB,GAAW,CAAC,CAAC;QAE/B,wBAAmB,GAAW,CAAC,CAAC;QAChC,uBAAkB,GAAW,CAAC,CAAC;QAoF/B,wBAAmB,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,EAAE;YAC9D,IAAI,CAAC,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S,KAAK,SAAS;QAAE,SAAS,GAAG,oBAAoB,CAAC,WAAW,CAAC;IAE1E,IAAI,SAAS,KAAK,oBAAoB,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAEvD,QAAQ,SAAS,EAAE;QACjB,KAAK,oBAAoB,CAAC,OAAO;YAC/B,SAAS,GAAG,8CAA8C,CAAC;YAC3D,MAAM;QACR,KAAK,oBAAoB,CAAC,GAAG;YAC3B,SAAS,GAAG,uBAAuB,CAAC;YACpC,MAAM;QACR,KAAK,oBAAoB,CAAC,QAAQ;YAChC,SAAS,GAAG,+CAA+C,CAAC;YAC5D,MAAM;QACR,KAAK,oBAAoB,CAAC,IAAI;YAC5B,SAAS,GAAG,wBAAwB,CAAC;YACrC,MAAM;QACR,KAAK,oBAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,oBAAoB,CAAC,KAAK;YAC7B,SAAS,GAAG,yBAAyB,CAAC;YACtC,MAAM;QACR,KAAK,oBAAoB,CAAC,UAAU;YAClC,SAAS,GAAG,iDAAiD,CAAC;YAC9D,MAAM;QACR,KAAK,oBAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,oBAAoB,CAAC,WAAW;YACnC,SAAS,GAAG,kDAAkD,CAAC;YAC/D,MAAM;KACT;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,AAzCyC,CAyCxC;SA7NS,WAAW","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 ContextMenu\n */\n\nimport \"./ContextMenu.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport type { ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextMenuItem } from \"./ContextMenuItem\";\nimport type { ContextSubMenuProps } from \"./ContextSubMenu\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\n\n/** Properties for the [[ContextMenu]] component\n * @public\n */\nexport interface ContextMenuProps extends CommonProps {\n /** Whether ContextMenu is currently opened. */\n opened: boolean;\n /** Which direction the menu opens. Default: ContextMenuDirection.BottomRight */\n direction?: ContextMenuDirection;\n /** When click is registered outside of ContextMenu. */\n onOutsideClick?: (event: MouseEvent) => any;\n /** When list item or submenu is selected */\n onSelect?: (event: any) => any;\n /** when Escape button is pressed */\n onEsc?: (data: any) => any;\n /** Whether menu flips directions based on screen edge. Default: true */\n autoflip?: boolean;\n /** Whether menu hugs screen edge when autoflip is off. Default: true */\n edgeLimit?: boolean;\n /** Whether Hotkey press selects item, or just highlights item. Default: true */\n hotkeySelect?: boolean;\n /** starting menu item selected index Default: -1 */\n selectedIndex?: number;\n /** whether menu floats on the viewport, or the page. When false, container elements can clip menu with overflow: hidden; Default: true */\n floating?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n /** @internal */\n parentSubmenu?: ContextSubMenu;\n /** @internal */\n ignoreNextKeyUp?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\ninterface ContextMenuState {\n selectedIndex: number;\n direction: ContextMenuDirection;\n ignoreNextKeyUp: boolean;\n}\n\n/**\n * A context menu populated with [[ContextMenuItem]] components.\n * Can be nested using [[ContextSubMenu]] component.\n * @public\n */\nexport class ContextMenu extends React.PureComponent<\n ContextMenuProps,\n ContextMenuState\n> {\n private _rootElement: HTMLElement | null = null;\n private _menuElement: HTMLElement | null = null;\n private _selectedElement: ContextMenuItem | ContextSubMenu | null = null;\n private _length: number = 0;\n private _hotKeyMap: Map<number, string> = new Map();\n\n private _lastChildren: React.ReactNode;\n private _lastDirection: ContextMenuDirection | undefined =\n ContextMenuDirection.BottomRight;\n private _lastSelectedIndex: number = 0;\n private _injectedChildren: React.ReactNode;\n private _parentWindowHeight: number = 0;\n private _parentWindowWidth: number = 0;\n\n public static defaultProps: Partial<ContextMenuProps> = {\n direction: ContextMenuDirection.BottomRight,\n autoflip: true,\n edgeLimit: true,\n hotkeySelect: true,\n selectedIndex: -1,\n floating: true,\n };\n\n /** @internal */\n public override readonly state: Readonly<ContextMenuState>;\n constructor(props: ContextMenuProps) {\n super(props);\n this.state = {\n selectedIndex: this.props.selectedIndex!,\n direction: props.direction!,\n ignoreNextKeyUp: props.ignoreNextKeyUp!,\n };\n }\n\n /** @internal */\n public static autoFlip = (\n dir: ContextMenuDirection,\n rect: DOMRectReadOnly,\n windowWidth: number,\n windowHeight: number\n ): ContextMenuDirection => {\n if (rect.right > windowWidth) {\n switch (dir) {\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Right:\n dir = ContextMenuDirection.Left;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.BottomLeft;\n break;\n }\n }\n if (rect.left < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.TopRight;\n break;\n case ContextMenuDirection.Left:\n dir = ContextMenuDirection.Right;\n break;\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n if (rect.bottom > windowHeight) {\n switch (dir) {\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Bottom:\n dir = ContextMenuDirection.Top;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.TopRight;\n break;\n }\n }\n if (rect.top < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.BottomLeft;\n break;\n case ContextMenuDirection.Top:\n dir = ContextMenuDirection.Bottom;\n break;\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n return dir;\n };\n\n private _handleHotKeyParsed = (index: number, hotKey: string) => {\n this._hotKeyMap.set(index, hotKey);\n };\n\n // istanbul ignore next\n private _handleOnOutsideClick = (event: MouseEvent): void => {\n if (this.props.opened && this.props.onOutsideClick)\n this.props.onOutsideClick(event);\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n direction,\n onOutsideClick,\n onSelect,\n onEsc,\n autoflip,\n edgeLimit,\n hotkeySelect,\n selectedIndex,\n floating,\n parentMenu,\n parentSubmenu,\n children,\n className,\n ignoreNextKeyUp,\n ...props\n } = this.props;\n const renderDirection =\n parentMenu === undefined ? this.state.direction : direction;\n\n if (\n this._lastChildren !== children ||\n this._lastDirection !== renderDirection ||\n this._lastSelectedIndex !== this.state.selectedIndex\n ) {\n this._injectedChildren = this._injectMenuItemProps(\n children,\n renderDirection,\n this.state.selectedIndex\n );\n this._lastChildren = children;\n this._lastDirection = renderDirection;\n this._lastSelectedIndex = this.state.selectedIndex;\n }\n\n const classNames = classnames(\"core-context-menu\", className);\n\n return (\n <div\n role=\"presentation\"\n className={classNames}\n onKeyUp={this._handleKeyUp}\n onClick={this._handleClick}\n data-testid=\"core-context-menu-root\"\n {...props}\n ref={this._rootRef}\n >\n <DivWithOutsideClick onOutsideClick={this._handleOnOutsideClick}>\n <div\n ref={this._menuRef}\n role=\"menu\"\n tabIndex={0}\n data-testid=\"core-context-menu-container\"\n className={classnames(\n \"core-context-menu-container\",\n opened && \"core-context-menu-opened\",\n floating && \"core-context-menu-floating\",\n ContextMenu.getCSSClassNameFromDirection(renderDirection)\n )}\n >\n {this._injectedChildren}\n </div>\n </DivWithOutsideClick>\n </div>\n );\n }\n\n /** @internal */\n public static getCSSClassNameFromDirection = (\n direction?: ContextMenuDirection\n ): string => {\n let className = \"\";\n\n // istanbul ignore next\n if (direction === undefined) direction = ContextMenuDirection.BottomRight;\n\n if (direction === ContextMenuDirection.None) return \"\";\n\n switch (direction) {\n case ContextMenuDirection.TopLeft:\n className = \"core-context-menu-top core-context-menu-left\";\n break;\n case ContextMenuDirection.Top:\n className = \"core-context-menu-top\";\n break;\n case ContextMenuDirection.TopRight:\n className = \"core-context-menu-top core-context-menu-right\";\n break;\n case ContextMenuDirection.Left:\n className = \"core-context-menu-left\";\n break;\n case ContextMenuDirection.Center:\n className = \"core-context-menu-center\";\n break;\n case ContextMenuDirection.Right:\n className = \"core-context-menu-right\";\n break;\n case ContextMenuDirection.BottomLeft:\n className = \"core-context-menu-bottom core-context-menu-left\";\n break;\n case ContextMenuDirection.Bottom:\n className = \"core-context-menu-bottom\";\n break;\n case ContextMenuDirection.BottomRight:\n className = \"core-context-menu-bottom core-context-menu-right\";\n break;\n }\n\n return className;\n };\n\n private _injectMenuItemProps = (\n children: React.ReactNode,\n direction: ContextMenuDirection | undefined,\n selectedIndex: number\n ) => {\n let index = 0;\n // add inheritance data to submenu children\n const ch = React.Children.map(children, (child: React.ReactNode) => {\n // Capture only ContextSubMenus and ContextMenuItems.\n if (\n child &&\n typeof child === \"object\" &&\n \"props\" in child &&\n (child.type === ContextSubMenu || child.type === ContextMenuItem) &&\n !ConditionalBooleanValue.getValue(child.props.disabled) &&\n !ConditionalBooleanValue.getValue(child.props.hidden)\n ) {\n const id = index; // get separate id variable so value stays the same when onHover is called later.\n const onHover = () => {\n this.setState({ selectedIndex: id });\n this.focus();\n };\n const ref = (el: ContextSubMenu | ContextMenuItem | null) => {\n if (selectedIndex === id)\n // only save to this._selectedElement if previously captured bool is true\n this._selectedElement = el;\n };\n const boundHandleHotKeyParse = this._handleHotKeyParsed.bind(this, id); // bind local callback for specific index\n const childProps: Partial<\n ContextSubMenuProps & ContextMenuItemProps & { ref: typeof ref }\n > = {\n parentMenu: this,\n ref,\n onHover,\n isSelected: selectedIndex === id,\n onHotKeyParsed: boundHandleHotKeyParse,\n };\n if (child.type === ContextSubMenu) {\n // add direction only to sub-menus\n childProps.direction =\n child.props.direction || /* istanbul ignore next */ direction;\n }\n index++;\n return React.cloneElement(child, childProps);\n } else return child; // Else, pass through unmodified\n });\n this._length = index;\n return ch;\n };\n\n private _rootRef = (el: HTMLDivElement | null) => {\n this._rootElement = el;\n };\n\n private _menuRef = (el: HTMLDivElement | null) => {\n this._menuElement = el;\n };\n\n private getWindow() {\n const el = this._rootElement\n ? this._rootElement\n : /* istanbul ignore next */ this._menuElement;\n const parentDocument = el!.ownerDocument;\n // istanbul ignore next\n return parentDocument.defaultView ?? window;\n }\n\n /** @internal */\n public override componentDidMount() {\n const parentWindow = this.getWindow();\n parentWindow.addEventListener(\"focus\", this._handleFocusChange);\n parentWindow.addEventListener(\"mouseup\", this._handleFocusChange);\n\n this.checkRenderDirection();\n\n if (this.props.opened) this.focus();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n const parentWindow = this.getWindow();\n parentWindow.removeEventListener(\"focus\", this._handleFocusChange);\n parentWindow.removeEventListener(\"mouseup\", this._handleFocusChange);\n }\n\n private checkRenderDirection() {\n const { direction, autoflip, parentMenu } = this.props;\n const parentWindow = this.getWindow();\n\n let renderDirection =\n parentMenu === undefined ? this.state.direction : direction;\n\n if (\n parentWindow.innerHeight === this._parentWindowHeight &&\n parentWindow.innerWidth === this._parentWindowWidth\n )\n return;\n this._parentWindowHeight = parentWindow.innerHeight;\n this._parentWindowWidth = parentWindow.innerWidth;\n\n // check if menu should flip\n if (parentWindow && autoflip && parentMenu === undefined) {\n const menuRect = this.getRect();\n renderDirection = ContextMenu.autoFlip(\n renderDirection!,\n menuRect,\n parentWindow.innerWidth,\n parentWindow.innerHeight\n );\n // istanbul ignore next\n if (renderDirection !== this.state.direction)\n this.setState({ direction: renderDirection });\n }\n }\n\n public focus = () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.focus();\n };\n\n public blur = () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.blur();\n };\n\n public getRect = (): DOMRect => {\n let clientRect = DOMRect.fromRect({ x: 0, y: 0, width: 0, height: 0 });\n\n // istanbul ignore else\n if (this._menuElement) {\n clientRect = this._menuElement.getBoundingClientRect();\n }\n return clientRect;\n };\n\n private _handleFocusChange = (event: any): void => {\n // istanbul ignore else\n if (\n this._rootElement &&\n this.props.opened &&\n event.target instanceof Node &&\n this.props.onOutsideClick &&\n !this._rootElement.contains(event.target)\n )\n this.props.onOutsideClick(event);\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (this.state.ignoreNextKeyUp) {\n this.setState({ ignoreNextKeyUp: false });\n return;\n }\n\n // istanbul ignore else\n if (event.key) {\n for (const [key, value] of this._hotKeyMap) {\n if (!this.props.hotkeySelect! && key > this.state.selectedIndex) {\n // Start search at current index.\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key });\n return;\n }\n }\n }\n for (const [key, value] of this._hotKeyMap) {\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key }, () => {\n if (this.props.hotkeySelect && this._selectedElement) {\n this._selectedElement.select();\n }\n });\n event.stopPropagation();\n return;\n }\n }\n }\n\n if (event.key === Key.ArrowLeft.valueOf()) {\n event.stopPropagation();\n if (this.props.parentMenu && this.props.parentSubmenu) {\n this.props.parentSubmenu.close();\n this.props.parentMenu.focus();\n }\n if (this.props.onEsc) this.props.onEsc(event);\n }\n\n if (event.key === Key.Escape.valueOf()) {\n // istanbul ignore else\n if (this.props.onEsc) this.props.onEsc(event);\n }\n\n if (\n (event.key === Key.Enter.valueOf() ||\n event.key === Key.ArrowRight.valueOf()) &&\n this._selectedElement\n ) {\n event.stopPropagation();\n\n // istanbul ignore else\n if (\n event.key === Key.Enter.valueOf() ||\n /* istanbul ignore next */ this._selectedElement instanceof\n ContextSubMenu\n ) {\n // istanbul ignore else\n if (this._selectedElement.select) this._selectedElement.select();\n }\n }\n\n let { selectedIndex } = this.state;\n if (\n event.key === Key.ArrowUp.valueOf() ||\n event.key === Key.ArrowDown.valueOf()\n ) {\n event.stopPropagation();\n if (selectedIndex === -1) {\n selectedIndex = 0;\n } else {\n if (event.key === Key.ArrowUp.valueOf()) {\n if (this.state.selectedIndex === 0) selectedIndex = this._length - 1;\n else selectedIndex--;\n }\n if (event.key === Key.ArrowDown.valueOf()) {\n if (this.state.selectedIndex === this._length - 1) selectedIndex = 0;\n else selectedIndex++;\n }\n }\n }\n this.setState({ selectedIndex });\n };\n\n public override componentDidUpdate(prevProps: ContextMenuProps) {\n if (prevProps.selectedIndex !== this.props.selectedIndex) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!prevProps.opened && this.props.opened) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!this.props.parentMenu) {\n // const direction = this.props.direction!;\n // if ((!this.props.opened && prevProps.opened && direction !== this.state.direction) || prevProps.direction !== direction)\n this.checkRenderDirection();\n }\n }\n}\n"]}
@@ -3,7 +3,6 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  @import "../icons/variables";
6
- @import "../inputs/variables";
7
6
  @import "../style/baseline";
8
7
  @import "../style/colors";
9
8
  @import "../style/opacity";
@@ -2,10 +2,10 @@
2
2
  * @module ContextMenu
3
3
  */
4
4
  import * as React from "react";
5
- import type { BadgeType } from "@itwin/appui-abstract";
6
5
  import { ConditionalBooleanValue } from "@itwin/appui-abstract";
7
6
  import type { CommonProps } from "../utils/Props";
8
7
  import type { ContextMenu } from "./ContextMenu";
8
+ import type { BadgeType } from "../badge/BadgeUtilities";
9
9
  import type { IconSpec } from "../icons/IconComponent";
10
10
  /** Properties for the [[ContextMenuItem]] component
11
11
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuItem.d.ts","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuItem.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO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;;AAhGD,gBAAgB;AACF,4BAAY,GAAkC;IAC1D,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;CAClB,AAJyB,CAIxB;SAZS,eAAe","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport type { BadgeType } from \"@itwin/appui-abstract\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { ContextMenu } from \"./ContextMenu\";\nimport { BadgeUtilities } from \"../badge/BadgeUtilities\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\n\n/** Properties for the [[ContextMenuItem]] component\n * @public\n */\nexport interface ContextMenuItemProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"disabled\" | \"hidden\">,\n CommonProps {\n onSelect?: (event: any) => any;\n /** @internal */\n onHotKeyParsed?: (hotKey: string) => void;\n /** Icon to display in the left margin. */\n icon?: IconSpec;\n /** Disables any onSelect calls, hover/keyboard highlighting, and grays item. */\n disabled?: boolean | ConditionalBooleanValue;\n /** Indicates whether the item is visible or hidden. The default is for the item to be visible. */\n hidden?: boolean | ConditionalBooleanValue;\n /** Badge to be overlaid on the item. */\n badgeType?: BadgeType;\n /** Icon to display in the right margin. */\n iconRight?: IconSpec;\n /** Hide the icon container. This can be used to eliminate space used to display an icon at the left of the menu item. */\n hideIconContainer?: boolean;\n /** @internal */\n onHover?: () => any;\n /* @internal */\n isSelected?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n}\n\n/** @internal */\ninterface ContextMenuItemState {\n hotKey?: string;\n}\n\n/**\n * Menu Item class for use within a [[ContextMenu]] component.\n * @public\n */\nexport class ContextMenuItem extends React.PureComponent<\n ContextMenuItemProps,\n ContextMenuItemState\n> {\n private _root: HTMLElement | null = null;\n private _lastChildren: React.ReactNode;\n private _parsedChildren: React.ReactNode;\n /** @internal */\n public static defaultProps: Partial<ContextMenuItemProps> = {\n disabled: false,\n hidden: false,\n isSelected: false,\n };\n constructor(props: ContextMenuItemProps) {\n super(props);\n }\n /** @internal */\n public override readonly state: Readonly<ContextMenuItemState> = {};\n public override render(): React.ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n onClick,\n className,\n style,\n onSelect,\n icon,\n disabled,\n hidden,\n onHover,\n isSelected,\n parentMenu,\n onHotKeyParsed,\n badgeType,\n iconRight,\n hideIconContainer,\n ...props\n } = this.props;\n const badge = BadgeUtilities.getComponentForBadgeType(badgeType);\n const isDisabled = ConditionalBooleanValue.getValue(disabled);\n const isHidden = ConditionalBooleanValue.getValue(hidden);\n\n if (this._lastChildren !== this.props.children) {\n this._parsedChildren = TildeFinder.findAfterTilde(\n this.props.children\n ).node;\n this._lastChildren = this.props.children;\n }\n\n return (\n <div\n {...props}\n ref={(el) => {\n this._root = el;\n }}\n onClick={this._handleClick}\n style={style}\n onFocus={this._handleFocus}\n onKeyUp={this._handleKeyUp}\n onMouseOver={this._handleMouseOver}\n data-testid={\"core-context-menu-item\"}\n className={classnames(\n \"core-context-menu-item\",\n className,\n isDisabled && \"core-context-menu-disabled\",\n isHidden && \"core-context-menu-hidden\",\n isSelected && \"core-context-menu-is-selected\"\n )}\n role=\"menuitem\"\n tabIndex={isSelected ? 0 : -1}\n aria-disabled={isDisabled}\n aria-hidden={isHidden}\n >\n {!hideIconContainer && (\n <div className=\"core-context-menu-icon\">\n {icon !== undefined && <Icon iconSpec={icon} />}\n </div>\n )}\n <div className={\"core-context-menu-content\"}>\n {this._parsedChildren}\n </div>\n {iconRight && (\n <div\n className={classnames(\n \"core-context-menu-icon\",\n \"core-context-menu-icon-right\"\n )}\n >\n <Icon iconSpec={iconRight} />\n </div>\n )}\n {badge && <div className=\"core-context-menu-badge\">{badge}</div>}\n </div>\n );\n }\n\n public override componentDidMount() {\n this._updateHotkey(this.props.children);\n }\n\n public override componentDidUpdate(prevProps: ContextMenuItemProps) {\n if (this.props.children !== prevProps.children) {\n this._updateHotkey(this.props.children);\n }\n }\n\n private _updateHotkey = (node: React.ReactNode) => {\n let hotKey: string | undefined;\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n const isHidden = ConditionalBooleanValue.getValue(this.props.hidden);\n if (!isDisabled && !isHidden)\n hotKey = TildeFinder.findAfterTilde(node).character;\n else hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed) this.props.onHotKeyParsed(hotKey);\n }\n };\n\n private _handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n event.stopPropagation();\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (\n this._root &&\n this._root.style.visibility !== \"hidden\" &&\n this.props.onHover\n ) {\n this.props.onHover();\n }\n };\n\n public select = () => {\n // istanbul ignore else\n if (this._root) {\n this._root.click();\n if (this.props.parentMenu && this.props.parentMenu.props.parentSubmenu)\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (isDisabled) return;\n\n if (this.props.onClick) this.props.onClick(event);\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (\n event.key === Key.Enter.valueOf() &&\n this.props.onSelect !== undefined &&\n !isDisabled\n ) {\n this.props.onSelect(event);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"ContextMenuItem.js","sourceRoot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AU,EAAE,KAAK;CAClB,AAJyB,CAIxB;SAZS,eAAe","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { ContextMenu } from \"./ContextMenu\";\nimport type { BadgeType } from \"../badge/BadgeUtilities\";\nimport { BadgeUtilities } from \"../badge/BadgeUtilities\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\n\n/** Properties for the [[ContextMenuItem]] component\n * @public\n */\nexport interface ContextMenuItemProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"disabled\" | \"hidden\">,\n CommonProps {\n onSelect?: (event: any) => any;\n /** @internal */\n onHotKeyParsed?: (hotKey: string) => void;\n /** Icon to display in the left margin. */\n icon?: IconSpec;\n /** Disables any onSelect calls, hover/keyboard highlighting, and grays item. */\n disabled?: boolean | ConditionalBooleanValue;\n /** Indicates whether the item is visible or hidden. The default is for the item to be visible. */\n hidden?: boolean | ConditionalBooleanValue;\n /** Badge to be overlaid on the item. */\n badgeType?: BadgeType;\n /** Icon to display in the right margin. */\n iconRight?: IconSpec;\n /** Hide the icon container. This can be used to eliminate space used to display an icon at the left of the menu item. */\n hideIconContainer?: boolean;\n /** @internal */\n onHover?: () => any;\n /* @internal */\n isSelected?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n}\n\n/** @internal */\ninterface ContextMenuItemState {\n hotKey?: string;\n}\n\n/**\n * Menu Item class for use within a [[ContextMenu]] component.\n * @public\n */\nexport class ContextMenuItem extends React.PureComponent<\n ContextMenuItemProps,\n ContextMenuItemState\n> {\n private _root: HTMLElement | null = null;\n private _lastChildren: React.ReactNode;\n private _parsedChildren: React.ReactNode;\n /** @internal */\n public static defaultProps: Partial<ContextMenuItemProps> = {\n disabled: false,\n hidden: false,\n isSelected: false,\n };\n constructor(props: ContextMenuItemProps) {\n super(props);\n }\n /** @internal */\n public override readonly state: Readonly<ContextMenuItemState> = {};\n public override render(): React.ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n onClick,\n className,\n style,\n onSelect,\n icon,\n disabled,\n hidden,\n onHover,\n isSelected,\n parentMenu,\n onHotKeyParsed,\n badgeType,\n iconRight,\n hideIconContainer,\n ...props\n } = this.props;\n const badge = BadgeUtilities.getComponentForBadgeType(badgeType);\n const isDisabled = ConditionalBooleanValue.getValue(disabled);\n const isHidden = ConditionalBooleanValue.getValue(hidden);\n\n if (this._lastChildren !== this.props.children) {\n this._parsedChildren = TildeFinder.findAfterTilde(\n this.props.children\n ).node;\n this._lastChildren = this.props.children;\n }\n\n return (\n <div\n {...props}\n ref={(el) => {\n this._root = el;\n }}\n onClick={this._handleClick}\n style={style}\n onFocus={this._handleFocus}\n onKeyUp={this._handleKeyUp}\n onMouseOver={this._handleMouseOver}\n data-testid={\"core-context-menu-item\"}\n className={classnames(\n \"core-context-menu-item\",\n className,\n isDisabled && \"core-context-menu-disabled\",\n isHidden && \"core-context-menu-hidden\",\n isSelected && \"core-context-menu-is-selected\"\n )}\n role=\"menuitem\"\n tabIndex={isSelected ? 0 : -1}\n aria-disabled={isDisabled}\n aria-hidden={isHidden}\n >\n {!hideIconContainer && (\n <div className=\"core-context-menu-icon\">\n {icon !== undefined && <Icon iconSpec={icon} />}\n </div>\n )}\n <div className={\"core-context-menu-content\"}>\n {this._parsedChildren}\n </div>\n {iconRight && (\n <div\n className={classnames(\n \"core-context-menu-icon\",\n \"core-context-menu-icon-right\"\n )}\n >\n <Icon iconSpec={iconRight} />\n </div>\n )}\n {badge && <div className=\"core-context-menu-badge\">{badge}</div>}\n </div>\n );\n }\n\n public override componentDidMount() {\n this._updateHotkey(this.props.children);\n }\n\n public override componentDidUpdate(prevProps: ContextMenuItemProps) {\n if (this.props.children !== prevProps.children) {\n this._updateHotkey(this.props.children);\n }\n }\n\n private _updateHotkey = (node: React.ReactNode) => {\n let hotKey: string | undefined;\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n const isHidden = ConditionalBooleanValue.getValue(this.props.hidden);\n if (!isDisabled && !isHidden)\n hotKey = TildeFinder.findAfterTilde(node).character;\n else hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed) this.props.onHotKeyParsed(hotKey);\n }\n };\n\n private _handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n event.stopPropagation();\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (\n this._root &&\n this._root.style.visibility !== \"hidden\" &&\n this.props.onHover\n ) {\n this.props.onHover();\n }\n };\n\n public select = () => {\n // istanbul ignore else\n if (this._root) {\n this._root.click();\n if (this.props.parentMenu && this.props.parentMenu.props.parentSubmenu)\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (isDisabled) return;\n\n if (this.props.onClick) this.props.onClick(event);\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (\n event.key === Key.Enter.valueOf() &&\n this.props.onSelect !== undefined &&\n !isDisabled\n ) {\n this.props.onSelect(event);\n }\n };\n}\n"]}
@@ -18,7 +18,8 @@ export class GlobalContextMenu extends React.PureComponent {
18
18
  parentDocument: null,
19
19
  };
20
20
  this._handleRefSet = (popupDiv) => {
21
- const parentDocument = popupDiv?.ownerDocument ?? null;
21
+ var _a, _b;
22
+ const parentDocument = (_a = popupDiv === null || popupDiv === void 0 ? void 0 : popupDiv.ownerDocument) !== null && _a !== void 0 ? _a : null;
22
23
  if (parentDocument) {
23
24
  this._container = parentDocument.createElement("div");
24
25
  this._container.id =
@@ -30,7 +31,7 @@ export class GlobalContextMenu extends React.PureComponent {
30
31
  rt = parentDocument.createElement("div");
31
32
  rt.id = "core-global-context-menu-root";
32
33
  // istanbul ignore next
33
- (parentDocument.body.querySelector('[data-root-container="appui-root-id"]') ?? parentDocument.body).appendChild(rt);
34
+ ((_b = parentDocument.body.querySelector('[data-root-container="appui-root-id"]')) !== null && _b !== void 0 ? _b : parentDocument.body).appendChild(rt);
34
35
  }
35
36
  rt.appendChild(this._container);
36
37
  // used to support component rendering in pop-out window
@@ -46,6 +47,7 @@ export class GlobalContextMenu extends React.PureComponent {
46
47
  }
47
48
  }
48
49
  render() {
50
+ var _a;
49
51
  const { x, y, identifier, contextMenuComponent, ...props } = this.props;
50
52
  const positioningStyle = {
51
53
  left: x,
@@ -56,7 +58,7 @@ export class GlobalContextMenu extends React.PureComponent {
56
58
  ReactDOM.createPortal(React.createElement("div", { className: "core-context-menu-global", style: positioningStyle },
57
59
  React.createElement(CtxMenu, { ...props })),
58
60
  // istanbul ignore next
59
- this.state.parentDocument.body.querySelector('[data-root-container="appui-root-id"]') ?? this.state.parentDocument.body)));
61
+ (_a = this.state.parentDocument.body.querySelector('[data-root-container="appui-root-id"]')) !== null && _a !== void 0 ? _a : this.state.parentDocument.body)));
60
62
  }
61
63
  }
62
64
  //# sourceMappingURL=GlobalContextMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/GlobalContextMenu.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEt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a,EAAE;YACpD,UAAU;YACV,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC5D;IACH,CAAC;IA8Be,MAAM;QACpB,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxE,MAAM,gBAAgB,GAAwB;YAC5C,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;SACP,CAAC;QAEF,MAAM,OAAO,GAAG,oBAAoB,IAAI,WAAW,CAAC;QAEpD,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IACrD,IAAI,CAAC,KAAK,CAAC,cAAc;YACxB,QAAQ,CAAC,YAAY,CACnB,6BAAK,SAAS,EAAC,0BAA0B,EAAC,KAAK,EAAE,gBAAgB;gBAC/D,oBAAC,OAAO,OAAK,KAAK,GAAI,CAClB;YACN,uBAAuB;YACvB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAC1C,uCAAuC,CACxC,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CACpC,CACC,CACP,CAAC;IACJ,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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport type { ContextMenuProps } from \"./ContextMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\n\n/** Properties for the [[GlobalContextMenu]] component\n * @public\n */\nexport interface GlobalContextMenuProps extends ContextMenuProps {\n /** Unique identifier, to distinguish from other GlobalContextMenu components. Needed only if multiple GlobalContextMenus are used simultaneously. */\n identifier?: string;\n /** Specifies the x/horizontal position on the viewport. */\n x: number | string;\n /** Specifies the y/vertical position on the viewport. */\n y: number | string;\n /** Context menu element. Default: ContextMenu */\n contextMenuComponent?: React.ComponentType<ContextMenuProps>;\n}\n\n/** @internal */\ninterface GlobalContextMenuState {\n parentDocument: Document | null;\n}\n\n/** GlobalContextMenu React component used to display a [[ContextMenu]] at the cursor\n * @public\n */\nexport class GlobalContextMenu extends React.PureComponent<\n GlobalContextMenuProps,\n GlobalContextMenuState\n> {\n private _container?: HTMLDivElement;\n\n public override readonly state: GlobalContextMenuState = {\n parentDocument: null,\n };\n\n constructor(props: GlobalContextMenuProps) {\n super(props);\n }\n\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._container && this._container.parentElement) {\n // cleanup\n this._container.parentElement.removeChild(this._container);\n }\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n const parentDocument = popupDiv?.ownerDocument ?? null;\n if (parentDocument) {\n this._container = parentDocument.createElement(\"div\");\n this._container.id =\n this.props.identifier !== undefined\n ? `dialog-${this.props.identifier}`\n : \"core-global-context-menu\";\n let rt = parentDocument.getElementById(\n \"core-global-context-menu-root\"\n ) as HTMLDivElement;\n if (!rt) {\n rt = parentDocument.createElement(\"div\");\n rt.id = \"core-global-context-menu-root\";\n // istanbul ignore next\n (\n parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ?? parentDocument.body\n ).appendChild(rt);\n }\n rt.appendChild(this._container);\n\n // used to support component rendering in pop-out window\n this.setState({ parentDocument });\n }\n };\n\n public override render(): React.ReactNode {\n const { x, y, identifier, contextMenuComponent, ...props } = this.props;\n const positioningStyle: React.CSSProperties = {\n left: x,\n top: y,\n };\n\n const CtxMenu = contextMenuComponent || ContextMenu;\n\n return (\n <div ref={this._handleRefSet} style={{ display: \"none\" }}>\n {this.state.parentDocument &&\n ReactDOM.createPortal(\n <div className=\"core-context-menu-global\" style={positioningStyle}>\n <CtxMenu {...props} />\n </div>,\n // istanbul ignore next\n this.state.parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ?? this.state.parentDocument.body\n )}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"GlobalContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/GlobalContextMenu.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAqB5C;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK,CAAC,aAG5C;IAOC,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QALU,UAAK,GAA2B;YACvD,cAAc,EAAE,IAAI;SACrB,CAAC;QAcM,kBAAa,GAAG,CAAC,QAA4B,EAAE,EAAE;;YACvD,MAAM,cAAc,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,mCAAI,IAAI,CAAC;YACvD,IAAI,cAAc,EAAE;gBAClB,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBACtD,IAAI,CAAC,UAAU,CAAC,EAAE;oBAChB,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS;wBACjC,CAAC,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;wBACnC,CAAC,CAAC,0BAA0B,CAAC;gBACjC,IAAI,EAAE,GAAG,cAAc,CAAC,cAAc,CACpC,+BAA+B,CACd,CAAC;gBACpB,IAAI,CAAC,EAAE,EAAE;oBACP,EAAE,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;oBACzC,EAAE,CAAC,EAAE,GAAG,+BAA+B,CAAC;oBACxC,uBAAuB;oBACvB,CACE,MAAA,cAAc,CAA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","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport type { ContextMenuProps } from \"./ContextMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\n\n/** Properties for the [[GlobalContextMenu]] component\n * @public\n */\nexport interface GlobalContextMenuProps extends ContextMenuProps {\n /** Unique identifier, to distinguish from other GlobalContextMenu components. Needed only if multiple GlobalContextMenus are used simultaneously. */\n identifier?: string;\n /** Specifies the x/horizontal position on the viewport. */\n x: number | string;\n /** Specifies the y/vertical position on the viewport. */\n y: number | string;\n /** Context menu element. Default: ContextMenu */\n contextMenuComponent?: React.ComponentType<ContextMenuProps>;\n}\n\n/** @internal */\ninterface GlobalContextMenuState {\n parentDocument: Document | null;\n}\n\n/** GlobalContextMenu React component used to display a [[ContextMenu]] at the cursor\n * @public\n */\nexport class GlobalContextMenu extends React.PureComponent<\n GlobalContextMenuProps,\n GlobalContextMenuState\n> {\n private _container?: HTMLDivElement;\n\n public override readonly state: GlobalContextMenuState = {\n parentDocument: null,\n };\n\n constructor(props: GlobalContextMenuProps) {\n super(props);\n }\n\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._container && this._container.parentElement) {\n // cleanup\n this._container.parentElement.removeChild(this._container);\n }\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n const parentDocument = popupDiv?.ownerDocument ?? null;\n if (parentDocument) {\n this._container = parentDocument.createElement(\"div\");\n this._container.id =\n this.props.identifier !== undefined\n ? `dialog-${this.props.identifier}`\n : \"core-global-context-menu\";\n let rt = parentDocument.getElementById(\n \"core-global-context-menu-root\"\n ) as HTMLDivElement;\n if (!rt) {\n rt = parentDocument.createElement(\"div\");\n rt.id = \"core-global-context-menu-root\";\n // istanbul ignore next\n (\n parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ?? parentDocument.body\n ).appendChild(rt);\n }\n rt.appendChild(this._container);\n\n // used to support component rendering in pop-out window\n this.setState({ parentDocument });\n }\n };\n\n public override render(): React.ReactNode {\n const { x, y, identifier, contextMenuComponent, ...props } = this.props;\n const positioningStyle: React.CSSProperties = {\n left: x,\n top: y,\n };\n\n const CtxMenu = contextMenuComponent || ContextMenu;\n\n return (\n <div ref={this._handleRefSet} style={{ display: \"none\" }}>\n {this.state.parentDocument &&\n ReactDOM.createPortal(\n <div className=\"core-context-menu-global\" style={positioningStyle}>\n <CtxMenu {...props} />\n </div>,\n // istanbul ignore next\n this.state.parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ?? this.state.parentDocument.body\n )}\n </div>\n );\n }\n}\n"]}
@@ -67,8 +67,8 @@ class Dialog extends React.Component {
67
67
  let initialOffset = {};
68
68
  if (x || y) {
69
69
  initialOffset = {
70
- left: x ?? 0,
71
- top: y ?? 0,
70
+ left: x !== null && x !== void 0 ? x : 0,
71
+ top: y !== null && y !== void 0 ? y : 0,
72
72
  transform: "none",
73
73
  };
74
74
  }