@@ -5,7 +5,6 @@ import { createUseStyles } from 'react-jss';
55
66import {
77 Grid ,
8- Row ,
98 Column ,
109 Button ,
1110 FormGroup ,
@@ -14,9 +13,8 @@ import {
1413 StructuredListRow ,
1514 StructuredListBody ,
1615 StructuredListCell ,
17- TooltipIcon ,
18- } from 'carbon-components-react' ;
19- import { CheckmarkFilled16 , ChevronRight32 , ChevronLeft32 , CaretSortDown32 , CaretSortUp32 } from '@carbon/icons-react' ;
16+ } from '@carbon/react' ;
17+ import { CheckmarkFilled , ChevronRight , ChevronLeft , CaretSortDown , CaretSortUp } from '@carbon/react/icons' ;
2018
2119import { buildLabel } from '../prepare-props' ;
2220
@@ -50,9 +48,13 @@ const useStyles = createUseStyles({
5048 } ,
5149 toolbar : {
5250 display : 'flex' ,
51+ '& .cds--tooltip-trigger__wrapper' : {
52+ height : '100%' ,
53+ } ,
5354 } ,
5455 tooltipButton : {
5556 background : '#c2c1c1 !important' ,
57+ height : '100%' ,
5658 } ,
5759} ) ;
5860
@@ -72,18 +74,16 @@ const List = ({ options, selectedValues, handleOptionsClick, noTitle, ListProps,
7274 return options . length > 0 ? (
7375 < StructuredListWrapper selection { ...ListProps } className = { clsx ( dualList , ListProps . className ) } >
7476 < StructuredListBody { ...BodyProps } className = { clsx ( dualListBody , BodyProps . className ) } >
75- { options . map ( ( { value, label, ListRowProps, ListCellProps, GridProps, RowProps , LabelProps, CheckmarkProps } ) => (
77+ { options . map ( ( { value, label, ListRowProps, ListCellProps, GridProps, LabelProps, CheckmarkProps } ) => (
7678 < StructuredListRow key = { value } { ...ListRowProps } onClick = { ( e ) => handleOptionsClick ( { ...e , ctrlKey : true } , value ) } >
7779 < StructuredListCell { ...ListCellProps } >
78- < Grid { ...GridProps } >
79- < Row narrow { ...RowProps } >
80- < Column sm = { 3 } { ...LabelProps } >
81- { label }
82- </ Column >
83- < Column sm = { 1 } { ...CheckmarkProps } >
84- { selectedValues . includes ( value ) && < CheckmarkFilled16 /> }
85- </ Column >
86- </ Row >
80+ < Grid condensed { ...GridProps } >
81+ < Column sm = { 3 } { ...LabelProps } >
82+ { label }
83+ </ Column >
84+ < Column sm = { 1 } { ...CheckmarkProps } >
85+ { selectedValues . includes ( value ) && < CheckmarkFilled size = { 16 } /> }
86+ </ Column >
8787 </ Grid >
8888 </ StructuredListCell >
8989 </ StructuredListRow >
@@ -101,9 +101,18 @@ const Toolbar = ({ sortTitle, onFilter, onSort, sortDirection, placeholder, Tool
101101 return (
102102 < div { ...ToolbarProps } className = { clsx ( toolbar , ToolbarProps . className ) } >
103103 < Search onChange = { ( e ) => onFilter ( e . target . value ) } labelText = "" placeholder = { placeholder } { ...SearchProps } />
104- < TooltipIcon onClick = { onSort } tooltipText = { sortTitle } { ...SortProps } className = { clsx ( tooltipButton , SortProps . className ) } >
105- { sortDirection ? < CaretSortDown32 /> : < CaretSortUp32 /> }
106- </ TooltipIcon >
104+ < Button
105+ kind = "ghost"
106+ size = "sm"
107+ hasIconOnly
108+ onClick = { onSort }
109+ iconDescription = { sortTitle }
110+ renderIcon = { ( props ) => ( sortDirection ? < CaretSortDown size = { 32 } { ...props } /> : < CaretSortUp size = { 32 } { ...props } /> ) }
111+ tooltipAlignment = "center"
112+ tooltipPosition = "bottom"
113+ { ...SortProps }
114+ className = { clsx ( tooltipButton , SortProps . className ) }
115+ />
107116 </ div >
108117 ) ;
109118} ;
@@ -146,7 +155,6 @@ const DualListSelectInner = ({
146155 filterValueText = 'Remove your filter to see all selected' ,
147156 FormGroupProps = { } ,
148157 GridProps = { } ,
149- RowProps = { } ,
150158 OptionsColumnProps = { } ,
151159 ButtonColumnProps = { } ,
152160 ValuesColumnProps = { } ,
@@ -169,77 +177,75 @@ const DualListSelectInner = ({
169177
170178 return (
171179 < FormGroup legendText = { buildLabel ( label || '' , isRequired ) } { ...FormGroupProps } >
172- < Grid { ...GridProps } >
173- < Row condensed { ...RowProps } >
174- < Column sm = { 4 } md = { 8 } lg = { 5 } { ...OptionsColumnProps } >
175- { React . createElement ( LeftTitleElement , LeftTitleProps , leftTitle ) }
176- < Toolbar
177- onFilter = { filterOptions }
178- placeholder = { filterOptionsTitle }
179- sortDirection = { state . sortLeftDesc }
180- onSort = { sortOptions }
181- sortTitle = { sortOptionsTitle }
182- ToolbarProps = { LeftToolbarProps }
183- SearchProps = { LeftSearchProps }
184- SortProps = { LeftSortProps }
185- />
186- < List
187- ListProps = { LeftListProps }
188- BodyProps = { LeftBodyProps }
189- options = { leftValues }
190- selectedValues = { state . selectedLeftValues }
191- handleOptionsClick = { handleOptionsClick }
192- noTitle = { state . filterOptions ? filterOptionsText : noOptionsTitle }
193- />
194- </ Column >
195- < Column sm = { 4 } md = { 8 } lg = { 2 } { ...ButtonColumnProps } className = { clsx ( buttonWrapper , ButtonColumnProps . className ) } >
196- < Button
197- id = "move-right"
198- renderIcon = { ChevronRight32 }
199- onClick = { handleMoveRight }
200- disabled = { isEmpty ( state . selectedLeftValues ) }
201- { ...AddButtonProps }
202- >
203- { moveRightTitle }
204- </ Button >
205- < Button id = "move-all-right" onClick = { handleClearLeftValues } disabled = { isEmpty ( leftValues ) } { ...AddAllButtonProps } >
206- { moveAllRightTitle }
207- </ Button >
208- < Button id = "move-all-left" onClick = { handleClearRightValues } disabled = { isEmpty ( rightValues ) } { ...RemoveAllButtonProps } >
209- { moveAllLeftTitle }
210- </ Button >
211- < Button
212- id = "move-left"
213- renderIcon = { ChevronLeft32 }
214- onClick = { handleMoveLeft }
215- disabled = { isEmpty ( state . selectedRightValues ) }
216- { ...RemoveButtonProps }
217- >
218- { moveLeftTitle }
219- </ Button >
220- </ Column >
221- < Column sm = { 4 } md = { 8 } lg = { 5 } { ...ValuesColumnProps } >
222- { React . createElement ( RightTitleElement , RightTitleProps , rightTitle ) }
223- < Toolbar
224- onFilter = { filterValues }
225- placeholder = { filterValuesTitle }
226- sortDirection = { state . sortRightDesc }
227- onSort = { sortValues }
228- sortTitle = { sortValuesTitle }
229- ToolbarProps = { RightToolbarProps }
230- SearchProps = { RightSearchProps }
231- SortProps = { RightSortProps }
232- />
233- < List
234- ListProps = { RightListProps }
235- BodyProps = { RightBodyProps }
236- options = { rightValues }
237- selectedValues = { state . selectedRightValues }
238- handleOptionsClick = { handleValuesClick }
239- noTitle = { state . filterValue ? filterValueText : noValueTitle }
240- />
241- </ Column >
242- </ Row >
180+ < Grid condensed { ...GridProps } >
181+ < Column sm = { 4 } md = { 8 } lg = { 5 } { ...OptionsColumnProps } >
182+ { React . createElement ( LeftTitleElement , LeftTitleProps , leftTitle ) }
183+ < Toolbar
184+ onFilter = { filterOptions }
185+ placeholder = { filterOptionsTitle }
186+ sortDirection = { state . sortLeftDesc }
187+ onSort = { sortOptions }
188+ sortTitle = { sortOptionsTitle }
189+ ToolbarProps = { LeftToolbarProps }
190+ SearchProps = { LeftSearchProps }
191+ SortProps = { LeftSortProps }
192+ />
193+ < List
194+ ListProps = { LeftListProps }
195+ BodyProps = { LeftBodyProps }
196+ options = { leftValues }
197+ selectedValues = { state . selectedLeftValues }
198+ handleOptionsClick = { handleOptionsClick }
199+ noTitle = { state . filterOptions ? filterOptionsText : noOptionsTitle }
200+ />
201+ </ Column >
202+ < Column sm = { 4 } md = { 8 } lg = { 4 } { ...ButtonColumnProps } className = { clsx ( buttonWrapper , ButtonColumnProps . className ) } >
203+ < Button
204+ id = "move-right"
205+ renderIcon = { ( props ) => < ChevronRight size = { 32 } { ...props } /> }
206+ onClick = { handleMoveRight }
207+ disabled = { isEmpty ( state . selectedLeftValues ) }
208+ { ...AddButtonProps }
209+ >
210+ { moveRightTitle }
211+ </ Button >
212+ < Button id = "move-all-right" onClick = { handleClearLeftValues } disabled = { isEmpty ( leftValues ) } { ...AddAllButtonProps } >
213+ { moveAllRightTitle }
214+ </ Button >
215+ < Button id = "move-all-left" onClick = { handleClearRightValues } disabled = { isEmpty ( rightValues ) } { ...RemoveAllButtonProps } >
216+ { moveAllLeftTitle }
217+ </ Button >
218+ < Button
219+ id = "move-left"
220+ renderIcon = { ( props ) => < ChevronLeft size = { 32 } { ...props } /> }
221+ onClick = { handleMoveLeft }
222+ disabled = { isEmpty ( state . selectedRightValues ) }
223+ { ...RemoveButtonProps }
224+ >
225+ { moveLeftTitle }
226+ </ Button >
227+ </ Column >
228+ < Column sm = { 4 } md = { 8 } lg = { 5 } { ...ValuesColumnProps } >
229+ { React . createElement ( RightTitleElement , RightTitleProps , rightTitle ) }
230+ < Toolbar
231+ onFilter = { filterValues }
232+ placeholder = { filterValuesTitle }
233+ sortDirection = { state . sortRightDesc }
234+ onSort = { sortValues }
235+ sortTitle = { sortValuesTitle }
236+ ToolbarProps = { RightToolbarProps }
237+ SearchProps = { RightSearchProps }
238+ SortProps = { RightSortProps }
239+ />
240+ < List
241+ ListProps = { RightListProps }
242+ BodyProps = { RightBodyProps }
243+ options = { rightValues }
244+ selectedValues = { state . selectedRightValues }
245+ handleOptionsClick = { handleValuesClick }
246+ noTitle = { state . filterValue ? filterValueText : noValueTitle }
247+ />
248+ </ Column >
243249 </ Grid >
244250 </ FormGroup >
245251 ) ;
0 commit comments