packageDocumentation module import * as React from "react" ; import { CommonProps } from "@itwin/core-react" ; import { UiIModelComponents } from "../../UiIModelComponents" ; import { ShowSignOption } from "@itwin/core-quantity" ; import { Select , SelectOption } from "@itwin/itwinui-react" ; internal export interface SignOptionSelectorProps extends CommonProps { signOption : ShowSignOption ; onChange : ( value : ShowSignOption ) => void ; } internal export function SignOptionSelector ( props ) { const { signOption , onChange , ... otherProps } = props ; const options = React . useRef < SelectOption < ShowSignOption > [ ] > ( [ { value : ShowSignOption . NoSign , label : UiIModelComponents . translate ( "QuantityFormat.sign_option.noSign" ) } , { value : ShowSignOption . OnlyNegative , label : UiIModelComponents . translate ( "QuantityFormat.sign_option.onlyNegative" ) } , { value : ShowSignOption . SignAlways , label : UiIModelComponents . translate ( "QuantityFormat.sign_option.signAlways" ) } , { value : ShowSignOption . NegativeParentheses , label : UiIModelComponents . translate ( "QuantityFormat.sign_option.negativeParentheses" ) } , ] ) ; const handleOnChange = React . useCallback ( ( newValue ) => { onChange && onChange ( newValue ) ; } , [ onChange ] ) ; return ( < Select options = { options . current } value = { signOption } onChange = { handleOnChange } size = "small" { ... otherProps } />); }