@itwin/core-react 4.14.1 → 4.15.1
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 +27 -1
- package/lib/cjs/core-react/UiCore.d.ts +1 -1
- package/lib/cjs/core-react/UiCore.js +1 -1
- package/lib/cjs/core-react/UiCore.js.map +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
- package/lib/cjs/core-react/base/Centered.d.ts +1 -1
- package/lib/cjs/core-react/base/Centered.d.ts.map +1 -1
- package/lib/cjs/core-react/base/Centered.js +2 -1
- package/lib/cjs/core-react/base/Centered.js.map +1 -1
- package/lib/cjs/core-react/base/Div.d.ts +2 -2
- package/lib/cjs/core-react/base/Div.d.ts.map +1 -1
- package/lib/cjs/core-react/base/Div.js +1 -1
- package/lib/cjs/core-react/base/Div.js.map +1 -1
- package/lib/cjs/core-react/base/DivWithOutsideClick.d.ts +1 -1
- package/lib/cjs/core-react/base/DivWithOutsideClick.d.ts.map +1 -1
- package/lib/cjs/core-react/base/DivWithOutsideClick.js +4 -2
- package/lib/cjs/core-react/base/DivWithOutsideClick.js.map +1 -1
- package/lib/cjs/core-react/base/FillCentered.d.ts +1 -1
- package/lib/cjs/core-react/base/FillCentered.d.ts.map +1 -1
- package/lib/cjs/core-react/base/FillCentered.js +2 -1
- package/lib/cjs/core-react/base/FillCentered.js.map +1 -1
- package/lib/cjs/core-react/base/FlexWrapContainer.d.ts +1 -1
- package/lib/cjs/core-react/base/FlexWrapContainer.d.ts.map +1 -1
- package/lib/cjs/core-react/base/FlexWrapContainer.js +2 -1
- package/lib/cjs/core-react/base/FlexWrapContainer.js.map +1 -1
- package/lib/cjs/core-react/base/Gap.d.ts +2 -2
- package/lib/cjs/core-react/base/Gap.d.ts.map +1 -1
- package/lib/cjs/core-react/base/Gap.js +1 -1
- package/lib/cjs/core-react/base/Gap.js.map +1 -1
- package/lib/cjs/core-react/base/ScrollView.d.ts +1 -1
- package/lib/cjs/core-react/base/ScrollView.d.ts.map +1 -1
- package/lib/cjs/core-react/base/ScrollView.js +2 -1
- package/lib/cjs/core-react/base/ScrollView.js.map +1 -1
- package/lib/cjs/core-react/button/UnderlinedButton.d.ts +2 -2
- package/lib/cjs/core-react/button/UnderlinedButton.js +1 -1
- package/lib/cjs/core-react/button/UnderlinedButton.js.map +1 -1
- package/lib/cjs/core-react/checklistbox/CheckListBox.d.ts +4 -4
- package/lib/cjs/core-react/checklistbox/CheckListBox.d.ts.map +1 -1
- package/lib/cjs/core-react/checklistbox/CheckListBox.js +3 -3
- package/lib/cjs/core-react/checklistbox/CheckListBox.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuDivider.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuDivider.js +1 -0
- package/lib/cjs/core-react/contextmenu/ContextMenuDivider.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/PopupContextMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/PopupContextMenu.js +3 -1
- package/lib/cjs/core-react/contextmenu/PopupContextMenu.js.map +1 -1
- package/lib/cjs/core-react/dialog/Dialog.d.ts +4 -5
- package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
- package/lib/cjs/core-react/dialog/Dialog.js +3 -3
- package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
- package/lib/cjs/core-react/dialog/GlobalDialog.d.ts +3 -3
- package/lib/cjs/core-react/dialog/GlobalDialog.js +1 -1
- package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
- package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts +3 -3
- package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
- package/lib/cjs/core-react/elementseparator/ElementSeparator.js +1 -1
- package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
- package/lib/cjs/core-react/enums/Alignment.d.ts +2 -0
- package/lib/cjs/core-react/enums/Alignment.d.ts.map +1 -1
- package/lib/cjs/core-react/enums/Alignment.js +2 -0
- package/lib/cjs/core-react/enums/Alignment.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.map +1 -1
- package/lib/cjs/core-react/enums/SortDirection.d.ts +1 -0
- package/lib/cjs/core-react/enums/SortDirection.d.ts.map +1 -1
- package/lib/cjs/core-react/enums/SortDirection.js +1 -0
- package/lib/cjs/core-react/enums/SortDirection.js.map +1 -1
- package/lib/cjs/core-react/expandable/ExpandableList.d.ts +2 -2
- package/lib/cjs/core-react/expandable/ExpandableList.d.ts.map +1 -1
- package/lib/cjs/core-react/expandable/ExpandableList.js +1 -1
- package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
- package/lib/cjs/core-react/hocs/withIsPressed.d.ts +2 -0
- package/lib/cjs/core-react/hocs/withIsPressed.d.ts.map +1 -1
- package/lib/cjs/core-react/hocs/withIsPressed.js +1 -0
- package/lib/cjs/core-react/hocs/withIsPressed.js.map +1 -1
- package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts +2 -0
- package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
- package/lib/cjs/core-react/hocs/withOnOutsideClick.js +1 -0
- package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
- package/lib/cjs/core-react/hocs/withTimeout.d.ts +2 -0
- package/lib/cjs/core-react/hocs/withTimeout.d.ts.map +1 -1
- package/lib/cjs/core-react/hocs/withTimeout.js +4 -1
- package/lib/cjs/core-react/hocs/withTimeout.js.map +1 -1
- package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts +0 -4
- package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/ConditionalIconItem.js +2 -13
- package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.js +1 -1
- package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
- package/lib/cjs/core-react/icons/SvgPath.d.ts +2 -0
- package/lib/cjs/core-react/icons/SvgPath.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/SvgPath.js +2 -0
- package/lib/cjs/core-react/icons/SvgPath.js.map +1 -1
- package/lib/cjs/core-react/icons/WebFontIcon.d.ts +2 -0
- package/lib/cjs/core-react/icons/WebFontIcon.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/WebFontIcon.js +2 -0
- package/lib/cjs/core-react/icons/WebFontIcon.js.map +1 -1
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts +2 -2
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js +1 -1
- package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
- package/lib/cjs/core-react/inputs/Input.d.ts.map +1 -1
- package/lib/cjs/core-react/inputs/Input.js.map +1 -1
- package/lib/cjs/core-react/inputs/InputLabel.d.ts +2 -2
- package/lib/cjs/core-react/inputs/InputLabel.d.ts.map +1 -1
- package/lib/cjs/core-react/inputs/InputLabel.js +1 -1
- package/lib/cjs/core-react/inputs/InputLabel.js.map +1 -1
- package/lib/cjs/core-react/inputs/InputStatus.d.ts +1 -1
- package/lib/cjs/core-react/inputs/InputStatus.js +1 -1
- package/lib/cjs/core-react/inputs/InputStatus.js.map +1 -1
- package/lib/cjs/core-react/inputs/LabeledComponentProps.d.ts +2 -2
- package/lib/cjs/core-react/inputs/LabeledComponentProps.js.map +1 -1
- package/lib/cjs/core-react/inputs/iconinput/IconInput.d.ts +2 -2
- package/lib/cjs/core-react/inputs/iconinput/IconInput.js +1 -1
- package/lib/cjs/core-react/inputs/iconinput/IconInput.js.map +1 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts +3 -3
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.js +1 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
- package/lib/cjs/core-react/listbox/Listbox.d.ts +7 -7
- package/lib/cjs/core-react/listbox/Listbox.js +3 -3
- package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
- package/lib/cjs/core-react/loading/LoadingBar.d.ts +2 -2
- package/lib/cjs/core-react/loading/LoadingBar.js +1 -1
- package/lib/cjs/core-react/loading/LoadingBar.js.map +1 -1
- package/lib/cjs/core-react/loading/LoadingPrompt.d.ts +2 -2
- package/lib/cjs/core-react/loading/LoadingPrompt.js +1 -1
- package/lib/cjs/core-react/loading/LoadingPrompt.js.map +1 -1
- package/lib/cjs/core-react/loading/LoadingSpinner.d.ts +3 -3
- package/lib/cjs/core-react/loading/LoadingSpinner.js +1 -1
- package/lib/cjs/core-react/loading/LoadingSpinner.js.map +1 -1
- package/lib/cjs/core-react/loading/LoadingStatus.d.ts +2 -2
- package/lib/cjs/core-react/loading/LoadingStatus.js +1 -1
- package/lib/cjs/core-react/loading/LoadingStatus.js.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.d.ts +5 -1
- package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
- package/lib/cjs/core-react/messagebox/MessageBox.js +8 -1
- package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
- package/lib/cjs/core-react/notification/MessageRenderer.d.ts +2 -0
- package/lib/cjs/core-react/notification/MessageRenderer.d.ts.map +1 -1
- package/lib/cjs/core-react/notification/MessageRenderer.js +2 -0
- package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
- package/lib/cjs/core-react/notification/MessageType.d.ts +2 -0
- package/lib/cjs/core-react/notification/MessageType.d.ts.map +1 -1
- package/lib/cjs/core-react/notification/MessageType.js.map +1 -1
- package/lib/cjs/core-react/popup/Popup.d.ts +6 -1
- package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
- package/lib/cjs/core-react/popup/Popup.js +9 -2
- package/lib/cjs/core-react/popup/Popup.js.map +1 -1
- package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts +4 -4
- package/lib/cjs/core-react/radialmenu/RadialMenu.js +2 -2
- package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
- package/lib/cjs/core-react/searchbox/SearchBox.d.ts +2 -2
- package/lib/cjs/core-react/searchbox/SearchBox.js +1 -1
- package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
- package/lib/cjs/core-react/settings/SettingsManager.d.ts +8 -8
- package/lib/cjs/core-react/settings/SettingsManager.js +4 -4
- package/lib/cjs/core-react/settings/SettingsManager.js.map +1 -1
- package/lib/cjs/core-react/tabs/Tabs.d.ts +4 -4
- package/lib/cjs/core-react/tabs/Tabs.js +1 -1
- package/lib/cjs/core-react/tabs/Tabs.js.map +1 -1
- package/lib/cjs/core-react/tabs/VerticalTabs.d.ts +1 -1
- package/lib/cjs/core-react/tabs/VerticalTabs.js +1 -1
- package/lib/cjs/core-react/tabs/VerticalTabs.js.map +1 -1
- package/lib/cjs/core-react/text/BlockText.d.ts +1 -1
- package/lib/cjs/core-react/text/BlockText.js +1 -1
- package/lib/cjs/core-react/text/BlockText.js.map +1 -1
- package/lib/cjs/core-react/text/BodyText.d.ts +1 -1
- package/lib/cjs/core-react/text/BodyText.js +1 -1
- package/lib/cjs/core-react/text/BodyText.js.map +1 -1
- package/lib/cjs/core-react/text/DisabledText.d.ts +1 -1
- package/lib/cjs/core-react/text/DisabledText.js +1 -1
- package/lib/cjs/core-react/text/DisabledText.js.map +1 -1
- package/lib/cjs/core-react/text/FilteredText.d.ts +2 -0
- package/lib/cjs/core-react/text/FilteredText.d.ts.map +1 -1
- package/lib/cjs/core-react/text/FilteredText.js +2 -0
- package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
- package/lib/cjs/core-react/text/MutedText.d.ts +1 -1
- package/lib/cjs/core-react/text/MutedText.js +1 -1
- package/lib/cjs/core-react/text/MutedText.js.map +1 -1
- package/lib/cjs/core-react/text/StyledText.d.ts +2 -2
- package/lib/cjs/core-react/text/StyledText.js +1 -1
- package/lib/cjs/core-react/text/StyledText.js.map +1 -1
- package/lib/cjs/core-react/text/TextProps.d.ts +1 -1
- package/lib/cjs/core-react/text/TextProps.js.map +1 -1
- package/lib/cjs/core-react/tree/Branch.d.ts +2 -0
- package/lib/cjs/core-react/tree/Branch.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/Branch.js +2 -0
- package/lib/cjs/core-react/tree/Branch.js.map +1 -1
- package/lib/cjs/core-react/tree/ExpansionToggle.d.ts +2 -0
- package/lib/cjs/core-react/tree/ExpansionToggle.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/ExpansionToggle.js +2 -0
- package/lib/cjs/core-react/tree/ExpansionToggle.js.map +1 -1
- package/lib/cjs/core-react/tree/Node.d.ts +3 -3
- package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/Node.js +6 -1
- package/lib/cjs/core-react/tree/Node.js.map +1 -1
- package/lib/cjs/core-react/tree/Placeholder.d.ts +2 -0
- package/lib/cjs/core-react/tree/Placeholder.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/Placeholder.js +2 -0
- package/lib/cjs/core-react/tree/Placeholder.js.map +1 -1
- package/lib/cjs/core-react/tree/Tree.d.ts +2 -0
- package/lib/cjs/core-react/tree/Tree.d.ts.map +1 -1
- package/lib/cjs/core-react/tree/Tree.js +2 -0
- package/lib/cjs/core-react/tree/Tree.js.map +1 -1
- package/lib/cjs/core-react/utils/IconHelper.d.ts +1 -0
- package/lib/cjs/core-react/utils/IconHelper.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/IconHelper.js +4 -2
- package/lib/cjs/core-react/utils/IconHelper.js.map +1 -1
- package/lib/cjs/core-react/utils/Props.d.ts +5 -1
- package/lib/cjs/core-react/utils/Props.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/Props.js.map +1 -1
- package/lib/cjs/core-react/utils/ScrollPositionMaintainer.d.ts +1 -0
- package/lib/cjs/core-react/utils/ScrollPositionMaintainer.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/ScrollPositionMaintainer.js +3 -0
- package/lib/cjs/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
- package/lib/cjs/core-react/utils/Timer.d.ts +2 -0
- package/lib/cjs/core-react/utils/Timer.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/Timer.js +2 -0
- package/lib/cjs/core-react/utils/Timer.js.map +1 -1
- package/lib/cjs/core-react/utils/getCssVariable.d.ts +2 -0
- package/lib/cjs/core-react/utils/getCssVariable.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/getCssVariable.js +3 -0
- package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
- 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/useDisposable.d.ts +1 -0
- package/lib/cjs/core-react/utils/hooks/useDisposable.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useDisposable.js +1 -0
- package/lib/cjs/core-react/utils/hooks/useDisposable.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useEffectSkipFirst.d.ts +1 -0
- package/lib/cjs/core-react/utils/hooks/useEffectSkipFirst.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useEffectSkipFirst.js +1 -0
- package/lib/cjs/core-react/utils/hooks/useEffectSkipFirst.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useInterval.d.ts +1 -0
- package/lib/cjs/core-react/utils/hooks/useInterval.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useInterval.js +1 -0
- package/lib/cjs/core-react/utils/hooks/useInterval.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts +5 -1
- package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.js +1 -0
- package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.js.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts +2 -0
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +2 -0
- package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
- package/lib/cjs/core-react/utils/typeUtils.d.ts +1 -0
- package/lib/cjs/core-react/utils/typeUtils.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/typeUtils.js.map +1 -1
- package/lib/cjs/core-react.d.ts +0 -1
- package/lib/cjs/core-react.d.ts.map +1 -1
- package/lib/cjs/core-react.js +2 -1
- package/lib/cjs/core-react.js.map +1 -1
- package/lib/esm/core-react/UiCore.d.ts +1 -1
- package/lib/esm/core-react/UiCore.js +1 -1
- package/lib/esm/core-react/UiCore.js.map +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
- package/lib/esm/core-react/base/Centered.d.ts +1 -1
- package/lib/esm/core-react/base/Centered.d.ts.map +1 -1
- package/lib/esm/core-react/base/Centered.js +2 -1
- package/lib/esm/core-react/base/Centered.js.map +1 -1
- package/lib/esm/core-react/base/Div.d.ts +2 -2
- package/lib/esm/core-react/base/Div.d.ts.map +1 -1
- package/lib/esm/core-react/base/Div.js +1 -1
- package/lib/esm/core-react/base/Div.js.map +1 -1
- package/lib/esm/core-react/base/DivWithOutsideClick.d.ts +1 -1
- package/lib/esm/core-react/base/DivWithOutsideClick.d.ts.map +1 -1
- package/lib/esm/core-react/base/DivWithOutsideClick.js +4 -2
- package/lib/esm/core-react/base/DivWithOutsideClick.js.map +1 -1
- package/lib/esm/core-react/base/FillCentered.d.ts +1 -1
- package/lib/esm/core-react/base/FillCentered.d.ts.map +1 -1
- package/lib/esm/core-react/base/FillCentered.js +2 -1
- package/lib/esm/core-react/base/FillCentered.js.map +1 -1
- package/lib/esm/core-react/base/FlexWrapContainer.d.ts +1 -1
- package/lib/esm/core-react/base/FlexWrapContainer.d.ts.map +1 -1
- package/lib/esm/core-react/base/FlexWrapContainer.js +2 -1
- package/lib/esm/core-react/base/FlexWrapContainer.js.map +1 -1
- package/lib/esm/core-react/base/Gap.d.ts +2 -2
- package/lib/esm/core-react/base/Gap.d.ts.map +1 -1
- package/lib/esm/core-react/base/Gap.js +1 -1
- package/lib/esm/core-react/base/Gap.js.map +1 -1
- package/lib/esm/core-react/base/ScrollView.d.ts +1 -1
- package/lib/esm/core-react/base/ScrollView.d.ts.map +1 -1
- package/lib/esm/core-react/base/ScrollView.js +2 -1
- package/lib/esm/core-react/base/ScrollView.js.map +1 -1
- package/lib/esm/core-react/button/UnderlinedButton.d.ts +2 -2
- package/lib/esm/core-react/button/UnderlinedButton.js +1 -1
- package/lib/esm/core-react/button/UnderlinedButton.js.map +1 -1
- package/lib/esm/core-react/checklistbox/CheckListBox.d.ts +4 -4
- package/lib/esm/core-react/checklistbox/CheckListBox.d.ts.map +1 -1
- package/lib/esm/core-react/checklistbox/CheckListBox.js +3 -3
- package/lib/esm/core-react/checklistbox/CheckListBox.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuDivider.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuDivider.js +1 -0
- package/lib/esm/core-react/contextmenu/ContextMenuDivider.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/PopupContextMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/PopupContextMenu.js +3 -1
- package/lib/esm/core-react/contextmenu/PopupContextMenu.js.map +1 -1
- package/lib/esm/core-react/dialog/Dialog.d.ts +4 -5
- package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
- package/lib/esm/core-react/dialog/Dialog.js +3 -3
- package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
- package/lib/esm/core-react/dialog/GlobalDialog.d.ts +3 -3
- package/lib/esm/core-react/dialog/GlobalDialog.js +1 -1
- package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
- package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts +3 -3
- package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
- package/lib/esm/core-react/elementseparator/ElementSeparator.js +1 -1
- package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
- package/lib/esm/core-react/enums/Alignment.d.ts +2 -0
- package/lib/esm/core-react/enums/Alignment.d.ts.map +1 -1
- package/lib/esm/core-react/enums/Alignment.js +2 -0
- package/lib/esm/core-react/enums/Alignment.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.map +1 -1
- package/lib/esm/core-react/enums/SortDirection.d.ts +1 -0
- package/lib/esm/core-react/enums/SortDirection.d.ts.map +1 -1
- package/lib/esm/core-react/enums/SortDirection.js +1 -0
- package/lib/esm/core-react/enums/SortDirection.js.map +1 -1
- package/lib/esm/core-react/expandable/ExpandableList.d.ts +2 -2
- package/lib/esm/core-react/expandable/ExpandableList.d.ts.map +1 -1
- package/lib/esm/core-react/expandable/ExpandableList.js +1 -1
- package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
- package/lib/esm/core-react/hocs/withIsPressed.d.ts +2 -0
- package/lib/esm/core-react/hocs/withIsPressed.d.ts.map +1 -1
- package/lib/esm/core-react/hocs/withIsPressed.js +1 -0
- package/lib/esm/core-react/hocs/withIsPressed.js.map +1 -1
- package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts +2 -0
- package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
- package/lib/esm/core-react/hocs/withOnOutsideClick.js +1 -0
- package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
- package/lib/esm/core-react/hocs/withTimeout.d.ts +2 -0
- package/lib/esm/core-react/hocs/withTimeout.d.ts.map +1 -1
- package/lib/esm/core-react/hocs/withTimeout.js +4 -1
- package/lib/esm/core-react/hocs/withTimeout.js.map +1 -1
- package/lib/esm/core-react/icons/ConditionalIconItem.d.ts +0 -4
- package/lib/esm/core-react/icons/ConditionalIconItem.d.ts.map +1 -1
- package/lib/esm/core-react/icons/ConditionalIconItem.js +2 -13
- package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.js +1 -1
- package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
- package/lib/esm/core-react/icons/SvgPath.d.ts +2 -0
- package/lib/esm/core-react/icons/SvgPath.d.ts.map +1 -1
- package/lib/esm/core-react/icons/SvgPath.js +2 -0
- package/lib/esm/core-react/icons/SvgPath.js.map +1 -1
- package/lib/esm/core-react/icons/WebFontIcon.d.ts +2 -0
- package/lib/esm/core-react/icons/WebFontIcon.d.ts.map +1 -1
- package/lib/esm/core-react/icons/WebFontIcon.js +2 -0
- package/lib/esm/core-react/icons/WebFontIcon.js.map +1 -1
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts +2 -2
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js +1 -1
- package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
- package/lib/esm/core-react/inputs/Input.d.ts.map +1 -1
- package/lib/esm/core-react/inputs/Input.js.map +1 -1
- package/lib/esm/core-react/inputs/InputLabel.d.ts +2 -2
- package/lib/esm/core-react/inputs/InputLabel.d.ts.map +1 -1
- package/lib/esm/core-react/inputs/InputLabel.js +1 -1
- package/lib/esm/core-react/inputs/InputLabel.js.map +1 -1
- package/lib/esm/core-react/inputs/InputStatus.d.ts +1 -1
- package/lib/esm/core-react/inputs/InputStatus.js +1 -1
- package/lib/esm/core-react/inputs/InputStatus.js.map +1 -1
- package/lib/esm/core-react/inputs/LabeledComponentProps.d.ts +2 -2
- package/lib/esm/core-react/inputs/LabeledComponentProps.js.map +1 -1
- package/lib/esm/core-react/inputs/iconinput/IconInput.d.ts +2 -2
- package/lib/esm/core-react/inputs/iconinput/IconInput.js +1 -1
- package/lib/esm/core-react/inputs/iconinput/IconInput.js.map +1 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts +3 -3
- package/lib/esm/core-react/inputs/numberinput/NumberInput.js +1 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
- package/lib/esm/core-react/listbox/Listbox.d.ts +7 -7
- package/lib/esm/core-react/listbox/Listbox.js +3 -3
- package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
- package/lib/esm/core-react/loading/LoadingBar.d.ts +2 -2
- package/lib/esm/core-react/loading/LoadingBar.js +1 -1
- package/lib/esm/core-react/loading/LoadingBar.js.map +1 -1
- package/lib/esm/core-react/loading/LoadingPrompt.d.ts +2 -2
- package/lib/esm/core-react/loading/LoadingPrompt.js +1 -1
- package/lib/esm/core-react/loading/LoadingPrompt.js.map +1 -1
- package/lib/esm/core-react/loading/LoadingSpinner.d.ts +3 -3
- package/lib/esm/core-react/loading/LoadingSpinner.js +1 -1
- package/lib/esm/core-react/loading/LoadingSpinner.js.map +1 -1
- package/lib/esm/core-react/loading/LoadingStatus.d.ts +2 -2
- package/lib/esm/core-react/loading/LoadingStatus.js +1 -1
- package/lib/esm/core-react/loading/LoadingStatus.js.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.d.ts +5 -1
- package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
- package/lib/esm/core-react/messagebox/MessageBox.js +8 -1
- package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
- package/lib/esm/core-react/notification/MessageRenderer.d.ts +2 -0
- package/lib/esm/core-react/notification/MessageRenderer.d.ts.map +1 -1
- package/lib/esm/core-react/notification/MessageRenderer.js +2 -0
- package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
- package/lib/esm/core-react/notification/MessageType.d.ts +2 -0
- package/lib/esm/core-react/notification/MessageType.d.ts.map +1 -1
- package/lib/esm/core-react/notification/MessageType.js.map +1 -1
- package/lib/esm/core-react/popup/Popup.d.ts +6 -1
- package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
- package/lib/esm/core-react/popup/Popup.js +9 -2
- package/lib/esm/core-react/popup/Popup.js.map +1 -1
- package/lib/esm/core-react/radialmenu/RadialMenu.d.ts +4 -4
- package/lib/esm/core-react/radialmenu/RadialMenu.js +2 -2
- package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
- package/lib/esm/core-react/searchbox/SearchBox.d.ts +2 -2
- package/lib/esm/core-react/searchbox/SearchBox.js +1 -1
- package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
- package/lib/esm/core-react/settings/SettingsManager.d.ts +8 -8
- package/lib/esm/core-react/settings/SettingsManager.js +4 -4
- package/lib/esm/core-react/settings/SettingsManager.js.map +1 -1
- package/lib/esm/core-react/tabs/Tabs.d.ts +4 -4
- package/lib/esm/core-react/tabs/Tabs.js +1 -1
- package/lib/esm/core-react/tabs/Tabs.js.map +1 -1
- package/lib/esm/core-react/tabs/VerticalTabs.d.ts +1 -1
- package/lib/esm/core-react/tabs/VerticalTabs.js +1 -1
- package/lib/esm/core-react/tabs/VerticalTabs.js.map +1 -1
- package/lib/esm/core-react/text/BlockText.d.ts +1 -1
- package/lib/esm/core-react/text/BlockText.js +1 -1
- package/lib/esm/core-react/text/BlockText.js.map +1 -1
- package/lib/esm/core-react/text/BodyText.d.ts +1 -1
- package/lib/esm/core-react/text/BodyText.js +1 -1
- package/lib/esm/core-react/text/BodyText.js.map +1 -1
- package/lib/esm/core-react/text/DisabledText.d.ts +1 -1
- package/lib/esm/core-react/text/DisabledText.js +1 -1
- package/lib/esm/core-react/text/DisabledText.js.map +1 -1
- package/lib/esm/core-react/text/FilteredText.d.ts +2 -0
- package/lib/esm/core-react/text/FilteredText.d.ts.map +1 -1
- package/lib/esm/core-react/text/FilteredText.js +2 -0
- package/lib/esm/core-react/text/FilteredText.js.map +1 -1
- package/lib/esm/core-react/text/MutedText.d.ts +1 -1
- package/lib/esm/core-react/text/MutedText.js +1 -1
- package/lib/esm/core-react/text/MutedText.js.map +1 -1
- package/lib/esm/core-react/text/StyledText.d.ts +2 -2
- package/lib/esm/core-react/text/StyledText.js +1 -1
- package/lib/esm/core-react/text/StyledText.js.map +1 -1
- package/lib/esm/core-react/text/TextProps.d.ts +1 -1
- package/lib/esm/core-react/text/TextProps.js.map +1 -1
- package/lib/esm/core-react/tree/Branch.d.ts +2 -0
- package/lib/esm/core-react/tree/Branch.d.ts.map +1 -1
- package/lib/esm/core-react/tree/Branch.js +2 -0
- package/lib/esm/core-react/tree/Branch.js.map +1 -1
- package/lib/esm/core-react/tree/ExpansionToggle.d.ts +2 -0
- package/lib/esm/core-react/tree/ExpansionToggle.d.ts.map +1 -1
- package/lib/esm/core-react/tree/ExpansionToggle.js +2 -0
- package/lib/esm/core-react/tree/ExpansionToggle.js.map +1 -1
- package/lib/esm/core-react/tree/Node.d.ts +3 -3
- package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
- package/lib/esm/core-react/tree/Node.js +6 -1
- package/lib/esm/core-react/tree/Node.js.map +1 -1
- package/lib/esm/core-react/tree/Placeholder.d.ts +2 -0
- package/lib/esm/core-react/tree/Placeholder.d.ts.map +1 -1
- package/lib/esm/core-react/tree/Placeholder.js +2 -0
- package/lib/esm/core-react/tree/Placeholder.js.map +1 -1
- package/lib/esm/core-react/tree/Tree.d.ts +2 -0
- package/lib/esm/core-react/tree/Tree.d.ts.map +1 -1
- package/lib/esm/core-react/tree/Tree.js +2 -0
- package/lib/esm/core-react/tree/Tree.js.map +1 -1
- package/lib/esm/core-react/utils/IconHelper.d.ts +1 -0
- package/lib/esm/core-react/utils/IconHelper.d.ts.map +1 -1
- package/lib/esm/core-react/utils/IconHelper.js +4 -2
- package/lib/esm/core-react/utils/IconHelper.js.map +1 -1
- package/lib/esm/core-react/utils/Props.d.ts +5 -1
- package/lib/esm/core-react/utils/Props.d.ts.map +1 -1
- package/lib/esm/core-react/utils/Props.js.map +1 -1
- package/lib/esm/core-react/utils/ScrollPositionMaintainer.d.ts +1 -0
- package/lib/esm/core-react/utils/ScrollPositionMaintainer.d.ts.map +1 -1
- package/lib/esm/core-react/utils/ScrollPositionMaintainer.js +3 -0
- package/lib/esm/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
- package/lib/esm/core-react/utils/Timer.d.ts +2 -0
- package/lib/esm/core-react/utils/Timer.d.ts.map +1 -1
- package/lib/esm/core-react/utils/Timer.js +2 -0
- package/lib/esm/core-react/utils/Timer.js.map +1 -1
- package/lib/esm/core-react/utils/getCssVariable.d.ts +2 -0
- package/lib/esm/core-react/utils/getCssVariable.d.ts.map +1 -1
- package/lib/esm/core-react/utils/getCssVariable.js +3 -0
- package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
- 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/useDisposable.d.ts +1 -0
- package/lib/esm/core-react/utils/hooks/useDisposable.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useDisposable.js +1 -0
- package/lib/esm/core-react/utils/hooks/useDisposable.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useEffectSkipFirst.d.ts +1 -0
- package/lib/esm/core-react/utils/hooks/useEffectSkipFirst.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useEffectSkipFirst.js +1 -0
- package/lib/esm/core-react/utils/hooks/useEffectSkipFirst.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useInterval.d.ts +1 -0
- package/lib/esm/core-react/utils/hooks/useInterval.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useInterval.js +1 -0
- package/lib/esm/core-react/utils/hooks/useInterval.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts +5 -1
- package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useOnOutsideClick.js +1 -0
- package/lib/esm/core-react/utils/hooks/useOnOutsideClick.js.map +1 -1
- package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts +2 -0
- package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useResizeObserver.js +2 -0
- package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
- package/lib/esm/core-react/utils/typeUtils.d.ts +1 -0
- package/lib/esm/core-react/utils/typeUtils.d.ts.map +1 -1
- package/lib/esm/core-react/utils/typeUtils.js.map +1 -1
- package/lib/esm/core-react.d.ts +0 -1
- package/lib/esm/core-react.d.ts.map +1 -1
- package/lib/esm/core-react.js +2 -1
- package/lib/esm/core-react.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageCheckBox.js","sourceRoot":"","sources":["../../../../src/core-react/imagecheckbox/ImageCheckBox.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ImageCheckBox.js","sourceRoot":"","sources":["../../../../src/core-react/imagecheckbox/ImageCheckBox.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AA+B9C;;;GAGG;AACH,mDAAmD;AACnD,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,aAAiC;IAA1E;;QACU,cAAS,GAAG,CAAC,CAAsC,EAAE,EAAE;YAC7D,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe;gBAAE,CAAC,CAAC,eAAe,EAAE,CAAC;YAEhD,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBACvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACvC,CAAC;QACH,CAAC,CAAC;QAEM,kBAAa,GAAG,CAAC,CAAqC,EAAE,EAAE;YAChE,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe;gBAAE,CAAC,CAAC,eAAe,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AC;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 Checkbox\n */\n\nimport \"./ImageCheckBox.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Icon } from \"../icons/IconComponent\";\nimport type { CommonProps } from \"../utils/Props\";\n\n/** Properties for the [[ImageCheckBox]] component\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link ImageCheckBox}.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface ImageCheckBoxProps extends CommonProps {\n /** Image for the \"checked\" state */\n imageOn: string | React.ReactNode;\n /** Image for the \"unchecked\" (default) state */\n imageOff: string | React.ReactNode;\n /** Determine if the item is checked or not */\n checked?: boolean;\n /** Determine if the item is disabled or not */\n disabled?: boolean;\n /** Function called when item is clicked. */\n onClick?: (checked: boolean) => any;\n /** Custom CSS class name for the checkbox input element */\n inputClassName?: string;\n /** Custom CSS Style for the checkbox input element */\n inputStyle?: React.CSSProperties;\n /** Tooltip to be displayed when mouse is hovered over the checkbox */\n tooltip?: string;\n /** If true, draw a border around the image checkbox */\n border?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n inputRef?: React.Ref<HTMLInputElement>;\n}\n\n/** ImageCheckBox React component shows a checked or unchecked image\n * @public\n * @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/checkbox iTwinUI checkbox} instead (custom icons are not supported at the moment, but feel free to submit your use cases).\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class ImageCheckBox extends React.PureComponent<ImageCheckBoxProps> {\n private _onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (e && e.stopPropagation) e.stopPropagation();\n\n if (this.props.onClick) {\n this.props.onClick(e.target.checked);\n }\n };\n\n private _onInputClick = (e: React.MouseEvent<HTMLInputElement>) => {\n if (e && e.stopPropagation) e.stopPropagation();\n };\n\n private _onLabelClick = (e: React.MouseEvent<HTMLLabelElement>) => {\n if (e && e.stopPropagation) e.stopPropagation();\n };\n\n /** @internal */\n public override render() {\n const checkBoxClass = classnames(\n \"core-image-checkbox\",\n this.props.className\n );\n const imageClass = classnames(\n \"image\",\n this.props.border && \"image-checkbox-border\"\n );\n const iconSpec = this.props.checked\n ? this.props.imageOn\n : this.props.imageOff;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/label-has-associated-control, jsx-a11y/no-noninteractive-element-interactions\n <label\n className={checkBoxClass}\n style={this.props.style}\n onClick={this._onLabelClick}\n title={this.props.tooltip}\n >\n <input\n type=\"checkbox\"\n className={this.props.inputClassName}\n style={this.props.inputStyle}\n checked={this.props.checked}\n disabled={this.props.disabled}\n onChange={this._onChange}\n onClick={this._onInputClick}\n ref={this.props.inputRef}\n />\n <span className={imageClass}>\n <Icon iconSpec={iconSpec} />\n </span>\n </label>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/core-react/inputs/Input.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/core-react/inputs/Input.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAEjD,WAAW;IACb,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,+DAA+D;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACnC;AAsDD;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,CAAC,SAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/Input.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/Input.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAkBjD,0GAA0G;AAC1G,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CACtC,SAAS,eAAe,CAAC,KAAK,EAAE,GAAG;IACjC,MAAM,EACJ,SAAS,EACT,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,IAAI,EACJ,GAAG,UAAU,EACd,GAAG,KAAK,CAAC;IACV,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,uGAAuG;IAEnJ,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,cAAc,GAAG,eAAe,CAAC,OAAO,CAAC;QAC/C,MAAM,cAAc,GAAG,gBAAgB,CAAC;QAExC,IAAI,cAAc,IAAI,cAAc,EAAE,CAAC;YACrC,cAAc,CAAC,gBAAgB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,GAAG,EAAE;YACV,IAAI,cAAc,IAAI,cAAc,EAAE,CAAC;gBACrC,cAAc,CAAC,mBAAmB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;YAChE,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,eAAe,CAAC,OAAO,IAAI,QAAQ;YAAE,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC3E,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,KAAyC,EAAE,EAAE;QAC5C,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,IACZ,GAAG,EAAE,IAAI,EACT,IAAI,EAAC,MAAM,KACP,UAAU,EACd,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,EACvD,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAA2C,eAAe,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 Inputs\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Input as ITwinUI_Input } from \"@itwin/itwinui-react\";\nimport { useRefs } from \"../utils/hooks/useRefs\";\nimport type { CommonProps } from \"../utils/Props\";\n\n/** Properties for the [[Input]] component\n * @internal\n */\nexport interface InputProps\n extends React.InputHTMLAttributes<HTMLInputElement>,\n // eslint-disable-next-line deprecation/deprecation\n CommonProps {\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Native keydown event handler */\n nativeKeyHandler?: (e: KeyboardEvent) => void;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\n// Defined using following pattern (const Input at bottom) to ensure useful API documentation is extracted\nconst ForwardRefInput = React.forwardRef<HTMLInputElement, InputProps>(\n function ForwardRefInput(props, ref) {\n const {\n className,\n style,\n setFocus,\n nativeKeyHandler,\n size,\n ...otherProps\n } = props;\n const inputElementRef = React.useRef<HTMLInputElement>(null);\n const refs = useRefs(inputElementRef, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.\n\n React.useEffect(() => {\n const currentElement = inputElementRef.current;\n const currentHandler = nativeKeyHandler;\n\n if (currentElement && currentHandler) {\n currentElement.addEventListener(\"keydown\", currentHandler);\n }\n return () => {\n if (currentHandler && currentElement) {\n currentElement.removeEventListener(\"keydown\", currentHandler);\n }\n };\n }, [nativeKeyHandler]);\n\n React.useEffect(() => {\n if (inputElementRef.current && setFocus) inputElementRef.current.focus();\n }, [setFocus]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n event.currentTarget.select();\n },\n []\n );\n\n return (\n <ITwinUI_Input\n ref={refs}\n type=\"text\"\n {...otherProps}\n onFocus={handleFocus}\n className={classnames(\"uicore-inputs-input\", className)}\n style={style}\n />\n );\n }\n);\n\n/** Basic text input, is a wrapper for the `<input type=\"text\">` HTML element.\n * @internal\n */\nexport const Input: (props: InputProps) => React.ReactNode = ForwardRefInput;\n"]}
|
|
@@ -6,7 +6,7 @@ import type { CommonProps } from "../utils/Props";
|
|
|
6
6
|
import type { LabeledComponentProps, MessagedComponentProps } from "./LabeledComponentProps";
|
|
7
7
|
/** Properties for [[InputLabel]] components
|
|
8
8
|
* @public
|
|
9
|
-
* @deprecated in 4.12.
|
|
9
|
+
* @deprecated in 4.12.0. Props of deprecated component {@link InputLabel}.
|
|
10
10
|
*/
|
|
11
11
|
export interface InputLabelProps extends LabeledComponentProps, MessagedComponentProps, CommonProps {
|
|
12
12
|
disabled?: boolean;
|
|
@@ -15,7 +15,7 @@ export interface InputLabelProps extends LabeledComponentProps, MessagedComponen
|
|
|
15
15
|
}
|
|
16
16
|
/** Text input wrapper that provides additional styling and labeling
|
|
17
17
|
* @public
|
|
18
|
-
* @deprecated in 4.12.
|
|
18
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/input iTwinUI input} instead.
|
|
19
19
|
*/
|
|
20
20
|
export declare class InputLabel extends React.PureComponent<InputLabelProps> {
|
|
21
21
|
render(): React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputLabel.d.ts","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputLabel.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAQH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,MAAM,WAAW,eAEf,SAAQ,qBAAqB,EAE3B,sBAAsB,
|
|
1
|
+
{"version":3,"file":"InputLabel.d.ts","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputLabel.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAQH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,MAAM,WAAW,eAEf,SAAQ,qBAAqB,EAE3B,sBAAsB,EAEtB,WAAW;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAWD;;;GAGG;AAEH,qBAAa,UAAW,SAAQ,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC;IAClD,MAAM,IAAI,KAAK,CAAC,YAAY;CAiD7C"}
|
|
@@ -20,7 +20,7 @@ const inputLabelIconSpec = {
|
|
|
20
20
|
};
|
|
21
21
|
/** Text input wrapper that provides additional styling and labeling
|
|
22
22
|
* @public
|
|
23
|
-
* @deprecated in 4.12.
|
|
23
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/input iTwinUI input} instead.
|
|
24
24
|
*/
|
|
25
25
|
// eslint-disable-next-line deprecation/deprecation
|
|
26
26
|
export class InputLabel extends React.PureComponent {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputLabel.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputLabel.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"InputLabel.js","sourceRoot":"","sources":["../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,MAAM,EAAE,CAAC;gBAC3D,IAAI,CAAC,KAAK,CAAC,QAAQ;gBACnB,MAAM,IAAI,CACT,oBAAC,IAAI,IAAC,SAAS,EAAC,MAAM,EAAC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,GAAI,CACpE,CACG;YACL,OAAO,IAAI,CACV,6BACE,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,EACzD,KAAK,EAAE,YAAY,IAElB,OAAO,CACJ,CACP,CACK,CACT,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 Inputs\n */\n\nimport {\n SvgStatusError,\n SvgStatusSuccess,\n SvgStatusWarning,\n} from \"@itwin/itwinui-icons-react\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { InputStatus } from \"./InputStatus\";\nimport type {\n LabeledComponentProps,\n MessagedComponentProps,\n} from \"./LabeledComponentProps\";\n\n/** Properties for [[InputLabel]] components\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link InputLabel}.\n */\nexport interface InputLabelProps\n // eslint-disable-next-line deprecation/deprecation\n extends LabeledComponentProps,\n // eslint-disable-next-line deprecation/deprecation\n MessagedComponentProps,\n // eslint-disable-next-line deprecation/deprecation\n CommonProps {\n disabled?: boolean;\n /** Labeled content */\n children?: React.ReactNode;\n}\n\nconst inputLabelIconSpec: { [key: string]: IconSpec } = {\n // eslint-disable-next-line deprecation/deprecation\n [InputStatus.Error]: <SvgStatusError />,\n // eslint-disable-next-line deprecation/deprecation\n [InputStatus.Success]: <SvgStatusSuccess />,\n // eslint-disable-next-line deprecation/deprecation\n [InputStatus.Warning]: <SvgStatusWarning />,\n};\n\n/** Text input wrapper that provides additional styling and labeling\n * @public\n * @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/input iTwinUI input} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class InputLabel extends React.PureComponent<InputLabelProps> {\n public override render(): React.ReactElement {\n const {\n label,\n status,\n className,\n style,\n labelClassName,\n labelStyle,\n message,\n messageClassName,\n messageStyle,\n } = this.props;\n\n return (\n <label\n style={style}\n className={classnames(\n \"uicore-inputs-labeled-input\",\n this.props.disabled && \"uicore-disabled\",\n status,\n className\n )}\n >\n {label && (\n <div\n className={classnames(\"uicore-label\", labelClassName)}\n style={labelStyle}\n >\n {\" \"}\n {label}{\" \"}\n </div>\n )}\n <div className={classnames(\"input\", { \"with-icon\": !!status })}>\n {this.props.children}\n {status && (\n <Icon className=\"icon\" iconSpec={inputLabelIconSpec[`{status}`]} />\n )}\n </div>\n {message && (\n <div\n className={classnames(\"uicore-message\", messageClassName)}\n style={messageStyle}\n >\n {message}\n </div>\n )}\n </label>\n );\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/** Enum for Input status
|
|
5
5
|
* @public
|
|
6
|
-
* @deprecated in 4.12.
|
|
6
|
+
* @deprecated in 4.12.0. Enum used in a deprecated component {@link InputLabel}.
|
|
7
7
|
*/
|
|
8
8
|
export declare enum InputStatus {
|
|
9
9
|
Success = "success",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/** Enum for Input status
|
|
9
9
|
* @public
|
|
10
|
-
* @deprecated in 4.12.
|
|
10
|
+
* @deprecated in 4.12.0. Enum used in a deprecated component {@link InputLabel}.
|
|
11
11
|
*/
|
|
12
12
|
export var InputStatus;
|
|
13
13
|
(function (InputStatus) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputStatus.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputStatus.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH;;;GAGG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB","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 Inputs\n */\n\nimport type { InputLabel } from \"./InputLabel\";\n\n/** Enum for Input status\n * @public\n * @deprecated in 4.12.
|
|
1
|
+
{"version":3,"file":"InputStatus.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputStatus.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH;;;GAGG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB","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 Inputs\n */\n\nimport type { InputLabel } from \"./InputLabel\";\n\n/** Enum for Input status\n * @public\n * @deprecated in 4.12.0. Enum used in a deprecated component {@link InputLabel}.\n */\nexport enum InputStatus {\n Success = \"success\",\n Warning = \"warning\",\n Error = \"error\",\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import type * as React from "react";
|
|
|
5
5
|
import type { InputStatus } from "./InputStatus";
|
|
6
6
|
/** Properties for labeled components
|
|
7
7
|
* @public
|
|
8
|
-
* @deprecated in 4.12.
|
|
8
|
+
* @deprecated in 4.12.0. Props of deprecated component {@link InputLabel}.
|
|
9
9
|
*/
|
|
10
10
|
export interface LabeledComponentProps {
|
|
11
11
|
/** Text that will be shown next to or above the input. */
|
|
@@ -23,7 +23,7 @@ export interface LabeledComponentProps {
|
|
|
23
23
|
}
|
|
24
24
|
/** Properties for components with messages
|
|
25
25
|
* @public
|
|
26
|
-
* @deprecated in 4.12.
|
|
26
|
+
* @deprecated in 4.12.0. Props of deprecated component {@link InputLabel}.
|
|
27
27
|
*/
|
|
28
28
|
export interface MessagedComponentProps {
|
|
29
29
|
/** Optional text shown below the input. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabeledComponentProps.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/LabeledComponentProps.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG","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 Inputs\n */\n\nimport type * as React from \"react\";\nimport type { InputLabel } from \"./InputLabel\";\nimport type { InputStatus } from \"./InputStatus\";\n\n/** Properties for labeled components\n * @public\n * @deprecated in 4.12.
|
|
1
|
+
{"version":3,"file":"LabeledComponentProps.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/LabeledComponentProps.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG","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 Inputs\n */\n\nimport type * as React from \"react\";\nimport type { InputLabel } from \"./InputLabel\";\nimport type { InputStatus } from \"./InputStatus\";\n\n/** Properties for labeled components\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link InputLabel}.\n */\nexport interface LabeledComponentProps {\n /** Text that will be shown next to or above the input. */\n label?: string;\n /** Input status like: \"Success\", \"Warning\" or \"Error\" */\n // eslint-disable-next-line deprecation/deprecation\n status?: InputStatus;\n /** Custom CSS class name for the checkbox input element */\n inputClassName?: string;\n /** Custom CSS Style for the checkbox input element */\n inputStyle?: React.CSSProperties;\n /** Custom CSS class name for the label */\n labelClassName?: string;\n /** Custom CSS Style for the label */\n labelStyle?: React.CSSProperties;\n}\n\n/** Properties for components with messages\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link InputLabel}.\n */\nexport interface MessagedComponentProps {\n /** Optional text shown below the input. */\n message?: string;\n /** Custom CSS class name for the message */\n messageClassName?: string;\n /** Custom CSS Style for the message */\n messageStyle?: React.CSSProperties;\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import * as React from "react";
|
|
|
6
6
|
import type { InputProps } from "../Input";
|
|
7
7
|
/** Properties for the [[IconInput]] component
|
|
8
8
|
* @public
|
|
9
|
-
* @deprecated in 4.12.
|
|
9
|
+
* @deprecated in 4.12.0. Props of deprecated component {@link IconInput}.
|
|
10
10
|
*/
|
|
11
11
|
export interface IconInputProps extends Omit<InputProps, "size"> {
|
|
12
12
|
/** Icon displayed to the left of the Input field within the IconInput component */
|
|
@@ -20,7 +20,7 @@ export interface IconInputProps extends Omit<InputProps, "size"> {
|
|
|
20
20
|
}
|
|
21
21
|
/** Input component with icon to the left of the input field
|
|
22
22
|
* @public
|
|
23
|
-
* @deprecated in 4.12.
|
|
23
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/inputwithdecorations iTwinUI input decorations} instead.
|
|
24
24
|
*/
|
|
25
25
|
export declare const IconInput: (props: IconInputProps) => React.ReactNode;
|
|
26
26
|
//# sourceMappingURL=IconInput.d.ts.map
|
|
@@ -22,7 +22,7 @@ const ForwardRefIconInput = React.forwardRef(function ForwardRefIconInput(props,
|
|
|
22
22
|
});
|
|
23
23
|
/** Input component with icon to the left of the input field
|
|
24
24
|
* @public
|
|
25
|
-
* @deprecated in 4.12.
|
|
25
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/inputwithdecorations iTwinUI input decorations} instead.
|
|
26
26
|
*/
|
|
27
27
|
// eslint-disable-next-line deprecation/deprecation
|
|
28
28
|
export const IconInput = ForwardRefIconInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconInput.js","sourceRoot":"","sources":["../../../../../src/core-react/inputs/iconinput/IconInput.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC,CAAC,mCAAmC;AAiBrE;;GAEG;AACH,mDAAmD;AACnD,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAC1C,SAAS,mBAAmB,CAAC,KAAK,EAAE,GAAG;IACrC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAE3E,uFAAuF;IACvF,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CAAC,0BAA0B,EAAE,kBAAkB,CAAC;QAErE,oBAAC,KAAK,IACJ,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,KAC1C,UAAU,GACd;QACF,6BAAK,SAAS,EAAC,qBAAqB,IAAE,IAAI,CAAO,CAC7C,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;GAGG;AACH,mDAAmD;AACnD,MAAM,CAAC,MAAM,SAAS,GACpB,mBAAmB,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 Inputs\n */\n\nimport \"./IconInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { InputProps } from \"../Input\";\nimport { Input } from \"../Input\"; // NEEDSWORK - for nativeKeyHandler\n\n/** Properties for the [[IconInput]] component\n * @public\n * @deprecated in 4.12.
|
|
1
|
+
{"version":3,"file":"IconInput.js","sourceRoot":"","sources":["../../../../../src/core-react/inputs/iconinput/IconInput.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC,CAAC,mCAAmC;AAiBrE;;GAEG;AACH,mDAAmD;AACnD,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAC1C,SAAS,mBAAmB,CAAC,KAAK,EAAE,GAAG;IACrC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAE3E,uFAAuF;IACvF,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CAAC,0BAA0B,EAAE,kBAAkB,CAAC;QAErE,oBAAC,KAAK,IACJ,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,KAC1C,UAAU,GACd;QACF,6BAAK,SAAS,EAAC,qBAAqB,IAAE,IAAI,CAAO,CAC7C,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;GAGG;AACH,mDAAmD;AACnD,MAAM,CAAC,MAAM,SAAS,GACpB,mBAAmB,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 Inputs\n */\n\nimport \"./IconInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { InputProps } from \"../Input\";\nimport { Input } from \"../Input\"; // NEEDSWORK - for nativeKeyHandler\n\n/** Properties for the [[IconInput]] component\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link IconInput}.\n */\nexport interface IconInputProps extends Omit<InputProps, \"size\"> {\n /** Icon displayed to the left of the Input field within the IconInput component */\n icon: React.ReactNode;\n /** CSS class name for the IconInput component container div */\n containerClassName?: string;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n /** Modify size of the input. */\n size?: \"small\" | \"large\";\n}\n\n/** Input component with icon to the left of the input field\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nconst ForwardRefIconInput = React.forwardRef<HTMLInputElement, IconInputProps>(\n function ForwardRefIconInput(props, ref) {\n const { className, icon, containerClassName, size, ...otherProps } = props;\n\n // NEEDSWORK: still using core-react Input component because of `nativeKeyHandler` prop\n return (\n <div\n className={classnames(\"core-iconInput-container\", containerClassName)}\n >\n <Input\n ref={ref}\n className={classnames(\"core-input\", className)}\n {...otherProps}\n />\n <div className=\"core-iconInput-icon\">{icon}</div>\n </div>\n );\n }\n);\n\n/** Input component with icon to the left of the input field\n * @public\n * @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/inputwithdecorations iTwinUI input decorations} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const IconInput: (props: IconInputProps) => React.ReactNode =\n ForwardRefIconInput;\n"]}
|
|
@@ -7,12 +7,12 @@ import { Input } from "@itwin/itwinui-react";
|
|
|
7
7
|
type InputProps = React.ComponentPropsWithoutRef<typeof Input>;
|
|
8
8
|
/** Step function prototype for [[NumberInput]] component
|
|
9
9
|
* @public
|
|
10
|
-
* @deprecated in 4.12.
|
|
10
|
+
* @deprecated in 4.12.0. Interface used in a deprecated component {@link NumberInput}.
|
|
11
11
|
*/
|
|
12
12
|
export type StepFunctionProp = number | ((direction: string) => number | undefined);
|
|
13
13
|
/** Properties for the [[NumberInput]] component
|
|
14
14
|
* @public
|
|
15
|
-
* @deprecated in 4.12.
|
|
15
|
+
* @deprecated in 4.12.0. Props of deprecated component {@link NumberInput}.
|
|
16
16
|
*/
|
|
17
17
|
export interface NumberInputProps extends Omit<InputProps, "min" | "max" | "step" | "onChange"> {
|
|
18
18
|
/** Numeric value, set to `undefined` to show placeholder text */
|
|
@@ -49,7 +49,7 @@ export interface NumberInputProps extends Omit<InputProps, "min" | "max" | "step
|
|
|
49
49
|
}
|
|
50
50
|
/** Input component for numbers with up and down buttons to increment and decrement the value.
|
|
51
51
|
* @public
|
|
52
|
-
* @deprecated in 4.12.
|
|
52
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/input iTwinUI input} instead.
|
|
53
53
|
*/
|
|
54
54
|
export declare const NumberInput: (props: NumberInputProps) => React.ReactNode;
|
|
55
55
|
export {};
|
|
@@ -154,7 +154,7 @@ const ForwardRefNumberInput = React.forwardRef(function ForwardRefNumberInput(pr
|
|
|
154
154
|
});
|
|
155
155
|
/** Input component for numbers with up and down buttons to increment and decrement the value.
|
|
156
156
|
* @public
|
|
157
|
-
* @deprecated in 4.12.
|
|
157
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/input iTwinUI input} instead.
|
|
158
158
|
*/
|
|
159
159
|
export const NumberInput = ForwardRefNumberInput;
|
|
160
160
|
//# sourceMappingURL=NumberInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../../../../src/core-react/inputs/numberinput/NumberInput.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,KAAK,EAA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,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,KAC1C,UAAU,GACd;QACF,6BACE,SAAS,EAAE,UAAU,CACnB,qCAAqC,EACrC,gBAAgB,IAAI,+BAA+B,CACpD;YAGD,6BACE,SAAS,EAAC,sDAAsD,EAChE,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,aAAa,EACtB,IAAI,EAAC,cAAc;gBAEnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,OAAO,GAAI,CACvB;YAEN,6BACE,SAAS,EAAC,wDAAwD,EAClE,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,eAAe,EACxB,IAAI,EAAC,cAAc;gBAEnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,SAAS,GAAI,CACzB,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAGD,qBAAqB,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 Inputs\n */\n\nimport \"./NumberInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { Icon } from \"../../icons/IconComponent\";\nimport {\n SvgCaretDown,\n SvgCaretDownSmall,\n SvgCaretUp,\n SvgCaretUpSmall,\n} from \"@itwin/itwinui-icons-react\";\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Input>;\n\n/** Step function prototype for [[NumberInput]] component\n * @public\n * @deprecated in 4.12.x. Interface used in a deprecated component {@link NumberInput}.\n */\nexport type StepFunctionProp =\n | number\n | ((direction: string) => number | undefined);\n\n/** Properties for the [[NumberInput]] component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link NumberInput}.\n */\nexport interface NumberInputProps\n extends Omit<InputProps, \"min\" | \"max\" | \"step\" | \"onChange\"> {\n /** Numeric value, set to `undefined` to show placeholder text */\n value?: number;\n /** CSS class name for the NumberInput component container div */\n containerClassName?: string;\n /** Style for component container div. */\n containerStyle?: React.CSSProperties;\n /** number or function\tNumber.MIN_SAFE_INTEGER */\n min?: number;\n /** number or function\tdefaults to Number.MAX_SAFE_INTEGER */\n max?: number;\n /** increment step value used while incrementing or decrementing (up/down buttons or arrow keys) defaults to 1. */\n // eslint-disable-next-line deprecation/deprecation\n step?: StepFunctionProp;\n /** number of decimal places, defaults to 0 */\n precision?: number;\n /** function parseFloat */\n parse?: (value: string) => number | null | undefined;\n /** function optional formatting function that takes the number value and the internal formatted value in case function just adds prefix or suffix. */\n format?: (num: number | null | undefined, formattedValue: string) => string;\n /** Set to true to \"snap\" to the closest step value while incrementing or decrementing (up/down buttons or arrow keys). */\n snap?: boolean;\n /** Function to call when value is changed. */\n onChange?: (value: number | undefined, stringValue: string) => void;\n /** if true up/down buttons are shown larger and side by side */\n showTouchButtons?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n /**\n * Makes this component behave as controlled component.\n * @internal\n */\n isControlled?: boolean;\n}\n\nconst ForwardRefNumberInput = React.forwardRef<\n HTMLInputElement,\n // eslint-disable-next-line deprecation/deprecation\n NumberInputProps\n>(function ForwardRefNumberInput(props, ref) {\n const {\n containerClassName,\n className,\n value,\n min,\n max,\n precision,\n format,\n parse,\n onChange,\n onBlur,\n onKeyDown,\n step,\n snap,\n showTouchButtons,\n containerStyle,\n isControlled,\n ...otherProps\n } = props;\n const currentValueRef = React.useRef(value);\n\n /**\n * Used internally to parse the argument x to it's numeric representation.\n * If the argument cannot be converted to finite number returns 0; If a\n * \"precision\" prop is specified uses it round the number with that\n * precision (no fixed precision here because the return value is float, not\n * string).\n */\n const parseInternal = React.useCallback(\n (x: string) => {\n let n: number | undefined | null;\n\n if (parse) n = parse(x);\n if (undefined === n || null === n) {\n n = parseFloat(x);\n if (isNaN(n) || !isFinite(n)) {\n n = 0;\n }\n }\n\n const localPrecision = undefined === precision ? 10 : precision;\n const q = Math.pow(10, localPrecision);\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n n = Math.min(Math.max(n, localMin), localMax);\n n = Math.round(n * q) / q;\n\n return n;\n },\n [parse, precision, min, max]\n );\n\n /**\n * This is used internally to format a number to its display representation.\n * It will invoke the format function if one is provided.\n */\n const formatInternal = React.useCallback(\n (num: number | undefined | null) => {\n const localPrecision =\n undefined === precision || null === precision ? 0 : precision;\n const str =\n undefined === num || null === num ? \"\" : num.toFixed(localPrecision);\n\n if (format) return format(num, str);\n\n return str;\n },\n [format, precision]\n );\n\n const [formattedValue, setFormattedValue] = React.useState(() =>\n formatInternal(value)\n );\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n currentValueRef.current = value;\n const currentFormattedValue = formatInternal(currentValueRef.current);\n setFormattedValue(currentFormattedValue);\n }, [formatInternal, value]);\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const newVal = event.currentTarget.value;\n setFormattedValue(newVal);\n isControlled && onChange && onChange(parseInternal(newVal), newVal);\n },\n [isControlled, onChange, parseInternal]\n );\n\n const updateValue = React.useCallback(\n (newVal: number) => {\n const newFormattedVal = formatInternal(newVal);\n onChange && onChange(newVal, newFormattedVal);\n setFormattedValue(newFormattedVal);\n },\n [onChange, formatInternal]\n );\n\n const updateValueFromString = React.useCallback(\n (strValue: string) => {\n const newVal = parseInternal(strValue);\n updateValue(newVal);\n },\n [parseInternal, updateValue]\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n const newVal = parseInternal(event.target.value);\n onBlur && onBlur(event);\n updateValue(newVal);\n },\n [parseInternal, updateValue, onBlur]\n );\n\n const getIncrementValue = React.useCallback(\n (increment: boolean) => {\n if (typeof step === \"function\") {\n const stepVal = step(increment ? \"up\" : \"down\");\n return stepVal ? stepVal : 1;\n }\n\n return !step ? 1 : step;\n },\n [step]\n );\n\n /**\n * The internal method that actually sets the new value on the input\n */\n const applyStep = React.useCallback(\n (increment: boolean) => {\n const incrementValue = getIncrementValue(increment);\n\n let num =\n parseInternal(formattedValue) +\n (increment ? incrementValue : -incrementValue);\n if (snap) {\n num = Math.round(num / incrementValue) * incrementValue;\n }\n\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n num = Math.min(Math.max(num, localMin), localMax);\n\n updateValue(num);\n },\n [\n formattedValue,\n getIncrementValue,\n max,\n min,\n parseInternal,\n snap,\n updateValue,\n ]\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === Key.Enter.valueOf()) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === Key.Escape.valueOf()) {\n setFormattedValue(formatInternal(currentValueRef.current));\n event.preventDefault();\n } else if (event.key === Key.ArrowDown.valueOf()) {\n applyStep(false);\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === Key.ArrowUp.valueOf()) {\n applyStep(true);\n event.preventDefault();\n event.stopPropagation();\n }\n onKeyDown && onKeyDown(event);\n },\n [applyStep, formatInternal, updateValueFromString, onKeyDown]\n );\n\n const handleDownClick = React.useCallback(\n (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(false);\n event.preventDefault();\n },\n [applyStep]\n );\n\n const handleUpClick = React.useCallback(\n (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(true);\n event.preventDefault();\n },\n [applyStep]\n );\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n event.currentTarget.select();\n },\n []\n );\n\n const isDisabled = !!otherProps.disabled;\n const containerClasses = classnames(\n \"core-number-input-container\",\n containerClassName,\n showTouchButtons && \"core-number-buttons-for-touch\",\n isDisabled && \"core-number-input-disabled\"\n );\n\n const caretUp = showTouchButtons ? <SvgCaretUp /> : <SvgCaretUpSmall />;\n const caretDown = showTouchButtons ? <SvgCaretDown /> : <SvgCaretDownSmall />;\n\n return (\n <div className={containerClasses} style={containerStyle}>\n <Input\n ref={ref}\n value={formattedValue}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n size=\"small\"\n className={classnames(\"core-input\", className)}\n {...otherProps}\n />\n <div\n className={classnames(\n \"core-number-input-buttons-container\",\n showTouchButtons && \"core-number-buttons-for-touch\"\n )}\n >\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n className=\"core-number-input-button core-number-input-button-up\"\n tabIndex={-1}\n onClick={handleUpClick}\n role=\"presentation\"\n >\n <Icon iconSpec={caretUp} />\n </div>\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n className=\"core-number-input-button core-number-input-button-down\"\n tabIndex={-1}\n onClick={handleDownClick}\n role=\"presentation\"\n >\n <Icon iconSpec={caretDown} />\n </div>\n </div>\n </div>\n );\n});\n\n/** Input component for numbers with up and down buttons to increment and decrement the value.\n * @public\n * @deprecated in 4.12.x. Use {@link https://itwinui.bentley.com/docs/input iTwinUI input} instead.\n */\nexport const NumberInput: (\n // eslint-disable-next-line deprecation/deprecation\n props: NumberInputProps\n) => React.ReactNode = ForwardRefNumberInput;\n"]}
|
|
1
|
+
{"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../../../../src/core-react/inputs/numberinput/NumberInput.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,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EACpB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,KAC1C,UAAU,GACd;QACF,6BACE,SAAS,EAAE,UAAU,CACnB,qCAAqC,EACrC,gBAAgB,IAAI,+BAA+B,CACpD;YAGD,6BACE,SAAS,EAAC,sDAAsD,EAChE,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,aAAa,EACtB,IAAI,EAAC,cAAc;gBAEnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,OAAO,GAAI,CACvB;YAEN,6BACE,SAAS,EAAC,wDAAwD,EAClE,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,eAAe,EACxB,IAAI,EAAC,cAAc;gBAEnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,SAAS,GAAI,CACzB,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAGD,qBAAqB,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 Inputs\n */\n\nimport \"./NumberInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { Icon } from \"../../icons/IconComponent\";\nimport {\n SvgCaretDown,\n SvgCaretDownSmall,\n SvgCaretUp,\n SvgCaretUpSmall,\n} from \"@itwin/itwinui-icons-react\";\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Input>;\n\n/** Step function prototype for [[NumberInput]] component\n * @public\n * @deprecated in 4.12.0. Interface used in a deprecated component {@link NumberInput}.\n */\nexport type StepFunctionProp =\n | number\n | ((direction: string) => number | undefined);\n\n/** Properties for the [[NumberInput]] component\n * @public\n * @deprecated in 4.12.0. Props of deprecated component {@link NumberInput}.\n */\nexport interface NumberInputProps\n extends Omit<InputProps, \"min\" | \"max\" | \"step\" | \"onChange\"> {\n /** Numeric value, set to `undefined` to show placeholder text */\n value?: number;\n /** CSS class name for the NumberInput component container div */\n containerClassName?: string;\n /** Style for component container div. */\n containerStyle?: React.CSSProperties;\n /** number or function\tNumber.MIN_SAFE_INTEGER */\n min?: number;\n /** number or function\tdefaults to Number.MAX_SAFE_INTEGER */\n max?: number;\n /** increment step value used while incrementing or decrementing (up/down buttons or arrow keys) defaults to 1. */\n // eslint-disable-next-line deprecation/deprecation\n step?: StepFunctionProp;\n /** number of decimal places, defaults to 0 */\n precision?: number;\n /** function parseFloat */\n parse?: (value: string) => number | null | undefined;\n /** function optional formatting function that takes the number value and the internal formatted value in case function just adds prefix or suffix. */\n format?: (num: number | null | undefined, formattedValue: string) => string;\n /** Set to true to \"snap\" to the closest step value while incrementing or decrementing (up/down buttons or arrow keys). */\n snap?: boolean;\n /** Function to call when value is changed. */\n onChange?: (value: number | undefined, stringValue: string) => void;\n /** if true up/down buttons are shown larger and side by side */\n showTouchButtons?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n /**\n * Makes this component behave as controlled component.\n * @internal\n */\n isControlled?: boolean;\n}\n\nconst ForwardRefNumberInput = React.forwardRef<\n HTMLInputElement,\n // eslint-disable-next-line deprecation/deprecation\n NumberInputProps\n>(function ForwardRefNumberInput(props, ref) {\n const {\n containerClassName,\n className,\n value,\n min,\n max,\n precision,\n format,\n parse,\n onChange,\n onBlur,\n onKeyDown,\n step,\n snap,\n showTouchButtons,\n containerStyle,\n isControlled,\n ...otherProps\n } = props;\n const currentValueRef = React.useRef(value);\n\n /**\n * Used internally to parse the argument x to it's numeric representation.\n * If the argument cannot be converted to finite number returns 0; If a\n * \"precision\" prop is specified uses it round the number with that\n * precision (no fixed precision here because the return value is float, not\n * string).\n */\n const parseInternal = React.useCallback(\n (x: string) => {\n let n: number | undefined | null;\n\n if (parse) n = parse(x);\n if (undefined === n || null === n) {\n n = parseFloat(x);\n if (isNaN(n) || !isFinite(n)) {\n n = 0;\n }\n }\n\n const localPrecision = undefined === precision ? 10 : precision;\n const q = Math.pow(10, localPrecision);\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n n = Math.min(Math.max(n, localMin), localMax);\n n = Math.round(n * q) / q;\n\n return n;\n },\n [parse, precision, min, max]\n );\n\n /**\n * This is used internally to format a number to its display representation.\n * It will invoke the format function if one is provided.\n */\n const formatInternal = React.useCallback(\n (num: number | undefined | null) => {\n const localPrecision =\n undefined === precision || null === precision ? 0 : precision;\n const str =\n undefined === num || null === num ? \"\" : num.toFixed(localPrecision);\n\n if (format) return format(num, str);\n\n return str;\n },\n [format, precision]\n );\n\n const [formattedValue, setFormattedValue] = React.useState(() =>\n formatInternal(value)\n );\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n currentValueRef.current = value;\n const currentFormattedValue = formatInternal(currentValueRef.current);\n setFormattedValue(currentFormattedValue);\n }, [formatInternal, value]);\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const newVal = event.currentTarget.value;\n setFormattedValue(newVal);\n isControlled && onChange && onChange(parseInternal(newVal), newVal);\n },\n [isControlled, onChange, parseInternal]\n );\n\n const updateValue = React.useCallback(\n (newVal: number) => {\n const newFormattedVal = formatInternal(newVal);\n onChange && onChange(newVal, newFormattedVal);\n setFormattedValue(newFormattedVal);\n },\n [onChange, formatInternal]\n );\n\n const updateValueFromString = React.useCallback(\n (strValue: string) => {\n const newVal = parseInternal(strValue);\n updateValue(newVal);\n },\n [parseInternal, updateValue]\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n const newVal = parseInternal(event.target.value);\n onBlur && onBlur(event);\n updateValue(newVal);\n },\n [parseInternal, updateValue, onBlur]\n );\n\n const getIncrementValue = React.useCallback(\n (increment: boolean) => {\n if (typeof step === \"function\") {\n const stepVal = step(increment ? \"up\" : \"down\");\n return stepVal ? stepVal : 1;\n }\n\n return !step ? 1 : step;\n },\n [step]\n );\n\n /**\n * The internal method that actually sets the new value on the input\n */\n const applyStep = React.useCallback(\n (increment: boolean) => {\n const incrementValue = getIncrementValue(increment);\n\n let num =\n parseInternal(formattedValue) +\n (increment ? incrementValue : -incrementValue);\n if (snap) {\n num = Math.round(num / incrementValue) * incrementValue;\n }\n\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n num = Math.min(Math.max(num, localMin), localMax);\n\n updateValue(num);\n },\n [\n formattedValue,\n getIncrementValue,\n max,\n min,\n parseInternal,\n snap,\n updateValue,\n ]\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === Key.Enter.valueOf()) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === Key.Escape.valueOf()) {\n setFormattedValue(formatInternal(currentValueRef.current));\n event.preventDefault();\n } else if (event.key === Key.ArrowDown.valueOf()) {\n applyStep(false);\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === Key.ArrowUp.valueOf()) {\n applyStep(true);\n event.preventDefault();\n event.stopPropagation();\n }\n onKeyDown && onKeyDown(event);\n },\n [applyStep, formatInternal, updateValueFromString, onKeyDown]\n );\n\n const handleDownClick = React.useCallback(\n (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(false);\n event.preventDefault();\n },\n [applyStep]\n );\n\n const handleUpClick = React.useCallback(\n (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(true);\n event.preventDefault();\n },\n [applyStep]\n );\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n event.currentTarget.select();\n },\n []\n );\n\n const isDisabled = !!otherProps.disabled;\n const containerClasses = classnames(\n \"core-number-input-container\",\n containerClassName,\n showTouchButtons && \"core-number-buttons-for-touch\",\n isDisabled && \"core-number-input-disabled\"\n );\n\n const caretUp = showTouchButtons ? <SvgCaretUp /> : <SvgCaretUpSmall />;\n const caretDown = showTouchButtons ? <SvgCaretDown /> : <SvgCaretDownSmall />;\n\n return (\n <div className={containerClasses} style={containerStyle}>\n <Input\n ref={ref}\n value={formattedValue}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n size=\"small\"\n className={classnames(\"core-input\", className)}\n {...otherProps}\n />\n <div\n className={classnames(\n \"core-number-input-buttons-container\",\n showTouchButtons && \"core-number-buttons-for-touch\"\n )}\n >\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n className=\"core-number-input-button core-number-input-button-up\"\n tabIndex={-1}\n onClick={handleUpClick}\n role=\"presentation\"\n >\n <Icon iconSpec={caretUp} />\n </div>\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n className=\"core-number-input-button core-number-input-button-down\"\n tabIndex={-1}\n onClick={handleDownClick}\n role=\"presentation\"\n >\n <Icon iconSpec={caretDown} />\n </div>\n </div>\n </div>\n );\n});\n\n/** Input component for numbers with up and down buttons to increment and decrement the value.\n * @public\n * @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/input iTwinUI input} instead.\n */\nexport const NumberInput: (\n // eslint-disable-next-line deprecation/deprecation\n props: NumberInputProps\n) => React.ReactNode = ForwardRefNumberInput;\n"]}
|
|
@@ -3,12 +3,12 @@ import "./Listbox.scss";
|
|
|
3
3
|
/** Ideas borrowed from https://reacttraining.com/reach-ui/listbox */
|
|
4
4
|
/** `Listbox` value.
|
|
5
5
|
* @alpha
|
|
6
|
-
* @deprecated in 4.12.
|
|
6
|
+
* @deprecated in 4.12.0. Value used in a deprecated component {@link Listbox}.
|
|
7
7
|
*/
|
|
8
8
|
export type ListboxValue = string;
|
|
9
9
|
/** `Listbox` Props.
|
|
10
10
|
* @alpha
|
|
11
|
-
* @deprecated in 4.12.
|
|
11
|
+
* @deprecated in 4.12.0. Props of deprecated component {@link Listbox}.
|
|
12
12
|
*/
|
|
13
13
|
export interface ListboxProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement> {
|
|
14
14
|
id?: string;
|
|
@@ -19,7 +19,7 @@ export interface ListboxProps extends React.DetailedHTMLProps<React.HTMLAttribut
|
|
|
19
19
|
}
|
|
20
20
|
/** `ListboxItem` Props.
|
|
21
21
|
* @alpha
|
|
22
|
-
* @deprecated in 4.12.
|
|
22
|
+
* @deprecated in 4.12.0. Props of deprecated component {@link ListboxItem}.
|
|
23
23
|
*/
|
|
24
24
|
export interface ListboxItemProps extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {
|
|
25
25
|
/** The unique item's value. */
|
|
@@ -29,7 +29,7 @@ export interface ListboxItemProps extends React.DetailedHTMLProps<React.LiHTMLAt
|
|
|
29
29
|
}
|
|
30
30
|
/** `Listbox` Context.
|
|
31
31
|
* @alpha
|
|
32
|
-
* @deprecated in 4.12.
|
|
32
|
+
* @deprecated in 4.12.0. Props of deprecated context {@link ListboxContext}.
|
|
33
33
|
*/
|
|
34
34
|
export interface ListboxContextProps {
|
|
35
35
|
listboxId?: string;
|
|
@@ -40,17 +40,17 @@ export interface ListboxContextProps {
|
|
|
40
40
|
}
|
|
41
41
|
/** Context set up by listbox for use by `ListboxItems` .
|
|
42
42
|
* @alpha
|
|
43
|
-
* @deprecated in 4.12.
|
|
43
|
+
* @deprecated in 4.12.0. Context of deprecated component {@link Listbox}.
|
|
44
44
|
*/
|
|
45
45
|
export declare const ListboxContext: React.Context<ListboxContextProps>;
|
|
46
46
|
/** Single select `Listbox` component
|
|
47
47
|
* @alpha
|
|
48
|
-
* @deprecated in 4.12.
|
|
48
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/list iTwinUI list} instead.
|
|
49
49
|
*/
|
|
50
50
|
export declare function Listbox(props: ListboxProps): React.JSX.Element;
|
|
51
51
|
/** `ListboxItem` component.
|
|
52
52
|
* @alpha
|
|
53
|
-
* @deprecated in 4.12.
|
|
53
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/list iTwinUI list} instead.
|
|
54
54
|
*/
|
|
55
55
|
export declare function ListboxItem(props: ListboxItemProps): React.JSX.Element;
|
|
56
56
|
//# sourceMappingURL=Listbox.d.ts.map
|
|
@@ -9,7 +9,7 @@ import "./Listbox.scss";
|
|
|
9
9
|
import { Guid } from "@itwin/core-bentley";
|
|
10
10
|
/** Context set up by listbox for use by `ListboxItems` .
|
|
11
11
|
* @alpha
|
|
12
|
-
* @deprecated in 4.12.
|
|
12
|
+
* @deprecated in 4.12.0. Context of deprecated component {@link Listbox}.
|
|
13
13
|
*/
|
|
14
14
|
export const ListboxContext = React.createContext({
|
|
15
15
|
onListboxValueChange: (_newValue) => { },
|
|
@@ -66,7 +66,7 @@ function processKeyboardNavigation(optionValues, itemIndex, key) {
|
|
|
66
66
|
}
|
|
67
67
|
/** Single select `Listbox` component
|
|
68
68
|
* @alpha
|
|
69
|
-
* @deprecated in 4.12.
|
|
69
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/list iTwinUI list} instead.
|
|
70
70
|
*/
|
|
71
71
|
export function Listbox(props) {
|
|
72
72
|
const { ariaLabel, ariaLabelledBy, id, children, selectedValue, className, onListboxValueChange, onKeyDown, ...otherProps } = props;
|
|
@@ -182,7 +182,7 @@ export function Listbox(props) {
|
|
|
182
182
|
}
|
|
183
183
|
/** `ListboxItem` component.
|
|
184
184
|
* @alpha
|
|
185
|
-
* @deprecated in 4.12.
|
|
185
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/list iTwinUI list} instead.
|
|
186
186
|
*/
|
|
187
187
|
export function ListboxItem(props) {
|
|
188
188
|
const { children, value, className, disabled, ...otherProps } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Listbox.js","sourceRoot":"","sources":["../../../../src/core-react/listbox/Listbox.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AA6D3C;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAsB;IACrE,oBAAoB,EAAE,CAAC,SAAmC,EAAE,EAAE,GAAE,CAAC;CAClE,CAAC,CAAC;AAEH,SAAS,MAAM,CAAC,GAAG,IAA+C;IAChE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,mBAAmB,CAAC,UAA2B;IACtD,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC;SACtC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;SAChE,GAAG,CACF,CAAC,UAAU,EAAE,EAAE,CACZ,UAAiC,CAAC,KAAyB,CAC/D,CAAC;AACN,CAAC;AAED,SAAS,yBAAyB,CAChC,YAAgC,EAChC,SAAiB,EACjB,GAAW;IAEX,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,QAAQ,GAAG,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;I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,OAAO,GAAG,KAAK,CAAC,OAAO,CAC3B,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,EAAE,QAAQ,IAAI,SAAS,EAAE,SAAS,CAAC,EACvE,CAAC,SAAS,EAAE,QAAQ,CAAC,CACtB,CAAC;IACF,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,YAAY,KAAK,KAAK,CAAC;IAE1C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,KAAkD,EAAE,EAAE;QACrD,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC;QAC1D,IAAI,SAAS,KAAK,aAAa,EAAE,CAAC;YAChC,oBAAoB,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,EACD,CAAC,oBAAoB,CAAC,CACvB,CAAC;IAEF,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACvC,OAAO,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvB,OAAO;IACL,iEAAiE;IACjE,6CAIiB,UAAU,mBAIV,QAAQ,IAAI,SAAS;QACpC,uEAAuE;QACvE,sCAAsC;QACtC,wDAAwD;QACxD,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,KACd,UAAU,EACd,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,SAAS,EAAE,gBAEH,KAAK,EACjB,OAAO,EAAE,WAAW,IAEnB,QAAQ,CACN,CACN,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 *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\n\nimport \"./Listbox.scss\";\nimport { Guid } from \"@itwin/core-bentley\";\n\n/** Ideas borrowed from https://reacttraining.com/reach-ui/listbox */\n\n/* eslint-disable deprecation/deprecation */\n\n/** `Listbox` value.\n * @alpha\n * @deprecated in 4.12.x. Value used in a deprecated component {@link Listbox}.\n */\nexport type ListboxValue = string;\n\n/** `Listbox` Props.\n * @alpha\n * @deprecated in 4.12.x. Props of deprecated component {@link Listbox}.\n */\nexport interface ListboxProps\n extends React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLUListElement>,\n HTMLUListElement\n > {\n id?: string;\n selectedValue?: ListboxValue;\n ariaLabel?: any;\n ariaLabelledBy?: any;\n onListboxValueChange?: (\n newValue: ListboxValue,\n isControlOrCommandPressed?: boolean\n ) => void;\n}\n\n/** `ListboxItem` Props.\n * @alpha\n * @deprecated in 4.12.x. Props of deprecated component {@link ListboxItem}.\n */\nexport interface ListboxItemProps\n extends React.DetailedHTMLProps<\n React.LiHTMLAttributes<HTMLLIElement>,\n HTMLLIElement\n > {\n /** The unique item's value. */\n value: ListboxValue;\n /** set if item is disabled. */\n disabled?: boolean;\n}\n\n/** `Listbox` Context.\n * @alpha\n * @deprecated in 4.12.x. Props of deprecated context {@link ListboxContext}.\n */\nexport interface ListboxContextProps {\n listboxId?: string;\n listboxValue?: ListboxValue;\n focusValue?: ListboxValue;\n onListboxValueChange: (\n newValue: ListboxValue,\n isControlOrCommandPressed?: boolean\n ) => void;\n listboxRef?: React.RefObject<HTMLUListElement>;\n}\n\n/** Context set up by listbox for use by `ListboxItems` .\n * @alpha\n * @deprecated in 4.12.x. Context of deprecated component {@link Listbox}.\n */\nexport const ListboxContext = React.createContext<ListboxContextProps>({\n onListboxValueChange: (_newValue: ListboxValue | undefined) => {},\n});\n\nfunction makeId(...args: Array<string | number | null | undefined>) {\n return args.filter((val) => val != null).join(\"--\");\n}\n\nfunction getOptionValueArray(childNodes: React.ReactNode): ListboxItemProps[] {\n return React.Children.toArray(childNodes)\n .filter((node) => React.isValidElement(node) && node.props.value)\n .map(\n (optionNode) =>\n (optionNode as React.ReactElement).props as ListboxItemProps\n );\n}\n\nfunction processKeyboardNavigation(\n optionValues: ListboxItemProps[],\n itemIndex: number,\n key: string\n): [number, boolean] {\n let keyProcessed = false;\n let newIndex = itemIndex >= 0 ? itemIndex : 0;\n\n // Note: In aria example Page Up/Down just moves up or down by one item. See https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/js/listbox.js\n if (key === Key.ArrowDown.valueOf() || key === Key.PageDown.valueOf()) {\n for (let i = itemIndex + 1; i < optionValues.length; i++) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === Key.ArrowUp.valueOf() || key === Key.PageUp.valueOf()) {\n for (let i = itemIndex - 1; i >= 0; i--) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === Key.Home.valueOf()) {\n for (let i = 0; i < optionValues.length; i++) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === Key.End.valueOf()) {\n for (let i = optionValues.length - 1; i >= 0; i--) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n }\n return [newIndex, keyProcessed];\n}\n\n/** Single select `Listbox` component\n * @alpha\n * @deprecated in 4.12.x. Use {@link https://itwinui.bentley.com/docs/list iTwinUI list} instead.\n */\nexport function Listbox(props: ListboxProps) {\n const {\n ariaLabel,\n ariaLabelledBy,\n id,\n children,\n selectedValue,\n className,\n onListboxValueChange,\n onKeyDown,\n ...otherProps\n } = props;\n const listRef = React.useRef<HTMLUListElement>(null);\n const [listId] = React.useState(() => {\n return id ?? Guid.createValue();\n });\n const optionValues = React.useMemo(\n () => getOptionValueArray(children),\n [children]\n );\n const classes = React.useMemo(\n () => classnames(\"core-listbox\", className),\n [className]\n );\n const [currentValue, setCurrentValue] = React.useState<\n ListboxValue | undefined\n >(selectedValue);\n const [focusValue, setFocusValue] = React.useState<ListboxValue | undefined>(\n currentValue\n );\n\n React.useEffect(() => {\n setCurrentValue(selectedValue);\n setFocusValue(selectedValue);\n }, [selectedValue]);\n\n const scrollTopRef = React.useRef(0);\n const handleValueChange = React.useCallback(\n (newValue: ListboxValue, isControlOrCommandPressed?: boolean) => {\n if (newValue !== currentValue) {\n setCurrentValue(newValue);\n setFocusValue(newValue);\n if (onListboxValueChange)\n onListboxValueChange(newValue, isControlOrCommandPressed);\n }\n },\n [setCurrentValue, currentValue, onListboxValueChange]\n );\n\n const focusOption = React.useCallback(\n (itemIndex: number) => {\n if (itemIndex >= 0 && itemIndex < optionValues.length) {\n const newSelection = optionValues[itemIndex];\n const listElement = listRef.current as HTMLUListElement;\n const optionToFocus = listElement.querySelector<HTMLLIElement>(\n `li[data-value=\"${newSelection.value}\"]`\n );\n if (optionToFocus && listElement) {\n let newScrollTop = listElement.scrollTop;\n\n if (listElement.scrollHeight > listElement.clientHeight) {\n const scrollBottom =\n listElement.clientHeight + listElement.scrollTop;\n const elementBottom =\n optionToFocus.offsetTop + optionToFocus.offsetHeight;\n if (elementBottom > scrollBottom) {\n newScrollTop = elementBottom - listElement.clientHeight;\n } else if (optionToFocus.offsetTop < listElement.scrollTop) {\n newScrollTop = optionToFocus.offsetTop;\n }\n scrollTopRef.current = newScrollTop;\n }\n setFocusValue(newSelection.value);\n }\n }\n },\n [optionValues]\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (optionValues.length < 1) return;\n\n const itemIndex =\n undefined === focusValue\n ? -1\n : optionValues.findIndex(\n (optionValue) => optionValue.value === focusValue\n );\n\n if (event.key === \" \") {\n event.preventDefault();\n if (focusValue)\n handleValueChange(\n focusValue,\n event.getModifierState(\"Control\") || event.getModifierState(\"Meta\")\n ); // Control or Command\n return;\n } else {\n const [newItemIndex, keyProcessed] = processKeyboardNavigation(\n optionValues,\n itemIndex,\n event.key\n );\n if (keyProcessed) {\n event.preventDefault();\n focusOption(newItemIndex);\n return;\n }\n }\n\n if (onKeyDown) onKeyDown(event);\n },\n [focusValue, optionValues, focusOption, onKeyDown, handleValueChange]\n );\n\n const isInitialMount = React.useRef(true);\n\n React.useEffect(() => {\n const list = listRef.current as HTMLUListElement;\n\n if (isInitialMount.current) {\n isInitialMount.current = false;\n\n if (undefined !== focusValue) {\n const itemIndex = optionValues.findIndex(\n (optionValue) => optionValue.value === focusValue\n );\n focusOption(itemIndex);\n }\n } else {\n list.scrollTop = scrollTopRef.current;\n }\n }, [focusValue, focusOption, optionValues]);\n\n const handleOnScroll = React.useCallback(\n (_event: React.UIEvent<HTMLUListElement, UIEvent>) => {\n if (listRef.current) scrollTopRef.current = listRef.current.scrollTop;\n },\n []\n );\n\n const handleOnFocus = React.useCallback(\n (_event: React.FocusEvent<HTMLUListElement>) => {\n if (!focusValue || 0 === focusValue.length) {\n if (currentValue) {\n setFocusValue(currentValue);\n } else {\n if (optionValues.length > 0) setFocusValue(optionValues[0].value);\n }\n }\n },\n [currentValue, focusValue, optionValues]\n );\n\n return (\n <ul\n className={classes}\n // If the listbox is not part of another widget, then it has a visible\n // label referenced by `aria-labelledby` on the element with role\n // `listbox`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n // If an `aria-label` is passed, we should skip `aria-labelledby` to\n // avoid confusion.\n aria-labelledby={ariaLabel ? undefined : ariaLabelledBy}\n aria-label={ariaLabel}\n // An element that contains or owns all the listbox options has role\n // listbox.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n role=\"listbox\"\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-collapsible.html\n tabIndex={0}\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-scrollable.html\n aria-activedescendant={makeId(currentValue, listId)}\n {...otherProps}\n ref={listRef}\n id={listId}\n onKeyDown={handleKeyDown}\n onScroll={handleOnScroll}\n data-value={currentValue}\n data-focusvalue={focusValue}\n onFocus={handleOnFocus}\n >\n <ListboxContext.Provider\n value={{\n listboxValue: currentValue,\n focusValue,\n listboxId: listId,\n onListboxValueChange: handleValueChange,\n listboxRef: listRef,\n }}\n >\n {children}\n </ListboxContext.Provider>\n </ul>\n );\n}\n\n/** `ListboxItem` component.\n * @alpha\n * @deprecated in 4.12.x. Use {@link https://itwinui.bentley.com/docs/list iTwinUI list} instead.\n */\nexport function ListboxItem(props: ListboxItemProps) {\n const { children, value, className, disabled, ...otherProps } = props;\n\n const { listboxValue, focusValue, listboxId, onListboxValueChange } =\n React.useContext(ListboxContext);\n\n const hasFocus = focusValue === value;\n\n const classes = React.useMemo(\n () => classnames(\"core-listbox-item\", hasFocus && \"focused\", className),\n [className, hasFocus]\n );\n const itemRef = React.useRef<HTMLLIElement>(null);\n const isSelected = listboxValue === value;\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLLIElement, MouseEvent>) => {\n event.preventDefault();\n const selectedValue = event.currentTarget?.dataset?.value;\n if (undefined !== selectedValue) {\n onListboxValueChange(selectedValue, event.ctrlKey);\n }\n },\n [onListboxValueChange]\n );\n\n const getItemId = React.useCallback(() => {\n return makeId(value, listboxId);\n }, [listboxId, value]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <li\n // In a single-select listbox, the selected option has `aria-selected`\n // set to `true`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n aria-selected={isSelected}\n // Applicable to all host language elements regardless of whether a\n // `role` is applied.\n // https://www.w3.org/WAI/PF/aria/states_and_properties#global_states_header\n aria-disabled={disabled || undefined}\n // Each option in the listbox has role `option` and is a DOM descendant\n // of the element with role `listbox`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n role=\"option\"\n className={classes}\n {...otherProps}\n ref={itemRef}\n id={getItemId()}\n // used for css styling\n data-value={value}\n onClick={handleClick}\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AU,CAAC,mBAAmB,EAAE,QAAQ,IAAI,SAAS,EAAE,SAAS,CAAC,EACvE,CAAC,SAAS,EAAE,QAAQ,CAAC,CACtB,CAAC;IACF,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,YAAY,KAAK,KAAK,CAAC;IAE1C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,KAAkD,EAAE,EAAE;QACrD,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC;QAC1D,IAAI,SAAS,KAAK,aAAa,EAAE,CAAC;YAChC,oBAAoB,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,EACD,CAAC,oBAAoB,CAAC,CACvB,CAAC;IAEF,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACvC,OAAO,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvB,OAAO;IACL,iEAAiE;IACjE,6CAIiB,UAAU,mBAIV,QAAQ,IAAI,SAAS;QACpC,uEAAuE;QACvE,sCAAsC;QACtC,wDAAwD;QACxD,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,KACd,UAAU,EACd,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,SAAS,EAAE,gBAEH,KAAK,EACjB,OAAO,EAAE,WAAW,IAEnB,QAAQ,CACN,CACN,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 *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\n\nimport \"./Listbox.scss\";\nimport { Guid } from \"@itwin/core-bentley\";\n\n/** Ideas borrowed from https://reacttraining.com/reach-ui/listbox */\n\n/* eslint-disable deprecation/deprecation */\n\n/** `Listbox` value.\n * @alpha\n * @deprecated in 4.12.0. Value used in a deprecated component {@link Listbox}.\n */\nexport type ListboxValue = string;\n\n/** `Listbox` Props.\n * @alpha\n * @deprecated in 4.12.0. Props of deprecated component {@link Listbox}.\n */\nexport interface ListboxProps\n extends React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLUListElement>,\n HTMLUListElement\n > {\n id?: string;\n selectedValue?: ListboxValue;\n ariaLabel?: any;\n ariaLabelledBy?: any;\n onListboxValueChange?: (\n newValue: ListboxValue,\n isControlOrCommandPressed?: boolean\n ) => void;\n}\n\n/** `ListboxItem` Props.\n * @alpha\n * @deprecated in 4.12.0. Props of deprecated component {@link ListboxItem}.\n */\nexport interface ListboxItemProps\n extends React.DetailedHTMLProps<\n React.LiHTMLAttributes<HTMLLIElement>,\n HTMLLIElement\n > {\n /** The unique item's value. */\n value: ListboxValue;\n /** set if item is disabled. */\n disabled?: boolean;\n}\n\n/** `Listbox` Context.\n * @alpha\n * @deprecated in 4.12.0. Props of deprecated context {@link ListboxContext}.\n */\nexport interface ListboxContextProps {\n listboxId?: string;\n listboxValue?: ListboxValue;\n focusValue?: ListboxValue;\n onListboxValueChange: (\n newValue: ListboxValue,\n isControlOrCommandPressed?: boolean\n ) => void;\n listboxRef?: React.RefObject<HTMLUListElement>;\n}\n\n/** Context set up by listbox for use by `ListboxItems` .\n * @alpha\n * @deprecated in 4.12.0. Context of deprecated component {@link Listbox}.\n */\nexport const ListboxContext = React.createContext<ListboxContextProps>({\n onListboxValueChange: (_newValue: ListboxValue | undefined) => {},\n});\n\nfunction makeId(...args: Array<string | number | null | undefined>) {\n return args.filter((val) => val != null).join(\"--\");\n}\n\nfunction getOptionValueArray(childNodes: React.ReactNode): ListboxItemProps[] {\n return React.Children.toArray(childNodes)\n .filter((node) => React.isValidElement(node) && node.props.value)\n .map(\n (optionNode) =>\n (optionNode as React.ReactElement).props as ListboxItemProps\n );\n}\n\nfunction processKeyboardNavigation(\n optionValues: ListboxItemProps[],\n itemIndex: number,\n key: string\n): [number, boolean] {\n let keyProcessed = false;\n let newIndex = itemIndex >= 0 ? itemIndex : 0;\n\n // Note: In aria example Page Up/Down just moves up or down by one item. See https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/js/listbox.js\n if (key === Key.ArrowDown.valueOf() || key === Key.PageDown.valueOf()) {\n for (let i = itemIndex + 1; i < optionValues.length; i++) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === Key.ArrowUp.valueOf() || key === Key.PageUp.valueOf()) {\n for (let i = itemIndex - 1; i >= 0; i--) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === Key.Home.valueOf()) {\n for (let i = 0; i < optionValues.length; i++) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === Key.End.valueOf()) {\n for (let i = optionValues.length - 1; i >= 0; i--) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n }\n return [newIndex, keyProcessed];\n}\n\n/** Single select `Listbox` component\n * @alpha\n * @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/list iTwinUI list} instead.\n */\nexport function Listbox(props: ListboxProps) {\n const {\n ariaLabel,\n ariaLabelledBy,\n id,\n children,\n selectedValue,\n className,\n onListboxValueChange,\n onKeyDown,\n ...otherProps\n } = props;\n const listRef = React.useRef<HTMLUListElement>(null);\n const [listId] = React.useState(() => {\n return id ?? Guid.createValue();\n });\n const optionValues = React.useMemo(\n () => getOptionValueArray(children),\n [children]\n );\n const classes = React.useMemo(\n () => classnames(\"core-listbox\", className),\n [className]\n );\n const [currentValue, setCurrentValue] = React.useState<\n ListboxValue | undefined\n >(selectedValue);\n const [focusValue, setFocusValue] = React.useState<ListboxValue | undefined>(\n currentValue\n );\n\n React.useEffect(() => {\n setCurrentValue(selectedValue);\n setFocusValue(selectedValue);\n }, [selectedValue]);\n\n const scrollTopRef = React.useRef(0);\n const handleValueChange = React.useCallback(\n (newValue: ListboxValue, isControlOrCommandPressed?: boolean) => {\n if (newValue !== currentValue) {\n setCurrentValue(newValue);\n setFocusValue(newValue);\n if (onListboxValueChange)\n onListboxValueChange(newValue, isControlOrCommandPressed);\n }\n },\n [setCurrentValue, currentValue, onListboxValueChange]\n );\n\n const focusOption = React.useCallback(\n (itemIndex: number) => {\n if (itemIndex >= 0 && itemIndex < optionValues.length) {\n const newSelection = optionValues[itemIndex];\n const listElement = listRef.current as HTMLUListElement;\n const optionToFocus = listElement.querySelector<HTMLLIElement>(\n `li[data-value=\"${newSelection.value}\"]`\n );\n if (optionToFocus && listElement) {\n let newScrollTop = listElement.scrollTop;\n\n if (listElement.scrollHeight > listElement.clientHeight) {\n const scrollBottom =\n listElement.clientHeight + listElement.scrollTop;\n const elementBottom =\n optionToFocus.offsetTop + optionToFocus.offsetHeight;\n if (elementBottom > scrollBottom) {\n newScrollTop = elementBottom - listElement.clientHeight;\n } else if (optionToFocus.offsetTop < listElement.scrollTop) {\n newScrollTop = optionToFocus.offsetTop;\n }\n scrollTopRef.current = newScrollTop;\n }\n setFocusValue(newSelection.value);\n }\n }\n },\n [optionValues]\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (optionValues.length < 1) return;\n\n const itemIndex =\n undefined === focusValue\n ? -1\n : optionValues.findIndex(\n (optionValue) => optionValue.value === focusValue\n );\n\n if (event.key === \" \") {\n event.preventDefault();\n if (focusValue)\n handleValueChange(\n focusValue,\n event.getModifierState(\"Control\") || event.getModifierState(\"Meta\")\n ); // Control or Command\n return;\n } else {\n const [newItemIndex, keyProcessed] = processKeyboardNavigation(\n optionValues,\n itemIndex,\n event.key\n );\n if (keyProcessed) {\n event.preventDefault();\n focusOption(newItemIndex);\n return;\n }\n }\n\n if (onKeyDown) onKeyDown(event);\n },\n [focusValue, optionValues, focusOption, onKeyDown, handleValueChange]\n );\n\n const isInitialMount = React.useRef(true);\n\n React.useEffect(() => {\n const list = listRef.current as HTMLUListElement;\n\n if (isInitialMount.current) {\n isInitialMount.current = false;\n\n if (undefined !== focusValue) {\n const itemIndex = optionValues.findIndex(\n (optionValue) => optionValue.value === focusValue\n );\n focusOption(itemIndex);\n }\n } else {\n list.scrollTop = scrollTopRef.current;\n }\n }, [focusValue, focusOption, optionValues]);\n\n const handleOnScroll = React.useCallback(\n (_event: React.UIEvent<HTMLUListElement, UIEvent>) => {\n if (listRef.current) scrollTopRef.current = listRef.current.scrollTop;\n },\n []\n );\n\n const handleOnFocus = React.useCallback(\n (_event: React.FocusEvent<HTMLUListElement>) => {\n if (!focusValue || 0 === focusValue.length) {\n if (currentValue) {\n setFocusValue(currentValue);\n } else {\n if (optionValues.length > 0) setFocusValue(optionValues[0].value);\n }\n }\n },\n [currentValue, focusValue, optionValues]\n );\n\n return (\n <ul\n className={classes}\n // If the listbox is not part of another widget, then it has a visible\n // label referenced by `aria-labelledby` on the element with role\n // `listbox`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n // If an `aria-label` is passed, we should skip `aria-labelledby` to\n // avoid confusion.\n aria-labelledby={ariaLabel ? undefined : ariaLabelledBy}\n aria-label={ariaLabel}\n // An element that contains or owns all the listbox options has role\n // listbox.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n role=\"listbox\"\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-collapsible.html\n tabIndex={0}\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-scrollable.html\n aria-activedescendant={makeId(currentValue, listId)}\n {...otherProps}\n ref={listRef}\n id={listId}\n onKeyDown={handleKeyDown}\n onScroll={handleOnScroll}\n data-value={currentValue}\n data-focusvalue={focusValue}\n onFocus={handleOnFocus}\n >\n <ListboxContext.Provider\n value={{\n listboxValue: currentValue,\n focusValue,\n listboxId: listId,\n onListboxValueChange: handleValueChange,\n listboxRef: listRef,\n }}\n >\n {children}\n </ListboxContext.Provider>\n </ul>\n );\n}\n\n/** `ListboxItem` component.\n * @alpha\n * @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/list iTwinUI list} instead.\n */\nexport function ListboxItem(props: ListboxItemProps) {\n const { children, value, className, disabled, ...otherProps } = props;\n\n const { listboxValue, focusValue, listboxId, onListboxValueChange } =\n React.useContext(ListboxContext);\n\n const hasFocus = focusValue === value;\n\n const classes = React.useMemo(\n () => classnames(\"core-listbox-item\", hasFocus && \"focused\", className),\n [className, hasFocus]\n );\n const itemRef = React.useRef<HTMLLIElement>(null);\n const isSelected = listboxValue === value;\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLLIElement, MouseEvent>) => {\n event.preventDefault();\n const selectedValue = event.currentTarget?.dataset?.value;\n if (undefined !== selectedValue) {\n onListboxValueChange(selectedValue, event.ctrlKey);\n }\n },\n [onListboxValueChange]\n );\n\n const getItemId = React.useCallback(() => {\n return makeId(value, listboxId);\n }, [listboxId, value]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <li\n // In a single-select listbox, the selected option has `aria-selected`\n // set to `true`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n aria-selected={isSelected}\n // Applicable to all host language elements regardless of whether a\n // `role` is applied.\n // https://www.w3.org/WAI/PF/aria/states_and_properties#global_states_header\n aria-disabled={disabled || undefined}\n // Each option in the listbox has role `option` and is a DOM descendant\n // of the element with role `listbox`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n role=\"option\"\n className={classes}\n {...otherProps}\n ref={itemRef}\n id={getItemId()}\n // used for css styling\n data-value={value}\n onClick={handleClick}\n >\n {children}\n </li>\n );\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import * as React from "react";
|
|
|
6
6
|
import type { CommonProps } from "../utils/Props";
|
|
7
7
|
/** Properties for [[LoadingBar]] component
|
|
8
8
|
* @public
|
|
9
|
-
* @deprecated in 4.12.
|
|
9
|
+
* @deprecated in 4.12.0. Props of deprecated component {@link LoadingBar}.
|
|
10
10
|
*/
|
|
11
11
|
export interface LoadingBarProps extends CommonProps {
|
|
12
12
|
/** Percent */
|
|
@@ -18,7 +18,7 @@ export interface LoadingBarProps extends CommonProps {
|
|
|
18
18
|
}
|
|
19
19
|
/** A loading bar with optional percentage text.
|
|
20
20
|
* @public
|
|
21
|
-
* @deprecated in 4.12.
|
|
21
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/progressindicator#progress-linear iTwinUI progress indicator} instead.
|
|
22
22
|
*/
|
|
23
23
|
export declare class LoadingBar extends React.PureComponent<LoadingBarProps> {
|
|
24
24
|
static defaultProps: Partial<LoadingBarProps>;
|
|
@@ -10,7 +10,7 @@ import classnames from "classnames";
|
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
/** A loading bar with optional percentage text.
|
|
12
12
|
* @public
|
|
13
|
-
* @deprecated in 4.12.
|
|
13
|
+
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/progressindicator#progress-linear iTwinUI progress indicator} instead.
|
|
14
14
|
*/
|
|
15
15
|
export class LoadingBar extends React.PureComponent {
|
|
16
16
|
render() {
|