@itwin/core-react 4.0.0-dev.2 → 4.0.0-dev.20
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.
- package/CHANGELOG.md +144 -7
- package/ContributeGuidelines.md +17 -14
- package/LICENSE.md +1 -1
- package/README.md +2 -2
- package/lib/cjs/core-react/UiCore.js +1 -1
- package/lib/cjs/core-react/UiCore.js.map +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts +2 -2
- package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.js +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.scss +5 -8
- package/lib/cjs/core-react/badge/BetaBadge.d.ts +0 -1
- package/lib/cjs/core-react/badge/BetaBadge.d.ts.map +1 -1
- package/lib/cjs/core-react/badge/BetaBadge.js +0 -1
- package/lib/cjs/core-react/badge/BetaBadge.js.map +1 -1
- package/lib/cjs/core-react/badge/NewBadge.scss +1 -1
- package/lib/cjs/core-react/base/Gap.js +1 -1
- package/lib/cjs/core-react/base/Gap.js.map +1 -1
- package/lib/cjs/core-react/checklistbox/CheckListBox.scss +1 -2
- package/lib/cjs/core-react/classes.scss +0 -3
- package/lib/cjs/core-react/colorthemes.scss +5 -34
- package/lib/cjs/core-react/colorvariables.scss +53 -76
- package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenu.js +2 -3
- package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenu.scss +12 -13
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts +1 -1
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.js +5 -2
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +6 -4
- package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/TildeFinder.js +1 -1
- package/lib/cjs/core-react/contextmenu/TildeFinder.js.map +1 -1
- package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
- package/lib/cjs/core-react/dialog/Dialog.js +18 -10
- package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
- package/lib/cjs/core-react/dialog/Dialog.scss +23 -22
- package/lib/cjs/core-react/dialog/GlobalDialog.js +1 -2
- package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
- package/lib/cjs/core-react/elementseparator/ElementSeparator.js +2 -2
- package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
- package/lib/cjs/core-react/elementseparator/ElementSeparator.scss +1 -1
- package/lib/cjs/core-react/expandable/ExpandableList.js +1 -1
- package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
- package/lib/cjs/core-react/expandable/list.scss +5 -5
- package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts +1 -1
- package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
- package/lib/cjs/core-react/hocs/withOnOutsideClick.js +1 -2
- package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
- package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts +27 -0
- package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts.map +1 -0
- package/lib/cjs/core-react/icons/ConditionalIconItem.js +65 -0
- package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -0
- package/lib/cjs/core-react/icons/IconComponent.d.ts +3 -2
- package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.js +1 -7
- package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
- package/lib/cjs/core-react/icons/SvgPath.d.ts +1 -1
- package/lib/cjs/core-react/icons/SvgPath.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/SvgPath.js +2 -2
- package/lib/cjs/core-react/icons/SvgPath.js.map +1 -1
- package/lib/cjs/core-react/icons/{SvgSprite.scss → SvgPath.scss} +1 -1
- package/lib/cjs/core-react/icons/WebFontIcon.d.ts +0 -1
- package/lib/cjs/core-react/icons/WebFontIcon.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/WebFontIcon.js +0 -1
- package/lib/cjs/core-react/icons/WebFontIcon.js.map +1 -1
- package/lib/cjs/core-react/icons/variables.scss +0 -9
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.scss +2 -2
- package/lib/cjs/core-react/index.scss +0 -2
- package/lib/cjs/core-react/inputs/InputLabel.d.ts.map +1 -1
- package/lib/cjs/core-react/inputs/InputLabel.js +9 -1
- package/lib/cjs/core-react/inputs/InputLabel.js.map +1 -1
- package/lib/cjs/core-react/inputs/input-label.scss +2 -2
- package/lib/cjs/core-react/inputs/input.scss +7 -7
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts +6 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.js +13 -8
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.scss +12 -13
- package/lib/cjs/core-react/inputs/variables.scss +4 -4
- package/lib/cjs/core-react/listbox/Listbox.d.ts +1 -1
- package/lib/cjs/core-react/listbox/Listbox.d.ts.map +1 -1
- package/lib/cjs/core-react/listbox/Listbox.js +2 -3
- package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
- package/lib/cjs/core-react/listbox/Listbox.scss +8 -8
- package/lib/cjs/core-react/loading/LoadingBar.js +1 -1
- package/lib/cjs/core-react/loading/LoadingBar.js.map +1 -1
- package/lib/cjs/core-react/loading/LoadingPrompt.js +1 -1
- package/lib/cjs/core-react/loading/LoadingPrompt.js.map +1 -1
- package/lib/cjs/core-react/loading/LoadingPrompt.scss +2 -2
- package/lib/cjs/core-react/loading/LoadingSpinner.d.ts +1 -1
- package/lib/cjs/core-react/loading/LoadingSpinner.d.ts.map +1 -1
- package/lib/cjs/core-react/loading/LoadingSpinner.js +1 -1
- package/lib/cjs/core-react/loading/LoadingSpinner.js.map +1 -1
- package/lib/cjs/core-react/loading/LoadingSpinner.scss +1 -1
- package/lib/cjs/core-react/loading/LoadingStatus.js +1 -1
- package/lib/cjs/core-react/loading/LoadingStatus.js.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.d.ts +13 -1
- package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.js +55 -11
- package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.scss +24 -14
- package/lib/cjs/core-react/notification/MessageRenderer.js +1 -1
- package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
- package/lib/cjs/core-react/notification/MessageType.d.ts +1 -1
- package/lib/cjs/core-react/notification/MessageType.d.ts.map +1 -1
- package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
- package/lib/cjs/core-react/popup/Popup.js +7 -8
- package/lib/cjs/core-react/popup/Popup.js.map +1 -1
- package/lib/cjs/core-react/popup/Popup.scss +5 -5
- package/lib/cjs/core-react/radialmenu/RadialMenu.js +1 -1
- package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
- package/lib/cjs/core-react/radialmenu/RadialMenu.scss +1 -1
- package/lib/cjs/core-react/searchbox/SearchBox.d.ts.map +1 -1
- package/lib/cjs/core-react/searchbox/SearchBox.js +8 -6
- package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
- package/lib/cjs/core-react/searchbox/SearchBox.scss +5 -9
- package/lib/cjs/core-react/settings/SettingsContainer.js +1 -1
- package/lib/cjs/core-react/settings/SettingsContainer.js.map +1 -1
- package/lib/cjs/core-react/settings/SettingsContainer.scss +3 -1
- package/lib/cjs/core-react/style/index.scss +0 -7
- package/lib/cjs/core-react/style/mixins.scss +2 -2
- package/lib/cjs/core-react/style/themecolors.scss +0 -6
- package/lib/cjs/core-react/tabs/tabs.scss +10 -20
- package/lib/cjs/core-react/tabs/vertical.scss +6 -13
- package/lib/cjs/core-react/text/BlockText.d.ts.map +1 -1
- package/lib/cjs/core-react/text/BlockText.js +1 -0
- package/lib/cjs/core-react/text/BlockText.js.map +1 -1
- package/lib/cjs/core-react/text/BodyText.d.ts +1 -0
- package/lib/cjs/core-react/text/BodyText.d.ts.map +1 -1
- package/lib/cjs/core-react/text/BodyText.js +2 -0
- package/lib/cjs/core-react/text/BodyText.js.map +1 -1
- package/lib/cjs/core-react/text/DisabledText.d.ts.map +1 -1
- package/lib/cjs/core-react/text/DisabledText.js +1 -0
- package/lib/cjs/core-react/text/DisabledText.js.map +1 -1
- package/lib/cjs/core-react/text/FilteredText.js +3 -3
- package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
- package/lib/cjs/core-react/text/MutedText.d.ts +1 -0
- package/lib/cjs/core-react/text/MutedText.d.ts.map +1 -1
- package/lib/cjs/core-react/text/MutedText.js +2 -0
- package/lib/cjs/core-react/text/MutedText.js.map +1 -1
- package/lib/cjs/core-react/text/StyledText.d.ts +1 -0
- package/lib/cjs/core-react/text/StyledText.d.ts.map +1 -1
- package/lib/cjs/core-react/text/StyledText.js +1 -0
- package/lib/cjs/core-react/text/StyledText.js.map +1 -1
- package/lib/cjs/core-react/text/block.scss +9 -4
- package/lib/cjs/core-react/text/body.scss +7 -4
- package/lib/cjs/core-react/text/mixins.scss +3 -3
- package/lib/cjs/core-react/tree/ExpansionToggle.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/ExpansionToggle.js +3 -1
- package/lib/cjs/core-react/tree/ExpansionToggle.js.map +1 -1
- package/lib/cjs/core-react/tree/ExpansionToggle.scss +9 -5
- package/lib/cjs/core-react/tree/Node.d.ts +2 -2
- package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/Node.js +2 -3
- package/lib/cjs/core-react/tree/Node.js.map +1 -1
- package/lib/cjs/core-react/tree/Node.scss +3 -19
- package/lib/cjs/core-react/tree/Placeholder.scss +1 -4
- package/lib/cjs/core-react/utils/IconWebComponent.js +1 -1
- package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
- package/lib/cjs/core-react/utils/Point.js +4 -4
- package/lib/cjs/core-react/utils/Point.js.map +1 -1
- package/lib/cjs/core-react/utils/Props.d.ts +1 -1
- package/lib/cjs/core-react/utils/Props.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/Rectangle.js +7 -7
- package/lib/cjs/core-react/utils/Rectangle.js.map +1 -1
- package/lib/cjs/core-react/utils/Size.js +4 -4
- package/lib/cjs/core-react/utils/Size.js.map +1 -1
- package/lib/cjs/core-react/utils/Timer.d.ts +1 -1
- package/lib/cjs/core-react/utils/Timer.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/getBestBWContrastColor.js +3 -3
- package/lib/cjs/core-react/utils/getBestBWContrastColor.js.map +1 -1
- package/lib/cjs/core-react/utils/getCssVariable.js +1 -1
- package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts +1 -1
- package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js +1 -2
- package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts +1 -1
- package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useProximityToMouse.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js +2 -2
- package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useRefs.d.ts +1 -1
- package/lib/cjs/core-react/utils/hooks/useRefs.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useRefs.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +8 -13
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
- package/lib/cjs/core-react/utils/typeUtils.d.ts +1 -1
- package/lib/cjs/core-react/utils/typeUtils.d.ts.map +1 -1
- package/lib/cjs/core-react.d.ts +1 -1
- package/lib/cjs/core-react.d.ts.map +1 -1
- package/lib/cjs/core-react.js +6 -2
- package/lib/cjs/core-react.js.map +1 -1
- package/lib/esm/core-react/UiCore.js +2 -1
- package/lib/esm/core-react/UiCore.js.map +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts +2 -2
- package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.js +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.scss +5 -8
- package/lib/esm/core-react/badge/BetaBadge.d.ts +0 -1
- package/lib/esm/core-react/badge/BetaBadge.d.ts.map +1 -1
- package/lib/esm/core-react/badge/BetaBadge.js +0 -1
- package/lib/esm/core-react/badge/BetaBadge.js.map +1 -1
- package/lib/esm/core-react/badge/NewBadge.scss +1 -1
- package/lib/esm/core-react/base/Gap.js +1 -1
- package/lib/esm/core-react/base/Gap.js.map +1 -1
- package/lib/esm/core-react/checklistbox/CheckListBox.scss +1 -2
- package/lib/esm/core-react/classes.scss +0 -3
- package/lib/esm/core-react/colorthemes.scss +5 -34
- package/lib/esm/core-react/colorvariables.scss +53 -76
- package/lib/esm/core-react/contextmenu/ContextMenu.d.ts +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenu.js +3 -3
- package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenu.scss +12 -13
- package/lib/esm/core-react/contextmenu/ContextMenuItem.js +2 -1
- package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts +1 -1
- package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextSubMenu.js +6 -2
- package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +6 -4
- package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/TildeFinder.js +2 -1
- package/lib/esm/core-react/contextmenu/TildeFinder.js.map +1 -1
- package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
- package/lib/esm/core-react/dialog/Dialog.js +19 -10
- package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
- package/lib/esm/core-react/dialog/Dialog.scss +23 -22
- package/lib/esm/core-react/dialog/GlobalDialog.js +1 -2
- package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
- package/lib/esm/core-react/elementseparator/ElementSeparator.js +2 -2
- package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
- package/lib/esm/core-react/elementseparator/ElementSeparator.scss +1 -1
- package/lib/esm/core-react/expandable/ExpandableList.js +2 -1
- package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
- package/lib/esm/core-react/expandable/list.scss +5 -5
- package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts +1 -1
- package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
- package/lib/esm/core-react/hocs/withOnOutsideClick.js +1 -2
- package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
- package/lib/esm/core-react/icons/ConditionalIconItem.d.ts +27 -0
- package/lib/esm/core-react/icons/ConditionalIconItem.d.ts.map +1 -0
- package/lib/esm/core-react/icons/ConditionalIconItem.js +61 -0
- package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -0
- package/lib/esm/core-react/icons/IconComponent.d.ts +3 -2
- package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.js +1 -7
- package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
- package/lib/esm/core-react/icons/SvgPath.d.ts +1 -1
- package/lib/esm/core-react/icons/SvgPath.d.ts.map +1 -1
- package/lib/esm/core-react/icons/SvgPath.js +2 -2
- package/lib/esm/core-react/icons/SvgPath.js.map +1 -1
- package/lib/esm/core-react/icons/{SvgSprite.scss → SvgPath.scss} +1 -1
- package/lib/esm/core-react/icons/WebFontIcon.d.ts +0 -1
- package/lib/esm/core-react/icons/WebFontIcon.d.ts.map +1 -1
- package/lib/esm/core-react/icons/WebFontIcon.js +0 -1
- package/lib/esm/core-react/icons/WebFontIcon.js.map +1 -1
- package/lib/esm/core-react/icons/variables.scss +0 -9
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.scss +2 -2
- package/lib/esm/core-react/index.scss +0 -2
- package/lib/esm/core-react/inputs/InputLabel.d.ts.map +1 -1
- package/lib/esm/core-react/inputs/InputLabel.js +9 -1
- package/lib/esm/core-react/inputs/InputLabel.js.map +1 -1
- package/lib/esm/core-react/inputs/input-label.scss +2 -2
- package/lib/esm/core-react/inputs/input.scss +7 -7
- package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts +6 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.js +13 -8
- package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.scss +12 -13
- package/lib/esm/core-react/inputs/variables.scss +4 -4
- package/lib/esm/core-react/listbox/Listbox.d.ts +1 -1
- package/lib/esm/core-react/listbox/Listbox.d.ts.map +1 -1
- package/lib/esm/core-react/listbox/Listbox.js +2 -3
- package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
- package/lib/esm/core-react/listbox/Listbox.scss +8 -8
- package/lib/esm/core-react/loading/LoadingBar.js +2 -1
- package/lib/esm/core-react/loading/LoadingBar.js.map +1 -1
- package/lib/esm/core-react/loading/LoadingPrompt.js +2 -1
- package/lib/esm/core-react/loading/LoadingPrompt.js.map +1 -1
- package/lib/esm/core-react/loading/LoadingPrompt.scss +2 -2
- package/lib/esm/core-react/loading/LoadingSpinner.d.ts +1 -1
- package/lib/esm/core-react/loading/LoadingSpinner.d.ts.map +1 -1
- package/lib/esm/core-react/loading/LoadingSpinner.js +2 -1
- package/lib/esm/core-react/loading/LoadingSpinner.js.map +1 -1
- package/lib/esm/core-react/loading/LoadingSpinner.scss +1 -1
- package/lib/esm/core-react/loading/LoadingStatus.js +2 -1
- package/lib/esm/core-react/loading/LoadingStatus.js.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.d.ts +13 -1
- package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.js +56 -11
- package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.scss +24 -14
- package/lib/esm/core-react/notification/MessageRenderer.js +1 -1
- package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
- package/lib/esm/core-react/notification/MessageType.d.ts +1 -1
- package/lib/esm/core-react/notification/MessageType.d.ts.map +1 -1
- package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
- package/lib/esm/core-react/popup/Popup.js +8 -8
- package/lib/esm/core-react/popup/Popup.js.map +1 -1
- package/lib/esm/core-react/popup/Popup.scss +5 -5
- package/lib/esm/core-react/radialmenu/RadialMenu.js +2 -1
- package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
- package/lib/esm/core-react/radialmenu/RadialMenu.scss +1 -1
- package/lib/esm/core-react/searchbox/SearchBox.d.ts.map +1 -1
- package/lib/esm/core-react/searchbox/SearchBox.js +8 -6
- package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
- package/lib/esm/core-react/searchbox/SearchBox.scss +5 -9
- package/lib/esm/core-react/settings/SettingsContainer.js +1 -1
- package/lib/esm/core-react/settings/SettingsContainer.js.map +1 -1
- package/lib/esm/core-react/settings/SettingsContainer.scss +3 -1
- package/lib/esm/core-react/style/index.scss +0 -7
- package/lib/esm/core-react/style/mixins.scss +2 -2
- package/lib/esm/core-react/style/themecolors.scss +0 -6
- package/lib/esm/core-react/tabs/tabs.scss +10 -20
- package/lib/esm/core-react/tabs/vertical.scss +6 -13
- package/lib/esm/core-react/text/BlockText.d.ts.map +1 -1
- package/lib/esm/core-react/text/BlockText.js +1 -0
- package/lib/esm/core-react/text/BlockText.js.map +1 -1
- package/lib/esm/core-react/text/BodyText.d.ts +1 -0
- package/lib/esm/core-react/text/BodyText.d.ts.map +1 -1
- package/lib/esm/core-react/text/BodyText.js +2 -0
- package/lib/esm/core-react/text/BodyText.js.map +1 -1
- package/lib/esm/core-react/text/DisabledText.d.ts.map +1 -1
- package/lib/esm/core-react/text/DisabledText.js +1 -0
- package/lib/esm/core-react/text/DisabledText.js.map +1 -1
- package/lib/esm/core-react/text/FilteredText.js +3 -3
- package/lib/esm/core-react/text/FilteredText.js.map +1 -1
- package/lib/esm/core-react/text/MutedText.d.ts +1 -0
- package/lib/esm/core-react/text/MutedText.d.ts.map +1 -1
- package/lib/esm/core-react/text/MutedText.js +2 -0
- package/lib/esm/core-react/text/MutedText.js.map +1 -1
- package/lib/esm/core-react/text/StyledText.d.ts +1 -0
- package/lib/esm/core-react/text/StyledText.d.ts.map +1 -1
- package/lib/esm/core-react/text/StyledText.js +1 -0
- package/lib/esm/core-react/text/StyledText.js.map +1 -1
- package/lib/esm/core-react/text/block.scss +9 -4
- package/lib/esm/core-react/text/body.scss +7 -4
- package/lib/esm/core-react/text/mixins.scss +3 -3
- package/lib/esm/core-react/tree/ExpansionToggle.d.ts.map +1 -1
- package/lib/esm/core-react/tree/ExpansionToggle.js +3 -1
- package/lib/esm/core-react/tree/ExpansionToggle.js.map +1 -1
- package/lib/esm/core-react/tree/ExpansionToggle.scss +9 -5
- package/lib/esm/core-react/tree/Node.d.ts +2 -2
- package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
- package/lib/esm/core-react/tree/Node.js +2 -3
- package/lib/esm/core-react/tree/Node.js.map +1 -1
- package/lib/esm/core-react/tree/Node.scss +3 -19
- package/lib/esm/core-react/tree/Placeholder.scss +1 -4
- package/lib/esm/core-react/utils/IconWebComponent.js +1 -1
- package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
- package/lib/esm/core-react/utils/Point.js +4 -4
- package/lib/esm/core-react/utils/Point.js.map +1 -1
- package/lib/esm/core-react/utils/Props.d.ts +1 -1
- package/lib/esm/core-react/utils/Props.d.ts.map +1 -1
- package/lib/esm/core-react/utils/Rectangle.js +7 -7
- package/lib/esm/core-react/utils/Rectangle.js.map +1 -1
- package/lib/esm/core-react/utils/Size.js +4 -4
- package/lib/esm/core-react/utils/Size.js.map +1 -1
- package/lib/esm/core-react/utils/Timer.d.ts +1 -1
- package/lib/esm/core-react/utils/Timer.d.ts.map +1 -1
- package/lib/esm/core-react/utils/getBestBWContrastColor.js +3 -3
- package/lib/esm/core-react/utils/getBestBWContrastColor.js.map +1 -1
- package/lib/esm/core-react/utils/getCssVariable.js +1 -1
- package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts +1 -1
- package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js +1 -2
- package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts +1 -1
- package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useProximityToMouse.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useProximityToMouse.js +2 -2
- package/lib/esm/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useRefs.d.ts +1 -1
- package/lib/esm/core-react/utils/hooks/useRefs.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useRefs.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useResizeObserver.js +8 -13
- package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
- package/lib/esm/core-react/utils/typeUtils.d.ts +1 -1
- package/lib/esm/core-react/utils/typeUtils.d.ts.map +1 -1
- package/lib/esm/core-react.d.ts +1 -1
- package/lib/esm/core-react.d.ts.map +1 -1
- package/lib/esm/core-react.js +1 -1
- package/lib/esm/core-react.js.map +1 -1
- package/package.json +26 -26
- package/ThirdPartyNotices.md +0 -28
- package/lib/cjs/core-react/badge/BetaBadge.scss +0 -9
- package/lib/cjs/core-react/button/blue-large.scss +0 -12
- package/lib/cjs/core-react/button/blue.scss +0 -25
- package/lib/cjs/core-react/button/button.scss +0 -70
- package/lib/cjs/core-react/button/classes.scss +0 -14
- package/lib/cjs/core-react/button/disabled-large.scss +0 -12
- package/lib/cjs/core-react/button/disabled.scss +0 -17
- package/lib/cjs/core-react/button/hollow-large.scss +0 -13
- package/lib/cjs/core-react/button/hollow.scss +0 -30
- package/lib/cjs/core-react/button/index.scss +0 -14
- package/lib/cjs/core-react/button/primary-large.scss +0 -12
- package/lib/cjs/core-react/button/primary.scss +0 -25
- package/lib/cjs/core-react/button/variables.scss +0 -22
- package/lib/cjs/core-react/checkbox/checkbox.scss +0 -124
- package/lib/cjs/core-react/checkbox/classes.scss +0 -8
- package/lib/cjs/core-react/checkbox/index.scss +0 -8
- package/lib/cjs/core-react/icons/SvgSprite.d.ts +0 -21
- package/lib/cjs/core-react/icons/SvgSprite.d.ts.map +0 -1
- package/lib/cjs/core-react/icons/SvgSprite.js +0 -27
- package/lib/cjs/core-react/icons/SvgSprite.js.map +0 -1
- package/lib/cjs/core-react/style/data-viz.scss +0 -20
- package/lib/cjs/core-react/style/itwinui-overrides.scss +0 -24
- package/lib/cjs/core-react/style/space.scss +0 -13
- package/lib/cjs/core-react/style/speed.scss +0 -12
- package/lib/cjs/core-react/style/typography.scss +0 -44
- package/lib/cjs/core-react/style/variables.scss +0 -12
- package/lib/esm/core-react/badge/BetaBadge.scss +0 -9
- package/lib/esm/core-react/button/blue-large.scss +0 -12
- package/lib/esm/core-react/button/blue.scss +0 -25
- package/lib/esm/core-react/button/button.scss +0 -70
- package/lib/esm/core-react/button/classes.scss +0 -14
- package/lib/esm/core-react/button/disabled-large.scss +0 -12
- package/lib/esm/core-react/button/disabled.scss +0 -17
- package/lib/esm/core-react/button/hollow-large.scss +0 -13
- package/lib/esm/core-react/button/hollow.scss +0 -30
- package/lib/esm/core-react/button/index.scss +0 -14
- package/lib/esm/core-react/button/primary-large.scss +0 -12
- package/lib/esm/core-react/button/primary.scss +0 -25
- package/lib/esm/core-react/button/variables.scss +0 -22
- package/lib/esm/core-react/checkbox/checkbox.scss +0 -124
- package/lib/esm/core-react/checkbox/classes.scss +0 -8
- package/lib/esm/core-react/checkbox/index.scss +0 -8
- package/lib/esm/core-react/icons/SvgSprite.d.ts +0 -21
- package/lib/esm/core-react/icons/SvgSprite.d.ts.map +0 -1
- package/lib/esm/core-react/icons/SvgSprite.js +0 -23
- package/lib/esm/core-react/icons/SvgSprite.js.map +0 -1
- package/lib/esm/core-react/style/data-viz.scss +0 -20
- package/lib/esm/core-react/style/itwinui-overrides.scss +0 -24
- package/lib/esm/core-react/style/space.scss +0 -13
- package/lib/esm/core-react/style/speed.scss +0 -12
- package/lib/esm/core-react/style/typography.scss +0 -44
- package/lib/esm/core-react/style/variables.scss +0 -12
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
|
-
@import "../style/index.scss";
|
|
7
|
-
@import "../style/themecolors.scss";
|
|
8
|
-
|
|
9
6
|
.core-tree-placeholder {
|
|
10
7
|
display: block;
|
|
11
8
|
box-sizing: border-box;
|
|
@@ -15,6 +12,6 @@
|
|
|
15
12
|
> .contents {
|
|
16
13
|
margin-left: 24px; // offset for expander
|
|
17
14
|
height: 18px;
|
|
18
|
-
background-color:
|
|
15
|
+
background-color: var(--iui-color-background-backdrop);
|
|
19
16
|
}
|
|
20
17
|
}
|
|
@@ -35,7 +35,7 @@ class IconWebComponent extends HTMLElement {
|
|
|
35
35
|
// the esm build of dompurify has a default import but the cjs build does not
|
|
36
36
|
// if there is a default export, use it (likely esm), otherwise use the namespace
|
|
37
37
|
// istanbul ignore next
|
|
38
|
-
const sanitizer = dompurify_1.default
|
|
38
|
+
const sanitizer = dompurify_1.default ?? DOMPurifyNS;
|
|
39
39
|
// eslint-disable-next-line deprecation/deprecation
|
|
40
40
|
const sanitizedSvg = sanitizer.sanitize(atob(dataUriParts[1]));
|
|
41
41
|
const parsedSvg = new window.DOMParser().parseFromString(sanitizedSvg, "text/xml");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWebComponent.js","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,uBAAuB;AACvB,+CAA+C;AAC/C;;GAEG;;;AAEH,0DAAgD;AAChD,sDAA6C;AAC7C,sCAAmC;AACnC,oEAAoD;AAEpD;;GAEG;A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M,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;QACvE,CAAC,CAAC;aACD,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACvB,IAAI,QAAQ,IAAI,QAAQ,CAAC,EAAE,EAAE;gBAC3B,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;aACxB;iBAAM;gBACL,MAAM,IAAI,wBAAO,CAAE,eAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;aACzE;QACH,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,IAAI,GAAG,KAAK,SAAS,EAAE;gBACrB,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;aAClE;iBAAM;gBACL,MAAM,IAAI,wBAAO,CAAE,eAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;aACzE;QACH,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IAClF,CAAC;CACF;AAzDD,4CAyDC","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// istanbul ignore file\n// IconWebComponent requires in-browser testing\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiCore } from \"../UiCore\";\nimport DOMPurify, * as DOMPurifyNS from \"dompurify\";\n\n/**\n * IconWebComponent loads icon from an svg path\n */\nexport class IconWebComponent extends HTMLElement {\n private async connectedCallback() {\n await this.loadSvg();\n this.dispatchEvent(new CustomEvent(\"load\"));\n }\n\n private async loadSvg() {\n // if svg was already appended don't request it again\n if (this.childNodes.length)\n return;\n\n const src = this.getAttribute(\"src\") || \"\";\n\n if (src.startsWith(\"data:\")) {\n const dataUriParts = src.split(\",\");\n\n if (dataUriParts.length !== 2 || \"data:image/svg+xml;base64\" !== dataUriParts[0]) {\n Logger.logError(UiCore.loggerCategory(this), \"Unable to load icon.\");\n }\n\n // the esm build of dompurify has a default import but the cjs build does not\n // if there is a default export, use it (likely esm), otherwise use the namespace\n // istanbul ignore next\n const sanitizer = DOMPurify ?? DOMPurifyNS;\n // eslint-disable-next-line deprecation/deprecation\n const sanitizedSvg = sanitizer.sanitize(atob(dataUriParts[1]));\n\n const parsedSvg = new window.DOMParser().parseFromString(sanitizedSvg, \"text/xml\");\n const errorNode = parsedSvg.querySelector(\"parsererror\");\n if (errorNode || \"svg\" !== parsedSvg.documentElement.nodeName.toLowerCase()) {\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\n }\n\n !this.childNodes.length && this.append(parsedSvg.documentElement);\n return;\n }\n\n await fetch(src)\n .catch((_error) => {\n Logger.logError(UiCore.loggerCategory(this), \"Unable to load icon.\");\n })\n .then(async (response) => {\n if (response && response.ok) {\n return response.text();\n } else {\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\n }\n })\n .then((str) => {\n if (str !== undefined) {\n return (new window.DOMParser()).parseFromString(str, \"text/xml\");\n } else {\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\n }\n })\n .then((data) => !this.childNodes.length && this.append(data.documentElement));\n }\n}\n"]}
|
|
@@ -12,15 +12,15 @@ exports.Point = void 0;
|
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
14
|
class Point {
|
|
15
|
+
/** Creates point from [[PointProps]]. */
|
|
16
|
+
static create(pointProps) {
|
|
17
|
+
return new Point(pointProps.x, pointProps.y);
|
|
18
|
+
}
|
|
15
19
|
/** Creates a new point. */
|
|
16
20
|
constructor(x = 0, y = 0) {
|
|
17
21
|
this.x = x;
|
|
18
22
|
this.y = y;
|
|
19
23
|
}
|
|
20
|
-
/** Creates point from [[PointProps]]. */
|
|
21
|
-
static create(pointProps) {
|
|
22
|
-
return new Point(pointProps.x, pointProps.y);
|
|
23
|
-
}
|
|
24
24
|
/** Calculates Euclidean distance to other point. */
|
|
25
25
|
getDistanceTo(other) {
|
|
26
26
|
const offset = this.getOffsetTo(other);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point.js","sourceRoot":"","sources":["../../../../src/core-react/utils/Point.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;GAEG;AACH,MAAa,KAAK;
|
|
1
|
+
{"version":3,"file":"Point.js","sourceRoot":"","sources":["../../../../src/core-react/utils/Point.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;GAEG;AACH,MAAa,KAAK;IAChB,yCAAyC;IAClC,MAAM,CAAC,MAAM,CAAC,UAAsB;QACzC,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,2BAA2B;IAC3B,YAAmC,IAAI,CAAC,EAAkB,IAAI,CAAC;QAA5B,MAAC,GAAD,CAAC,CAAI;QAAkB,MAAC,GAAD,CAAC,CAAI;IAC/D,CAAC;IAED,oDAAoD;IAC7C,aAAa,CAAC,KAAiB;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,oDAAoD;IAC7C,sBAAsB,CAAC,KA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AC,CAAC,CAAC;IAC9B,CAAC;IAED,8EAA8E;IACvE,QAAQ,CAAC,MAAc;QAC5B,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,qDAAqD;IAC9C,OAAO;QACZ,OAAO;YACL,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAAC,CAAC;SACV,CAAC;IACJ,CAAC;CACF;AApED,sBAoEC","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 { PointProps } from \"@itwin/appui-abstract\";\n\n/** Describes and provides methods to work with 2d points.\n * @internal\n */\nexport class Point implements PointProps {\n /** Creates point from [[PointProps]]. */\n public static create(pointProps: PointProps) {\n return new Point(pointProps.x, pointProps.y);\n }\n\n /** Creates a new point. */\n public constructor(public readonly x = 0, public readonly y = 0) {\n }\n\n /** Calculates Euclidean distance to other point. */\n public getDistanceTo(other: PointProps): number {\n const offset = this.getOffsetTo(other);\n return Math.sqrt(Math.pow(offset.x, 2) + Math.pow(offset.y, 2));\n }\n\n /** Calculates grid-like distance to other point. */\n public getManhattanDistanceTo(other: PointProps): number {\n return Math.abs(this.x - other.x) + Math.abs(this.y - other.y);\n }\n\n /** Gets offset to other point. */\n public getOffsetTo(other: PointProps) {\n return new Point(other.x - this.x, other.y - this.y);\n }\n\n /** @returns New [[Point]] that is offset along the X and Y axes. */\n public offset(offset: PointProps) {\n return new Point(this.x + offset.x, this.y + offset.y);\n }\n\n /** @returns New [[Point]] that is offset along the X axis. */\n public offsetX(offset: number) {\n return new Point(this.x + offset, this.y);\n }\n\n /** @returns New [[Point]] that is offset along the Y axis. */\n public offsetY(offset: number) {\n return new Point(this.x, this.y + offset);\n }\n\n /** @returns True if position of this and other points are equal. */\n public equals(other: PointProps) {\n return other.x === this.x && other.y === this.y;\n }\n\n /** @returns New [[Point]] with modified x value. */\n public setX(x: number) {\n return new Point(x, this.y);\n }\n\n /** @returns New [[Point]] with modified y value. */\n public setY(y: number) {\n return new Point(this.x, y);\n }\n\n /** @returns New [[Point]] with coordinates multiplied by specified factor. */\n public multiply(factor: number) {\n return new Point(this.x * factor, this.y * factor);\n }\n\n /** @returns [[PointProps]] object for this point. */\n public toProps(): PointProps {\n return {\n x: this.x,\n y: this.y,\n };\n }\n}\n"]}
|
|
@@ -33,7 +33,7 @@ export interface NoChildrenProps {
|
|
|
33
33
|
/** Omit children property from T.
|
|
34
34
|
* @public
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type OmitChildrenProp<T extends {
|
|
37
37
|
children?: React.ReactNode;
|
|
38
38
|
}> = Omit<T, "children">;
|
|
39
39
|
//# sourceMappingURL=Props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/Props.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,kCAAkC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,WAAW;CAAI;AAEhG;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/Props.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,kCAAkC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,WAAW;CAAI;AAEhG;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,IAAI,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -25,13 +25,6 @@ var Corner;
|
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
class Rectangle {
|
|
28
|
-
/** Creates rectangle with specified bounds. */
|
|
29
|
-
constructor(left = 0, top = 0, right = 0, bottom = 0) {
|
|
30
|
-
this.left = left;
|
|
31
|
-
this.top = top;
|
|
32
|
-
this.right = right;
|
|
33
|
-
this.bottom = bottom;
|
|
34
|
-
}
|
|
35
28
|
/** Creates rectangle from [[RectangleProps]]. */
|
|
36
29
|
static create(props) {
|
|
37
30
|
return new Rectangle(props.left, props.top, props.right, props.bottom);
|
|
@@ -44,6 +37,13 @@ class Rectangle {
|
|
|
44
37
|
static createXYXY(xA, yA, xB, yB) {
|
|
45
38
|
return new Rectangle(Math.min(xA, xB), Math.min(yA, yB), Math.max(xA, xB), Math.max(yA, yB));
|
|
46
39
|
}
|
|
40
|
+
/** Creates rectangle with specified bounds. */
|
|
41
|
+
constructor(left = 0, top = 0, right = 0, bottom = 0) {
|
|
42
|
+
this.left = left;
|
|
43
|
+
this.top = top;
|
|
44
|
+
this.right = right;
|
|
45
|
+
this.bottom = bottom;
|
|
46
|
+
}
|
|
47
47
|
/** @returns Size of this rectangle. */
|
|
48
48
|
getSize() {
|
|
49
49
|
const width = this.getWidth();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rectangle.js","sourceRoot":"","sources":["../../../../src/core-react/utils/Rectangle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,mCAAgC;AAChC,iCAAyC;AACzC,6CAA0C;AAY1C;;GAEG;AACH,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,yCAAO,CAAA;IACP,2CAAQ,CAAA;IACR,iDAAW,CAAA;IACX,+CAAU,CAAA;AACZ,CAAC,EALW,MAAM,GAAN,cAAM,KAAN,cAAM,QAKjB;AAED;;GAEG;AACH,MAAa,SAAS;IAkBpB,+CAA+C;IAC/C,YAAmC,OAAO,CAAC,EAAkB,MAAM,CAAC,EAAkB,QAAQ,CAAC,EAAkB,SAAS,CAAC;QAAxF,SAAI,GAAJ,IAAI,CAAI;QAAkB,QAAG,GAAH,GAAG,CAAI;QAAkB,UAAK,GAAL,KAAK,CAAI;QAAkB,WAAM,GAAN,MAAM,CAAI;IAC3H,CAAC;IAnBD,iDAAiD;IAC1C,MAAM,CAAC,MAAM,CAAC,KAAqB;QACxC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;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EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC;IACJ,CAAC;CACF;AAjRD,8BAiRC","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 { PointProps } from \"@itwin/appui-abstract\";\nimport { Point } from \"./Point\";\nimport { Size, SizeProps } from \"./Size\";\nimport { UiGeometry } from \"./UiGeometry\";\n\n/** Describes 2d bounds.\n * @public\n */\nexport interface RectangleProps {\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n}\n\n/** Available corners of [[Rectangle]].\n * @internal\n */\nexport enum Corner {\n TopLeft,\n TopRight,\n BottomRight,\n BottomLeft,\n}\n\n/** Describes and provides methods to work with 2d bounds.\n * @internal\n */\nexport class Rectangle implements RectangleProps {\n /** Creates rectangle from [[RectangleProps]]. */\n public static create(props: RectangleProps): Rectangle {\n return new Rectangle(props.left, props.top, props.right, props.bottom);\n }\n\n /** Creates rectangle from [[SizeProps]]. */\n public static createFromSize(size: SizeProps): Rectangle {\n return new Rectangle(0, 0, size.width, size.height);\n }\n\n /** Create a rectangle with 2 pairs of xy candidates. Theses are compared and shuffled as needed for the rectangle. */\n public static createXYXY(xA: number, yA: number, xB: number, yB: number): Rectangle {\n return new Rectangle(\n Math.min(xA, xB), Math.min(yA, yB),\n Math.max(xA, xB), Math.max(yA, yB));\n }\n\n /** Creates rectangle with specified bounds. */\n public constructor(public readonly left = 0, public readonly top = 0, public readonly right = 0, public readonly bottom = 0) {\n }\n\n /** @returns Size of this rectangle. */\n public getSize(): Size {\n const width = this.getWidth();\n const height = this.getHeight();\n return new Size(width, height);\n }\n\n /** @returns Width of this rectangle. */\n public getWidth(): number {\n return this.right - this.left;\n }\n\n /** @returns Height of this rectangle. */\n public getHeight(): number {\n return this.bottom - this.top;\n }\n\n /** @returns Position of specified corner. */\n public getCorner(corner: Corner): Point {\n switch (corner) {\n case Corner.TopLeft: {\n return this.topLeft();\n }\n case Corner.TopRight: {\n return new Point(this.right, this.top);\n }\n case Corner.BottomLeft: {\n return new Point(this.left, this.bottom);\n }\n case Corner.BottomRight: {\n return new Point(this.right, this.bottom);\n }\n }\n }\n\n /**\n * Inset the bounds of this rectangle.\n * @note Negative arguments will increase the size of rectangle.\n * @returns New [[Rectangle]] with modified bounds.\n */\n public inset(left: number, top: number, right: number, bottom: number): Rectangle {\n return new Rectangle(this.left + left, this.top + top, this.right - right, this.bottom - bottom);\n }\n\n /**\n * Offsets the rectangle along the X and Y axes.\n * @returns New [[Rectangle]] with modified position.\n */\n public offset(offset: PointProps): Rectangle {\n return new Rectangle(this.left + offset.x, this.top + offset.y, this.right + offset.x, this.bottom + offset.y);\n }\n\n /**\n * Offsets the rectangle along the X axis.\n * @returns New [[Rectangle]] with modified position along X axis.\n */\n public offsetX(offset: number): Rectangle {\n return new Rectangle(this.left + offset, this.top, this.right + offset, this.bottom);\n }\n\n /**\n * Offsets the rectangle along the Y axis.\n * @returns New [[Rectangle]] with modified position along Y axis.\n */\n public offsetY(offset: number): Rectangle {\n return new Rectangle(this.left, this.top + offset, this.right, this.bottom + offset);\n }\n\n /**\n * Moves the top left corner of rectangle to specified point.\n * @returns New [[Rectangle]] with modified position.\n */\n public setPosition(position: PointProps): Rectangle {\n return new Rectangle(position.x, position.y, position.x + this.getWidth(), position.y + this.getHeight());\n }\n\n /**\n * Sets the height of the rectangle.\n * @note Only [[Edge.Bottom]] is subject to change.\n * @returns New [[Rectangle]] with modified height.\n */\n public setHeight(height: number): Rectangle {\n return new Rectangle(this.left, this.top, this.right, this.top + height);\n }\n\n /**\n * Sets the width of the rectangle.\n * @note Only [[Edge.Right]] is subject to change.\n * @returns New [[Rectangle]] with modified width.\n */\n public setWidth(width: number): Rectangle {\n return new Rectangle(this.left, this.top, this.left + width, this.bottom);\n }\n\n /**\n * Sets the height and width of the rectangle.\n * @note Only [[Edge.Bottom]] and [[Edge.Right]] are subjects to change.\n * @returns New [[Rectangle]] with modified height.\n */\n public setSize(size: SizeProps): Rectangle {\n return new Rectangle(this.left, this.top, this.left + size.width, this.top + size.height);\n }\n\n /** Checks if bounds of two rectangles match. */\n public equals(other: RectangleProps): boolean {\n if (this.left === other.left &&\n this.top === other.top &&\n this.right === other.right &&\n this.bottom === other.bottom)\n return true;\n\n return false;\n }\n\n /**\n * Checks if point is within bounds of the rectangle.\n * @note Inclusive.\n */\n public containsPoint(point: PointProps): boolean {\n return point.x >= this.left && point.x <= this.right && point.y >= this.top && point.y <= this.bottom;\n }\n\n /**\n * Checks if a point given as x,y is within the rectangle.\n * @note Inclusive.\n */\n public containsXY(x: number, y: number): boolean {\n return this.containsPoint({x, y});\n }\n\n /**\n * @returns true if this rectangle contains other rectangle.\n * @note Inclusive.\n */\n public contains(other: RectangleProps): boolean {\n return other.left >= this.left && other.right <= this.right && other.top >= this.top && other.bottom <= this.bottom;\n }\n\n /** @returns New [[Rectangle]] which is contained in other rectangle. */\n public containIn(other: RectangleProps): Rectangle {\n let contained: Rectangle = this.containVerticallyIn(other);\n contained = contained.containHorizontallyIn(other);\n return contained;\n }\n\n /** @returns New [[Rectangle]] which is vertically contained in other rectangle. */\n public containVerticallyIn(other: RectangleProps): Rectangle {\n const contained = this.offsetY(Math.min(other.bottom - this.bottom, 0));\n return contained.offsetY(Math.max(other.top - contained.top, 0));\n }\n\n /** @returns New [[Rectangle]] which is horizontally contained in other rectangle. */\n public containHorizontallyIn(other: RectangleProps): Rectangle {\n const contained = this.offsetX(Math.min(other.right - this.right, 0));\n return contained.offsetX(Math.max(other.left - contained.left, 0));\n }\n\n /** @returns [[Corner.TopLeft]] position of this rectangle. */\n public topLeft(): Point {\n return new Point(this.left, this.top);\n }\n\n /** @returns Center point position of this rectangle. */\n public center(): Point {\n const x = this.left + (this.right - this.left) / 2;\n const y = this.top + (this.bottom - this.top) / 2;\n return new Point(x, y);\n }\n\n /** @returns true if this rectangle intersects other rectangle. */\n public intersects(other: RectangleProps): boolean {\n return this.left < other.right && this.right > other.left &&\n this.top < other.bottom && this.bottom > other.top;\n }\n\n /**\n * Merges outer edges of this and other rectangles.\n * @returns New [[Rectangle]] with merged bounds.\n */\n public outerMergeWith(other: RectangleProps): Rectangle {\n const left = Math.min(this.left, other.left);\n const top = Math.min(this.top, other.top);\n const right = Math.max(this.right, other.right);\n const bottom = Math.max(this.bottom, other.bottom);\n return new Rectangle(left, top, right, bottom);\n }\n\n /**\n * Vertically divides this rectangle into specified number of equal height segments.\n * @returns Vertical rectangle segment.\n */\n public getVerticalSegmentBounds(segmentId: number, numberOfSegments: number): Rectangle {\n const segmentHeight = this.getHeight() / numberOfSegments;\n\n const top = segmentId * segmentHeight;\n return this.inset(0, top, 0, 0).setHeight(segmentHeight);\n }\n\n /**\n * Horizontally divides this rectangle into specified number of equal width segments.\n * @returns Horizontal rectangle segment.\n */\n public getHorizontalSegmentBounds(segmentId: number, numberOfSegments: number): Rectangle {\n const segmentWidth = this.getWidth() / numberOfSegments;\n\n const left = segmentId * segmentWidth;\n return this.inset(left, 0, 0, 0).setWidth(segmentWidth);\n }\n\n /**\n * Calculates the shortest distance between this rectangle and a given point.\n * @returns The shortest distance to a point.\n */\n public getShortestDistanceToPoint(point: PointProps): number {\n let shortestDistance = 0;\n\n if (point.x < this.left) {\n if (point.y < this.top)\n shortestDistance = UiGeometry.hypotenuseXY(this.left - point.x, this.top - point.y);\n else if (point.y <= this.bottom)\n shortestDistance = this.left - point.x;\n else\n shortestDistance = UiGeometry.hypotenuseXY(this.left - point.x, this.bottom - point.y);\n } else if (point.x <= this.right) {\n if (point.y < this.top)\n shortestDistance = this.top - point.y;\n else if (point.y <= this.bottom)\n shortestDistance = 0;\n else\n shortestDistance = point.y - this.bottom;\n } else {\n if (point.y < this.top)\n shortestDistance = UiGeometry.hypotenuseXY(this.right - point.x, this.top - point.y);\n else if (point.y <= this.bottom)\n shortestDistance = point.x - this.right;\n else\n shortestDistance = UiGeometry.hypotenuseXY(this.right - point.x, this.bottom - point.y);\n }\n\n return shortestDistance;\n }\n\n /** @returns [[RectangleProps]] object for this rectangle. */\n public toProps(): RectangleProps {\n return {\n bottom: this.bottom,\n left: this.left,\n right: this.right,\n top: this.top,\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Rectangle.js","sourceRoot":"","sources":["../../../../src/core-react/utils/Rectangle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,mCAAgC;AAChC,iCAAyC;AACzC,6CAA0C;AAY1C;;GAEG;AACH,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,yCAAO,CAAA;IACP,2CAAQ,CAAA;IACR,iDAAW,CAAA;IACX,+CAAU,CAAA;AACZ,CAAC,EALW,MAAM,GAAN,cAAM,KAAN,cAAM,QAKjB;AAED;;GAEG;AACH,MAAa,SAAS;IACpB,iDAAiD;IAC1C,MAAM,CAAC,MAAM,CAAC,KAAqB;QACxC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzE,CAAC;IAED,4CAA4C;IACrC,MAAM,CAAC,cAAc,CAAC,IAAe;QAC1C,OAAO,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IAED,sHAAsH;IAC/G,MAAM,CAAC,UAAU,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;QACrE,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAClC,IAAI,C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,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;SAC1F;aAAM,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE;YAChC,IAAI,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG;gBACpB,gBAAgB,GAAG,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;iBACnC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM;gBAC7B,gBAAgB,GAAG,CAAC,CAAC;;gBAErB,gBAAgB,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;SAC5C;aAAM;YACL,IAAI,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG;gBACpB,gBAAgB,GAAG,uBAAU,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClF,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM;gBAC7B,gBAAgB,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;;gBAExC,gBAAgB,GAAG,uBAAU,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3F;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,6DAA6D;IACtD,OAAO;QACZ,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC;IACJ,CAAC;CACF;AAjRD,8BAiRC","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 { PointProps } from \"@itwin/appui-abstract\";\nimport { Point } from \"./Point\";\nimport { Size, SizeProps } from \"./Size\";\nimport { UiGeometry } from \"./UiGeometry\";\n\n/** Describes 2d bounds.\n * @public\n */\nexport interface RectangleProps {\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n}\n\n/** Available corners of [[Rectangle]].\n * @internal\n */\nexport enum Corner {\n TopLeft,\n TopRight,\n BottomRight,\n BottomLeft,\n}\n\n/** Describes and provides methods to work with 2d bounds.\n * @internal\n */\nexport class Rectangle implements RectangleProps {\n /** Creates rectangle from [[RectangleProps]]. */\n public static create(props: RectangleProps): Rectangle {\n return new Rectangle(props.left, props.top, props.right, props.bottom);\n }\n\n /** Creates rectangle from [[SizeProps]]. */\n public static createFromSize(size: SizeProps): Rectangle {\n return new Rectangle(0, 0, size.width, size.height);\n }\n\n /** Create a rectangle with 2 pairs of xy candidates. Theses are compared and shuffled as needed for the rectangle. */\n public static createXYXY(xA: number, yA: number, xB: number, yB: number): Rectangle {\n return new Rectangle(\n Math.min(xA, xB), Math.min(yA, yB),\n Math.max(xA, xB), Math.max(yA, yB));\n }\n\n /** Creates rectangle with specified bounds. */\n public constructor(public readonly left = 0, public readonly top = 0, public readonly right = 0, public readonly bottom = 0) {\n }\n\n /** @returns Size of this rectangle. */\n public getSize(): Size {\n const width = this.getWidth();\n const height = this.getHeight();\n return new Size(width, height);\n }\n\n /** @returns Width of this rectangle. */\n public getWidth(): number {\n return this.right - this.left;\n }\n\n /** @returns Height of this rectangle. */\n public getHeight(): number {\n return this.bottom - this.top;\n }\n\n /** @returns Position of specified corner. */\n public getCorner(corner: Corner): Point {\n switch (corner) {\n case Corner.TopLeft: {\n return this.topLeft();\n }\n case Corner.TopRight: {\n return new Point(this.right, this.top);\n }\n case Corner.BottomLeft: {\n return new Point(this.left, this.bottom);\n }\n case Corner.BottomRight: {\n return new Point(this.right, this.bottom);\n }\n }\n }\n\n /**\n * Inset the bounds of this rectangle.\n * @note Negative arguments will increase the size of rectangle.\n * @returns New [[Rectangle]] with modified bounds.\n */\n public inset(left: number, top: number, right: number, bottom: number): Rectangle {\n return new Rectangle(this.left + left, this.top + top, this.right - right, this.bottom - bottom);\n }\n\n /**\n * Offsets the rectangle along the X and Y axes.\n * @returns New [[Rectangle]] with modified position.\n */\n public offset(offset: PointProps): Rectangle {\n return new Rectangle(this.left + offset.x, this.top + offset.y, this.right + offset.x, this.bottom + offset.y);\n }\n\n /**\n * Offsets the rectangle along the X axis.\n * @returns New [[Rectangle]] with modified position along X axis.\n */\n public offsetX(offset: number): Rectangle {\n return new Rectangle(this.left + offset, this.top, this.right + offset, this.bottom);\n }\n\n /**\n * Offsets the rectangle along the Y axis.\n * @returns New [[Rectangle]] with modified position along Y axis.\n */\n public offsetY(offset: number): Rectangle {\n return new Rectangle(this.left, this.top + offset, this.right, this.bottom + offset);\n }\n\n /**\n * Moves the top left corner of rectangle to specified point.\n * @returns New [[Rectangle]] with modified position.\n */\n public setPosition(position: PointProps): Rectangle {\n return new Rectangle(position.x, position.y, position.x + this.getWidth(), position.y + this.getHeight());\n }\n\n /**\n * Sets the height of the rectangle.\n * @note Only [[Edge.Bottom]] is subject to change.\n * @returns New [[Rectangle]] with modified height.\n */\n public setHeight(height: number): Rectangle {\n return new Rectangle(this.left, this.top, this.right, this.top + height);\n }\n\n /**\n * Sets the width of the rectangle.\n * @note Only [[Edge.Right]] is subject to change.\n * @returns New [[Rectangle]] with modified width.\n */\n public setWidth(width: number): Rectangle {\n return new Rectangle(this.left, this.top, this.left + width, this.bottom);\n }\n\n /**\n * Sets the height and width of the rectangle.\n * @note Only [[Edge.Bottom]] and [[Edge.Right]] are subjects to change.\n * @returns New [[Rectangle]] with modified height.\n */\n public setSize(size: SizeProps): Rectangle {\n return new Rectangle(this.left, this.top, this.left + size.width, this.top + size.height);\n }\n\n /** Checks if bounds of two rectangles match. */\n public equals(other: RectangleProps): boolean {\n if (this.left === other.left &&\n this.top === other.top &&\n this.right === other.right &&\n this.bottom === other.bottom)\n return true;\n\n return false;\n }\n\n /**\n * Checks if point is within bounds of the rectangle.\n * @note Inclusive.\n */\n public containsPoint(point: PointProps): boolean {\n return point.x >= this.left && point.x <= this.right && point.y >= this.top && point.y <= this.bottom;\n }\n\n /**\n * Checks if a point given as x,y is within the rectangle.\n * @note Inclusive.\n */\n public containsXY(x: number, y: number): boolean {\n return this.containsPoint({x, y});\n }\n\n /**\n * @returns true if this rectangle contains other rectangle.\n * @note Inclusive.\n */\n public contains(other: RectangleProps): boolean {\n return other.left >= this.left && other.right <= this.right && other.top >= this.top && other.bottom <= this.bottom;\n }\n\n /** @returns New [[Rectangle]] which is contained in other rectangle. */\n public containIn(other: RectangleProps): Rectangle {\n let contained: Rectangle = this.containVerticallyIn(other);\n contained = contained.containHorizontallyIn(other);\n return contained;\n }\n\n /** @returns New [[Rectangle]] which is vertically contained in other rectangle. */\n public containVerticallyIn(other: RectangleProps): Rectangle {\n const contained = this.offsetY(Math.min(other.bottom - this.bottom, 0));\n return contained.offsetY(Math.max(other.top - contained.top, 0));\n }\n\n /** @returns New [[Rectangle]] which is horizontally contained in other rectangle. */\n public containHorizontallyIn(other: RectangleProps): Rectangle {\n const contained = this.offsetX(Math.min(other.right - this.right, 0));\n return contained.offsetX(Math.max(other.left - contained.left, 0));\n }\n\n /** @returns [[Corner.TopLeft]] position of this rectangle. */\n public topLeft(): Point {\n return new Point(this.left, this.top);\n }\n\n /** @returns Center point position of this rectangle. */\n public center(): Point {\n const x = this.left + (this.right - this.left) / 2;\n const y = this.top + (this.bottom - this.top) / 2;\n return new Point(x, y);\n }\n\n /** @returns true if this rectangle intersects other rectangle. */\n public intersects(other: RectangleProps): boolean {\n return this.left < other.right && this.right > other.left &&\n this.top < other.bottom && this.bottom > other.top;\n }\n\n /**\n * Merges outer edges of this and other rectangles.\n * @returns New [[Rectangle]] with merged bounds.\n */\n public outerMergeWith(other: RectangleProps): Rectangle {\n const left = Math.min(this.left, other.left);\n const top = Math.min(this.top, other.top);\n const right = Math.max(this.right, other.right);\n const bottom = Math.max(this.bottom, other.bottom);\n return new Rectangle(left, top, right, bottom);\n }\n\n /**\n * Vertically divides this rectangle into specified number of equal height segments.\n * @returns Vertical rectangle segment.\n */\n public getVerticalSegmentBounds(segmentId: number, numberOfSegments: number): Rectangle {\n const segmentHeight = this.getHeight() / numberOfSegments;\n\n const top = segmentId * segmentHeight;\n return this.inset(0, top, 0, 0).setHeight(segmentHeight);\n }\n\n /**\n * Horizontally divides this rectangle into specified number of equal width segments.\n * @returns Horizontal rectangle segment.\n */\n public getHorizontalSegmentBounds(segmentId: number, numberOfSegments: number): Rectangle {\n const segmentWidth = this.getWidth() / numberOfSegments;\n\n const left = segmentId * segmentWidth;\n return this.inset(left, 0, 0, 0).setWidth(segmentWidth);\n }\n\n /**\n * Calculates the shortest distance between this rectangle and a given point.\n * @returns The shortest distance to a point.\n */\n public getShortestDistanceToPoint(point: PointProps): number {\n let shortestDistance = 0;\n\n if (point.x < this.left) {\n if (point.y < this.top)\n shortestDistance = UiGeometry.hypotenuseXY(this.left - point.x, this.top - point.y);\n else if (point.y <= this.bottom)\n shortestDistance = this.left - point.x;\n else\n shortestDistance = UiGeometry.hypotenuseXY(this.left - point.x, this.bottom - point.y);\n } else if (point.x <= this.right) {\n if (point.y < this.top)\n shortestDistance = this.top - point.y;\n else if (point.y <= this.bottom)\n shortestDistance = 0;\n else\n shortestDistance = point.y - this.bottom;\n } else {\n if (point.y < this.top)\n shortestDistance = UiGeometry.hypotenuseXY(this.right - point.x, this.top - point.y);\n else if (point.y <= this.bottom)\n shortestDistance = point.x - this.right;\n else\n shortestDistance = UiGeometry.hypotenuseXY(this.right - point.x, this.bottom - point.y);\n }\n\n return shortestDistance;\n }\n\n /** @returns [[RectangleProps]] object for this rectangle. */\n public toProps(): RectangleProps {\n return {\n bottom: this.bottom,\n left: this.left,\n right: this.right,\n top: this.top,\n };\n }\n}\n"]}
|
|
@@ -12,15 +12,15 @@ exports.Size = void 0;
|
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
14
|
class Size {
|
|
15
|
+
/** Creates a size from [[SizeProps]]. */
|
|
16
|
+
static create(size) {
|
|
17
|
+
return new Size(size.width, size.height);
|
|
18
|
+
}
|
|
15
19
|
/** Creates a size with specified dimensions. */
|
|
16
20
|
constructor(width = 0, height = 0) {
|
|
17
21
|
this.width = width;
|
|
18
22
|
this.height = height;
|
|
19
23
|
}
|
|
20
|
-
/** Creates a size from [[SizeProps]]. */
|
|
21
|
-
static create(size) {
|
|
22
|
-
return new Size(size.width, size.height);
|
|
23
|
-
}
|
|
24
24
|
/** Checks if dimensions of two sizes are equal. */
|
|
25
25
|
equals(other) {
|
|
26
26
|
if (this.width === other.width &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Size.js","sourceRoot":"","sources":["../../../../src/core-react/utils/Size.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAUH;;GAEG;AACH,MAAa,IAAI;
|
|
1
|
+
{"version":3,"file":"Size.js","sourceRoot":"","sources":["../../../../src/core-react/utils/Size.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAUH;;GAEG;AACH,MAAa,IAAI;IACf,yCAAyC;IAClC,MAAM,CAAC,MAAM,CAAC,IAAe;QAClC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED,gDAAgD;IAChD,YAAmC,QAAQ,CAAC,EAAkB,SAAS,CAAC;QAArC,UAAK,GAAL,KAAK,CAAI;QAAkB,WAAM,GAAN,MAAM,CAAI;IACxE,CAAC;IAED,mDAAmD;IAC5C,MAAM,CAAC,KAAgB;QAC5B,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK;YAC5B,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;YAC5B,OAAO,IAAI,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAjBD,oBAiBC","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/** Describes 2d dimensions.\n * @public\n */\nexport interface SizeProps {\n readonly width: number;\n readonly height: number;\n}\n\n/** Describes and provides methods to work with 2d dimensions.\n * @internal\n */\nexport class Size implements SizeProps {\n /** Creates a size from [[SizeProps]]. */\n public static create(size: SizeProps) {\n return new Size(size.width, size.height);\n }\n\n /** Creates a size with specified dimensions. */\n public constructor(public readonly width = 0, public readonly height = 0) {\n }\n\n /** Checks if dimensions of two sizes are equal. */\n public equals(other: SizeProps) {\n if (this.width === other.width &&\n this.height === other.height)\n return true;\n return false;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timer.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/Timer.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"Timer.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/Timer.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;AAElD;;GAEG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAA6B;IAE/C;;;OAGG;gBACgB,OAAO,EAAE,MAAM;IAIlC,6CAA6C;IAC7C,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,0EAA0E;IAC1E,IAAW,KAAK,IAGK,MAAM,CAD1B;IACD,IAAW,KAAK,CAAC,EAAE,EAAE,MAAM,EAE1B;IAED,uDAAuD;IAChD,YAAY,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS;IAIzD,yBAAyB;IAClB,KAAK;IAQZ,wBAAwB;IACjB,IAAI;IAQX,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;CAGrB"}
|
|
@@ -13,9 +13,9 @@ exports.getBestBWContrastColor = void 0;
|
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
15
|
function getBestBWContrastColor(hexColor) {
|
|
16
|
-
const r = parseInt(hexColor.
|
|
17
|
-
const g = parseInt(hexColor.
|
|
18
|
-
const b = parseInt(hexColor.
|
|
16
|
+
const r = parseInt(hexColor.substring(1, 3), 16);
|
|
17
|
+
const g = parseInt(hexColor.substring(3, 5), 16);
|
|
18
|
+
const b = parseInt(hexColor.substring(5, 7), 16);
|
|
19
19
|
const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
|
|
20
20
|
return (yiq >= 128) ? "black" : "white";
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBestBWContrastColor.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getBestBWContrastColor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,uBAAuB;AAEvB;;GAEG;AACH,SAAgB,sBAAsB,CAAC,QAAgB;IACrD,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"getBestBWContrastColor.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getBestBWContrastColor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,uBAAuB;AAEvB;;GAEG;AACH,SAAgB,sBAAsB,CAAC,QAAgB;IACrD,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjD,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IACvD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AAC1C,CAAC;AAND,wDAMC","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// cspell:ignore RRGGBB\n\n/** Gets best black or white color that contrasts with a given color in #RRGGBB format.\n * @internal\n */\nexport function getBestBWContrastColor(hexColor: string) {\n const r = parseInt(hexColor.substring(1, 3), 16);\n const g = parseInt(hexColor.substring(3, 5), 16);\n const b = parseInt(hexColor.substring(5, 7), 16);\n const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\n return (yiq >= 128) ? \"black\" : \"white\";\n}\n"]}
|
|
@@ -12,7 +12,7 @@ exports.getCssVariableAsNumber = exports.getCssVariable = void 0;
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
function getCssVariable(variableName, htmlElement) {
|
|
15
|
-
const element = htmlElement
|
|
15
|
+
const element = htmlElement ?? document.documentElement;
|
|
16
16
|
const cssStyles = getComputedStyle(element, null);
|
|
17
17
|
const cssVal = String(cssStyles.getPropertyValue(variableName)).trim();
|
|
18
18
|
return cssVal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCssVariable.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,SAAgB,cAAc,CAAC,YAAoB,EAAE,WAAyB;IAC5E,MAAM,OAAO,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"getCssVariable.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,SAAgB,cAAc,CAAC,YAAoB,EAAE,WAAyB;IAC5E,MAAM,OAAO,GAAG,WAAW,IAAI,QAAQ,CAAC,eAAe,CAAC;IACxD,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvE,OAAO,MAAM,CAAC;AAChB,CAAC;AALD,wCAKC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CAAC,YAAoB,EAAE,WAAyB;IACpF,IAAI,SAAS,GAAW,GAAG,CAAC;IAC5B,MAAM,SAAS,GAAG,cAAc,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAC5D,IAAI,SAAS;QACX,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC;AACnB,CAAC;AAND,wDAMC","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/** Get CSS variable\n * @public\n */\nexport function getCssVariable(variableName: string, htmlElement?: HTMLElement): string {\n const element = htmlElement ?? document.documentElement;\n const cssStyles = getComputedStyle(element, null);\n const cssVal = String(cssStyles.getPropertyValue(variableName)).trim();\n return cssVal;\n}\n\n/** Get CSS variable as number\n * @public\n */\nexport function getCssVariableAsNumber(variableName: string, htmlElement?: HTMLElement): number {\n let cssValNum: number = NaN;\n const cssValStr = getCssVariable(variableName, htmlElement);\n if (cssValStr)\n cssValNum = parseFloat(cssValStr);\n return cssValNum;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export
|
|
2
|
+
export type ResizeObserverType = typeof import("resize-observer-polyfill").default;
|
|
3
3
|
/** @internal */
|
|
4
4
|
export declare const ResizeObserver: ResizeObserverType;
|
|
5
5
|
//# sourceMappingURL=ResizeObserverPolyfill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResizeObserverPolyfill.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/ResizeObserverPolyfill.tsx"],"names":[],"mappings":"AASA,gBAAgB;AAChB,
|
|
1
|
+
{"version":3,"file":"ResizeObserverPolyfill.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/ResizeObserverPolyfill.tsx"],"names":[],"mappings":"AASA,gBAAgB;AAChB,MAAM,MAAM,kBAAkB,GAAG,cAAc,0BAA0B,EAAE,OAAO,CAAC;AASnF,gBAAgB;AAChB,eAAO,MAAM,cAAc,EAAE,kBAAsD,CAAC"}
|
|
@@ -41,8 +41,7 @@ function useCrossOriginPopup(visible, url, title, width, height, onClose) {
|
|
|
41
41
|
}
|
|
42
42
|
}, [handleClosedPopup]);
|
|
43
43
|
const checkPopupClosed = React.useCallback(() => {
|
|
44
|
-
|
|
45
|
-
if ((_a = popupWindow.current) === null || _a === void 0 ? void 0 : _a.closed) {
|
|
44
|
+
if (popupWindow.current?.closed) {
|
|
46
45
|
// Popup has been closed by end-user, inform our host and cleanup
|
|
47
46
|
handleClosedPopup();
|
|
48
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossOriginPopup.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useCrossOriginPopup.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,+CAA0C;AAE1C;;GAEG;AACH,SAAgB,mBAAmB,CAAC,OAAgB,EAAE,GAAuB,EAAE,KAAa,EAAE,KAAa,EAAE,MAAc,EAAE,OAAmB;IAE9I,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAsB,CAAC;IAE7F,gHAAgH;IAChH,oCAAoC;IACpC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,EAAU,CAAC;IAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE3C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,OAAO,GAAG,KAAK,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QAC7E,IAAI,OAAO,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE;YAChD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,SAAS,UAAU,CAAC,OAAO,WAAW,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7H,IAAI,KAAK,EAAE;gBACT,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;gBAE5B,iEAAiE;gBACjE,uBAAuB,CAAC,IAAI,CAAC,CAAC;aAC/B;SACF;QAED,sEAAsE;QACtE,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE;YACjD,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAE5B,iBAAiB,EAAE,CAAC;SACrB;IAEH,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC;AArFD,kDAqFC","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 {useInterval} from \"./useInterval\";\n\n/** Hook that will show a popup window\n * @beta\n */\nexport function useCrossOriginPopup(visible: boolean, url: string | undefined, title: string, width: number, height: number, onClose: () => void) {\n\n const [checkPopupAliveDelay, setCheckPopupAliveDelay] = React.useState<number | undefined>();\n\n // ONLY re-render the popup when visibility changes, any other changes get deferred until next visibility change\n // hence the massive use of 'useRef'\n const popupWindow = React.useRef<Window>();\n const savedUrl = React.useRef(url);\n const savedTitle = React.useRef(title);\n const savedWidth = React.useRef(width);\n const savedHeight = React.useRef(height);\n const savedOnClose = React.useRef(onClose);\n\n React.useEffect(() => { savedUrl.current = url; }, [url]);\n React.useEffect(() => { savedTitle.current = title; }, [title]);\n React.useEffect(() => { savedWidth.current = width; }, [width]);\n React.useEffect(() => { savedHeight.current = height; }, [height]);\n React.useEffect(() => { savedOnClose.current = onClose; }, [onClose]);\n\n // Cleanup method after a popup closure. Also calls the OnClose callback.\n const handleClosedPopup = React.useCallback(() => {\n savedOnClose.current();\n setCheckPopupAliveDelay(undefined);\n popupWindow.current = undefined;\n }, []);\n\n const closePopup = React.useCallback(() => {\n if (popupWindow.current !== undefined) {\n popupWindow.current.close(); // Manually close the popup\n handleClosedPopup();\n }\n }, [handleClosedPopup]);\n\n const checkPopupClosed = React.useCallback(() => {\n if (popupWindow.current?.closed) {\n // Popup has been closed by end-user, inform our host and cleanup\n handleClosedPopup();\n }\n }, [handleClosedPopup]);\n\n // Close popup when parent window get closed\n React.useEffect(() => {\n window.onbeforeunload = (_event) => {closePopup();};\n return () => {\n window.onbeforeunload = null;\n };\n }, [closePopup]);\n\n // Whenever the hook is unloaded, make sure the underlying popup get closed.\n // Note: An interval is used to check if popup was closed by user: because we access\n // a cross domain resource inside the popup, we don't have access to popup window events.\n // As a workaround, we periodically check if popup is still alive.\n // Reference: https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128\n React.useEffect(() => {\n return () => {\n closePopup();\n };\n }, [closePopup]);\n\n // Timer that checks if popup was closed by end-user\n useInterval(checkPopupClosed, checkPopupAliveDelay);\n\n // ==> Main render effect\n // Monitors visibility changes and open/close the popup accordingly.\n React.useEffect(() => {\n // If visible and a popup window is not already open, open a new popup window\n if (visible && popupWindow.current === undefined) {\n const popup = window.open(savedUrl.current, savedTitle.current, `width=${savedWidth.current},height=${savedHeight.current}`);\n if (popup) {\n popup.focus();\n popupWindow.current = popup;\n\n // Start and interval that will check if popup got closed by user\n setCheckPopupAliveDelay(1000);\n }\n }\n\n // If not visible but a previous popup window is still open, close it.\n if (!visible && popupWindow.current !== undefined) {\n popupWindow.current.close();\n\n handleClosedPopup();\n }\n\n }, [handleClosedPopup, visible]);\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
/** @public */
|
|
6
|
-
export
|
|
6
|
+
export type OutsideClickEvent = PointerEvent | MouseEvent | TouchEvent;
|
|
7
7
|
/** Invokes onOutsideClick handler when user clicks outside of referenced element.
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOnOutsideClick.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useOnOutsideClick.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,cAAc;AACd,
|
|
1
|
+
{"version":3,"file":"useOnOutsideClick.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useOnOutsideClick.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,cAAc;AACd,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvE;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EACjD,cAAc,CAAC,EAAE,MAAM,IAAI;AAC3B,gFAAgF;AAChF,qBAAqB,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,OAAO,sBAoE1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProximityToMouse.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useProximityToMouse.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,gBAAgB;AAChB,qBAAa,gBAAiB,SAAQ,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useProximityToMouse.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useProximityToMouse.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,gBAAgB;AAChB,qBAAa,gBAAiB,SAAQ,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;CAAG;AAEtE;;GAEG;AACH,eAAO,MAAM,mBAAmB,eAClB,gBAAgB,SACtB,OAAO,+BAkCd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,uBAAuB,cACvB,MAAM,SACX,OAAO,yBAEZ,MAIF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,mBAAoB,MAAM,KAAG,MAEhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,mBAAoB,MAAM,KAAG,MAElE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,mBAAoB,MAAM,KAAG,MAEpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,YAAa,MAAM,KAAG,MAE3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,YAAa,MAAM,KAAG,MAErD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,eAAgB,MAAM,KAAG,MAE7D,CAAC"}
|
|
@@ -64,7 +64,7 @@ exports.TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT = 10;
|
|
|
64
64
|
* @internal
|
|
65
65
|
*/
|
|
66
66
|
const calculateProximityScale = (proximity, snap = false, threshold = exports.PROXIMITY_THRESHOLD_DEFAULT) => {
|
|
67
|
-
let scale = (
|
|
67
|
+
let scale = (proximity < threshold ? threshold - proximity : 0) / threshold;
|
|
68
68
|
if (snap && scale > 0)
|
|
69
69
|
scale = 1.0;
|
|
70
70
|
return scale;
|
|
@@ -95,7 +95,7 @@ exports.calculateBackdropFilterBlur = calculateBackdropFilterBlur;
|
|
|
95
95
|
* @internal
|
|
96
96
|
*/
|
|
97
97
|
const getToolbarBackgroundColor = (opacity) => {
|
|
98
|
-
return `
|
|
98
|
+
return `hsl(var(--iui-color-background-hsl) / ${opacity})`;
|
|
99
99
|
};
|
|
100
100
|
exports.getToolbarBackgroundColor = getToolbarBackgroundColor;
|
|
101
101
|
/** Gets the Toolbar box-shadow based on a given opacity.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProximityToMouse.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useProximityToMouse.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,oCAAiC;AACjC,4CAAyC;AAEzC,gBAAgB;AAChB,MAAa,gBAAiB,SAAQ,GAA6B;
|
|
1
|
+
{"version":3,"file":"useProximityToMouse.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useProximityToMouse.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,oCAAiC;AACjC,4CAAyC;AAEzC,gBAAgB;AAChB,MAAa,gBAAiB,SAAQ,GAA6B;CAAG;AAAtE,4CAAsE;AAEtE;;GAEG;AACI,MAAM,mBAAmB,GAAG,CACjC,UAA4B,EAC5B,OAAgB,KAAK,EACrB,SAAS,GAAG,mCAA2B,EACvC,EAAE;IACF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEhE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,yBAAyB,GAAG,CAAC,CAAe,EAAE,EAAE;YACpD,IAAI,iBA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AFW,QAAA,wBAAwB,4BAEnC","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 { Point } from \"../Point\";\nimport { Rectangle } from \"../Rectangle\";\n\n/** @internal */\nexport class WidgetElementSet extends Set<React.RefObject<Element>> {}\n\n/** Returns the proximity scale associated with the shortest distance from the element(s) to the mouse.\n * @internal\n */\nexport const useProximityToMouse = (\n elementSet: WidgetElementSet,\n snap: boolean = false,\n threshold = PROXIMITY_THRESHOLD_DEFAULT\n) => {\n const [proximityScale, setProximityScale] = React.useState(1.0);\n\n React.useEffect(() => {\n const handleDocumentPointerMove = (e: PointerEvent) => {\n let shortestProximity = Number.MAX_SAFE_INTEGER;\n\n for (const ref of elementSet) {\n // istanbul ignore else\n if (ref.current) {\n const clientRect = ref.current.getBoundingClientRect();\n const rectangle = Rectangle.create(clientRect);\n const point = new Point(e.pageX, e.pageY);\n shortestProximity = Math.min(\n rectangle.getShortestDistanceToPoint(point),\n shortestProximity\n );\n }\n }\n\n const scale = calculateProximityScale(shortestProximity, snap, threshold);\n if (scale !== proximityScale) setProximityScale(scale);\n };\n\n document.addEventListener(\"pointermove\", handleDocumentPointerMove);\n\n return () => {\n document.removeEventListener(\"pointermove\", handleDocumentPointerMove);\n };\n }, [elementSet, proximityScale, snap, threshold]);\n\n return proximityScale;\n};\n\n/** Default proximity threshold.\n * @internal\n */\nexport const PROXIMITY_THRESHOLD_DEFAULT = 100;\n\n/** Default toolbar opacity.\n * @internal\n */\nexport const TOOLBAR_OPACITY_DEFAULT = 0.5;\n\n/** Default toolbar box-shadow opacity.\n * @internal\n */\nexport const TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT = 0.35;\n\n/** Default toolbar backdrop-filter blur.\n * @internal\n */\nexport const TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT = 10;\n\n/** Calculates a proximity scale for further calculations given the proximity and threshold.\n * @internal\n */\nexport const calculateProximityScale = (\n proximity: number,\n snap: boolean = false,\n threshold = PROXIMITY_THRESHOLD_DEFAULT\n): number => {\n let scale = (proximity < threshold ? threshold - proximity : 0) / threshold;\n if (snap && scale > 0) scale = 1.0;\n return scale;\n};\n\n/** Calculates a toolbar opacity based on a given proximity scale.\n * @internal\n */\nexport const calculateToolbarOpacity = (proximityScale: number): number => {\n return TOOLBAR_OPACITY_DEFAULT * proximityScale;\n};\n\n/** Calculates a box-shadow opacity based on a given proximity scale.\n * @internal\n */\nexport const calculateBoxShadowOpacity = (proximityScale: number): number => {\n return TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT * proximityScale;\n};\n\n/** Calculates a backdrop-filter blur based on a given proximity scale.\n * @internal\n */\nexport const calculateBackdropFilterBlur = (proximityScale: number): number => {\n return TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT * proximityScale;\n};\n\n/** Gets the Toolbar background-color based on a given opacity.\n * @internal\n */\nexport const getToolbarBackgroundColor = (opacity: number): string => {\n return `hsl(var(--iui-color-background-hsl) / ${opacity})`;\n};\n\n/** Gets the Toolbar box-shadow based on a given opacity.\n * @internal\n */\nexport const getToolbarBoxShadow = (opacity: number): string => {\n return `0 1px 3px 0 rgba(0, 0, 0, ${opacity})`;\n};\n\n/** Gets the Toolbar backdrop-filter based on a given blur amount.\n * @internal\n */\nexport const getToolbarBackdropFilter = (filterBlur: number): string => {\n return `blur(${filterBlur}px)`;\n};\n"]}
|
|
@@ -5,7 +5,7 @@ import * as React from "react";
|
|
|
5
5
|
/** Hook used to combine multiple refs.
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export declare function useRefs<T>(...refs: ReadonlyArray<React.Ref<T
|
|
8
|
+
export declare function useRefs<T>(...refs: ReadonlyArray<React.Ref<T> | undefined>): (instance: T | null) => void;
|
|
9
9
|
/** Used to combine multiple refs for a class component.
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRefs.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useRefs.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useRefs.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useRefs.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,cACrC,CAAC,GAAG,IAAI,UAY7C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAC5C,CAAC,GAAG,IAAI,UAY5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRefs.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useRefs.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAE/B,+BAA+B;AAC/B,SAAS,aAAa,CAAI,GAAiB;IACzC,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"useRefs.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useRefs.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAE/B,+BAA+B;AAC/B,SAAS,aAAa,CAAI,GAAiB;IACzC,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAI,GAAG,IAA6C;IACzE,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,QAAkB,EAAE,EAAE;QAC9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,uBAAuB;YACvB,IAAI,GAAG,EAAE;gBACP,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE;oBACtB,GAAG,CAAC,QAAQ,CAAC,CAAC;iBACf;qBAAM;oBACJ,GAAwC,CAAC,OAAO,GAAG,QAAQ,CAAC;iBAC9D;aACF;SACF;IACH,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,kDAAkD;AACnE,CAAC;AAbD,0BAaC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAI,GAAG,IAAiC;IAC/D,OAAO,CAAC,CAAC,QAAkB,EAAE,EAAE;QAC7B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,uBAAuB;YACvB,IAAI,GAAG,EAAE;gBACP,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE;oBACtB,GAAG,CAAC,QAAQ,CAAC,CAAC;iBACf;qBAAM;oBACJ,GAAwC,CAAC,OAAO,GAAG,QAAQ,CAAC;iBAC9D;aACF;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAbD,8BAaC","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\";\n\n/** Callback ref type guard. */\nfunction isRefCallback<T>(ref: React.Ref<T>): ref is (_: T | null) => void {\n return typeof ref === \"function\";\n}\n\n/** Hook used to combine multiple refs.\n * @internal\n */\nexport function useRefs<T>(...refs: ReadonlyArray<React.Ref<T> | undefined>) {\n return React.useCallback((instance: T | null) => {\n for (const ref of refs) {\n // istanbul ignore else\n if (ref) {\n if (isRefCallback(ref)) {\n ref(instance);\n } else {\n (ref as React.MutableRefObject<T | null>).current = instance;\n }\n }\n }\n }, [...refs]); // eslint-disable-line react-hooks/exhaustive-deps\n}\n\n/** Used to combine multiple refs for a class component.\n * @internal\n */\nexport function mergeRefs<T>(...refs: ReadonlyArray<React.Ref<T>>) {\n return ((instance: T | null) => {\n for (const ref of refs) {\n // istanbul ignore else\n if (ref) {\n if (isRefCallback(ref)) {\n ref(instance);\n } else {\n (ref as React.MutableRefObject<T | null>).current = instance;\n }\n }\n }\n });\n}\n"]}
|
|
@@ -23,20 +23,18 @@ function useResizeObserver(onResize) {
|
|
|
23
23
|
const owningWindowRef = React.useRef(null);
|
|
24
24
|
// istanbul ignore next
|
|
25
25
|
const resizeObserverCleanup = () => {
|
|
26
|
-
var _a;
|
|
27
26
|
if (rafRef.current)
|
|
28
27
|
owningWindowRef.current.cancelAnimationFrame(rafRef.current);
|
|
29
|
-
|
|
28
|
+
resizeObserver.current?.disconnect();
|
|
30
29
|
resizeObserver.current = null;
|
|
31
30
|
};
|
|
32
31
|
React.useEffect(() => {
|
|
33
32
|
isMountedRef.current = true;
|
|
34
33
|
return () => {
|
|
35
|
-
var _a;
|
|
36
34
|
isMountedRef.current = false;
|
|
37
35
|
if (rafRef.current)
|
|
38
36
|
owningWindowRef.current.cancelAnimationFrame(rafRef.current);
|
|
39
|
-
|
|
37
|
+
owningWindowRef.current?.removeEventListener("beforeunload", resizeObserverCleanup);
|
|
40
38
|
};
|
|
41
39
|
}, []);
|
|
42
40
|
const processResize = React.useCallback((target) => {
|
|
@@ -73,8 +71,7 @@ function useResizeObserver(onResize) {
|
|
|
73
71
|
setBounds(newBounds);
|
|
74
72
|
}
|
|
75
73
|
return () => {
|
|
76
|
-
|
|
77
|
-
instance && ( /* istanbul ignore next */(_a = resizeObserver.current) === null || _a === void 0 ? void 0 : _a.unobserve(instance));
|
|
74
|
+
instance && ( /* istanbul ignore next */resizeObserver.current?.unobserve(instance));
|
|
78
75
|
resizeObserver.current = null;
|
|
79
76
|
};
|
|
80
77
|
}, [handleResize, onResize]);
|
|
@@ -96,8 +93,8 @@ exports.useResizeObserver = useResizeObserver;
|
|
|
96
93
|
* @internal
|
|
97
94
|
*/
|
|
98
95
|
function useLayoutResizeObserver(inElement, onResize) {
|
|
99
|
-
const inBoundingRect = inElement
|
|
100
|
-
const [bounds, setBounds] = React.useState({ width: inBoundingRect
|
|
96
|
+
const inBoundingRect = inElement?.getBoundingClientRect();
|
|
97
|
+
const [bounds, setBounds] = React.useState({ width: inBoundingRect?.width, height: inBoundingRect?.height });
|
|
101
98
|
const [watchedElement, setWatchedElement] = React.useState(inElement);
|
|
102
99
|
const resizeObserver = React.useRef(null);
|
|
103
100
|
const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active
|
|
@@ -105,10 +102,9 @@ function useLayoutResizeObserver(inElement, onResize) {
|
|
|
105
102
|
const owningWindowRef = React.useRef(null);
|
|
106
103
|
// istanbul ignore next
|
|
107
104
|
const resizeObserverCleanup = () => {
|
|
108
|
-
var _a;
|
|
109
105
|
if (rafRef.current)
|
|
110
106
|
owningWindowRef.current.cancelAnimationFrame(rafRef.current);
|
|
111
|
-
|
|
107
|
+
resizeObserver.current?.disconnect();
|
|
112
108
|
resizeObserver.current = null;
|
|
113
109
|
};
|
|
114
110
|
React.useEffect(() => {
|
|
@@ -159,9 +155,8 @@ function useLayoutResizeObserver(inElement, onResize) {
|
|
|
159
155
|
resizeObserver.current = new ResizeObserverPolyfill_1.ResizeObserver(handleResize);
|
|
160
156
|
resizeObserver.current.observe(watchedElement);
|
|
161
157
|
return () => {
|
|
162
|
-
var _a;
|
|
163
158
|
// istanbul ignore next
|
|
164
|
-
|
|
159
|
+
resizeObserver.current?.disconnect();
|
|
165
160
|
resizeObserver.current = null;
|
|
166
161
|
};
|
|
167
162
|
}, [handleResize, watchedElement]);
|
|
@@ -199,7 +194,7 @@ function ResizableContainerObserver({ onResize, children }) {
|
|
|
199
194
|
}, [hasChildren]);
|
|
200
195
|
const processResize = React.useCallback((width, height) => {
|
|
201
196
|
// istanbul ignore next
|
|
202
|
-
onResize(width
|
|
197
|
+
onResize(width ?? 0, height ?? 0);
|
|
203
198
|
}, [onResize]);
|
|
204
199
|
useLayoutResizeObserver(containerElement, processResize);
|
|
205
200
|
const style = hasChildren ? { width: "100%", height: "100%" } : { display: "none" };
|