STOCK BASED COMPENSATION - Stock-based compensation expense (Details) - USD ($)
$ in Thousands
12 Months Ended
Jun. 30, 2019
Jun. 30, 2018
Jun. 30, 2017
Employee Service Share-based Compensation, Allocation of Recognized Period Costs [Line Items]      
Stock-based compensation expense $ 2,890 $ 3,208 $ 2,785
Cost of revenues      
Employee Service Share-based Compensation, Allocation of Recognized Period Costs [Line Items]      
Stock-based compensation expense 347 360 264
Research and development      
Employee Service Share-based Compensation, Allocation of Recognized Period Costs [Line Items]      
Stock-based compensation expense 2,045 1,873 1,861
Sales, general and administrative      
Employee Service Share-based Compensation, Allocation of Recognized Period Costs [Line Items]      
Stock-based compensation expense $ 498 $ 975 $ 660