@@ -4,19 +4,21 @@ import { followCursor } from 'tippy.js'
4
4
5
5
import { ReactComponent as ICCross } from '@Icons/ic-cross.svg'
6
6
import { Tooltip } from '@Common/Tooltip'
7
-
8
7
import { ConditionalWrap } from '@Common/Helper'
9
8
import { ResizableTagTextArea } from '@Common/CustomTagSelector'
9
+ import { ComponentSizeType } from '@Shared/constants'
10
+
11
+ import { Button , ButtonStyleType , ButtonVariantType } from '../Button'
10
12
import { SelectTextArea } from '../SelectTextArea'
11
13
import {
12
14
getSelectPickerOptionByValue ,
13
15
SelectPicker ,
14
16
SelectPickerOptionType ,
15
17
SelectPickerVariantType ,
16
18
} from '../SelectPicker'
19
+ import { FileUpload } from '../FileUpload'
17
20
import { getActionButtonPosition , getRowGridTemplateColumn , rowTypeHasInputField } from './utils'
18
21
import { DynamicDataTableRowType , DynamicDataTableRowProps , DynamicDataTableRowDataType } from './types'
19
- import { FileUpload } from '../FileUpload'
20
22
21
23
const conditionalWrap =
22
24
< K extends string , CustomStateType = Record < string , unknown > > (
@@ -214,7 +216,7 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
214
216
215
217
const renderCellIcon = ( row : DynamicDataTableRowType < K , CustomStateType > , key : K , isLeadingIcon ?: boolean ) => {
216
218
const iconConfig = isLeadingIcon ? leadingCellIcon : trailingCellIcon
217
- if ( ! iconConfig ?. [ key ] ) {
219
+ if ( ! iconConfig ?. [ key ] ?. ( row ) ) {
218
220
return null
219
221
}
220
222
@@ -256,8 +258,9 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
256
258
257
259
const cellNode = (
258
260
< Tooltip
259
- alwaysShowTippyOnHover = { ! ! row . data [ key ] . tooltipText || isDisabled }
260
- content = { row . data [ key ] . tooltipText || ( isDisabled ? 'Cannot edit in read-only mode' : '' ) }
261
+ alwaysShowTippyOnHover = { ! ! row . data [ key ] . tooltip ?. content || isDisabled }
262
+ className = { row . data [ key ] . tooltip ?. className }
263
+ content = { row . data [ key ] . tooltip ?. content || ( isDisabled ? 'Cannot edit in read-only mode' : '' ) }
261
264
followCursor = "horizontal"
262
265
plugins = { [ followCursor ] }
263
266
>
@@ -308,14 +311,19 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
308
311
< Fragment key = { key } > { renderCell ( row , key , index ) } </ Fragment >
309
312
) ) }
310
313
{ ! isDeletionNotAllowed && ! readOnly && (
311
- < button
312
- type = "button"
313
- className = { `dynamic-data-table__row-delete-btn dc__unset-button-styles dc__align-self-stretch dc__no-shrink flex py-10 px-8 bcn-0 ${ disableDeleteRow || row . disableDelete ? 'dc__disabled' : 'dc__hover-n50 dc__tab-focus' } ` }
314
- onClick = { onDelete ( row ) }
315
- disabled = { disableDeleteRow || row . disableDelete }
316
- >
317
- < ICCross aria-label = "delete-row" className = "icon-dim-16 fcn-4 dc__align-self-start" />
318
- </ button >
314
+ < div className = "dynamic-data-table__row-delete-btn bcn-0" >
315
+ < Button
316
+ dataTestId = "dynamic-data-table-row-delete-btn"
317
+ ariaLabel = "Delete Row"
318
+ showAriaLabelInTippy = { false }
319
+ icon = { < ICCross /> }
320
+ disabled = { disableDeleteRow || row . disableDelete }
321
+ onClick = { onDelete ( row ) }
322
+ variant = { ButtonVariantType . borderLess }
323
+ style = { ButtonStyleType . negativeGrey }
324
+ size = { ComponentSizeType . small }
325
+ />
326
+ </ div >
319
327
) }
320
328
</ div >
321
329
) ) }
0 commit comments