diff --git a/packages/pn-commons/src/components/CustomTooltip.tsx b/packages/pn-commons/src/components/CustomTooltip.tsx index 1983585583..4713cdacd5 100644 --- a/packages/pn-commons/src/components/CustomTooltip.tsx +++ b/packages/pn-commons/src/components/CustomTooltip.tsx @@ -17,7 +17,6 @@ const CustomTooltip: React.FC = ({ onOpen, tooltipProps, }) => { - // tooltip state const [open, setOpen] = useState(false); const handleTooltipClose = () => { if (openOnClick) { @@ -30,16 +29,14 @@ const CustomTooltip: React.FC = ({ setOpen(!open); } }; - const tooltipId = `tooltip-${Math.random().toString(36).substr(2, 9)}`; // Genera un ID unico per ogni tooltip + const tooltipId = `tooltip-${Math.random().toString(36).substr(2, 9)}`; - // Funzione per gestire il focus su tastiera const handleFocus = () => { - handleTooltipOpen(); // Apre il tooltip quando l'elemento riceve il focus + handleTooltipOpen(); }; - // Funzione per gestire il mouseover const handleMouseOver = () => { - handleTooltipOpen(); // Apre il tooltip quando il mouse passa sopra l'elemento + handleTooltipOpen(); }; return ( @@ -52,20 +49,20 @@ const CustomTooltip: React.FC = ({ disableHoverListener={openOnClick} enterTouchDelay={0} onOpen={onOpen} - aria-live="polite" // Tooltip letto dal lettore di schermo quando visibile - aria-describedby={open ? tooltipId : undefined} // Associa il tooltip se visibile + aria-live="polite" + aria-describedby={open ? tooltipId : undefined} {...tooltipProps} > {openOnClick ? cloneElement(children, { - onClick: () => handleTooltipOpen(), // Apre il tooltip su click - 'aria-describedby': tooltipId, // Associa il tooltip all'elemento + onClick: () => handleTooltipOpen(), + 'aria-describedby': tooltipId, }) : cloneElement(children, { - onFocus: handleFocus, // Apre il tooltip su focus - onMouseOver: handleMouseOver, // Apre il tooltip su mouseover + onFocus: handleFocus, + onMouseOver: handleMouseOver, 'aria-describedby': tooltipId, - tabIndex: 0, // Associa il tooltip all'elemento + tabIndex: 0, })} ); diff --git a/packages/pn-commons/src/components/Data/PnTable/PnTableBodyCell.tsx b/packages/pn-commons/src/components/Data/PnTable/PnTableBodyCell.tsx index 06803d49d3..ae675f84f6 100644 --- a/packages/pn-commons/src/components/Data/PnTable/PnTableBodyCell.tsx +++ b/packages/pn-commons/src/components/Data/PnTable/PnTableBodyCell.tsx @@ -1,21 +1,12 @@ import { Box, SxProps, TableCell } from '@mui/material'; -/* import { ButtonNaked } from '@pagopa/mui-italia'; - -import { buttonNakedInheritStyle } from '../../../utility'; */ export type PnTableBodyCellProps = { testId?: string; cellProps?: SxProps; - // onClick?: () => void; children: React.ReactNode; }; -const PnTableBodyCell: React.FC = ({ - testId, - cellProps, - children, - // onClick, -}) => ( +const PnTableBodyCell: React.FC = ({ testId, cellProps, children }) => ( = ({ ...cellProps!, borderBottom: 'none', }} - // onClick={onClick} > - {/* {onClick && ( - <> - {/* Even there is a onClick function on the TableCell, leave ButtonNaked below as is. - This makes spacebar key with accessibility to trigger the onClick function. - The ButtonNaked "inherits" the onClick action from the outer TableCell, so that is not necessary to replicate it. } - {children} - - )} */} - {/* !onClick && {children} */} {children} ); diff --git a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyCell.test.tsx b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyCell.test.tsx index 404615ac7c..608782d94e 100644 --- a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyCell.test.tsx +++ b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyCell.test.tsx @@ -4,8 +4,6 @@ import PnTableBodyCell from '../PnTableBodyCell'; describe('PnTableBodyCell', () => { disableConsoleLogging('error'); - // const mockFn = vi.fn(); - it('render component', () => { const { container, queryByTestId } = render( mocke-cell-content @@ -14,18 +12,4 @@ describe('PnTableBodyCell', () => { const buttons = queryByTestId('cell.button'); expect(buttons).not.toBeInTheDocument(); }); - - /* it('click cell event', () => { - const { getByTestId } = render( - mockFn()} - > - mocke-cell-content - - ); - const cell = getByTestId('cell'); - fireEvent.click(cell); - expect(mockFn).toBeCalledTimes(1); - }); */ }); diff --git a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartData.test.tsx b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartData.test.tsx index 62ac28325c..c9836d813f 100644 --- a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartData.test.tsx +++ b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartData.test.tsx @@ -150,12 +150,6 @@ describe('SmartData', () => { const sortToggle = within(table).getByTestId(`headerCellDesktop.sort.${sortableColumn!.id}`); fireEvent.click(sortToggle); expect(handleSort).toHaveBeenCalledTimes(1); - /* const clickableColumnIdx = smartCfg.findIndex((cfg) => cfg.tableConfiguration.onClick); - const rows = within(table).getAllByTestId('bodyRowDesktop'); - // we can take the row we want - const cells = within(rows[0]).getAllByTestId('rowCellDesktop'); - fireEvent.click(cells[clickableColumnIdx]); - expect(handleColumnClick).toHaveBeenCalledTimes(1); */ }); it('no sort available (desktop version)', () => { diff --git a/packages/pn-commons/src/components/Data/__test__/PnTable.test.tsx b/packages/pn-commons/src/components/Data/__test__/PnTable.test.tsx index c63978171e..153edd6488 100644 --- a/packages/pn-commons/src/components/Data/__test__/PnTable.test.tsx +++ b/packages/pn-commons/src/components/Data/__test__/PnTable.test.tsx @@ -102,29 +102,6 @@ describe('PnTable Component', () => { }); }); - /* it('sorts a column', () => { - const { getByRole } = render(); - const table = getByRole('table'); - const tableHead = within(table).getByTestId('table-test.header'); - const firstColumn = within(tableHead).getAllByTestId('table-test.header.cell')[0]; - const sortButton = within(firstColumn).getByRole('button'); - expect(sortButton).toBeInTheDocument(); - fireEvent.click(sortButton); - expect(handleSort).toBeCalledTimes(1); - expect(handleSort).toBeCalledWith({ order: 'desc', orderBy: 'column-1' }); - }); - - it('click on a column', () => { - const { getByRole } = render(); - const table = getByRole('table'); - const tableBody = within(table).getByTestId('table-test.body'); - const firstRow = within(tableBody).getAllByTestId('table-test.body.row')[0]; - const tableColumns = within(firstRow).getAllByTestId('table-test.body.row.cell'); - fireEvent.click(tableColumns[2].querySelectorAll('button')[0]); - expect(handleColumnClick).toHaveBeenCalledTimes(1); - expect(handleColumnClick).toHaveBeenCalledWith(rows[0], columns[2].id); - }); */ - it('render component - multiple PnTableBody', () => { expect(() => render( @@ -133,12 +110,7 @@ describe('PnTable Component', () => { {rows.map((row, index) => ( {columns.map((column) => ( - column.onClick?.()} - > - {row[column.id]} - + {row[column.id]} ))} ))} @@ -147,12 +119,7 @@ describe('PnTable Component', () => { {rows.map((row, index) => ( {columns.map((column) => ( - column.onClick?.()} - > - {row[column.id]} - + {row[column.id]} ))} ))} diff --git a/packages/pn-commons/src/components/Data/__test__/SmartTable.test.tsx b/packages/pn-commons/src/components/Data/__test__/SmartTable.test.tsx index a1647e37c8..074e4617c2 100644 --- a/packages/pn-commons/src/components/Data/__test__/SmartTable.test.tsx +++ b/packages/pn-commons/src/components/Data/__test__/SmartTable.test.tsx @@ -115,11 +115,7 @@ const RenderSmartable: React.FC<{ @@ -231,11 +227,7 @@ describe('Smart Table Component', () => { diff --git a/packages/pn-commons/src/components/Notifications/StatusTooltip.tsx b/packages/pn-commons/src/components/Notifications/StatusTooltip.tsx index e754c0b2b3..caaf16e5c9 100644 --- a/packages/pn-commons/src/components/Notifications/StatusTooltip.tsx +++ b/packages/pn-commons/src/components/Notifications/StatusTooltip.tsx @@ -34,7 +34,7 @@ const StatusTooltip = ({ }} data-testid={`statusChip-${label}`} aria-label={isMobile ? `${label}: ${tooltip}` : undefined} - aria-describedby={`tooltip-${label}`} // Associa il chip al tooltip + aria-describedby={`tooltip-${label}`} /> ); diff --git a/packages/pn-commons/src/components/Pagination/CustomPagination.tsx b/packages/pn-commons/src/components/Pagination/CustomPagination.tsx index 573eb99efe..50b692eccf 100644 --- a/packages/pn-commons/src/components/Pagination/CustomPagination.tsx +++ b/packages/pn-commons/src/components/Pagination/CustomPagination.tsx @@ -195,7 +195,7 @@ export default function CustomPagination({ : props2.type } {...props2} - // sx={{ border: 'none' }} + sx={{ border: 'none' }} /> ); }} diff --git a/packages/pn-pa-webapp/src/components/Notifications/DesktopNotifications.tsx b/packages/pn-pa-webapp/src/components/Notifications/DesktopNotifications.tsx index 2796bee11d..5044ce8091 100644 --- a/packages/pn-pa-webapp/src/components/Notifications/DesktopNotifications.tsx +++ b/packages/pn-pa-webapp/src/components/Notifications/DesktopNotifications.tsx @@ -14,7 +14,6 @@ import { PnTableBodyRow, PnTableHeader, PnTableHeaderCell, - // Row, Sort, } from '@pagopa-pn/pn-commons'; @@ -154,7 +153,6 @@ const DesktopNotifications = ({ const showFilters = notifications?.length > 0 || filtersApplied; - // Navigation handlers const handleRowClick = (iun: string) => { navigate(routes.GET_DETTAGLIO_NOTIFICA_PATH(iun)); }; @@ -190,10 +188,8 @@ const DesktopNotifications = ({ {columns.map((column) => ( handleRowClick(row)} cellProps={{ ...column.cellProps, - // cursor: 'pointer', }} > 0 || filtersApplied; - // Navigation handlers const handleRowClick = (iun: string, mandateId?: string) => { if (isDelegatedPage && mandateId) { navigate(routes.GET_DETTAGLIO_NOTIFICA_DELEGATO_PATH(iun, mandateId)); @@ -163,10 +162,8 @@ const DesktopNotifications = ({ {columns.map((column) => ( handleRowClick(row)} cellProps={{ ...column.cellProps, - // cursor: 'pointer', }} >