packageDocumentation module import * as React from "react" ; import { CommonProps } from "@itwin/core-react" ; import { UiIModelComponents } from "../../UiIModelComponents" ; import { Select , SelectOption } from "@itwin/itwinui-react" ; internal export interface ThousandsSelectorProps extends CommonProps { separator : string ; disabled : boolean ; onChange : ( value : string ) => void ; } internal export function ThousandsSelector ( props ) { const { separator , disabled , onChange , ... otherProps } = props ; const uomDefaultEntries = React . useRef < SelectOption < string > [ ] > ( [ { value : "," , label : UiIModelComponents . translate ( "QuantityFormat.thousand_separator.comma" ) } , { value : "." , label : UiIModelComponents . translate ( "QuantityFormat.thousand_separator.point" ) } , ] ) ; const handleOnChange = React . useCallback ( ( newValue ) => { onChange && onChange ( newValue ) ; } , [ onChange ] ) ; const separatorOptions = React . useMemo ( ( ) => { const completeListOfEntries = [ ] ; if ( undefined === uomDefaultEntries . current . find ( ( option ) => option . value === separator ) ) { completeListOfEntries . push ( { value : separator , label : separator } ) ; } completeListOfEntries . push ( ... uomDefaultEntries . current ) ; return completeListOfEntries ; } , [ separator ] ) ; return ( < Select options = { separatorOptions } disabled = { disabled } value = { separator } onChange = { handleOnChange } size = "small" { ... otherProps } />); }