@itwin/core-react 4.15.5 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/lib/cjs/core-react/UiCore.d.ts +1 -0
- package/lib/cjs/core-react/UiCore.d.ts.map +1 -1
- package/lib/cjs/core-react/UiCore.js +2 -0
- package/lib/cjs/core-react/UiCore.js.map +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts +5 -3
- package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.js +1 -2
- package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
- package/lib/cjs/core-react/badge/Badge.d.ts +3 -2
- package/lib/cjs/core-react/badge/Badge.d.ts.map +1 -1
- package/lib/cjs/core-react/badge/Badge.js +5 -2
- package/lib/cjs/core-react/badge/Badge.js.map +1 -1
- package/lib/cjs/core-react/badge/BadgeType.d.ts +6 -0
- package/lib/cjs/core-react/badge/BadgeType.d.ts.map +1 -1
- package/lib/cjs/core-react/badge/BadgeType.js +2 -1
- package/lib/cjs/core-react/badge/BadgeType.js.map +1 -1
- package/lib/cjs/core-react/badge/DeprecatedBadge.d.ts +10 -0
- package/lib/cjs/core-react/badge/DeprecatedBadge.d.ts.map +1 -0
- package/lib/cjs/core-react/badge/DeprecatedBadge.js +29 -0
- package/lib/cjs/core-react/badge/DeprecatedBadge.js.map +1 -0
- package/lib/cjs/core-react/badge/DeprecatedBadge.scss +11 -0
- package/lib/cjs/core-react/badge/NewBadge.scss +4 -0
- package/lib/cjs/core-react/badge/TechnicalPreviewBadge.js +2 -2
- package/lib/cjs/core-react/badge/TechnicalPreviewBadge.js.map +1 -1
- package/lib/cjs/core-react/badge/TechnicalPreviewBadge.scss +4 -0
- package/lib/cjs/core-react/colorthemes.scss +0 -8
- package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts +3 -6
- package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenu.js +2 -4
- package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenu.scss +5 -6
- package/lib/cjs/core-react/contextmenu/ContextMenuDirection.d.ts +1 -3
- package/lib/cjs/core-react/contextmenu/ContextMenuDirection.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuDirection.js +1 -7
- package/lib/cjs/core-react/contextmenu/ContextMenuDirection.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuDivider.d.ts +2 -2
- package/lib/cjs/core-react/contextmenu/ContextMenuDivider.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuDivider.js +3 -3
- package/lib/cjs/core-react/contextmenu/ContextMenuDivider.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts +8 -6
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +6 -7
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts +3 -4
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.js +6 -5
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts +2 -1
- package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +1 -0
- package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/PopupContextMenu.d.ts +2 -0
- package/lib/cjs/core-react/contextmenu/PopupContextMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/PopupContextMenu.js +2 -3
- package/lib/cjs/core-react/contextmenu/PopupContextMenu.js.map +1 -1
- package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
- package/lib/cjs/core-react/elementseparator/ElementSeparator.js +0 -1
- package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
- package/lib/cjs/core-react/enums/CheckBoxState.d.ts +1 -0
- package/lib/cjs/core-react/enums/CheckBoxState.d.ts.map +1 -1
- package/lib/cjs/core-react/enums/CheckBoxState.js +1 -0
- package/lib/cjs/core-react/enums/CheckBoxState.js.map +1 -1
- package/lib/cjs/core-react/enums/Orientation.d.ts +1 -0
- package/lib/cjs/core-react/enums/Orientation.d.ts.map +1 -1
- package/lib/cjs/core-react/enums/Orientation.js +1 -0
- package/lib/cjs/core-react/enums/Orientation.js.map +1 -1
- package/lib/cjs/core-react/enums/TimeFormat.d.ts +1 -0
- package/lib/cjs/core-react/enums/TimeFormat.d.ts.map +1 -1
- package/lib/cjs/core-react/enums/TimeFormat.js +1 -0
- package/lib/cjs/core-react/enums/TimeFormat.js.map +1 -1
- package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
- package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
- package/lib/cjs/core-react/focustrap/FocusTrap.js +1 -1
- package/lib/cjs/core-react/focustrap/FocusTrap.js.map +1 -1
- package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts +0 -2
- package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
- package/lib/cjs/core-react/hocs/withOnOutsideClick.js +0 -1
- package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
- package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts +1 -0
- package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/ConditionalIconItem.js +2 -0
- package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.d.ts +3 -0
- package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.js +1 -0
- package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts +0 -1
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js +0 -2
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
- package/lib/cjs/core-react/inputs/InputLabel.d.ts.map +1 -1
- package/lib/cjs/core-react/inputs/InputLabel.js +1 -8
- package/lib/cjs/core-react/inputs/InputLabel.js.map +1 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
- package/lib/cjs/core-react/l10n/LocalizationProvider.d.ts +1 -0
- package/lib/cjs/core-react/l10n/LocalizationProvider.d.ts.map +1 -1
- package/lib/cjs/core-react/l10n/LocalizationProvider.js +1 -0
- package/lib/cjs/core-react/l10n/LocalizationProvider.js.map +1 -1
- package/lib/cjs/core-react/l10n/useTranslation.d.ts.map +1 -1
- package/lib/cjs/core-react/l10n/useTranslation.js +1 -1
- package/lib/cjs/core-react/l10n/useTranslation.js.map +1 -1
- package/lib/cjs/core-react/listbox/Listbox.d.ts +10 -7
- package/lib/cjs/core-react/listbox/Listbox.d.ts.map +1 -1
- package/lib/cjs/core-react/listbox/Listbox.js +6 -3
- package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.js +2 -9
- package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
- package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts +0 -2
- package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/radialmenu/RadialMenu.js +0 -2
- package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
- package/lib/cjs/core-react/radialmenu/RadialMenu.scss +3 -3
- package/lib/cjs/core-react/searchbox/SearchBox.d.ts +0 -2
- package/lib/cjs/core-react/searchbox/SearchBox.d.ts.map +1 -1
- package/lib/cjs/core-react/searchbox/SearchBox.js +0 -2
- package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
- package/lib/cjs/core-react/settings/SettingsContainer.d.ts +7 -3
- package/lib/cjs/core-react/settings/SettingsContainer.d.ts.map +1 -1
- package/lib/cjs/core-react/settings/SettingsContainer.js +14 -19
- package/lib/cjs/core-react/settings/SettingsContainer.js.map +1 -1
- package/lib/cjs/core-react/settings/SettingsManager.d.ts +3 -1
- package/lib/cjs/core-react/settings/SettingsManager.d.ts.map +1 -1
- package/lib/cjs/core-react/settings/SettingsManager.js +6 -10
- package/lib/cjs/core-react/settings/SettingsManager.js.map +1 -1
- package/lib/cjs/core-react/tabs/Tabs.d.ts +0 -3
- package/lib/cjs/core-react/tabs/Tabs.d.ts.map +1 -1
- package/lib/cjs/core-react/tabs/Tabs.js +0 -4
- package/lib/cjs/core-react/tabs/Tabs.js.map +1 -1
- package/lib/cjs/core-react/tree/ExpansionToggle.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/ExpansionToggle.js +0 -1
- package/lib/cjs/core-react/tree/ExpansionToggle.js.map +1 -1
- package/lib/cjs/core-react/tree/Node.d.ts +2 -0
- package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/Node.js +1 -5
- package/lib/cjs/core-react/tree/Node.js.map +1 -1
- package/lib/cjs/core-react/uistate/LocalStateStorage.d.ts +2 -2
- package/lib/cjs/core-react/uistate/LocalStateStorage.d.ts.map +1 -1
- package/lib/cjs/core-react/uistate/LocalStateStorage.js +3 -4
- package/lib/cjs/core-react/uistate/LocalStateStorage.js.map +1 -1
- package/lib/cjs/core-react/uistate/UiStateEntry.d.ts +1 -0
- package/lib/cjs/core-react/uistate/UiStateEntry.d.ts.map +1 -1
- package/lib/cjs/core-react/uistate/UiStateEntry.js +2 -0
- package/lib/cjs/core-react/uistate/UiStateEntry.js.map +1 -1
- package/lib/cjs/core-react/uistate/UiStateStorage.d.ts +3 -0
- package/lib/cjs/core-react/uistate/UiStateStorage.d.ts.map +1 -1
- package/lib/cjs/core-react/uistate/UiStateStorage.js +1 -0
- package/lib/cjs/core-react/uistate/UiStateStorage.js.map +1 -1
- package/lib/cjs/core-react/utils/IconWebComponent.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/IconWebComponent.js +1 -3
- package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
- package/lib/cjs/core-react/utils/ListenerType.d.ts +15 -0
- package/lib/cjs/core-react/utils/ListenerType.d.ts.map +1 -0
- package/lib/cjs/core-react/utils/ListenerType.js +3 -0
- package/lib/cjs/core-react/utils/ListenerType.js.map +1 -0
- package/lib/cjs/core-react/utils/Rectangle.d.ts +1 -0
- package/lib/cjs/core-react/utils/Rectangle.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/Rectangle.js.map +1 -1
- package/lib/cjs/core-react/utils/Size.d.ts +1 -0
- package/lib/cjs/core-react/utils/Size.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/Size.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.d.ts +1 -0
- package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js +1 -0
- package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts +3 -2
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +2 -1
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
- package/lib/cjs/core-react.d.ts +5 -0
- package/lib/cjs/core-react.d.ts.map +1 -1
- package/lib/cjs/core-react.js +10 -6
- package/lib/cjs/core-react.js.map +1 -1
- package/lib/esm/core-react/UiCore.d.ts +1 -0
- package/lib/esm/core-react/UiCore.d.ts.map +1 -1
- package/lib/esm/core-react/UiCore.js +2 -0
- package/lib/esm/core-react/UiCore.js.map +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts +5 -3
- package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.js +1 -2
- package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
- package/lib/esm/core-react/badge/Badge.d.ts +3 -2
- package/lib/esm/core-react/badge/Badge.d.ts.map +1 -1
- package/lib/esm/core-react/badge/Badge.js +5 -2
- package/lib/esm/core-react/badge/Badge.js.map +1 -1
- package/lib/esm/core-react/badge/BadgeType.d.ts +6 -0
- package/lib/esm/core-react/badge/BadgeType.d.ts.map +1 -1
- package/lib/esm/core-react/badge/BadgeType.js +2 -1
- package/lib/esm/core-react/badge/BadgeType.js.map +1 -1
- package/lib/esm/core-react/badge/DeprecatedBadge.d.ts +10 -0
- package/lib/esm/core-react/badge/DeprecatedBadge.d.ts.map +1 -0
- package/lib/esm/core-react/badge/DeprecatedBadge.js +25 -0
- package/lib/esm/core-react/badge/DeprecatedBadge.js.map +1 -0
- package/lib/esm/core-react/badge/DeprecatedBadge.scss +11 -0
- package/lib/esm/core-react/badge/NewBadge.scss +4 -0
- package/lib/esm/core-react/badge/TechnicalPreviewBadge.js +2 -2
- package/lib/esm/core-react/badge/TechnicalPreviewBadge.js.map +1 -1
- package/lib/esm/core-react/badge/TechnicalPreviewBadge.scss +4 -0
- package/lib/esm/core-react/colorthemes.scss +0 -8
- package/lib/esm/core-react/contextmenu/ContextMenu.d.ts +3 -6
- package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenu.js +2 -4
- package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenu.scss +5 -6
- package/lib/esm/core-react/contextmenu/ContextMenuDirection.d.ts +1 -3
- package/lib/esm/core-react/contextmenu/ContextMenuDirection.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuDirection.js +1 -7
- package/lib/esm/core-react/contextmenu/ContextMenuDirection.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuDivider.d.ts +2 -2
- package/lib/esm/core-react/contextmenu/ContextMenuDivider.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuDivider.js +3 -3
- package/lib/esm/core-react/contextmenu/ContextMenuDivider.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts +8 -6
- package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuItem.js +6 -7
- package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts +3 -4
- package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextSubMenu.js +6 -5
- package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts +2 -1
- package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +1 -0
- package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/PopupContextMenu.d.ts +2 -0
- package/lib/esm/core-react/contextmenu/PopupContextMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/PopupContextMenu.js +2 -3
- package/lib/esm/core-react/contextmenu/PopupContextMenu.js.map +1 -1
- package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
- package/lib/esm/core-react/elementseparator/ElementSeparator.js +0 -1
- package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
- package/lib/esm/core-react/enums/CheckBoxState.d.ts +1 -0
- package/lib/esm/core-react/enums/CheckBoxState.d.ts.map +1 -1
- package/lib/esm/core-react/enums/CheckBoxState.js +1 -0
- package/lib/esm/core-react/enums/CheckBoxState.js.map +1 -1
- package/lib/esm/core-react/enums/Orientation.d.ts +1 -0
- package/lib/esm/core-react/enums/Orientation.d.ts.map +1 -1
- package/lib/esm/core-react/enums/Orientation.js +1 -0
- package/lib/esm/core-react/enums/Orientation.js.map +1 -1
- package/lib/esm/core-react/enums/TimeFormat.d.ts +1 -0
- package/lib/esm/core-react/enums/TimeFormat.d.ts.map +1 -1
- package/lib/esm/core-react/enums/TimeFormat.js +1 -0
- package/lib/esm/core-react/enums/TimeFormat.js.map +1 -1
- package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
- package/lib/esm/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
- package/lib/esm/core-react/focustrap/FocusTrap.js +1 -1
- package/lib/esm/core-react/focustrap/FocusTrap.js.map +1 -1
- package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts +0 -2
- package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
- package/lib/esm/core-react/hocs/withOnOutsideClick.js +0 -1
- package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
- package/lib/esm/core-react/icons/ConditionalIconItem.d.ts +1 -0
- package/lib/esm/core-react/icons/ConditionalIconItem.d.ts.map +1 -1
- package/lib/esm/core-react/icons/ConditionalIconItem.js +2 -0
- package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.d.ts +3 -0
- package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.js +1 -0
- package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts +0 -1
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js +0 -2
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
- package/lib/esm/core-react/inputs/InputLabel.d.ts.map +1 -1
- package/lib/esm/core-react/inputs/InputLabel.js +1 -8
- package/lib/esm/core-react/inputs/InputLabel.js.map +1 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
- package/lib/esm/core-react/l10n/LocalizationProvider.d.ts +1 -0
- package/lib/esm/core-react/l10n/LocalizationProvider.d.ts.map +1 -1
- package/lib/esm/core-react/l10n/LocalizationProvider.js +1 -0
- package/lib/esm/core-react/l10n/LocalizationProvider.js.map +1 -1
- package/lib/esm/core-react/l10n/useTranslation.d.ts.map +1 -1
- package/lib/esm/core-react/l10n/useTranslation.js +1 -1
- package/lib/esm/core-react/l10n/useTranslation.js.map +1 -1
- package/lib/esm/core-react/listbox/Listbox.d.ts +10 -7
- package/lib/esm/core-react/listbox/Listbox.d.ts.map +1 -1
- package/lib/esm/core-react/listbox/Listbox.js +6 -3
- package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.js +2 -9
- package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
- package/lib/esm/core-react/radialmenu/RadialMenu.d.ts +0 -2
- package/lib/esm/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
- package/lib/esm/core-react/radialmenu/RadialMenu.js +0 -2
- package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
- package/lib/esm/core-react/radialmenu/RadialMenu.scss +3 -3
- package/lib/esm/core-react/searchbox/SearchBox.d.ts +0 -2
- package/lib/esm/core-react/searchbox/SearchBox.d.ts.map +1 -1
- package/lib/esm/core-react/searchbox/SearchBox.js +0 -2
- package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
- package/lib/esm/core-react/settings/SettingsContainer.d.ts +7 -3
- package/lib/esm/core-react/settings/SettingsContainer.d.ts.map +1 -1
- package/lib/esm/core-react/settings/SettingsContainer.js +14 -19
- package/lib/esm/core-react/settings/SettingsContainer.js.map +1 -1
- package/lib/esm/core-react/settings/SettingsManager.d.ts +3 -1
- package/lib/esm/core-react/settings/SettingsManager.d.ts.map +1 -1
- package/lib/esm/core-react/settings/SettingsManager.js +6 -10
- package/lib/esm/core-react/settings/SettingsManager.js.map +1 -1
- package/lib/esm/core-react/tabs/Tabs.d.ts +0 -3
- package/lib/esm/core-react/tabs/Tabs.d.ts.map +1 -1
- package/lib/esm/core-react/tabs/Tabs.js +0 -4
- package/lib/esm/core-react/tabs/Tabs.js.map +1 -1
- package/lib/esm/core-react/tree/ExpansionToggle.d.ts.map +1 -1
- package/lib/esm/core-react/tree/ExpansionToggle.js +0 -1
- package/lib/esm/core-react/tree/ExpansionToggle.js.map +1 -1
- package/lib/esm/core-react/tree/Node.d.ts +2 -0
- package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
- package/lib/esm/core-react/tree/Node.js +1 -5
- package/lib/esm/core-react/tree/Node.js.map +1 -1
- package/lib/esm/core-react/uistate/LocalStateStorage.d.ts +2 -2
- package/lib/esm/core-react/uistate/LocalStateStorage.d.ts.map +1 -1
- package/lib/esm/core-react/uistate/LocalStateStorage.js +3 -4
- package/lib/esm/core-react/uistate/LocalStateStorage.js.map +1 -1
- package/lib/esm/core-react/uistate/UiStateEntry.d.ts +1 -0
- package/lib/esm/core-react/uistate/UiStateEntry.d.ts.map +1 -1
- package/lib/esm/core-react/uistate/UiStateEntry.js +2 -0
- package/lib/esm/core-react/uistate/UiStateEntry.js.map +1 -1
- package/lib/esm/core-react/uistate/UiStateStorage.d.ts +3 -0
- package/lib/esm/core-react/uistate/UiStateStorage.d.ts.map +1 -1
- package/lib/esm/core-react/uistate/UiStateStorage.js +1 -0
- package/lib/esm/core-react/uistate/UiStateStorage.js.map +1 -1
- package/lib/esm/core-react/utils/IconWebComponent.d.ts.map +1 -1
- package/lib/esm/core-react/utils/IconWebComponent.js +1 -3
- package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
- package/lib/esm/core-react/utils/ListenerType.d.ts +15 -0
- package/lib/esm/core-react/utils/ListenerType.d.ts.map +1 -0
- package/lib/esm/core-react/utils/ListenerType.js +2 -0
- package/lib/esm/core-react/utils/ListenerType.js.map +1 -0
- package/lib/esm/core-react/utils/Rectangle.d.ts +1 -0
- package/lib/esm/core-react/utils/Rectangle.d.ts.map +1 -1
- package/lib/esm/core-react/utils/Rectangle.js.map +1 -1
- package/lib/esm/core-react/utils/Size.d.ts +1 -0
- package/lib/esm/core-react/utils/Size.d.ts.map +1 -1
- package/lib/esm/core-react/utils/Size.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.d.ts +1 -0
- package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js +1 -0
- package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts +3 -2
- package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useResizeObserver.js +2 -1
- package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
- package/lib/esm/core-react.d.ts +5 -0
- package/lib/esm/core-react.d.ts.map +1 -1
- package/lib/esm/core-react.js +6 -2
- package/lib/esm/core-react.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import "./SettingsContainer.scss";
|
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { VerticalTabs } from "../tabs/VerticalTabs";
|
|
11
11
|
import { ConditionalBooleanValue } from "@itwin/appui-abstract";
|
|
12
|
+
/* eslint-disable deprecation/deprecation */
|
|
12
13
|
/* ---------------------------------------------------------------------------------------------------
|
|
13
14
|
// A typical implementation of a saveFunction callback
|
|
14
15
|
const saveChanges = React.useCallback((afterSaveFunction: (args: any) => void, args?: any) => {
|
|
@@ -23,32 +24,30 @@ const saveChanges = React.useCallback((afterSaveFunction: (args: any) => void, a
|
|
|
23
24
|
---------------------------------------------------------------------------------------------------------- */
|
|
24
25
|
/** Hook to use within Settings Page component to allow saving the current page's data before the Setting Container is closed.
|
|
25
26
|
* @public
|
|
27
|
+
* @deprecated in 4.16.0. Use {@link SettingsManager} instead.
|
|
26
28
|
*/
|
|
27
29
|
export function useSaveBeforeClosingSettingsContainer(settingsManager, saveFunction) {
|
|
28
30
|
React.useEffect(() => {
|
|
29
|
-
|
|
30
|
-
) => {
|
|
31
|
+
return settingsManager.onProcessSettingsContainerClose.addListener(({ closeFunc, closeFuncArgs }) => {
|
|
31
32
|
saveFunction(closeFunc, closeFuncArgs);
|
|
32
|
-
};
|
|
33
|
-
return settingsManager.onProcessSettingsContainerClose.addListener(handleProcessSettingsContainerClose);
|
|
33
|
+
});
|
|
34
34
|
}, [saveFunction, settingsManager]);
|
|
35
35
|
}
|
|
36
36
|
/** Hook to use within Settings Page component to allow saving the current page's data before loading to the requested Setting Tab's page.
|
|
37
37
|
* @public
|
|
38
|
+
* @deprecated in 4.16.0. Use {@link SettingsManager} instead.
|
|
38
39
|
*/
|
|
39
40
|
export function useSaveBeforeActivatingNewSettingsTab(settingsManager, saveFunction) {
|
|
40
41
|
React.useEffect(() => {
|
|
41
|
-
|
|
42
|
-
) => {
|
|
42
|
+
return settingsManager.onProcessSettingsTabActivation.addListener(({ tabSelectionFunc, requestedSettingsTabId }) => {
|
|
43
43
|
saveFunction(tabSelectionFunc, requestedSettingsTabId);
|
|
44
|
-
};
|
|
45
|
-
return settingsManager.onProcessSettingsTabActivation.addListener(handleProcessSettingsTabActivation);
|
|
44
|
+
});
|
|
46
45
|
}, [saveFunction, settingsManager]);
|
|
47
46
|
}
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* Note: that SettingsContainer is not rendered if tabs array is empty
|
|
47
|
+
/** Component that displays setting tabs on the left and the setting page on the right.
|
|
48
|
+
* Note: that SettingsContainer is not rendered if tabs array is empty.
|
|
51
49
|
* @public
|
|
50
|
+
* @deprecated in 4.16.0. Used internally by {@link @itwin/appui-react#SettingsModalFrontstage}.
|
|
52
51
|
*/
|
|
53
52
|
export const SettingsContainer = ({ tabs, onSettingsTabSelected, currentSettingsTab, settingsManager, showHeader, }) => {
|
|
54
53
|
// sort the tabs based on itemPriority
|
|
@@ -87,8 +86,7 @@ export const SettingsContainer = ({ tabs, onSettingsTabSelected, currentSettings
|
|
|
87
86
|
tabs,
|
|
88
87
|
]);
|
|
89
88
|
React.useEffect(() => {
|
|
90
|
-
|
|
91
|
-
) => {
|
|
89
|
+
return settingsManager.onActivateSettingsTab.addListener(({ settingsTabId }) => {
|
|
92
90
|
const idToFind = settingsTabId.toLowerCase();
|
|
93
91
|
let tabToActivate = tabs.find((tab) => tab.tabId.toLowerCase() === idToFind);
|
|
94
92
|
if (!tabToActivate)
|
|
@@ -102,8 +100,7 @@ export const SettingsContainer = ({ tabs, onSettingsTabSelected, currentSettings
|
|
|
102
100
|
else
|
|
103
101
|
processTabSelection(tabToActivate);
|
|
104
102
|
}
|
|
105
|
-
};
|
|
106
|
-
return settingsManager.onActivateSettingsTab.addListener(handleActivateSettingsTab);
|
|
103
|
+
});
|
|
107
104
|
}, [
|
|
108
105
|
openTab,
|
|
109
106
|
processTabSelection,
|
|
@@ -113,8 +110,7 @@ export const SettingsContainer = ({ tabs, onSettingsTabSelected, currentSettings
|
|
|
113
110
|
tabs,
|
|
114
111
|
]);
|
|
115
112
|
React.useEffect(() => {
|
|
116
|
-
|
|
117
|
-
) => {
|
|
113
|
+
return settingsManager.onCloseSettingsContainer.addListener(({ closeFunc, closeFuncArgs }) => {
|
|
118
114
|
if (openTab && openTab.pageWillHandleCloseRequest)
|
|
119
115
|
settingsManager.onProcessSettingsContainerClose.emit({
|
|
120
116
|
closeFunc,
|
|
@@ -122,8 +118,7 @@ export const SettingsContainer = ({ tabs, onSettingsTabSelected, currentSettings
|
|
|
122
118
|
});
|
|
123
119
|
else
|
|
124
120
|
closeFunc(closeFuncArgs);
|
|
125
|
-
};
|
|
126
|
-
return settingsManager.onCloseSettingsContainer.addListener(handleSettingsContainerClose);
|
|
121
|
+
});
|
|
127
122
|
}, [
|
|
128
123
|
openTab,
|
|
129
124
|
processTabSelection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsContainer.js","sourceRoot":"","sources":["../../../../src/core-react/settings/SettingsContainer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;;;;;;;;;;6GAW6G;AAE7G;;GAEG;AACH,MAAM,UAAU,qCAAqC,CACnD,eAAgC,EAChC,YAA2E;IAE3E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,mCAAmC,GAAG,CAC1C,EAAE,SAAS,EAAE,aAAa,EAA0C,CAAC,8CAA8C;UACnH,EAAE;YACF,YAAY,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,OAAO,eAAe,CAAC,+BAA+B,CAAC,WAAW,CAChE,mCAAmC,CACpC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qCAAqC,CACnD,eAAgC,EAChC,YAGS;IAET,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,kCAA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AAC;IACJ,CAAC,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IACzE,OAAO,CACL,6BAAK,SAAS,EAAC,yBAAyB;QACtC,6BAAK,SAAS,EAAC,8BAA8B;YAE3C,oBAAC,YAAY,IACX,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,GAC5B,CACE;QACN,6BAAK,SAAS,EAAC,+BAA+B;YAC3C,UAAU,IAAI,CACb,6BAAK,SAAS,EAAC,sCAAsC;gBACnD,8BAAM,SAAS,EAAC,qCAAqC,IAClD,OAAO,CAAC,KAAK,CACT;gBACN,OAAO,CAAC,QAAQ,IAAI,CACnB,8BAAM,SAAS,EAAC,yCAAyC,IACtD,OAAO,CAAC,QAAQ,CACZ,CACR,CACG,CACP;YACD,6BAAK,SAAS,EAAC,wCAAwC,IACpD,OAAO,CAAC,IAAI,CACT,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Settings\n */\n\nimport \"./SettingsContainer.scss\";\nimport * as React from \"react\";\nimport type {\n ActivateSettingsTabEventArgs,\n ProcessSettingsContainerCloseEventArgs,\n ProcessSettingsTabActivationEventArgs,\n SettingsManager,\n SettingsTabEntry,\n} from \"./SettingsManager\";\nimport { VerticalTabs } from \"../tabs/VerticalTabs\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\n\n/* ---------------------------------------------------------------------------------------------------\n// A typical implementation of a saveFunction callback\nconst saveChanges = React.useCallback((afterSaveFunction: (args: any) => void, args?: any) => {\n if (dataIsDirty) {\n // prompt user to save changes passing in function and arguments to call after saving changes.\n UiFramework.dialogs.modal.openDialog(<CustomSavePromptModalDialog customProps={customProps}\n onDialogCloseArgs={args} onDialogClose={afterSaveFunction} />);\n return;\n }\n afterSaveFunction(args);\n}, []);\n---------------------------------------------------------------------------------------------------------- */\n\n/** Hook to use within Settings Page component to allow saving the current page's data before the Setting Container is closed.\n * @public\n */\nexport function useSaveBeforeClosingSettingsContainer(\n settingsManager: SettingsManager,\n saveFunction: (closeFunc: (args: any) => void, closeFuncArgs?: any) => void\n) {\n React.useEffect(() => {\n const handleProcessSettingsContainerClose = (\n { closeFunc, closeFuncArgs }: ProcessSettingsContainerCloseEventArgs // eslint-disable-line deprecation/deprecation\n ) => {\n saveFunction(closeFunc, closeFuncArgs);\n };\n return settingsManager.onProcessSettingsContainerClose.addListener(\n handleProcessSettingsContainerClose\n );\n }, [saveFunction, settingsManager]);\n}\n\n/** Hook to use within Settings Page component to allow saving the current page's data before loading to the requested Setting Tab's page.\n * @public\n */\nexport function useSaveBeforeActivatingNewSettingsTab(\n settingsManager: SettingsManager,\n saveFunction: (\n tabSelectionFunc: (args: any) => void,\n requestedSettingsTabId?: string\n ) => void\n) {\n React.useEffect(() => {\n const handleProcessSettingsTabActivation = (\n {\n tabSelectionFunc,\n requestedSettingsTabId,\n }: ProcessSettingsTabActivationEventArgs // eslint-disable-line deprecation/deprecation\n ) => {\n saveFunction(tabSelectionFunc, requestedSettingsTabId);\n };\n return settingsManager.onProcessSettingsTabActivation.addListener(\n handleProcessSettingsTabActivation\n );\n }, [saveFunction, settingsManager]);\n}\n\n/**\n * @public\n */\nexport interface SettingsContainerProps {\n tabs: SettingsTabEntry[];\n // sets tab to set as active tab\n currentSettingsTab?: SettingsTabEntry;\n // If plugging into a SPA and you need to modify the route, you can pass in additional logic here\n onSettingsTabSelected?: (tab: SettingsTabEntry) => void;\n // The SettingsManager that can have event handlers registered against it so pages can save its settings before the page is closed.\n settingsManager: SettingsManager;\n // if true show tab label as header above page contents.\n showHeader?: boolean;\n}\n\n/**\n * SettingsContainer component that displays Setting Tabs on Left and the P\n * Note: that SettingsContainer is not rendered if tabs array is empty\n * @public\n */\nexport const SettingsContainer = ({\n tabs,\n onSettingsTabSelected,\n currentSettingsTab,\n settingsManager,\n showHeader,\n}: SettingsContainerProps) => {\n // sort the tabs based on itemPriority\n tabs = tabs.sort((a, b) => a.itemPriority - b.itemPriority);\n\n const [openTab, setOpenTab] = React.useState(() => {\n if (\n currentSettingsTab &&\n !ConditionalBooleanValue.getValue(currentSettingsTab.isDisabled)\n )\n return currentSettingsTab;\n else return tabs[0];\n });\n\n const processTabSelection = React.useCallback(\n (tab: SettingsTabEntry) => {\n if (ConditionalBooleanValue.getValue(tab.isDisabled)) return;\n onSettingsTabSelected && onSettingsTabSelected(tab);\n setOpenTab(tab);\n },\n [onSettingsTabSelected]\n );\n\n const processTabSelectionById = React.useCallback(\n (tabId: string) => {\n const tabToActivate = tabs.find((tab) => tab.tabId === tabId);\n tabToActivate && processTabSelection(tabToActivate);\n },\n [processTabSelection, tabs]\n );\n\n const onActivateTab = React.useCallback(\n (tabIndex: number) => {\n const selectedTab = tabs[tabIndex];\n if (openTab && openTab.pageWillHandleCloseRequest)\n settingsManager.onProcessSettingsTabActivation.emit({\n requestedSettingsTabId: selectedTab.tabId,\n tabSelectionFunc: processTabSelectionById,\n });\n else processTabSelection(selectedTab);\n },\n [\n openTab,\n processTabSelection,\n processTabSelectionById,\n settingsManager,\n tabs,\n ]\n );\n\n React.useEffect(() => {\n const handleActivateSettingsTab = (\n { settingsTabId }: ActivateSettingsTabEventArgs // eslint-disable-line deprecation/deprecation\n ) => {\n const idToFind = settingsTabId.toLowerCase();\n let tabToActivate = tabs.find(\n (tab) => tab.tabId.toLowerCase() === idToFind\n );\n if (!tabToActivate)\n tabToActivate = tabs.find(\n (tab) => tab.label.toLowerCase() === idToFind\n );\n if (tabToActivate) {\n if (openTab && openTab.pageWillHandleCloseRequest)\n settingsManager.onProcessSettingsTabActivation.emit({\n requestedSettingsTabId: tabToActivate.tabId,\n tabSelectionFunc: processTabSelectionById,\n });\n else processTabSelection(tabToActivate);\n }\n };\n\n return settingsManager.onActivateSettingsTab.addListener(\n handleActivateSettingsTab\n );\n }, [\n openTab,\n processTabSelection,\n processTabSelectionById,\n settingsManager,\n settingsManager.onActivateSettingsTab,\n tabs,\n ]);\n\n React.useEffect(() => {\n const handleSettingsContainerClose = (\n { closeFunc, closeFuncArgs }: ProcessSettingsContainerCloseEventArgs // eslint-disable-line deprecation/deprecation\n ) => {\n if (openTab && openTab.pageWillHandleCloseRequest)\n settingsManager.onProcessSettingsContainerClose.emit({\n closeFunc,\n closeFuncArgs,\n });\n else closeFunc(closeFuncArgs);\n };\n return settingsManager.onCloseSettingsContainer.addListener(\n handleSettingsContainerClose\n );\n }, [\n openTab,\n processTabSelection,\n settingsManager,\n settingsManager.onActivateSettingsTab,\n tabs,\n ]);\n\n const labels = tabs.map((tab) => {\n return {\n label: tab.label,\n subLabel: tab.subLabel,\n icon: tab.icon,\n tooltip: tab.tooltip,\n tabId: tab.tabId,\n disabled: ConditionalBooleanValue.getValue(tab.isDisabled),\n };\n });\n const activeIndex = tabs.findIndex((tab) => tab.tabId === openTab.tabId);\n return (\n <div className=\"core-settings-container\">\n <div className=\"core-settings-container-left\">\n {/* eslint-disable-next-line deprecation/deprecation */}\n <VerticalTabs\n labels={labels}\n activeIndex={activeIndex}\n onActivateTab={onActivateTab}\n />\n </div>\n <div className=\"core-settings-container-right\">\n {showHeader && (\n <div className=\"core-settings-container-right-header\">\n <span className=\"core-settings-container-main-header\">\n {openTab.label}\n </span>\n {openTab.subLabel && (\n <span className=\"core-settings-container-main-sub-header\">\n {openTab.subLabel}\n </span>\n )}\n </div>\n )}\n <div className=\"core-settings-container-right-contents\">\n {openTab.page}\n </div>\n </div>\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"SettingsContainer.js","sourceRoot":"","sources":["../../../../src/core-react/settings/SettingsContainer.tsx"],"names":[],"mappings":"AAAA;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ACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Settings\n */\n\nimport \"./SettingsContainer.scss\";\nimport * as React from \"react\";\nimport type { SettingsManager, SettingsTabEntry } from \"./SettingsManager\";\nimport { VerticalTabs } from \"../tabs/VerticalTabs\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\n\n/* eslint-disable deprecation/deprecation */\n\n/* ---------------------------------------------------------------------------------------------------\n// A typical implementation of a saveFunction callback\nconst saveChanges = React.useCallback((afterSaveFunction: (args: any) => void, args?: any) => {\n if (dataIsDirty) {\n // prompt user to save changes passing in function and arguments to call after saving changes.\n UiFramework.dialogs.modal.openDialog(<CustomSavePromptModalDialog customProps={customProps}\n onDialogCloseArgs={args} onDialogClose={afterSaveFunction} />);\n return;\n }\n afterSaveFunction(args);\n}, []);\n---------------------------------------------------------------------------------------------------------- */\n\n/** Hook to use within Settings Page component to allow saving the current page's data before the Setting Container is closed.\n * @public\n * @deprecated in 4.16.0. Use {@link SettingsManager} instead.\n */\nexport function useSaveBeforeClosingSettingsContainer(\n settingsManager: SettingsManager,\n saveFunction: (closeFunc: (args: any) => void, closeFuncArgs?: any) => void\n) {\n React.useEffect(() => {\n return settingsManager.onProcessSettingsContainerClose.addListener(\n ({ closeFunc, closeFuncArgs }) => {\n saveFunction(closeFunc, closeFuncArgs);\n }\n );\n }, [saveFunction, settingsManager]);\n}\n\n/** Hook to use within Settings Page component to allow saving the current page's data before loading to the requested Setting Tab's page.\n * @public\n * @deprecated in 4.16.0. Use {@link SettingsManager} instead.\n */\nexport function useSaveBeforeActivatingNewSettingsTab(\n settingsManager: SettingsManager,\n saveFunction: (\n tabSelectionFunc: (args: any) => void,\n requestedSettingsTabId?: string\n ) => void\n) {\n React.useEffect(() => {\n return settingsManager.onProcessSettingsTabActivation.addListener(\n ({ tabSelectionFunc, requestedSettingsTabId }) => {\n saveFunction(tabSelectionFunc, requestedSettingsTabId);\n }\n );\n }, [saveFunction, settingsManager]);\n}\n\n/**\n * Properties of {@link SettingsContainer} component.\n * @public\n * @deprecated in 4.16.0. Props of deprecated component {@link SettingsContainer}.\n */\nexport interface SettingsContainerProps {\n tabs: SettingsTabEntry[];\n // sets tab to set as active tab\n currentSettingsTab?: SettingsTabEntry;\n // If plugging into a SPA and you need to modify the route, you can pass in additional logic here\n onSettingsTabSelected?: (tab: SettingsTabEntry) => void;\n // The SettingsManager that can have event handlers registered against it so pages can save its settings before the page is closed.\n settingsManager: SettingsManager;\n // if true show tab label as header above page contents.\n showHeader?: boolean;\n}\n\n/** Component that displays setting tabs on the left and the setting page on the right.\n * Note: that SettingsContainer is not rendered if tabs array is empty.\n * @public\n * @deprecated in 4.16.0. Used internally by {@link @itwin/appui-react#SettingsModalFrontstage}.\n */\nexport const SettingsContainer = ({\n tabs,\n onSettingsTabSelected,\n currentSettingsTab,\n settingsManager,\n showHeader,\n}: SettingsContainerProps) => {\n // sort the tabs based on itemPriority\n tabs = tabs.sort((a, b) => a.itemPriority - b.itemPriority);\n\n const [openTab, setOpenTab] = React.useState(() => {\n if (\n currentSettingsTab &&\n !ConditionalBooleanValue.getValue(currentSettingsTab.isDisabled)\n )\n return currentSettingsTab;\n else return tabs[0];\n });\n\n const processTabSelection = React.useCallback(\n (tab: SettingsTabEntry) => {\n if (ConditionalBooleanValue.getValue(tab.isDisabled)) return;\n onSettingsTabSelected && onSettingsTabSelected(tab);\n setOpenTab(tab);\n },\n [onSettingsTabSelected]\n );\n\n const processTabSelectionById = React.useCallback(\n (tabId: string) => {\n const tabToActivate = tabs.find((tab) => tab.tabId === tabId);\n tabToActivate && processTabSelection(tabToActivate);\n },\n [processTabSelection, tabs]\n );\n\n const onActivateTab = React.useCallback(\n (tabIndex: number) => {\n const selectedTab = tabs[tabIndex];\n if (openTab && openTab.pageWillHandleCloseRequest)\n settingsManager.onProcessSettingsTabActivation.emit({\n requestedSettingsTabId: selectedTab.tabId,\n tabSelectionFunc: processTabSelectionById,\n });\n else processTabSelection(selectedTab);\n },\n [\n openTab,\n processTabSelection,\n processTabSelectionById,\n settingsManager,\n tabs,\n ]\n );\n\n React.useEffect(() => {\n return settingsManager.onActivateSettingsTab.addListener(\n ({ settingsTabId }) => {\n const idToFind = settingsTabId.toLowerCase();\n let tabToActivate = tabs.find(\n (tab) => tab.tabId.toLowerCase() === idToFind\n );\n if (!tabToActivate)\n tabToActivate = tabs.find(\n (tab) => tab.label.toLowerCase() === idToFind\n );\n if (tabToActivate) {\n if (openTab && openTab.pageWillHandleCloseRequest)\n settingsManager.onProcessSettingsTabActivation.emit({\n requestedSettingsTabId: tabToActivate.tabId,\n tabSelectionFunc: processTabSelectionById,\n });\n else processTabSelection(tabToActivate);\n }\n }\n );\n }, [\n openTab,\n processTabSelection,\n processTabSelectionById,\n settingsManager,\n settingsManager.onActivateSettingsTab,\n tabs,\n ]);\n\n React.useEffect(() => {\n return settingsManager.onCloseSettingsContainer.addListener(\n ({ closeFunc, closeFuncArgs }) => {\n if (openTab && openTab.pageWillHandleCloseRequest)\n settingsManager.onProcessSettingsContainerClose.emit({\n closeFunc,\n closeFuncArgs,\n });\n else closeFunc(closeFuncArgs);\n }\n );\n }, [\n openTab,\n processTabSelection,\n settingsManager,\n settingsManager.onActivateSettingsTab,\n tabs,\n ]);\n\n const labels = tabs.map((tab) => {\n return {\n label: tab.label,\n subLabel: tab.subLabel,\n icon: tab.icon,\n tooltip: tab.tooltip,\n tabId: tab.tabId,\n disabled: ConditionalBooleanValue.getValue(tab.isDisabled),\n };\n });\n const activeIndex = tabs.findIndex((tab) => tab.tabId === openTab.tabId);\n return (\n <div className=\"core-settings-container\">\n <div className=\"core-settings-container-left\">\n <VerticalTabs\n labels={labels}\n activeIndex={activeIndex}\n onActivateTab={onActivateTab}\n />\n </div>\n <div className=\"core-settings-container-right\">\n {showHeader && (\n <div className=\"core-settings-container-right-header\">\n <span className=\"core-settings-container-main-header\">\n {openTab.label}\n </span>\n {openTab.subLabel && (\n <span className=\"core-settings-container-main-sub-header\">\n {openTab.subLabel}\n </span>\n )}\n </div>\n )}\n <div className=\"core-settings-container-right-contents\">\n {openTab.page}\n </div>\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -5,6 +5,7 @@ import { BeUiEvent } from "@itwin/core-bentley";
|
|
|
5
5
|
import type { ConditionalBooleanValue } from "@itwin/appui-abstract";
|
|
6
6
|
/** Interface used to populate a tab entry in the SettingContainer control
|
|
7
7
|
* @public
|
|
8
|
+
* @deprecated in 4.16.0. Use {@link @itwin/appui-react#SettingsTabEntry} instead.
|
|
8
9
|
*/
|
|
9
10
|
export interface SettingsTabEntry {
|
|
10
11
|
/** unique id for entry */
|
|
@@ -86,6 +87,7 @@ export interface ActivateSettingsTabEventArgs {
|
|
|
86
87
|
/** Setting Provider interface. Implemented by classes that want to supply settings pages for display in the SettingContainer. The
|
|
87
88
|
* classes that implement this interface need to be registered with the [[SettingsManager]].
|
|
88
89
|
* @public
|
|
90
|
+
* @deprecated in 4.16.0. Use {@link @itwin/appui-react#SettingsTabsProvider} instead.
|
|
89
91
|
*/
|
|
90
92
|
export interface SettingsTabsProvider {
|
|
91
93
|
/** Id of provider, used to remove registration. */
|
|
@@ -94,6 +96,7 @@ export interface SettingsTabsProvider {
|
|
|
94
96
|
}
|
|
95
97
|
/** Settings Manager class. Hold registration of settings providers and supplies events for the provided settings pages to listen.
|
|
96
98
|
* @public
|
|
99
|
+
* @deprecated in 4.16.0. Use {@link @itwin/appui-react#SettingsManager} instead.
|
|
97
100
|
*/
|
|
98
101
|
export declare class SettingsManager {
|
|
99
102
|
private _providers;
|
|
@@ -116,7 +119,6 @@ export declare class SettingsManager {
|
|
|
116
119
|
* @internal
|
|
117
120
|
*/
|
|
118
121
|
readonly onCloseSettingsContainer: BeUiEvent<ProcessSettingsContainerCloseEventArgs>;
|
|
119
|
-
/** @public */
|
|
120
122
|
get providers(): ReadonlyArray<SettingsTabsProvider>;
|
|
121
123
|
set providers(p: ReadonlyArray<SettingsTabsProvider>);
|
|
122
124
|
/** Called by application when an tool, keyin, or other process want to change the active settings tab/page giving the current tab/page and opportunity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsManager.d.ts","sourceRoot":"","sources":["../../../../src/core-react/settings/SettingsManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAU,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SettingsManager.d.ts","sourceRoot":"","sources":["../../../../src/core-react/settings/SettingsManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAU,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAKrE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC;IAClC;gHAC4G;IAC5G,QAAQ,CAAC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAC9C,4CAA4C;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IAC5C,qEAAqE;IACrE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IAC/C,2CAA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C;;OAEG;IACH,SAAgB,8BAA8B,oCACJ;IAE1C;;OAEG;IACH,SAAgB,+BAA+B,qCACJ;IAE3C;;OAEG;IACH,SAAgB,qBAAqB,0CACW;IAEhD;;OAEG;IACH,SAAgB,wBAAwB,oDACkB;IAE1D,IAAW,SAAS,IAAI,aAAa,CAAC,oBAAoB,CAAC,CAE1D;IACD,IAAW,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAG1D;IAED;;OAEG;IACI,mBAAmB,CAAC,aAAa,EAAE,MAAM;IAIhD;;OAEG;IACI,sBAAsB,CAC3B,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAC9B,aAAa,CAAC,EAAE,GAAG;IAKd,mBAAmB,CAAC,gBAAgB,EAAE,oBAAoB,GAAG,IAAI;IAejE,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAW1D,mFAAmF;IAC5E,iBAAiB,CACtB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,KAAK,CAAC,gBAAgB,CAAC;CAU3B"}
|
|
@@ -11,7 +11,6 @@ import { UiCore } from "../UiCore";
|
|
|
11
11
|
* @public
|
|
12
12
|
* @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.
|
|
13
13
|
*/
|
|
14
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
15
14
|
export class SettingsProvidersChangedEvent extends BeUiEvent {
|
|
16
15
|
}
|
|
17
16
|
/** Event class for [[this.onProcessSettingsTabActivation]] which is emitted when a new Tab needs to be activated. This allows the current
|
|
@@ -19,7 +18,6 @@ export class SettingsProvidersChangedEvent extends BeUiEvent {
|
|
|
19
18
|
* @public
|
|
20
19
|
* @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.
|
|
21
20
|
*/
|
|
22
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
23
21
|
export class ProcessSettingsTabActivationEvent extends BeUiEvent {
|
|
24
22
|
}
|
|
25
23
|
/** Event class for [[this.onProcessSettingsContainerClose]] which is emitted when the settings container will be closed. This allows the current
|
|
@@ -27,43 +25,41 @@ export class ProcessSettingsTabActivationEvent extends BeUiEvent {
|
|
|
27
25
|
* @public
|
|
28
26
|
* @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.
|
|
29
27
|
*/
|
|
30
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
31
28
|
export class ProcessSettingsContainerCloseEvent extends BeUiEvent {
|
|
32
29
|
}
|
|
33
30
|
/** Event class for [[this.onActivateSettingsTab]] which is emitted when API call needs to set the active settings tab (ie via Tool key-in).
|
|
34
31
|
* @public
|
|
35
32
|
* @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.
|
|
36
33
|
*/
|
|
37
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
38
34
|
export class ActivateSettingsTabEvent extends BeUiEvent {
|
|
39
35
|
}
|
|
40
36
|
/** Settings Manager class. Hold registration of settings providers and supplies events for the provided settings pages to listen.
|
|
41
37
|
* @public
|
|
38
|
+
* @deprecated in 4.16.0. Use {@link @itwin/appui-react#SettingsManager} instead.
|
|
42
39
|
*/
|
|
43
40
|
export class SettingsManager {
|
|
44
41
|
constructor() {
|
|
45
42
|
this._providers = [];
|
|
46
43
|
/** Event raised when SettingsProviders are changed.
|
|
47
44
|
*/
|
|
48
|
-
this.onSettingsProvidersChanged = new SettingsProvidersChangedEvent();
|
|
45
|
+
this.onSettingsProvidersChanged = new SettingsProvidersChangedEvent();
|
|
49
46
|
/** Event raised solely for a settings page to monitor so it can save its settings before continuing tab activation.
|
|
50
47
|
* See React hook function `useSaveBeforeActivatingNewSettingsTab`.
|
|
51
48
|
*/
|
|
52
|
-
this.onProcessSettingsTabActivation = new ProcessSettingsTabActivationEvent();
|
|
49
|
+
this.onProcessSettingsTabActivation = new ProcessSettingsTabActivationEvent();
|
|
53
50
|
/** Event raised when the settings container will be closed. Any setting page component that is 'modal' should register to
|
|
54
51
|
* listen to this event so that it can save its state before closing. See React hook function `useSaveBeforeClosingSettingsContainer`.
|
|
55
52
|
*/
|
|
56
|
-
this.onProcessSettingsContainerClose = new ProcessSettingsContainerCloseEvent();
|
|
53
|
+
this.onProcessSettingsContainerClose = new ProcessSettingsContainerCloseEvent();
|
|
57
54
|
/** Event raised to change the active settings tab shown in UI. Monitored by the SettingsContainer.
|
|
58
55
|
* @internal
|
|
59
56
|
*/
|
|
60
|
-
this.onActivateSettingsTab = new BeUiEvent();
|
|
57
|
+
this.onActivateSettingsTab = new BeUiEvent();
|
|
61
58
|
/** Event monitored by SettingsContainer to process request to close the settings container.
|
|
62
59
|
* @internal
|
|
63
60
|
*/
|
|
64
|
-
this.onCloseSettingsContainer = new BeUiEvent();
|
|
61
|
+
this.onCloseSettingsContainer = new BeUiEvent();
|
|
65
62
|
}
|
|
66
|
-
/** @public */
|
|
67
63
|
get providers() {
|
|
68
64
|
return this._providers;
|
|
69
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsManager.js","sourceRoot":"","sources":["../../../../src/core-react/settings/SettingsManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA2BnC;;;GAGG;AACH,mDAAmD;AACnD,MAAM,OAAO,6BAA8B,SAAQ,SAA4C;CAAG;AAUlG;;;;GAIG;AACH,mDAAmD;AACnD,MAAM,OAAO,iCAAkC,SAAQ,SAAgD;CAAG;AAW1G;;;;GAIG;AACH,mDAAmD;AACnD,MAAM,OAAO,kCAAmC,SAAQ,SAAiD;CAAG;AAW5G;;;GAGG;AACH,mDAAmD;AACnD,MAAM,OAAO,wBAAyB,SAAQ,SAAuC;CAAG;AAuBxF;;GAEG;AACH,MAAM,OAAO,eAAe;IAA5B;QACU,eAAU,GAAwC,EAAE,CAAC;QAE7D;WACG;QACa,+BAA0B,GAC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CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CACZ,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAC3B,gCAAgC,gBAAgB,CAAC,EAAE,8BAA8B,CAClF,CAAC;QACJ,CAAC;IACH,CAAC;IAEM,sBAAsB,CAAC,UAAkB;QAC9C,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC;QAC5E,IAAI,gBAAgB,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvD,IAAI,CAAC,SAAS,GAAG,gBAAgB,CAAC;YAClC,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mFAAmF;IAC5E,iBAAiB,CACtB,OAAe,EACf,UAAkB;QAElB,MAAM,iBAAiB,GAAuB,EAAE,CAAC;QACjD,2CAA2C;QAC3C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YACzD,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Settings\n */\n\nimport { BeUiEvent, Logger } from \"@itwin/core-bentley\";\nimport type { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport { UiCore } from \"../UiCore\";\n\n/** Interface used to populate a tab entry in the SettingContainer control\n * @public\n */\nexport interface SettingsTabEntry {\n /** unique id for entry */\n readonly tabId: string;\n /** localized display label */\n readonly label: string;\n /** Setting page content to display when tab item is selected. */\n readonly page: React.ReactElement;\n /** Setting to true if page will register to watch for stage closing event so it can save any dirty settings. Page component should register and handle the events:\n * `settingsManager.onProcessSettingsTabActivation` and `settingsManager.onProcessSettingsContainerClose` */\n readonly pageWillHandleCloseRequest?: boolean;\n /** used to determine position in tablist */\n readonly itemPriority: number;\n /** Optional Subtitle to show below label. */\n readonly subLabel?: string;\n /** Icon specification */\n readonly icon?: string | React.ReactElement;\n /** Tooltip. Allows JSX|Element to support react-tooltip component */\n readonly tooltip?: string | React.ReactElement;\n /** Allows Settings entry to be disabled */\n readonly isDisabled?: boolean | ConditionalBooleanValue;\n}\n\n/** Event class for [[this.onSettingsProvidersChanged]] which is emitted when a new SettingsTabsProvider is added or removed.\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class SettingsProvidersChangedEvent extends BeUiEvent<SettingsProvidersChangedEventArgs> {}\n\n/** Arguments of [[this.onSettingsProvidersChanged]] event.\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface SettingsProvidersChangedEventArgs {\n readonly providers: ReadonlyArray<SettingsTabsProvider>;\n}\n\n/** Event class for [[this.onProcessSettingsTabActivation]] which is emitted when a new Tab needs to be activated. This allows the current\n * settings page to save its settings before activating the new SettingTab.\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class ProcessSettingsTabActivationEvent extends BeUiEvent<ProcessSettingsTabActivationEventArgs> {}\n\n/** Arguments of [[this.onProcessSettingsTabActivation]] event.\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ProcessSettingsTabActivationEventArgs {\n readonly tabSelectionFunc: (tabId: string) => void;\n readonly requestedSettingsTabId: string;\n}\n\n/** Event class for [[this.onProcessSettingsContainerClose]] which is emitted when the settings container will be closed. This allows the current\n * settings page to save its settings before calling the function to close the container.\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class ProcessSettingsContainerCloseEvent extends BeUiEvent<ProcessSettingsContainerCloseEventArgs> {}\n\n/** Arguments of [[this.onProcessSettingsContainerClose]] event.\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ProcessSettingsContainerCloseEventArgs {\n readonly closeFunc: (args: any) => void;\n readonly closeFuncArgs?: any;\n}\n\n/** Event class for [[this.onActivateSettingsTab]] which is emitted when API call needs to set the active settings tab (ie via Tool key-in).\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class ActivateSettingsTabEvent extends BeUiEvent<ActivateSettingsTabEventArgs> {}\n\n/** Arguments of [[this.onActivateSettingsTab]] event.\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ActivateSettingsTabEventArgs {\n readonly settingsTabId: string;\n}\n\n/** Setting Provider interface. Implemented by classes that want to supply settings pages for display in the SettingContainer. The\n * classes that implement this interface need to be registered with the [[SettingsManager]].\n * @public\n */\nexport interface SettingsTabsProvider {\n /** Id of provider, used to remove registration. */\n readonly id: string;\n getSettingEntries(\n stageId: string,\n stageUsage: string\n ): ReadonlyArray<SettingsTabEntry> | undefined;\n}\n\n/** Settings Manager class. Hold registration of settings providers and supplies events for the provided settings pages to listen.\n * @public\n */\nexport class SettingsManager {\n private _providers: ReadonlyArray<SettingsTabsProvider> = [];\n\n /** Event raised when SettingsProviders are changed.\n */\n public readonly onSettingsProvidersChanged =\n new SettingsProvidersChangedEvent(); // eslint-disable-line deprecation/deprecation\n\n /** Event raised solely for a settings page to monitor so it can save its settings before continuing tab activation.\n * See React hook function `useSaveBeforeActivatingNewSettingsTab`.\n */\n public readonly onProcessSettingsTabActivation =\n new ProcessSettingsTabActivationEvent(); // eslint-disable-line deprecation/deprecation\n\n /** Event raised when the settings container will be closed. Any setting page component that is 'modal' should register to\n * listen to this event so that it can save its state before closing. See React hook function `useSaveBeforeClosingSettingsContainer`.\n */\n public readonly onProcessSettingsContainerClose =\n new ProcessSettingsContainerCloseEvent(); // eslint-disable-line deprecation/deprecation\n\n /** Event raised to change the active settings tab shown in UI. Monitored by the SettingsContainer.\n * @internal\n */\n public readonly onActivateSettingsTab =\n new BeUiEvent<ActivateSettingsTabEventArgs>(); // eslint-disable-line deprecation/deprecation\n\n /** Event monitored by SettingsContainer to process request to close the settings container.\n * @internal\n */\n public readonly onCloseSettingsContainer =\n new BeUiEvent<ProcessSettingsContainerCloseEventArgs>(); // eslint-disable-line deprecation/deprecation\n\n /** @public */\n public get providers(): ReadonlyArray<SettingsTabsProvider> {\n return this._providers;\n }\n public set providers(p: ReadonlyArray<SettingsTabsProvider>) {\n this._providers = p;\n this.onSettingsProvidersChanged.emit({ providers: p });\n }\n\n /** Called by application when an tool, keyin, or other process want to change the active settings tab/page giving the current tab/page and opportunity\n * to save its state.\n */\n public activateSettingsTab(settingsTabId: string) {\n this.onActivateSettingsTab.emit({ settingsTabId });\n }\n\n /** Called by application when the Settings Container is to be closed. The function to invoke to actually close the Settings Container is\n * passed in and executed once the active settings tab/page has a chance to save its settings.\n */\n public closeSettingsContainer(\n closeFunc: (args: any) => void,\n closeFuncArgs?: any\n ) {\n this.onCloseSettingsContainer.emit({ closeFunc, closeFuncArgs });\n }\n\n public addSettingsProvider(settingsProvider: SettingsTabsProvider): void {\n const foundProvider = this._providers.find(\n (p) => p.id === settingsProvider.id\n );\n if (!foundProvider) {\n const updatedProviders = [...this.providers, settingsProvider];\n this.providers = updatedProviders;\n } else {\n Logger.logInfo(\n UiCore.loggerCategory(this),\n `Settings Provider with id of ${settingsProvider.id} has already been registered`\n );\n }\n }\n\n public removeSettingsProvider(providerId: string): boolean {\n let result = false;\n const updatedProviders = this._providers.filter((p) => p.id !== providerId);\n if (updatedProviders.length !== this._providers.length) {\n this.providers = updatedProviders;\n result = true;\n }\n\n return result;\n }\n\n /** Get an array of SettingsTabEntry objects to populate the settings container. */\n public getSettingEntries(\n stageId: string,\n stageUsage: string\n ): Array<SettingsTabEntry> {\n const allSettingEntries: SettingsTabEntry[] = [];\n // Consult the registered SettingsProviders\n this._providers.forEach((p) => {\n const entries = p.getSettingEntries(stageId, stageUsage);\n entries && allSettingEntries.push(...entries);\n });\n\n return allSettingEntries;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SettingsManager.js","sourceRoot":"","sources":["../../../../src/core-react/settings/SettingsManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA8BnC;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,SAA4C;CAAG;AAUlG;;;;GAIG;AACH,MAAM,OAAO,iCAAkC,SAAQ,SAAgD;CAAG;AAW1G;;;;GAIG;AACH,MAAM,OAAO,kCAAmC,SAAQ,SAAiD;CAAG;AAW5G;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,SAAuC;CAAG;AAwBxF;;;GAGG;AACH,MAAM,OAAO,eAAe;IAA5B;QACU,eAAU,GAAwC,EAAE,CAAC;QAE7D;WACG;QACa,+BAA0B,GACxC,IAAI,6BAA6B,EAAE,CAAC;QAEtC;;WAEG;QACa,mCAA8B,GAC5C,IAAI,iCAAiC,EAAE,CAAC;QAE1C;;WAEG;QACa,oCAA+B,GAC7C,IAAI,kCAAkC,EAAE,CAAC;QAE3C;;WAEG;QACa,0BAAqB,GACnC,IAAI,SAAS,EAAgC,CAAC;QAEhD;;WAEG;QACa,6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CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC;QAC5E,IAAI,gBAAgB,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvD,IAAI,CAAC,SAAS,GAAG,gBAAgB,CAAC;YAClC,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mFAAmF;IAC5E,iBAAiB,CACtB,OAAe,EACf,UAAkB;QAElB,MAAM,iBAAiB,GAAuB,EAAE,CAAC;QACjD,2CAA2C;QAC3C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YACzD,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Settings\n */\n\nimport { BeUiEvent, Logger } from \"@itwin/core-bentley\";\nimport type { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport { UiCore } from \"../UiCore\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Interface used to populate a tab entry in the SettingContainer control\n * @public\n * @deprecated in 4.16.0. Use {@link @itwin/appui-react#SettingsTabEntry} instead.\n */\nexport interface SettingsTabEntry {\n /** unique id for entry */\n readonly tabId: string;\n /** localized display label */\n readonly label: string;\n /** Setting page content to display when tab item is selected. */\n readonly page: React.ReactElement;\n /** Setting to true if page will register to watch for stage closing event so it can save any dirty settings. Page component should register and handle the events:\n * `settingsManager.onProcessSettingsTabActivation` and `settingsManager.onProcessSettingsContainerClose` */\n readonly pageWillHandleCloseRequest?: boolean;\n /** used to determine position in tablist */\n readonly itemPriority: number;\n /** Optional Subtitle to show below label. */\n readonly subLabel?: string;\n /** Icon specification */\n readonly icon?: string | React.ReactElement;\n /** Tooltip. Allows JSX|Element to support react-tooltip component */\n readonly tooltip?: string | React.ReactElement;\n /** Allows Settings entry to be disabled */\n readonly isDisabled?: boolean | ConditionalBooleanValue;\n}\n\n/** Event class for [[this.onSettingsProvidersChanged]] which is emitted when a new SettingsTabsProvider is added or removed.\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\nexport class SettingsProvidersChangedEvent extends BeUiEvent<SettingsProvidersChangedEventArgs> {}\n\n/** Arguments of [[this.onSettingsProvidersChanged]] event.\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface SettingsProvidersChangedEventArgs {\n readonly providers: ReadonlyArray<SettingsTabsProvider>;\n}\n\n/** Event class for [[this.onProcessSettingsTabActivation]] which is emitted when a new Tab needs to be activated. This allows the current\n * settings page to save its settings before activating the new SettingTab.\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\nexport class ProcessSettingsTabActivationEvent extends BeUiEvent<ProcessSettingsTabActivationEventArgs> {}\n\n/** Arguments of [[this.onProcessSettingsTabActivation]] event.\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ProcessSettingsTabActivationEventArgs {\n readonly tabSelectionFunc: (tabId: string) => void;\n readonly requestedSettingsTabId: string;\n}\n\n/** Event class for [[this.onProcessSettingsContainerClose]] which is emitted when the settings container will be closed. This allows the current\n * settings page to save its settings before calling the function to close the container.\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\nexport class ProcessSettingsContainerCloseEvent extends BeUiEvent<ProcessSettingsContainerCloseEventArgs> {}\n\n/** Arguments of [[this.onProcessSettingsContainerClose]] event.\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ProcessSettingsContainerCloseEventArgs {\n readonly closeFunc: (args: any) => void;\n readonly closeFuncArgs?: any;\n}\n\n/** Event class for [[this.onActivateSettingsTab]] which is emitted when API call needs to set the active settings tab (ie via Tool key-in).\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\nexport class ActivateSettingsTabEvent extends BeUiEvent<ActivateSettingsTabEventArgs> {}\n\n/** Arguments of [[this.onActivateSettingsTab]] event.\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ActivateSettingsTabEventArgs {\n readonly settingsTabId: string;\n}\n\n/** Setting Provider interface. Implemented by classes that want to supply settings pages for display in the SettingContainer. The\n * classes that implement this interface need to be registered with the [[SettingsManager]].\n * @public\n * @deprecated in 4.16.0. Use {@link @itwin/appui-react#SettingsTabsProvider} instead.\n */\nexport interface SettingsTabsProvider {\n /** Id of provider, used to remove registration. */\n readonly id: string;\n getSettingEntries(\n stageId: string,\n stageUsage: string\n ): ReadonlyArray<SettingsTabEntry> | undefined;\n}\n\n/** Settings Manager class. Hold registration of settings providers and supplies events for the provided settings pages to listen.\n * @public\n * @deprecated in 4.16.0. Use {@link @itwin/appui-react#SettingsManager} instead.\n */\nexport class SettingsManager {\n private _providers: ReadonlyArray<SettingsTabsProvider> = [];\n\n /** Event raised when SettingsProviders are changed.\n */\n public readonly onSettingsProvidersChanged =\n new SettingsProvidersChangedEvent();\n\n /** Event raised solely for a settings page to monitor so it can save its settings before continuing tab activation.\n * See React hook function `useSaveBeforeActivatingNewSettingsTab`.\n */\n public readonly onProcessSettingsTabActivation =\n new ProcessSettingsTabActivationEvent();\n\n /** Event raised when the settings container will be closed. Any setting page component that is 'modal' should register to\n * listen to this event so that it can save its state before closing. See React hook function `useSaveBeforeClosingSettingsContainer`.\n */\n public readonly onProcessSettingsContainerClose =\n new ProcessSettingsContainerCloseEvent();\n\n /** Event raised to change the active settings tab shown in UI. Monitored by the SettingsContainer.\n * @internal\n */\n public readonly onActivateSettingsTab =\n new BeUiEvent<ActivateSettingsTabEventArgs>();\n\n /** Event monitored by SettingsContainer to process request to close the settings container.\n * @internal\n */\n public readonly onCloseSettingsContainer =\n new BeUiEvent<ProcessSettingsContainerCloseEventArgs>();\n\n public get providers(): ReadonlyArray<SettingsTabsProvider> {\n return this._providers;\n }\n public set providers(p: ReadonlyArray<SettingsTabsProvider>) {\n this._providers = p;\n this.onSettingsProvidersChanged.emit({ providers: p });\n }\n\n /** Called by application when an tool, keyin, or other process want to change the active settings tab/page giving the current tab/page and opportunity\n * to save its state.\n */\n public activateSettingsTab(settingsTabId: string) {\n this.onActivateSettingsTab.emit({ settingsTabId });\n }\n\n /** Called by application when the Settings Container is to be closed. The function to invoke to actually close the Settings Container is\n * passed in and executed once the active settings tab/page has a chance to save its settings.\n */\n public closeSettingsContainer(\n closeFunc: (args: any) => void,\n closeFuncArgs?: any\n ) {\n this.onCloseSettingsContainer.emit({ closeFunc, closeFuncArgs });\n }\n\n public addSettingsProvider(settingsProvider: SettingsTabsProvider): void {\n const foundProvider = this._providers.find(\n (p) => p.id === settingsProvider.id\n );\n if (!foundProvider) {\n const updatedProviders = [...this.providers, settingsProvider];\n this.providers = updatedProviders;\n } else {\n Logger.logInfo(\n UiCore.loggerCategory(this),\n `Settings Provider with id of ${settingsProvider.id} has already been registered`\n );\n }\n }\n\n public removeSettingsProvider(providerId: string): boolean {\n let result = false;\n const updatedProviders = this._providers.filter((p) => p.id !== providerId);\n if (updatedProviders.length !== this._providers.length) {\n this.providers = updatedProviders;\n result = true;\n }\n\n return result;\n }\n\n /** Get an array of SettingsTabEntry objects to populate the settings container. */\n public getSettingEntries(\n stageId: string,\n stageUsage: string\n ): Array<SettingsTabEntry> {\n const allSettingEntries: SettingsTabEntry[] = [];\n // Consult the registered SettingsProviders\n this._providers.forEach((p) => {\n const entries = p.getSettingEntries(stageId, stageUsage);\n entries && allSettingEntries.push(...entries);\n });\n\n return allSettingEntries;\n }\n}\n"]}
|
|
@@ -54,9 +54,7 @@ export declare class Tabs extends React.PureComponent<MainTabsProps, TabsState>
|
|
|
54
54
|
private _itemKeyboardNavigator;
|
|
55
55
|
constructor(props: MainTabsProps);
|
|
56
56
|
private validateActiveIndex;
|
|
57
|
-
/** @internal */
|
|
58
57
|
componentDidMount(): void;
|
|
59
|
-
/** @internal */
|
|
60
58
|
componentDidUpdate(prevProps: MainTabsProps): void;
|
|
61
59
|
private _handleFocusItem;
|
|
62
60
|
private _handleTabClick;
|
|
@@ -65,7 +63,6 @@ export declare class Tabs extends React.PureComponent<MainTabsProps, TabsState>
|
|
|
65
63
|
/** Handle keyup on tabs */
|
|
66
64
|
private _handleKeyUpEvent;
|
|
67
65
|
private _activateTab;
|
|
68
|
-
/** @internal */
|
|
69
66
|
render(): React.ReactElement;
|
|
70
67
|
}
|
|
71
68
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../src/core-react/tabs/Tabs.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMnD;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IACnC,KAAK,EAAE,MAAM,CAAoE;IACjF,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAUD;;;GAGG;AACH,MAAM,WAAW,SACf,SAAQ,KAAK,CAAC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** @internal */
|
|
53
52
|
componentDidMount() {
|
|
54
53
|
this._itemKeyboardNavigator.itemCount = this.props.labels.length;
|
|
55
54
|
this._itemKeyboardNavigator.orientation = this.props.orientation;
|
|
56
55
|
}
|
|
57
|
-
/** @internal */
|
|
58
56
|
componentDidUpdate(prevProps) {
|
|
59
57
|
if (prevProps.labels !== this.props.labels)
|
|
60
58
|
this._itemKeyboardNavigator.itemCount = this.props.labels.length;
|
|
@@ -83,7 +81,6 @@ export class Tabs extends React.PureComponent {
|
|
|
83
81
|
_handleKeyUpEvent(event, index) {
|
|
84
82
|
this._itemKeyboardNavigator.handleKeyUpEvent(event, index);
|
|
85
83
|
}
|
|
86
|
-
/** @internal */
|
|
87
84
|
render() {
|
|
88
85
|
const ulClassNames = classnames(this.props.mainClassName, this.props.green && "uicore-tabs-green", this.props.className);
|
|
89
86
|
const anyIconsPresent = this.props.labels.reduce((a, b) => a + (isTabLabelWithIcon(b) ? 1 : 0), 0) > 0;
|
|
@@ -109,7 +106,6 @@ export class Tabs extends React.PureComponent {
|
|
|
109
106
|
return (React.createElement("li", { key: index, title: title, className: classnames(index === this.state.activeIndex && "core-active", disabled && "core-tab-item-disabled"), role: "tab", "aria-selected": index === this.state.activeIndex, "data-for": `${tabId}` },
|
|
110
107
|
tooltipElement,
|
|
111
108
|
React.createElement("a", { ref: this._anchorRefs[index], tabIndex: index === this.state.activeIndex ? 0 : -1, onClick: () => this._handleTabClick(index), onKeyDown: (event) => this._handleKeyDownEvent(event, index), onKeyUp: (event) => this._handleKeyUpEvent(event, index), "data-testid": `${tabId}`, role: "button" },
|
|
112
|
-
" ",
|
|
113
109
|
React.createElement("div", { className: classnames("uicore-tabs-inline-label", disabled && "core-tab-item-disabled") },
|
|
114
110
|
anyIconsPresent && (React.createElement("span", { className: "uicore-tabs-icon" }, icon)),
|
|
115
111
|
React.createElement("div", { className: "uicore-tabs-label-subLabel-container" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","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U,CACnB,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,aAAa,EACjD,QAAQ,IAAI,wBAAwB,CACrC,EACD,IAAI,EAAC,KAAK,mBACK,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,cACrC,GAAG,KAAK,EAAE;gBAEnB,cAAc;gBAEf,2BACE,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAC5B,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACnD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAC1C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,EAC5D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,iBAC3C,GAAG,KAAK,EAAE,EACvB,IAAI,EAAC,QAAQ;oBAEZ,GAAG;oBACJ,6BACE,SAAS,EAAE,UAAU,CACnB,0BAA0B,EAC1B,QAAQ,IAAI,wBAAwB,CACrC;wBAEA,eAAe,IAAI,CAClB,8BAAM,SAAS,EAAC,kBAAkB,IAAE,IAAI,CAAQ,CACjD;wBACD,6BAAK,SAAS,EAAC,sCAAsC;4BACnD,kCACG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAC3C;4BACN,QAAQ,IAAI,CACX,8BAAM,SAAS,EAAC,sBAAsB,IAAE,QAAQ,CAAQ,CACzD,CACG,CACF,CACJ,CACD,CACN,CAAC;QACJ,CAAC,CAAC,CACC,CACN,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tabs\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { Orientation } from \"../enums/Orientation\";\nimport { ItemKeyboardNavigator } from \"../focus/ItemKeyboardNavigator\";\nimport { IconHelper } from \"../utils/IconHelper\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** TabLabel provides ability to define label, icon, and tooltip for a tab entry. The tooltip can be defined as JSX|Element\n * to support react-tooltip component or a string that will be use to set the title property.\n * @public\n * @deprecated in 4.12.0. Interface used in a deprecated component {@link Tabs}.\n */\nexport interface TabLabel {\n label: string;\n subLabel?: string;\n icon?: string | React.ReactElement;\n tabId: string /* optional id added to tab so it can be used by react-tooltip */;\n /** tooltip allows React.ReactElement to support styled tooltips like react-tooltip. */\n tooltip?: string | React.ReactElement;\n disabled?: boolean;\n}\n\nfunction isTabLabelWithIcon(item: string | TabLabel): item is TabLabel {\n return typeof item !== \"string\" && !!item.icon;\n}\n\nfunction isTabLabel(item: string | TabLabel): item is TabLabel {\n return typeof item !== \"string\";\n}\n\n/** Properties for the [[VerticalTabs]] component\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link Tabs}.\n */\nexport interface TabsProps\n extends React.AllHTMLAttributes<HTMLUListElement>,\n CommonProps {\n /** Text shown for each tab */\n labels: Array<string | TabLabel>;\n /** Handler for activating a tab */\n onActivateTab?: (index: number) => any;\n /** Index of the initial active tab */\n activeIndex?: number;\n /** Indicates whether the bar on the active tab is green instead of the default blue */\n green?: boolean;\n}\n\ninterface TabsState {\n activeIndex: number;\n}\n\n/** Properties for the base [[Tabs]] component\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link Tabs}.\n */\nexport interface MainTabsProps extends TabsProps {\n /** Main CSS class name */\n mainClassName: string;\n /** Orientation of the Tabs list */\n orientation: Orientation;\n}\n\n/** Tabs meant to represent the current position in a page/section\n * @public\n * @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/tabs iTwinUI Tabs} instead.\n */\nexport class Tabs extends React.PureComponent<MainTabsProps, TabsState> {\n private _anchorRefs: Array<React.RefObject<HTMLAnchorElement>> = [];\n private _itemKeyboardNavigator: ItemKeyboardNavigator;\n\n constructor(props: MainTabsProps) {\n super(props);\n\n const activeIndex = this.validateActiveIndex(props.activeIndex);\n this.state = {\n activeIndex,\n };\n\n props.labels.forEach(() =>\n this._anchorRefs.push(React.createRef<HTMLAnchorElement>())\n );\n this._itemKeyboardNavigator = new ItemKeyboardNavigator(\n this._handleFocusItem,\n this._activateTab\n );\n }\n\n private validateActiveIndex(idx?: number): number {\n let activeIndex = 0;\n if (idx && idx >= 0 && idx < this.props.labels.length) activeIndex = idx;\n return activeIndex;\n }\n\n /** @internal */\n public override componentDidMount() {\n this._itemKeyboardNavigator.itemCount = this.props.labels.length;\n this._itemKeyboardNavigator.orientation = this.props.orientation;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: MainTabsProps) {\n if (prevProps.labels !== this.props.labels)\n this._itemKeyboardNavigator.itemCount = this.props.labels.length;\n\n if (prevProps.orientation !== this.props.orientation)\n this._itemKeyboardNavigator.orientation = this.props.orientation;\n\n if (prevProps.activeIndex !== this.props.activeIndex) {\n let hadFocus = false;\n const element = this._anchorRefs[this.state.activeIndex].current;\n if (element && document.activeElement === element) hadFocus = true;\n const activeIndex = this.validateActiveIndex(this.props.activeIndex);\n\n this.setState(\n () => ({ activeIndex }),\n () => {\n if (hadFocus) {\n const newElement = this._anchorRefs[activeIndex].current;\n if (newElement) newElement.focus();\n }\n }\n );\n }\n }\n\n private _handleFocusItem = (index: number) => {\n const itemRef = this._anchorRefs[index];\n if (itemRef && itemRef.current) itemRef.current.focus();\n };\n\n private _handleTabClick = (index: number) => {\n this._activateTab(index);\n };\n\n /** Handle keydown on tabs */\n private _handleKeyDownEvent(event: React.KeyboardEvent, index: number) {\n this._itemKeyboardNavigator.handleKeyDownEvent(event, index);\n }\n\n /** Handle keyup on tabs */\n private _handleKeyUpEvent(event: React.KeyboardEvent, index: number) {\n this._itemKeyboardNavigator.handleKeyUpEvent(event, index);\n }\n\n private _activateTab = (index: number) => {\n this.props.onActivateTab && this.props.onActivateTab(index);\n this.setState({ activeIndex: index });\n };\n\n /** @internal */\n public override render(): React.ReactElement {\n const ulClassNames = classnames(\n this.props.mainClassName,\n this.props.green && \"uicore-tabs-green\",\n this.props.className\n );\n\n const anyIconsPresent =\n this.props.labels.reduce(\n (a, b) => a + (isTabLabelWithIcon(b) ? 1 : 0),\n 0\n ) > 0;\n\n return (\n <ul\n className={ulClassNames}\n style={this.props.style}\n role=\"tablist\"\n aria-orientation={\n this.props.orientation === Orientation.Vertical\n ? \"vertical\"\n : \"horizontal\"\n }\n >\n {this.props.labels.map((label, index) => {\n let disabled;\n let tooltipElement: React.ReactElement | undefined;\n let title: string | undefined;\n let subLabel: string | undefined;\n let tabId = \"\";\n let icon;\n if (isTabLabel(label)) {\n icon = IconHelper.getIconReactNode(label.icon);\n subLabel = label.subLabel;\n disabled = label.disabled;\n tabId = label.tabId;\n if (React.isValidElement(label.tooltip))\n tooltipElement = label.tooltip;\n else if (typeof label.tooltip === \"string\") title = label.tooltip;\n }\n return (\n <li\n key={index}\n title={title}\n className={classnames(\n index === this.state.activeIndex && \"core-active\",\n disabled && \"core-tab-item-disabled\"\n )}\n role=\"tab\"\n aria-selected={index === this.state.activeIndex}\n data-for={`${tabId}`} /* to support react-tooltip */\n >\n {tooltipElement}\n {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}\n <a\n ref={this._anchorRefs[index]}\n tabIndex={index === this.state.activeIndex ? 0 : -1}\n onClick={() => this._handleTabClick(index)}\n onKeyDown={(event) => this._handleKeyDownEvent(event, index)}\n onKeyUp={(event) => this._handleKeyUpEvent(event, index)}\n data-testid={`${tabId}`}\n role=\"button\"\n >\n {\" \"}\n <div\n className={classnames(\n \"uicore-tabs-inline-label\",\n disabled && \"core-tab-item-disabled\"\n )}\n >\n {anyIconsPresent && (\n <span className=\"uicore-tabs-icon\">{icon}</span>\n )}\n <div className=\"uicore-tabs-label-subLabel-container\">\n <span>\n {typeof label === \"string\" ? label : label.label}\n </span>\n {subLabel && (\n <span className=\"uicore-tabs-subLabel\">{subLabel}</span>\n )}\n </div>\n </div>\n </a>\n </li>\n );\n })}\n </ul>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../../src/core-react/tabs/Tabs.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAmBjD,SAAS,kBAAkB,CAAC,IAAuB;IACjD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC;AAED,SAAS,UAAU,CAAC,IAAuB;IACzC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;AAClC,CAAC;AAkCD;;;GAGG;AACH,MAAM,OAAO,IAAK,SAAQ,KAAK,CAAC,aAAuC;IAIrE,YAAY,KAAoB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QAJP,gBAAW,GAA8C,EAAE,CAAC;QAwD5D,qBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACxC,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO;gBAAE,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1D,CAAC,CAAC;QAEM,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AAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAC3C;4BACN,QAAQ,IAAI,CACX,8BAAM,SAAS,EAAC,sBAAsB,IAAE,QAAQ,CAAQ,CACzD,CACG,CACF,CACJ,CACD,CACN,CAAC;QACJ,CAAC,CAAC,CACC,CACN,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tabs\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { Orientation } from \"../enums/Orientation\";\nimport { ItemKeyboardNavigator } from \"../focus/ItemKeyboardNavigator\";\nimport { IconHelper } from \"../utils/IconHelper\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** TabLabel provides ability to define label, icon, and tooltip for a tab entry. The tooltip can be defined as JSX|Element\n * to support react-tooltip component or a string that will be use to set the title property.\n * @public\n * @deprecated in 4.12.0. Interface used in a deprecated component {@link Tabs}.\n */\nexport interface TabLabel {\n label: string;\n subLabel?: string;\n icon?: string | React.ReactElement;\n tabId: string /* optional id added to tab so it can be used by react-tooltip */;\n /** tooltip allows React.ReactElement to support styled tooltips like react-tooltip. */\n tooltip?: string | React.ReactElement;\n disabled?: boolean;\n}\n\nfunction isTabLabelWithIcon(item: string | TabLabel): item is TabLabel {\n return typeof item !== \"string\" && !!item.icon;\n}\n\nfunction isTabLabel(item: string | TabLabel): item is TabLabel {\n return typeof item !== \"string\";\n}\n\n/** Properties for the [[VerticalTabs]] component\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link Tabs}.\n */\nexport interface TabsProps\n extends React.AllHTMLAttributes<HTMLUListElement>,\n CommonProps {\n /** Text shown for each tab */\n labels: Array<string | TabLabel>;\n /** Handler for activating a tab */\n onActivateTab?: (index: number) => any;\n /** Index of the initial active tab */\n activeIndex?: number;\n /** Indicates whether the bar on the active tab is green instead of the default blue */\n green?: boolean;\n}\n\ninterface TabsState {\n activeIndex: number;\n}\n\n/** Properties for the base [[Tabs]] component\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link Tabs}.\n */\nexport interface MainTabsProps extends TabsProps {\n /** Main CSS class name */\n mainClassName: string;\n /** Orientation of the Tabs list */\n orientation: Orientation;\n}\n\n/** Tabs meant to represent the current position in a page/section\n * @public\n * @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/tabs iTwinUI Tabs} instead.\n */\nexport class Tabs extends React.PureComponent<MainTabsProps, TabsState> {\n private _anchorRefs: Array<React.RefObject<HTMLAnchorElement>> = [];\n private _itemKeyboardNavigator: ItemKeyboardNavigator;\n\n constructor(props: MainTabsProps) {\n super(props);\n\n const activeIndex = this.validateActiveIndex(props.activeIndex);\n this.state = {\n activeIndex,\n };\n\n props.labels.forEach(() =>\n this._anchorRefs.push(React.createRef<HTMLAnchorElement>())\n );\n this._itemKeyboardNavigator = new ItemKeyboardNavigator(\n this._handleFocusItem,\n this._activateTab\n );\n }\n\n private validateActiveIndex(idx?: number): number {\n let activeIndex = 0;\n if (idx && idx >= 0 && idx < this.props.labels.length) activeIndex = idx;\n return activeIndex;\n }\n\n public override componentDidMount() {\n this._itemKeyboardNavigator.itemCount = this.props.labels.length;\n this._itemKeyboardNavigator.orientation = this.props.orientation;\n }\n\n public override componentDidUpdate(prevProps: MainTabsProps) {\n if (prevProps.labels !== this.props.labels)\n this._itemKeyboardNavigator.itemCount = this.props.labels.length;\n\n if (prevProps.orientation !== this.props.orientation)\n this._itemKeyboardNavigator.orientation = this.props.orientation;\n\n if (prevProps.activeIndex !== this.props.activeIndex) {\n let hadFocus = false;\n const element = this._anchorRefs[this.state.activeIndex].current;\n if (element && document.activeElement === element) hadFocus = true;\n const activeIndex = this.validateActiveIndex(this.props.activeIndex);\n\n this.setState(\n () => ({ activeIndex }),\n () => {\n if (hadFocus) {\n const newElement = this._anchorRefs[activeIndex].current;\n if (newElement) newElement.focus();\n }\n }\n );\n }\n }\n\n private _handleFocusItem = (index: number) => {\n const itemRef = this._anchorRefs[index];\n if (itemRef && itemRef.current) itemRef.current.focus();\n };\n\n private _handleTabClick = (index: number) => {\n this._activateTab(index);\n };\n\n /** Handle keydown on tabs */\n private _handleKeyDownEvent(event: React.KeyboardEvent, index: number) {\n this._itemKeyboardNavigator.handleKeyDownEvent(event, index);\n }\n\n /** Handle keyup on tabs */\n private _handleKeyUpEvent(event: React.KeyboardEvent, index: number) {\n this._itemKeyboardNavigator.handleKeyUpEvent(event, index);\n }\n\n private _activateTab = (index: number) => {\n this.props.onActivateTab && this.props.onActivateTab(index);\n this.setState({ activeIndex: index });\n };\n\n public override render(): React.ReactElement {\n const ulClassNames = classnames(\n this.props.mainClassName,\n this.props.green && \"uicore-tabs-green\",\n this.props.className\n );\n\n const anyIconsPresent =\n this.props.labels.reduce(\n (a, b) => a + (isTabLabelWithIcon(b) ? 1 : 0),\n 0\n ) > 0;\n\n return (\n <ul\n className={ulClassNames}\n style={this.props.style}\n role=\"tablist\"\n aria-orientation={\n this.props.orientation === Orientation.Vertical\n ? \"vertical\"\n : \"horizontal\"\n }\n >\n {this.props.labels.map((label, index) => {\n let disabled;\n let tooltipElement: React.ReactElement | undefined;\n let title: string | undefined;\n let subLabel: string | undefined;\n let tabId = \"\";\n let icon;\n if (isTabLabel(label)) {\n icon = IconHelper.getIconReactNode(label.icon);\n subLabel = label.subLabel;\n disabled = label.disabled;\n tabId = label.tabId;\n if (React.isValidElement(label.tooltip))\n tooltipElement = label.tooltip;\n else if (typeof label.tooltip === \"string\") title = label.tooltip;\n }\n return (\n <li\n key={index}\n title={title}\n className={classnames(\n index === this.state.activeIndex && \"core-active\",\n disabled && \"core-tab-item-disabled\"\n )}\n role=\"tab\"\n aria-selected={index === this.state.activeIndex}\n data-for={`${tabId}`} /* to support react-tooltip */\n >\n {tooltipElement}\n {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}\n <a\n ref={this._anchorRefs[index]}\n tabIndex={index === this.state.activeIndex ? 0 : -1}\n onClick={() => this._handleTabClick(index)}\n onKeyDown={(event) => this._handleKeyDownEvent(event, index)}\n onKeyUp={(event) => this._handleKeyUpEvent(event, index)}\n data-testid={`${tabId}`}\n role=\"button\"\n >\n <div\n className={classnames(\n \"uicore-tabs-inline-label\",\n disabled && \"core-tab-item-disabled\"\n )}\n >\n {anyIconsPresent && (\n <span className=\"uicore-tabs-icon\">{icon}</span>\n )}\n <div className=\"uicore-tabs-label-subLabel-container\">\n <span>\n {typeof label === \"string\" ? label : label.label}\n </span>\n {subLabel && (\n <span className=\"uicore-tabs-subLabel\">{subLabel}</span>\n )}\n </div>\n </div>\n </a>\n </li>\n );\n })}\n </ul>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpansionToggle.d.ts","sourceRoot":"","sources":["../../../../src/core-react/tree/ExpansionToggle.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpansionToggle.d.ts","sourceRoot":"","sources":["../../../../src/core-react/tree/ExpansionToggle.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACxD,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAwB1D"}
|
|
@@ -15,7 +15,6 @@ import { useTranslation } from "../l10n/useTranslation";
|
|
|
15
15
|
* @public
|
|
16
16
|
* @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/tree iTwinUI Tree} instead.
|
|
17
17
|
*/
|
|
18
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
19
18
|
export function ExpansionToggle(props) {
|
|
20
19
|
const { translate } = useTranslation();
|
|
21
20
|
const className = classnames("core-tree-expansionToggle", props.isExpanded && "is-expanded", props.className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpansionToggle.js","sourceRoot":"","sources":["../../../../src/core-react/tree/ExpansionToggle.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpansionToggle.js","sourceRoot":"","sources":["../../../../src/core-react/tree/ExpansionToggle.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAcxD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,UAAU,CAC1B,2BAA2B,EAC3B,KAAK,CAAC,UAAU,IAAI,aAAa,EACjC,KAAK,CAAC,SAAS,CAChB,CAAC;IACF,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAE5E,OAAO;IACL,iEAAiE;IACjE,6BACE,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACvC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,iBACL,KAAK,CAAC,aAAa,CAAC,EACjC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,gBACA,KAAK;QAEjB,oBAAC,IAAI,IAAC,SAAS,EAAC,aAAa,EAAC,QAAQ,EAAE,oBAAC,eAAe,OAAG,GAAI,CAC3D,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tree\n */\n\nimport \"./ExpansionToggle.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { SvgChevronRight } from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../l10n/useTranslation\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Properties for the [[ExpansionToggle]] component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link ExpansionToggle} component.\n */\nexport interface ExpansionToggleProps extends CommonProps {\n isExpanded?: boolean;\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n [\"data-testid\"]?: string;\n}\n\n/** ExpansionToggle React component used by the [[TreeNode]] component to show collapsed or expanded state\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/tree iTwinUI Tree} instead.\n */\nexport function ExpansionToggle(props: ExpansionToggleProps) {\n const { translate } = useTranslation();\n const className = classnames(\n \"core-tree-expansionToggle\",\n props.isExpanded && \"is-expanded\",\n props.className\n );\n const label = translate(props.isExpanded ? \"tree.collapse\" : \"tree.expand\");\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div\n onMouseDown={(e) => e.stopPropagation()}\n onClick={props.onClick}\n className={className}\n style={props.style}\n data-testid={props[\"data-testid\"]}\n role=\"button\"\n tabIndex={-1}\n aria-label={label}\n >\n <Icon className=\"toggle icon\" iconSpec={<SvgChevronRight />} />\n </div>\n );\n}\n"]}
|
|
@@ -9,6 +9,7 @@ import type { CommonProps } from "../utils/Props";
|
|
|
9
9
|
type CheckboxProps = React.ComponentPropsWithoutRef<typeof Checkbox>;
|
|
10
10
|
/** Props for node Checkbox renderer
|
|
11
11
|
* @public
|
|
12
|
+
* @deprecated in 4.16.0. Type is inlined in component props. Use `React.ComponentProps` type helper instead.
|
|
12
13
|
*/
|
|
13
14
|
export type NodeCheckboxRenderProps = Omit<CheckboxProps, "onChange" | "onClick"> & {
|
|
14
15
|
onChange: (checked: boolean) => void;
|
|
@@ -16,6 +17,7 @@ export type NodeCheckboxRenderProps = Omit<CheckboxProps, "onChange" | "onClick"
|
|
|
16
17
|
};
|
|
17
18
|
/** Type for node Checkbox renderer
|
|
18
19
|
* @public
|
|
20
|
+
* @deprecated in 4.16.0. Type is inlined in component props. Use `React.ComponentProps` type helper instead.
|
|
19
21
|
*/
|
|
20
22
|
export type NodeCheckboxRenderer = (props: NodeCheckboxRenderProps) => React.ReactNode;
|
|
21
23
|
/** Number of pixels the node gets offset per each hierarchy level
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Node.d.ts","sourceRoot":"","sources":["../../../../src/core-react/tree/Node.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAkB,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Node.d.ts","sourceRoot":"","sources":["../../../../src/core-react/tree/Node.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAkB,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,KAAK,aAAa,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,QAAQ,CAAC,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,aAAa,EACb,UAAU,GAAG,SAAS,CACvB,GAAG;IACF,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,KAAK,EAAE,uBAAuB,KAC3B,KAAK,CAAC,SAAS,CAAC;AAErB;;GAEG;AACH,eAAO,MAAM,YAAY,KAAK,CAAC;AAI/B;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,2BAA2B;I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C,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,QAAS,SAAQ,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;gBAC9C,KAAK,EAAE,aAAa;IAIhB,MAAM;IA6FtB,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,iBAAiB,CASvB;IAEF,OAAO,CAAC,gBAAgB,CAEtB;IAEF,OAAO,CAAC,uBAAuB,CAG7B;IAEF,OAAO,CAAC,QAAQ,CAGd;CACH"}
|
|
@@ -20,9 +20,7 @@ const EXPANSION_TOGGLE_WIDTH = 24;
|
|
|
20
20
|
* @public
|
|
21
21
|
* @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/tree iTwinUI Tree} instead.
|
|
22
22
|
*/
|
|
23
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
24
23
|
export class TreeNode extends React.Component {
|
|
25
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
26
24
|
constructor(props) {
|
|
27
25
|
super(props);
|
|
28
26
|
this._onCheckboxChange = (checked) => {
|
|
@@ -69,9 +67,7 @@ export class TreeNode extends React.Component {
|
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
69
|
const icon = this.props.icon ? (React.createElement("div", { className: "core-tree-node-icon" }, this.props.icon)) : undefined;
|
|
72
|
-
const toggle = this.props.isLoading ? undefined : this.props.isLeaf ? (React.createElement("div", null)) : (
|
|
73
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
74
|
-
React.createElement(ExpansionToggle, { className: "expansion-toggle", "data-testid": this.createSubComponentTestId("expansion-toggle"), onClick: this._onClickExpansionToggle, isExpanded: this.props.isExpanded }));
|
|
70
|
+
const toggle = this.props.isLoading ? undefined : this.props.isLeaf ? (React.createElement("div", null)) : (React.createElement(ExpansionToggle, { className: "expansion-toggle", "data-testid": this.createSubComponentTestId("expansion-toggle"), onClick: this._onClickExpansionToggle, isExpanded: this.props.isExpanded }));
|
|
75
71
|
return (
|
|
76
72
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
77
73
|
React.createElement("div", { className: className, style: this.props.style, "data-testid": this.props["data-testid"], onClick: this._onClick, onContextMenu: this.props.onContextMenu, onMouseDown: this.props.onMouseDown, onMouseUp: this.props.onMouseUp, onMouseMove: this.props.onMouseMove, role: "treeitem", "aria-selected": this.props.isSelected ? "true" : "false", tabIndex: -1 },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Node.js","sourceRoot":"","sources":["../../../../src/core-react/tree/Node.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,aAAa,CAAC;AACrB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAsBpD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAkDlC;;;GAGG;AACH,mDAAmD;AACnD,MAAM,OAAO,QAAS,SAAQ,KAAK,CAAC,SAAwB;IAC1D,mDAAmD;IACnD,YAAY,KAAoB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QAsGP,sBAAiB,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC/C,IACE,IAAI,CAAC,KAAK,CAAC,aAAa;gBACxB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO;gBAChC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU;gBAEpC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAC9B,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,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,EACrC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,GACjC,CACH,CAAC;QAEF,OAAO;QACL,iEAAiE;QACjE,6BACE,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,iBACV,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EACtC,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EACvC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACnC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACnC,IAAI,EAAC,UAAU,mBACA,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACvD,QAAQ,EAAE,CAAC,CAAC;YAEZ,6BACE,SAAS,EAAC,UAAU,EACpB,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,iBAChB,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC;gBAErD,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CACvB,oBAAC,cAAc,IACb,IAAI,EAAC,SAAS,EACd,aAAa,QACb,SAAS,EAAC,yBAAyB,GACnC,CACH;gBACA,MAAM;gBACN,QAAQ;gBACR,IAAI;gBACJ,IAAI,CAAC,KAAK,CAAC,KAAK,CACb;YACL,IAAI,CAAC,KAAK,CAAC,QAAQ,CAChB,CACP,CAAC;IACJ,CAAC;IAEO,wBAAwB,CAAC,KAAa;QAC5C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;YAAE,OAAO,SAAS,CAAC;QACjD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,KAAK,EAAE,CAAC;IACjD,CAAC;CA0BF","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 Tree\n */\n\nimport \"./Node.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Checkbox, ProgressRadial } from \"@itwin/itwinui-react\";\nimport { CheckBoxState } from \"../enums/CheckBoxState\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { ExpansionToggle } from \"./ExpansionToggle\";\n\ntype CheckboxProps = React.ComponentPropsWithoutRef<typeof Checkbox>;\n\n/** Props for node Checkbox renderer\n * @public\n */\nexport type NodeCheckboxRenderProps = Omit<\n CheckboxProps,\n \"onChange\" | \"onClick\"\n> & {\n onChange: (checked: boolean) => void;\n onClick: (e: React.MouseEvent) => void;\n};\n\n/** Type for node Checkbox renderer\n * @public\n */\nexport type NodeCheckboxRenderer = (\n props: NodeCheckboxRenderProps\n) => React.ReactNode;\n\n/** Number of pixels the node gets offset per each hierarchy level\n * @internal\n */\nexport const LEVEL_OFFSET = 20;\n\nconst EXPANSION_TOGGLE_WIDTH = 24;\n\n/** Properties for Tree Node CheckBox\n * @public\n * @deprecated in 4.15.0. Used in deprecated {@link TreeNodeProps} props.\n */\nexport interface NodeCheckboxProps {\n /** State of the checkbox */\n state?: CheckBoxState;\n /** Click event callback */\n onClick?: (newState: CheckBoxState) => void;\n /** Indicates whether checkbox is disabled */\n isDisabled?: boolean;\n /** Tooltip to be displayed when mouse is hovered over checkbox */\n tooltip?: string;\n}\n\n/** Properties for the [[TreeNode]] React component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link TreeNode} component.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface TreeNodeProps extends CommonProps {\n label: React.ReactNode;\n level: number;\n icon?: React.ReactElement | string | number;\n // eslint-disable-next-line deprecation/deprecation\n checkboxProps?: NodeCheckboxProps;\n isLeaf?: boolean;\n isLoading?: boolean;\n isExpanded?: boolean;\n isFocused?: boolean;\n isSelected?: boolean;\n isHoverDisabled?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n onContextMenu?: (e: React.MouseEvent) => void;\n onMouseMove?: (e: React.MouseEvent) => void;\n onMouseDown?: (e: React.MouseEvent) => void;\n onMouseUp?: (e: React.MouseEvent) => void;\n onClickExpansionToggle?: () => void;\n children?: React.ReactNode;\n\n /** Contains render overrides for different pieces of the node component. */\n renderOverrides?: {\n /** Callback to render a checkbox. Only called when checkbox is displayed. */\n renderCheckbox?: NodeCheckboxRenderer;\n };\n [\"data-testid\"]?: string;\n}\n\n/** Presentation React component for a Tree node\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/tree iTwinUI Tree} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class TreeNode extends React.Component<TreeNodeProps> {\n // eslint-disable-next-line deprecation/deprecation\n constructor(props: TreeNodeProps) {\n super(props);\n }\n\n public override render() {\n const className = classnames(\n \"core-tree-node\",\n this.props.isFocused && \"is-focused\",\n this.props.isSelected && \"is-selected\",\n this.props.isHoverDisabled && \"is-hover-disabled\",\n this.props.className\n );\n let offset = this.props.level * LEVEL_OFFSET;\n if (!this.props.isLoading && this.props.isLeaf)\n offset += EXPANSION_TOGGLE_WIDTH; // Add expansion toggle/loader width if they're not rendered\n\n let checkbox: React.ReactNode;\n if (this.props.checkboxProps) {\n const props: NodeCheckboxRenderProps = {\n label: \"\",\n checked: this.props.checkboxProps.state === CheckBoxState.On,\n indeterminate: this.props.checkboxProps.state === CheckBoxState.Partial,\n disabled: this.props.checkboxProps.isDisabled,\n title: this.props.checkboxProps.tooltip,\n onClick: this._onCheckboxClick,\n onChange: this._onCheckboxChange,\n };\n if (\n this.props.renderOverrides &&\n this.props.renderOverrides.renderCheckbox\n ) {\n checkbox = this.props.renderOverrides.renderCheckbox(props);\n } else {\n checkbox = (\n <Checkbox\n {...props}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n this._onCheckboxChange(e.target.checked)\n }\n data-testid={this.createSubComponentTestId(\"checkbox\")}\n />\n );\n }\n }\n\n const icon = this.props.icon ? (\n <div className=\"core-tree-node-icon\">{this.props.icon}</div>\n ) : undefined;\n\n const toggle = this.props.isLoading ? undefined : this.props.isLeaf ? (\n <div />\n ) : (\n // eslint-disable-next-line deprecation/deprecation\n <ExpansionToggle\n className=\"expansion-toggle\"\n data-testid={this.createSubComponentTestId(\"expansion-toggle\")}\n onClick={this._onClickExpansionToggle}\n isExpanded={this.props.isExpanded}\n />\n );\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div\n className={className}\n style={this.props.style}\n data-testid={this.props[\"data-testid\"]}\n onClick={this._onClick}\n onContextMenu={this.props.onContextMenu}\n onMouseDown={this.props.onMouseDown}\n onMouseUp={this.props.onMouseUp}\n onMouseMove={this.props.onMouseMove}\n role=\"treeitem\"\n aria-selected={this.props.isSelected ? \"true\" : \"false\"}\n tabIndex={-1}\n >\n <div\n className=\"contents\"\n style={{ marginLeft: offset }}\n data-testid={this.createSubComponentTestId(\"contents\")}\n >\n {this.props.isLoading && (\n <ProgressRadial\n size=\"x-small\"\n indeterminate\n className=\"core-progress-indicator\"\n />\n )}\n {toggle}\n {checkbox}\n {icon}\n {this.props.label}\n </div>\n {this.props.children}\n </div>\n );\n }\n\n private createSubComponentTestId(subId: string): string | undefined {\n if (!this.props[\"data-testid\"]) return undefined;\n return `${this.props[\"data-testid\"]}-${subId}`;\n }\n\n private _onCheckboxChange = (checked: boolean) => {\n if (\n this.props.checkboxProps &&\n this.props.checkboxProps.onClick &&\n !this.props.checkboxProps.isDisabled\n )\n this.props.checkboxProps.onClick(\n checked ? CheckBoxState.On : CheckBoxState.Off\n );\n };\n\n private _onCheckboxClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n private _onClickExpansionToggle = (e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n if (this.props.onClickExpansionToggle) this.props.onClickExpansionToggle();\n };\n\n private _onClick = (e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n this.props.onClick?.(e);\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Node.js","sourceRoot":"","sources":["../../../../src/core-react/tree/Node.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,aAAa,CAAC;AACrB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA0BpD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAgDlC;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK,CAAC,SAAwB;IAC1D,YAAY,KAAoB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QAqGP,sBAAiB,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC/C,IACE,IAAI,CAAC,KAAK,CAAC,aAAa;gBACxB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO;gBAChC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU;gBAEpC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAC9B,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAC/C,CAAC;QACN,CAAC,CAAC;QAEM,qBAAgB,GAAG,CAAC,CAAmB,EAAE,EAAE;YACjD,CAAC,CAAC,eAAe,EAAE,CAAC;QACtB,CAAC,CAAC;QAEM,4BAAuB,GAAG,CAAC,CAAmC,EAAE,EAAE;YACxE,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,IAAI,IAAI,CAAC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aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EACvC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACnC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACnC,IAAI,EAAC,UAAU,mBACA,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACvD,QAAQ,EAAE,CAAC,CAAC;YAEZ,6BACE,SAAS,EAAC,UAAU,EACpB,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,iBAChB,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC;gBAErD,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CACvB,oBAAC,cAAc,IACb,IAAI,EAAC,SAAS,EACd,aAAa,QACb,SAAS,EAAC,yBAAyB,GACnC,CACH;gBACA,MAAM;gBACN,QAAQ;gBACR,IAAI;gBACJ,IAAI,CAAC,KAAK,CAAC,KAAK,CACb;YACL,IAAI,CAAC,KAAK,CAAC,QAAQ,CAChB,CACP,CAAC;IACJ,CAAC;IAEO,wBAAwB,CAAC,KAAa;QAC5C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;YAAE,OAAO,SAAS,CAAC;QACjD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,KAAK,EAAE,CAAC;IACjD,CAAC;CA0BF","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 Tree\n */\n\nimport \"./Node.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Checkbox, ProgressRadial } from \"@itwin/itwinui-react\";\nimport { CheckBoxState } from \"../enums/CheckBoxState\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { ExpansionToggle } from \"./ExpansionToggle\";\n\n/* eslint-disable deprecation/deprecation */\n\ntype CheckboxProps = React.ComponentPropsWithoutRef<typeof Checkbox>;\n\n/** Props for node Checkbox renderer\n * @public\n * @deprecated in 4.16.0. Type is inlined in component props. Use `React.ComponentProps` type helper instead.\n */\nexport type NodeCheckboxRenderProps = Omit<\n CheckboxProps,\n \"onChange\" | \"onClick\"\n> & {\n onChange: (checked: boolean) => void;\n onClick: (e: React.MouseEvent) => void;\n};\n\n/** Type for node Checkbox renderer\n * @public\n * @deprecated in 4.16.0. Type is inlined in component props. Use `React.ComponentProps` type helper instead.\n */\nexport type NodeCheckboxRenderer = (\n props: NodeCheckboxRenderProps\n) => React.ReactNode;\n\n/** Number of pixels the node gets offset per each hierarchy level\n * @internal\n */\nexport const LEVEL_OFFSET = 20;\n\nconst EXPANSION_TOGGLE_WIDTH = 24;\n\n/** Properties for Tree Node CheckBox\n * @public\n * @deprecated in 4.15.0. Used in deprecated {@link TreeNodeProps} props.\n */\nexport interface NodeCheckboxProps {\n /** State of the checkbox */\n state?: CheckBoxState;\n /** Click event callback */\n onClick?: (newState: CheckBoxState) => void;\n /** Indicates whether checkbox is disabled */\n isDisabled?: boolean;\n /** Tooltip to be displayed when mouse is hovered over checkbox */\n tooltip?: string;\n}\n\n/** Properties for the [[TreeNode]] React component\n * @public\n * @deprecated in 4.15.0. Props of deprecated {@link TreeNode} component.\n */\nexport interface TreeNodeProps extends CommonProps {\n label: React.ReactNode;\n level: number;\n icon?: React.ReactElement | string | number;\n checkboxProps?: NodeCheckboxProps;\n isLeaf?: boolean;\n isLoading?: boolean;\n isExpanded?: boolean;\n isFocused?: boolean;\n isSelected?: boolean;\n isHoverDisabled?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n onContextMenu?: (e: React.MouseEvent) => void;\n onMouseMove?: (e: React.MouseEvent) => void;\n onMouseDown?: (e: React.MouseEvent) => void;\n onMouseUp?: (e: React.MouseEvent) => void;\n onClickExpansionToggle?: () => void;\n children?: React.ReactNode;\n\n /** Contains render overrides for different pieces of the node component. */\n renderOverrides?: {\n /** Callback to render a checkbox. Only called when checkbox is displayed. */\n renderCheckbox?: NodeCheckboxRenderer;\n };\n [\"data-testid\"]?: string;\n}\n\n/** Presentation React component for a Tree node\n * @public\n * @deprecated in 4.15.0. Use {@link https://itwinui.bentley.com/docs/tree iTwinUI Tree} instead.\n */\nexport class TreeNode extends React.Component<TreeNodeProps> {\n constructor(props: TreeNodeProps) {\n super(props);\n }\n\n public override render() {\n const className = classnames(\n \"core-tree-node\",\n this.props.isFocused && \"is-focused\",\n this.props.isSelected && \"is-selected\",\n this.props.isHoverDisabled && \"is-hover-disabled\",\n this.props.className\n );\n let offset = this.props.level * LEVEL_OFFSET;\n if (!this.props.isLoading && this.props.isLeaf)\n offset += EXPANSION_TOGGLE_WIDTH; // Add expansion toggle/loader width if they're not rendered\n\n let checkbox: React.ReactNode;\n if (this.props.checkboxProps) {\n const props: NodeCheckboxRenderProps = {\n label: \"\",\n checked: this.props.checkboxProps.state === CheckBoxState.On,\n indeterminate: this.props.checkboxProps.state === CheckBoxState.Partial,\n disabled: this.props.checkboxProps.isDisabled,\n title: this.props.checkboxProps.tooltip,\n onClick: this._onCheckboxClick,\n onChange: this._onCheckboxChange,\n };\n if (\n this.props.renderOverrides &&\n this.props.renderOverrides.renderCheckbox\n ) {\n checkbox = this.props.renderOverrides.renderCheckbox(props);\n } else {\n checkbox = (\n <Checkbox\n {...props}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n this._onCheckboxChange(e.target.checked)\n }\n data-testid={this.createSubComponentTestId(\"checkbox\")}\n />\n );\n }\n }\n\n const icon = this.props.icon ? (\n <div className=\"core-tree-node-icon\">{this.props.icon}</div>\n ) : undefined;\n\n const toggle = this.props.isLoading ? undefined : this.props.isLeaf ? (\n <div />\n ) : (\n <ExpansionToggle\n className=\"expansion-toggle\"\n data-testid={this.createSubComponentTestId(\"expansion-toggle\")}\n onClick={this._onClickExpansionToggle}\n isExpanded={this.props.isExpanded}\n />\n );\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div\n className={className}\n style={this.props.style}\n data-testid={this.props[\"data-testid\"]}\n onClick={this._onClick}\n onContextMenu={this.props.onContextMenu}\n onMouseDown={this.props.onMouseDown}\n onMouseUp={this.props.onMouseUp}\n onMouseMove={this.props.onMouseMove}\n role=\"treeitem\"\n aria-selected={this.props.isSelected ? \"true\" : \"false\"}\n tabIndex={-1}\n >\n <div\n className=\"contents\"\n style={{ marginLeft: offset }}\n data-testid={this.createSubComponentTestId(\"contents\")}\n >\n {this.props.isLoading && (\n <ProgressRadial\n size=\"x-small\"\n indeterminate\n className=\"core-progress-indicator\"\n />\n )}\n {toggle}\n {checkbox}\n {icon}\n {this.props.label}\n </div>\n {this.props.children}\n </div>\n );\n }\n\n private createSubComponentTestId(subId: string): string | undefined {\n if (!this.props[\"data-testid\"]) return undefined;\n return `${this.props[\"data-testid\"]}-${subId}`;\n }\n\n private _onCheckboxChange = (checked: boolean) => {\n if (\n this.props.checkboxProps &&\n this.props.checkboxProps.onClick &&\n !this.props.checkboxProps.isDisabled\n )\n this.props.checkboxProps.onClick(\n checked ? CheckBoxState.On : CheckBoxState.Off\n );\n };\n\n private _onCheckboxClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n private _onClickExpansionToggle = (e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n if (this.props.onClickExpansionToggle) this.props.onClickExpansionToggle();\n };\n\n private _onClick = (e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n this.props.onClick?.(e);\n };\n}\n"]}
|