@coveord/plasma-mantine 52.9.0 → 52.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +33 -32
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/components/code-editor/CodeEditor.d.ts.map +1 -1
  5. package/dist/cjs/components/code-editor/CodeEditor.js +4 -2
  6. package/dist/cjs/components/code-editor/CodeEditor.js.map +1 -1
  7. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.d.ts.map +1 -1
  8. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js +2 -1
  9. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  10. package/dist/cjs/components/table/Table.d.ts.map +1 -1
  11. package/dist/cjs/components/table/Table.js +23 -12
  12. package/dist/cjs/components/table/Table.js.map +1 -1
  13. package/dist/cjs/components/table/Table.styles.d.ts.map +1 -1
  14. package/dist/cjs/components/table/Table.styles.js +1 -10
  15. package/dist/cjs/components/table/Table.styles.js.map +1 -1
  16. package/dist/cjs/components/table/Table.types.d.ts +14 -3
  17. package/dist/cjs/components/table/Table.types.d.ts.map +1 -1
  18. package/dist/cjs/components/table/TableFooter.js +2 -2
  19. package/dist/cjs/components/table/TableFooter.js.map +1 -1
  20. package/dist/cjs/components/table/TableHeader.js +1 -1
  21. package/dist/cjs/components/table/TableHeader.js.map +1 -1
  22. package/dist/cjs/components/table/TableLastUpdated.d.ts +24 -0
  23. package/dist/cjs/components/table/TableLastUpdated.d.ts.map +1 -0
  24. package/dist/cjs/components/table/TableLastUpdated.js +73 -0
  25. package/dist/cjs/components/table/TableLastUpdated.js.map +1 -0
  26. package/dist/cjs/components/table/TablePagination.d.ts.map +1 -1
  27. package/dist/cjs/components/table/TablePagination.js +1 -0
  28. package/dist/cjs/components/table/TablePagination.js.map +1 -1
  29. package/dist/cjs/components/table/TablePerPage.js +3 -1
  30. package/dist/cjs/components/table/TablePerPage.js.map +1 -1
  31. package/dist/cjs/components/table/layouts/RowLayout.d.ts.map +1 -1
  32. package/dist/cjs/components/table/layouts/RowLayout.js +41 -9
  33. package/dist/cjs/components/table/layouts/RowLayout.js.map +1 -1
  34. package/dist/cjs/components/table/useRowSelection.d.ts +2 -2
  35. package/dist/cjs/components/table/useRowSelection.d.ts.map +1 -1
  36. package/dist/cjs/components/table/useRowSelection.js +8 -3
  37. package/dist/cjs/components/table/useRowSelection.js.map +1 -1
  38. package/dist/esm/components/code-editor/CodeEditor.d.ts.map +1 -1
  39. package/dist/esm/components/code-editor/CodeEditor.js +4 -2
  40. package/dist/esm/components/code-editor/CodeEditor.js.map +1 -1
  41. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.d.ts.map +1 -1
  42. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js +2 -1
  43. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  44. package/dist/esm/components/table/Table.d.ts.map +1 -1
  45. package/dist/esm/components/table/Table.js +25 -14
  46. package/dist/esm/components/table/Table.js.map +1 -1
  47. package/dist/esm/components/table/Table.styles.d.ts.map +1 -1
  48. package/dist/esm/components/table/Table.styles.js +1 -10
  49. package/dist/esm/components/table/Table.styles.js.map +1 -1
  50. package/dist/esm/components/table/Table.types.d.ts +14 -3
  51. package/dist/esm/components/table/Table.types.d.ts.map +1 -1
  52. package/dist/esm/components/table/Table.types.js.map +1 -1
  53. package/dist/esm/components/table/TableFooter.js +2 -2
  54. package/dist/esm/components/table/TableFooter.js.map +1 -1
  55. package/dist/esm/components/table/TableHeader.js +1 -1
  56. package/dist/esm/components/table/TableHeader.js.map +1 -1
  57. package/dist/esm/components/table/TableLastUpdated.d.ts +24 -0
  58. package/dist/esm/components/table/TableLastUpdated.d.ts.map +1 -0
  59. package/dist/esm/components/table/TableLastUpdated.js +62 -0
  60. package/dist/esm/components/table/TableLastUpdated.js.map +1 -0
  61. package/dist/esm/components/table/TablePagination.d.ts.map +1 -1
  62. package/dist/esm/components/table/TablePagination.js +1 -0
  63. package/dist/esm/components/table/TablePagination.js.map +1 -1
  64. package/dist/esm/components/table/TablePerPage.js +3 -1
  65. package/dist/esm/components/table/TablePerPage.js.map +1 -1
  66. package/dist/esm/components/table/layouts/RowLayout.d.ts.map +1 -1
  67. package/dist/esm/components/table/layouts/RowLayout.js +42 -10
  68. package/dist/esm/components/table/layouts/RowLayout.js.map +1 -1
  69. package/dist/esm/components/table/useRowSelection.d.ts +2 -2
  70. package/dist/esm/components/table/useRowSelection.d.ts.map +1 -1
  71. package/dist/esm/components/table/useRowSelection.js +8 -3
  72. package/dist/esm/components/table/useRowSelection.js.map +1 -1
  73. package/package.json +2 -2
  74. package/src/__tests__/VitestSetup.ts +12 -0
  75. package/src/components/code-editor/CodeEditor.tsx +4 -2
  76. package/src/components/code-editor/__tests__/CodeEditor.spec.tsx +1 -0
  77. package/src/components/date-range-picker/DateRangePickerPresetSelect.tsx +1 -0
  78. package/src/components/date-range-picker/__tests__/DateRangePickerInlineCalendar.spec.tsx +2 -0
  79. package/src/components/date-range-picker/__tests__/DateRangePickerPopoverCalendar.spec.tsx +4 -19
  80. package/src/components/date-range-picker/__tests__/EditableDateRangePicker.spec.tsx +3 -3
  81. package/src/components/modal-wizard/__tests__/ModalWizard.spec.tsx +19 -4
  82. package/src/components/table/Table.styles.ts +0 -9
  83. package/src/components/table/Table.tsx +22 -13
  84. package/src/components/table/Table.types.ts +14 -3
  85. package/src/components/table/TableFooter.tsx +1 -1
  86. package/src/components/table/TableHeader.tsx +1 -1
  87. package/src/components/table/TableLastUpdated.tsx +51 -0
  88. package/src/components/table/TablePagination.tsx +1 -0
  89. package/src/components/table/TablePerPage.tsx +3 -3
  90. package/src/components/table/__tests__/Table.spec.tsx +44 -5
  91. package/src/components/table/__tests__/TableActions.spec.tsx +4 -3
  92. package/src/components/table/__tests__/TableDateRangePicker.spec.tsx +26 -59
  93. package/src/components/table/__tests__/TableLastUpdated.spec.tsx +97 -0
  94. package/src/components/table/__tests__/TablePredicate.spec.tsx +7 -55
  95. package/src/components/table/layouts/RowLayout.tsx +45 -11
  96. package/src/components/table/useRowSelection.ts +13 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/table/layouts/RowLayout.tsx"],"sourcesContent":["import {ListSize16Px} from '@coveord/plasma-react-icons';\nimport {Box, Collapse, createStyles} from '@mantine/core';\nimport {flexRender} from '@tanstack/react-table';\nimport {defaultColumnSizing} from '@tanstack/table-core';\nimport {Fragment} from 'react';\nimport {TableLayout, TableLayoutProps} from '../Table.types';\nimport {TableCollapsibleColumn} from '../TableCollapsibleColumn';\nimport {useTable} from '../TableContext';\nimport {TableLoading} from '../TableLoading';\nimport {Th} from '../Th';\n\ninterface TableStylesParams {\n multiRowSelectionEnabled: boolean;\n disableRowSelection: boolean;\n}\n\nconst useStyles = createStyles<string, TableStylesParams>((theme, {multiRowSelectionEnabled, disableRowSelection}) => {\n const rowBackgroundColor =\n theme.colorScheme === 'dark'\n ? theme.fn.rgba(theme.colors[theme.primaryColor][7], 0.2)\n : theme.colors[theme.primaryColor][0];\n return {\n headerColumns: {\n '& th:first-of-type > *': {\n paddingLeft: theme.spacing.xl,\n },\n\n '& input[type=checkbox]': {\n backgroundColor: disableRowSelection ? `${theme.colors.gray[2]}` : undefined,\n borderColor: disableRowSelection ? `${theme.colors.gray[3]}` : `${theme.colors.gray[4]}`,\n pointerEvents: disableRowSelection ? 'none' : 'auto',\n cursor: disableRowSelection ? 'not-allowed' : 'default',\n\n '& + svg': {\n color: disableRowSelection ? `${theme.colors.gray[5]}` : 'inherit',\n },\n },\n },\n\n rowSelected: {\n backgroundColor: multiRowSelectionEnabled ? undefined : rowBackgroundColor,\n },\n\n rowUnselectable: {\n '& input[type=checkbox]': {\n backgroundColor: `${theme.colors.gray[2]}`,\n borderColor: `${theme.colors.gray[3]}`,\n pointerEvents: 'none',\n cursor: 'not-allowed',\n\n '&:checked + svg': {\n color: `${theme.colors.gray[5]}`,\n },\n },\n },\n\n rowCollapsibleButtonCell: {\n textAlign: 'right',\n padding: `calc(${theme.spacing.xs}/2) ${theme.spacing.sm} !important`,\n },\n\n row: {\n '&:hover': {\n backgroundColor: rowBackgroundColor,\n },\n },\n };\n});\n\nconst RowLayoutHeader = <T,>({table}: TableLayoutProps<T>) => {\n const {multiRowSelectionEnabled, disableRowSelection} = useTable();\n const {classes} = useStyles({disableRowSelection, multiRowSelectionEnabled});\n const headers = table.getHeaderGroups().map((headerGroup) => (\n <tr key={headerGroup.id} className={classes.headerColumns}>\n {headerGroup.headers.map((columnHeader) => (\n <Th key={columnHeader.id} header={columnHeader} />\n ))}\n </tr>\n ));\n return <>{headers}</>;\n};\n\nconst RowLayoutBody = <T,>({table, doubleClickAction, getExpandChildren, loading}: TableLayoutProps<T>) => {\n const {multiRowSelectionEnabled, disableRowSelection} = useTable();\n const {classes, cx} = useStyles({disableRowSelection, multiRowSelectionEnabled});\n\n const rows = table.getRowModel().rows.map((row) => {\n const rowChildren = getExpandChildren?.(row.original) ?? null;\n const isSelected = !!row.getIsSelected();\n\n return (\n <Fragment key={row.id}>\n <tr\n onClick={() => (disableRowSelection ? undefined : row.toggleSelected())}\n onDoubleClick={() => doubleClickAction?.(row.original)}\n className={cx(classes.row, {\n [classes.rowSelected]: isSelected,\n [classes.rowUnselectable]: disableRowSelection,\n })}\n aria-selected={isSelected}\n >\n {row.getVisibleCells().map((cell) => {\n const size = cell.column.getSize();\n const width = size !== defaultColumnSizing.size ? size : undefined;\n return (\n <td\n key={cell.id}\n style={{width}}\n className={cx({\n [classes.rowCollapsibleButtonCell]: cell.column.id === TableCollapsibleColumn.id,\n })}\n >\n <TableLoading visible={loading}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableLoading>\n </td>\n );\n })}\n </tr>\n {rowChildren ? (\n <tr>\n <td\n colSpan={table.getAllColumns().length}\n style={{\n padding: 0,\n borderTop: row.getIsExpanded() ? undefined : 'none',\n borderBottom: row.getIsExpanded() ? undefined : 'none',\n }}\n >\n <Collapse in={row.getIsExpanded()}>\n <Box px=\"sm\" py=\"xs\">\n {rowChildren}\n </Box>\n </Collapse>\n </td>\n </tr>\n ) : null}\n </Fragment>\n );\n });\n\n return <>{rows}</>;\n};\n\nexport const RowLayout: TableLayout = {\n name: 'Rows',\n icon: ListSize16Px,\n Header: RowLayoutHeader,\n Body: RowLayoutBody,\n};\n"],"names":["ListSize16Px","Box","Collapse","createStyles","flexRender","defaultColumnSizing","Fragment","TableCollapsibleColumn","useTable","TableLoading","Th","useStyles","theme","multiRowSelectionEnabled","disableRowSelection","rowBackgroundColor","colorScheme","fn","rgba","colors","primaryColor","headerColumns","paddingLeft","spacing","xl","backgroundColor","gray","undefined","borderColor","pointerEvents","cursor","color","rowSelected","rowUnselectable","rowCollapsibleButtonCell","textAlign","padding","xs","sm","row","RowLayoutHeader","table","classes","headers","getHeaderGroups","map","headerGroup","tr","className","columnHeader","header","id","RowLayoutBody","doubleClickAction","getExpandChildren","loading","cx","rows","getRowModel","rowChildren","original","isSelected","getIsSelected","onClick","toggleSelected","onDoubleClick","aria-selected","getVisibleCells","cell","size","column","getSize","width","td","style","visible","columnDef","getContext","colSpan","getAllColumns","length","borderTop","getIsExpanded","borderBottom","in","px","py","RowLayout","name","icon","Header","Body"],"mappings":";;AAAA,SAAQA,YAAY,QAAO,8BAA8B;AACzD,SAAQC,GAAG,EAAEC,QAAQ,EAAEC,YAAY,QAAO,gBAAgB;AAC1D,SAAQC,UAAU,QAAO,wBAAwB;AACjD,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,QAAQ,QAAO,QAAQ;AAE/B,SAAQC,sBAAsB,QAAO,4BAA4B;AACjE,SAAQC,QAAQ,QAAO,kBAAkB;AACzC,SAAQC,YAAY,QAAO,kBAAkB;AAC7C,SAAQC,EAAE,QAAO,QAAQ;AAOzB,IAAMC,YAAYR,aAAwC,SAACS;QAAQC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["import {ListSize16Px} from '@coveord/plasma-react-icons';\nimport {Box, Collapse, createStyles, rem} from '@mantine/core';\nimport {flexRender} from '@tanstack/react-table';\nimport {defaultColumnSizing} from '@tanstack/table-core';\nimport {Fragment, type MouseEvent} from 'react';\nimport {TableLayout, TableLayoutProps} from '../Table.types';\nimport {TableCollapsibleColumn} from '../TableCollapsibleColumn';\nimport {useTable} from '../TableContext';\nimport {TableLoading} from '../TableLoading';\nimport {TableSelectableColumn} from '../TableSelectableColumn';\nimport {Th} from '../Th';\n\ninterface TableStylesParams {\n multiRowSelectionEnabled: boolean;\n disableRowSelection: boolean;\n}\n\nconst useStyles = createStyles<string, TableStylesParams>((theme, {multiRowSelectionEnabled, disableRowSelection}) => {\n const rowBackgroundColor =\n theme.colorScheme === 'dark' ? theme.fn.rgba(theme.colors[theme.primaryColor][7], 0.2) : theme.colors.gray[1];\n const border = `${rem(1)} solid ${theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`;\n return {\n headerColumns: {\n '& th:first-of-type > *': {\n paddingLeft: '40px',\n },\n\n '& input[type=checkbox]': {\n backgroundColor: disableRowSelection ? `${theme.colors.gray[2]}` : undefined,\n borderColor: disableRowSelection ? `${theme.colors.gray[3]}` : `${theme.colors.gray[4]}`,\n pointerEvents: disableRowSelection ? 'none' : 'auto',\n cursor: disableRowSelection ? 'not-allowed' : 'default',\n\n '& + svg': {\n color: disableRowSelection ? `${theme.colors.gray[5]}` : 'inherit',\n },\n },\n },\n\n rowSelected: {\n backgroundColor: multiRowSelectionEnabled ? undefined : rowBackgroundColor,\n },\n\n rowUnselectable: {\n '& input[type=checkbox]': {\n backgroundColor: `${theme.colors.gray[2]}`,\n borderColor: `${theme.colors.gray[3]}`,\n pointerEvents: 'none',\n cursor: 'not-allowed',\n\n '&:checked + svg': {\n color: `${theme.colors.gray[5]}`,\n },\n },\n },\n\n rowCollapsibleButtonCell: {\n textAlign: 'right',\n padding: `calc(${theme.spacing.xs}/2) ${theme.spacing.sm} !important`,\n },\n\n row: {\n '& td:first-of-type': {\n paddingLeft: '40px',\n },\n '&:hover': {\n backgroundColor: rowBackgroundColor,\n },\n },\n\n cell: {\n verticalAlign: 'middle',\n // We must use height instead of minHeight here, otherwise it doesn't apply\n height: '56px',\n padding: `${theme.spacing.xs} ${theme.spacing.sm}`,\n borderBottom: border,\n },\n\n collapsible: {\n backgroundColor: rowBackgroundColor,\n borderBottom: border,\n },\n };\n});\n\nconst RowLayoutHeader = <T,>({table}: TableLayoutProps<T>) => {\n const {multiRowSelectionEnabled, disableRowSelection} = useTable();\n const {classes} = useStyles({disableRowSelection, multiRowSelectionEnabled});\n const headers = table.getHeaderGroups().map((headerGroup) => (\n <tr key={headerGroup.id} className={classes.headerColumns}>\n {headerGroup.headers.map((columnHeader) => (\n <Th key={columnHeader.id} header={columnHeader} />\n ))}\n </tr>\n ));\n return <>{headers}</>;\n};\n\nconst RowLayoutBody = <T,>({table, doubleClickAction, getExpandChildren, loading}: TableLayoutProps<T>) => {\n const {multiRowSelectionEnabled, disableRowSelection} = useTable();\n const {classes, cx} = useStyles({disableRowSelection, multiRowSelectionEnabled});\n\n const toggleCollapsible = (el: HTMLTableRowElement) => {\n const cell = el.children[el.children.length - 1] as HTMLTableCellElement;\n cell.querySelector('button').click();\n };\n\n const rows = table.getRowModel().rows.map((row) => {\n const rowChildren = getExpandChildren?.(row.original) ?? null;\n const isSelected = !!row.getIsSelected();\n const onClick = (event: MouseEvent<HTMLTableRowElement>) => {\n if (rowChildren) {\n toggleCollapsible(event.currentTarget);\n }\n if (!disableRowSelection && !multiRowSelectionEnabled) {\n row.toggleSelected();\n }\n };\n\n return (\n <Fragment key={row.id}>\n <tr\n onClick={onClick}\n onDoubleClick={() => doubleClickAction?.(row.original)}\n className={cx(classes.row, {\n [classes.rowSelected]: isSelected,\n [classes.rowUnselectable]: disableRowSelection,\n })}\n aria-selected={isSelected}\n >\n {row.getVisibleCells().map((cell) => {\n const size = cell.column.getSize();\n const width = size !== defaultColumnSizing.size ? size : undefined;\n const onCollapsibleCellClick = (event: MouseEvent<HTMLTableCellElement>) => {\n if (cell.column.id === TableSelectableColumn.id && !disableRowSelection) {\n event.stopPropagation();\n row.getToggleSelectedHandler();\n }\n };\n return (\n <td\n key={cell.id}\n style={{width}}\n className={cx(classes.cell, {\n [classes.rowCollapsibleButtonCell]: cell.column.id === TableCollapsibleColumn.id,\n })}\n onClick={onCollapsibleCellClick}\n >\n <TableLoading visible={loading}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableLoading>\n </td>\n );\n })}\n </tr>\n {rowChildren ? (\n <tr>\n <td\n colSpan={table.getAllColumns().length}\n style={{\n padding: 0,\n }}\n >\n <Collapse in={row.getIsExpanded()}>\n <Box className={classes.collapsible} px=\"sm\" py=\"xs\">\n {rowChildren}\n </Box>\n </Collapse>\n </td>\n </tr>\n ) : null}\n </Fragment>\n );\n });\n\n return <>{rows}</>;\n};\n\nexport const RowLayout: TableLayout = {\n name: 'Rows',\n icon: ListSize16Px,\n Header: RowLayoutHeader,\n Body: RowLayoutBody,\n};\n"],"names":["ListSize16Px","Box","Collapse","createStyles","rem","flexRender","defaultColumnSizing","Fragment","TableCollapsibleColumn","useTable","TableLoading","TableSelectableColumn","Th","useStyles","theme","multiRowSelectionEnabled","disableRowSelection","rowBackgroundColor","colorScheme","fn","rgba","colors","primaryColor","gray","border","dark","headerColumns","paddingLeft","backgroundColor","undefined","borderColor","pointerEvents","cursor","color","rowSelected","rowUnselectable","rowCollapsibleButtonCell","textAlign","padding","spacing","xs","sm","row","cell","verticalAlign","height","borderBottom","collapsible","RowLayoutHeader","table","classes","headers","getHeaderGroups","map","headerGroup","tr","className","columnHeader","header","id","RowLayoutBody","doubleClickAction","getExpandChildren","loading","cx","toggleCollapsible","el","children","length","querySelector","click","rows","getRowModel","rowChildren","original","isSelected","getIsSelected","onClick","event","currentTarget","toggleSelected","onDoubleClick","aria-selected","getVisibleCells","size","column","getSize","width","onCollapsibleCellClick","stopPropagation","getToggleSelectedHandler","td","style","visible","columnDef","getContext","colSpan","getAllColumns","in","getIsExpanded","px","py","RowLayout","name","icon","Header","Body"],"mappings":";;AAAA,SAAQA,YAAY,QAAO,8BAA8B;AACzD,SAAQC,GAAG,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,GAAG,QAAO,gBAAgB;AAC/D,SAAQC,UAAU,QAAO,wBAAwB;AACjD,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,QAAQ,QAAwB,QAAQ;AAEhD,SAAQC,sBAAsB,QAAO,4BAA4B;AACjE,SAAQC,QAAQ,QAAO,kBAAkB;AACzC,SAAQC,YAAY,QAAO,kBAAkB;AAC7C,SAAQC,qBAAqB,QAAO,2BAA2B;AAC/D,SAAQC,EAAE,QAAO,QAAQ;AAOzB,IAAMC,YAAYV,aAAwC,SAACW;QAAQC,iCAAAA,0BAA0BC,4BAAAA;IACzF,IAAMC,qBACFH,MAAMI,WAAW,KAAK,SAASJ,MAAMK,EAAE,CAACC,IAAI,CAACN,MAAMO,MAAM,CAACP,MAAMQ,YAAY,CAAC,CAAC,EAAE,EAAE,OAAOR,MAAMO,MAAM,CAACE,IAAI,CAAC,EAAE;IACjH,IAAMC,SAAS,AAAC,GAAkBV,OAAhBV,IAAI,IAAG,WAAoF,OAA3EU,MAAMI,WAAW,KAAK,SAASJ,MAAMO,MAAM,CAACI,IAAI,CAAC,EAAE,GAAGX,MAAMO,MAAM,CAACE,IAAI,CAAC,EAAE;IAC5G,OAAO;QACHG,eAAe;YACX,0BAA0B;gBACtBC,aAAa;YACjB;YAEA,0BAA0B;gBACtBC,iBAAiBZ,sBAAsB,AAAC,GAAuB,OAArBF,MAAMO,MAAM,CAACE,IAAI,CAAC,EAAE,IAAKM;gBACnEC,aAAad,sBAAsB,AAAC,GAAuB,OAArBF,MAAMO,MAAM,CAACE,IAAI,CAAC,EAAE,IAAK,AAAC,GAAuB,OAArBT,MAAMO,MAAM,CAACE,IAAI,CAAC,EAAE;gBAC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AEA,OAAO,IAAM+B,YAAyB;IAClCC,MAAM;IACNC,MAAMxG;IACNyG,QAAQzD;IACR0D,MAAM9C;AACV,EAAE"}
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { Table } from '@tanstack/table-core';
3
3
  import { TableProps } from './Table.types';
4
- export declare const useRowSelection: <T>(table: Table<T>, { onRowSelectionChange, multiRowSelectionEnabled, }: Pick<TableProps<T>, "multiRowSelectionEnabled" | "onRowSelectionChange">) => {
4
+ export declare const useRowSelection: <T>(table: Table<T>, { onRowSelectionChange, multiRowSelectionEnabled, additionalRootNodes, }: Pick<TableProps<T>, "multiRowSelectionEnabled" | "onRowSelectionChange" | "additionalRootNodes">) => {
5
5
  clearSelection: () => void;
6
6
  getSelectedRow: () => T;
7
7
  getSelectedRows: () => T[];
8
- outsideClickRef: import("react").MutableRefObject<any>;
8
+ outsideClickRef: import("react").MutableRefObject<HTMLDivElement>;
9
9
  };
10
10
  //# sourceMappingURL=useRowSelection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRowSelection.d.ts","sourceRoot":"","sources":["../../../../src/components/table/useRowSelection.ts"],"names":[],"mappings":";AACA,OAAO,EAAsC,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAGhF,OAAO,EAAuB,UAAU,EAAa,MAAM,eAAe,CAAC;AAE3E,eAAO,MAAM,eAAe;;;;;CA0D3B,CAAC"}
1
+ {"version":3,"file":"useRowSelection.d.ts","sourceRoot":"","sources":["../../../../src/components/table/useRowSelection.ts"],"names":[],"mappings":";AACA,OAAO,EAAsC,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAIhF,OAAO,EAAuB,UAAU,EAAa,MAAM,eAAe,CAAC;AAE3E,eAAO,MAAM,eAAe;;;;;CAgE3B,CAAC"}
@@ -1,15 +1,20 @@
1
1
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
+ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
3
4
  import { useClickOutside } from "@mantine/hooks";
4
5
  import { functionalUpdate } from "@tanstack/table-core";
5
6
  import isEqual from "fast-deep-equal";
7
+ import { useRef } from "react";
6
8
  export var useRowSelection = function(table, param) {
7
- var onRowSelectionChange = param.onRowSelectionChange, multiRowSelectionEnabled = param.multiRowSelectionEnabled;
8
- var outsideClickRef = useClickOutside(function() {
9
+ var onRowSelectionChange = param.onRowSelectionChange, multiRowSelectionEnabled = param.multiRowSelectionEnabled, _param_additionalRootNodes = param.additionalRootNodes, additionalRootNodes = _param_additionalRootNodes === void 0 ? [] : _param_additionalRootNodes;
10
+ var outsideClickRef = useRef();
11
+ useClickOutside(function() {
9
12
  if (!multiRowSelectionEnabled) {
10
13
  clearSelection();
11
14
  }
12
- });
15
+ }, null, [
16
+ outsideClickRef.current
17
+ ].concat(_to_consumable_array(additionalRootNodes)));
13
18
  table.setOptions(function(prev) {
14
19
  return _object_spread_props(_object_spread({}, prev), {
15
20
  onRowSelectionChange: function(rowSelectionUpdater) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/useRowSelection.ts"],"sourcesContent":["import {useClickOutside} from '@mantine/hooks';\nimport {functionalUpdate, RowSelectionState, Table} from '@tanstack/table-core';\nimport isEqual from 'fast-deep-equal';\n\nimport {RowSelectionWithData, TableProps, TableState} from './Table.types';\n\nexport const useRowSelection = <T>(\n table: Table<T>,\n {\n onRowSelectionChange,\n multiRowSelectionEnabled,\n }: Pick<TableProps<T>, 'onRowSelectionChange' | 'multiRowSelectionEnabled'>\n) => {\n const outsideClickRef = useClickOutside(() => {\n if (!multiRowSelectionEnabled) {\n clearSelection();\n }\n });\n\n table.setOptions((prev) => ({\n ...prev,\n onRowSelectionChange: (rowSelectionUpdater) => {\n table.setState((old) => {\n const newRowSelection = functionalUpdate(\n rowSelectionUpdater,\n old['rowSelection']\n ) as RowSelectionWithData<T>;\n\n if (isEqual(old['rowSelection'], newRowSelection)) {\n return old;\n }\n\n const rows = table.getRowModel().rowsById;\n\n Object.keys(newRowSelection).forEach((rowId) => {\n if (newRowSelection[rowId] === true) {\n if (!rows[rowId]) {\n console.error(\n 'The table was not initialized properly, the rowSelection state should contain an object of type Record<string, TData>.'\n );\n }\n newRowSelection[rowId] = rows[rowId]?.original ?? (true as T);\n }\n });\n\n onRowSelectionChange?.(Object.values(newRowSelection));\n\n return {\n ...old,\n rowSelection: newRowSelection as RowSelectionState,\n };\n });\n },\n }));\n\n const clearSelection = () => {\n table.resetRowSelection(true);\n };\n\n const getSelectedRows = () => Object.values((table.getState() as TableState<T>).rowSelection);\n\n const getSelectedRow = () => getSelectedRows()[0] ?? null;\n\n return {clearSelection, getSelectedRow, getSelectedRows, outsideClickRef};\n};\n"],"names":["useClickOutside","functionalUpdate","isEqual","useRowSelection","table","onRowSelectionChange","multiRowSelectionEnabled","outsideClickRef","clearSelection","setOptions","prev","rowSelectionUpdater","setState","old","newRowSelection","rows","getRowModel","rowsById","Object","keys","forEach","rowId","console","error","original","values","rowSelection","resetRowSelection","getSelectedRows","getState","getSelectedRow"],"mappings":";;AAAA,SAAQA,eAAe,QAAO,iBAAiB;AAC/C,SAAQC,gBAAgB,QAAiC,uBAAuB;AAChF,OAAOC,aAAa,kBAAkB;AAItC,OAAO,IAAMC,kBAAkB,SAC3BC;QAEIC,6BAAAA,sBACAC,iCAAAA;IAGJ,IAAMC,kBAAkBP,gBAAgB;QACpC,IAAI,CAACM,0BAA0B;YAC3BE;QACJ;IACJ;IAEAJ,MAAMK,UAAU,CAAC,SAACC;eAAU,wCACrBA;YACHL,sBAAsB,SAACM;gBACnBP,MAAMQ,QAAQ,CAAC,SAACC;wBAuBZR;oBAtBA,IAAMS,kBAAkBb,iBACpBU,qBACAE,GAAG,CAAC,eAAe;oBAGvB,IAAIX,QAAQW,GAAG,CAAC,eAAe,EAAEC,kBAAkB;wBAC/C,OAAOD;oBACX;oBAEA,IAAME,OAAOX,MAAMY,WAAW,GAAGC,QAAQ;oBAEzCC,OAAOC,IAAI,CAACL,iBAAiBM,OAAO,CAAC,SAACC;wBAClC,IAAIP,eAAe,CAACO,MAAM,KAAK,MAAM;gCAMRN;4BALzB,IAAI,CAACA,IAAI,CAACM,MAAM,EAAE;gCACdC,QAAQC,KAAK,CACT;4BAER;gCACyBR;4BAAzBD,eAAe,CAACO,MAAM,GAAGN,CAAAA,wBAAAA,cAAAA,IAAI,CAACM,MAAM,cAAXN,kCAAAA,YAAaS,QAAQ,cAArBT,kCAAAA,uBAA0B;wBACvD;oBACJ;qBAEAV,wBAAAA,kCAAAA,4CAAAA,sBAAuBa,OAAOO,MAAM,CAACX;oBAErC,OAAO,wCACAD;wBACHa,cAAcZ;;gBAEtB;YACJ;;;IAGJ,IAAMN,iBAAiB;QACnBJ,MAAMuB,iBAAiB,CAAC;IAC5B;IAEA,IAAMC,kBAAkB;eAAMV,OAAOO,MAAM,CAAC,AAACrB,MAAMyB,QAAQ,GAAqBH,YAAY;;QAE/DE;IAA7B,IAAME,iBAAiB;eAAMF,CAAAA,oBAAAA,iBAAiB,CAAC,EAAE,cAApBA,+BAAAA,oBAAwB;;IAErD,OAAO;QAACpB,gBAAAA;QAAgBsB,gBAAAA;QAAgBF,iBAAAA;QAAiBrB,iBAAAA;IAAe;AAC5E,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/table/useRowSelection.ts"],"sourcesContent":["import {useClickOutside} from '@mantine/hooks';\nimport {functionalUpdate, RowSelectionState, Table} from '@tanstack/table-core';\nimport isEqual from 'fast-deep-equal';\n\nimport {useRef} from 'react';\nimport {RowSelectionWithData, TableProps, TableState} from './Table.types';\n\nexport const useRowSelection = <T>(\n table: Table<T>,\n {\n onRowSelectionChange,\n multiRowSelectionEnabled,\n additionalRootNodes = [],\n }: Pick<TableProps<T>, 'onRowSelectionChange' | 'multiRowSelectionEnabled' | 'additionalRootNodes'>\n) => {\n const outsideClickRef = useRef<HTMLDivElement>();\n useClickOutside(\n () => {\n if (!multiRowSelectionEnabled) {\n clearSelection();\n }\n },\n null,\n [outsideClickRef.current, ...additionalRootNodes]\n );\n\n table.setOptions((prev) => ({\n ...prev,\n onRowSelectionChange: (rowSelectionUpdater) => {\n table.setState((old) => {\n const newRowSelection = functionalUpdate(\n rowSelectionUpdater,\n old['rowSelection']\n ) as RowSelectionWithData<T>;\n\n if (isEqual(old['rowSelection'], newRowSelection)) {\n return old;\n }\n\n const rows = table.getRowModel().rowsById;\n\n Object.keys(newRowSelection).forEach((rowId) => {\n if (newRowSelection[rowId] === true) {\n if (!rows[rowId]) {\n console.error(\n 'The table was not initialized properly, the rowSelection state should contain an object of type Record<string, TData>.'\n );\n }\n newRowSelection[rowId] = rows[rowId]?.original ?? (true as T);\n }\n });\n\n onRowSelectionChange?.(Object.values(newRowSelection));\n\n return {\n ...old,\n rowSelection: newRowSelection as RowSelectionState,\n };\n });\n },\n }));\n\n const clearSelection = () => {\n table.resetRowSelection(true);\n };\n\n const getSelectedRows = () => Object.values((table.getState() as TableState<T>).rowSelection);\n\n const getSelectedRow = () => getSelectedRows()[0] ?? null;\n\n return {clearSelection, getSelectedRow, getSelectedRows, outsideClickRef};\n};\n"],"names":["useClickOutside","functionalUpdate","isEqual","useRef","useRowSelection","table","onRowSelectionChange","multiRowSelectionEnabled","additionalRootNodes","outsideClickRef","clearSelection","current","setOptions","prev","rowSelectionUpdater","setState","old","newRowSelection","rows","getRowModel","rowsById","Object","keys","forEach","rowId","console","error","original","values","rowSelection","resetRowSelection","getSelectedRows","getState","getSelectedRow"],"mappings":";;;AAAA,SAAQA,eAAe,QAAO,iBAAiB;AAC/C,SAAQC,gBAAgB,QAAiC,uBAAuB;AAChF,OAAOC,aAAa,kBAAkB;AAEtC,SAAQC,MAAM,QAAO,QAAQ;AAG7B,OAAO,IAAMC,kBAAkB,SAC3BC;QAEIC,6BAAAA,sBACAC,iCAAAA,6DACAC,qBAAAA,8DAAsB,EAAE;IAG5B,IAAMC,kBAAkBN;IACxBH,gBACI;QACI,IAAI,CAAC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  {
2
2
  "name": "@coveord/plasma-mantine",
3
- "version": "52.9.0",
3
+ "version": "52.10.0",
4
4
  "description": "A Plasma flavoured Mantine theme",
5
5
  "keywords": [
6
6
  "plasma",
@@ -57,7 +57,7 @@
57
57
  "@swc/core": "1.3.64",
58
58
  "@swc/jest": "0.2.26",
59
59
  "@testing-library/jest-dom": "5.16.5",
60
- "@testing-library/react": "13.4.0",
60
+ "@testing-library/react": "14.0.0",
61
61
  "@testing-library/user-event": "14.4.3",
62
62
  "@types/jest": "29.5.2",
63
63
  "@types/lodash.debounce": "^4.0.7",
@@ -30,6 +30,18 @@ window.ResizeObserver =
30
30
  unobserve: vi.fn(),
31
31
  }));
32
32
 
33
+ // Temporarily workaround for bug in @testing-library/react when use user-event with `vi.useFakeTimers()`
34
+ beforeAll(() => {
35
+ const _jest = (globalThis as any).jest;
36
+
37
+ (globalThis as any).jest = {
38
+ ...(globalThis as any).jest,
39
+ advanceTimersByTime: vi.advanceTimersByTime.bind(vi),
40
+ };
41
+
42
+ return () => void ((globalThis as any).jest = _jest);
43
+ });
44
+
33
45
  afterEach(() => {
34
46
  cleanup();
35
47
  });
@@ -126,8 +126,10 @@ export const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {
126
126
  };
127
127
 
128
128
  const handleSearch = () => {
129
- editorRef.current.focus();
130
- editorRef.current.trigger('editor', 'actions.find', '');
129
+ if (editorRef.current) {
130
+ editorRef.current.focus();
131
+ editorRef.current.trigger('editor', 'actions.find', '');
132
+ }
131
133
  };
132
134
 
133
135
  useEffect(() => {
@@ -65,6 +65,7 @@ describe('CodeEditor', () => {
65
65
  it('focus and triggers search on the Monaco editor when handleSearch is called', async () => {
66
66
  const user = userEvent.setup();
67
67
  render(<CodeEditor />);
68
+ expect(await screen.findByTestId('monaco-editor')).toBeInTheDocument();
68
69
  await user.click(screen.getByRole('button', {name: /search/i}));
69
70
  expect(screen.getByTestId('monaco-editor')).toHaveAttribute('focus');
70
71
  expect(screen.getByTestId('monaco-editor')).toHaveAttribute('trigger');
@@ -57,6 +57,7 @@ export const DateRangePickerPresetSelect = <T extends unknown>({
57
57
  value={selectedPreset}
58
58
  onChange={onChangePreset}
59
59
  data={selectData}
60
+ maxDropdownHeight={240}
60
61
  />
61
62
  );
62
63
  };
@@ -87,6 +87,7 @@ describe('DateRangePickerInlineCalendar', () => {
87
87
  });
88
88
 
89
89
  it('calls onApply with the selected dates when typing in the inputs', async () => {
90
+ vi.useFakeTimers().setSystemTime(new Date(2022, 0, 31));
90
91
  const user = userEvent.setup({delay: null});
91
92
  const onApply = vi.fn();
92
93
  render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={vi.fn()} />);
@@ -109,5 +110,6 @@ describe('DateRangePickerInlineCalendar', () => {
109
110
  dayjs(new Date(2022, 0, 8)).startOf('day').toDate(),
110
111
  dayjs(new Date(2022, 0, 14)).endOf('day').toDate(),
111
112
  ]);
113
+ vi.useRealTimers();
112
114
  });
113
115
  });
@@ -4,17 +4,6 @@ import {DateRangePickerValue} from '../DateRangePickerInlineCalendar';
4
4
 
5
5
  import {DateRangePickerPopoverCalendar} from '../DateRangePickerPopoverCalendar';
6
6
 
7
- // Since we're mocking the date and the animations are timer based we're mocking useReduceMotion to disable all the animations
8
- // I tried wrapping the components in <MantineProvider theme={{components: {Transition: {defaultProps: {duration: 0}}}}}>
9
- // but the animation was still happening. :(
10
- vi.mock('@mantine/hooks', async () => {
11
- const actual = await vi.importActual('@mantine/hooks');
12
- return {
13
- ...actual,
14
- useReduceMotion: () => true,
15
- };
16
- });
17
-
18
7
  describe('DateRangePickerPopoverCalendar', () => {
19
8
  it('does not render the preset searchbox when there is no presets', () => {
20
9
  render(<DateRangePickerPopoverCalendar defaultValue={[null, null]} />);
@@ -23,7 +12,7 @@ describe('DateRangePickerPopoverCalendar', () => {
23
12
  });
24
13
 
25
14
  it('updates with the selected dates when choosing a preset', async () => {
26
- const user = userEvent.setup({delay: null});
15
+ const user = userEvent.setup();
27
16
  const Fixture = () => {
28
17
  const form = useForm<{dates: DateRangePickerValue}>({initialValues: {dates: [null, null]}});
29
18
  return (
@@ -40,11 +29,7 @@ describe('DateRangePickerPopoverCalendar', () => {
40
29
  };
41
30
  render(<Fixture />);
42
31
 
43
- await user.click(
44
- screen.getByRole('searchbox', {
45
- name: 'Date range',
46
- })
47
- );
32
+ await user.click(screen.getByRole('searchbox', {name: 'Date range'}));
48
33
  await user.click(screen.getByRole('option', {name: 'select me'}));
49
34
 
50
35
  expect(screen.getByTestId('json')).toHaveTextContent('["1999-12-31T00:00:00.000Z","2000-01-01T00:00:00.000Z"]');
@@ -79,7 +64,7 @@ describe('DateRangePickerPopoverCalendar', () => {
79
64
  });
80
65
 
81
66
  it('calls onApply with the selected dates when typing in the inputs', async () => {
82
- const user = userEvent.setup({delay: null});
67
+ const user = userEvent.setup();
83
68
  const Fixture = () => {
84
69
  const form = useForm<{dates: DateRangePickerValue}>({initialValues: {dates: [null, null]}});
85
70
  return (
@@ -104,5 +89,5 @@ describe('DateRangePickerPopoverCalendar', () => {
104
89
  await user.type(endInput, 'Jan 14, 2022');
105
90
 
106
91
  expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T23:59:59.999Z"]');
107
- });
92
+ }, 10000);
108
93
  });
@@ -1,8 +1,8 @@
1
- import {DateRangePickerValue} from '@mantine/dates';
2
1
  import {render, screen, userEvent} from '@test-utils';
3
2
  import {useState} from 'react';
4
3
 
5
4
  import {EditableDateRangePicker} from '../EditableDateRangePicker';
5
+ import {DateRangePickerValue} from '../DateRangePickerInlineCalendar';
6
6
 
7
7
  describe('EditableDateRangePicker', () => {
8
8
  it('renders an input for the start and an input for the end', () => {
@@ -19,7 +19,7 @@ describe('EditableDateRangePicker', () => {
19
19
  });
20
20
 
21
21
  it('updates when editing values', async () => {
22
- const user = userEvent.setup({delay: null});
22
+ const user = userEvent.setup();
23
23
  const Fixture = () => {
24
24
  const [value, setValue] = useState<DateRangePickerValue>([null, null]);
25
25
  return (
@@ -44,5 +44,5 @@ describe('EditableDateRangePicker', () => {
44
44
  await user.type(endInput, 'Jan 14, 2022');
45
45
 
46
46
  expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T23:59:59.999Z"]');
47
- });
47
+ }, 10000);
48
48
  });
@@ -8,24 +8,28 @@ describe('ModalWizard', () => {
8
8
 
9
9
  const modelSteps = [
10
10
  {
11
+ id: 'step1',
11
12
  docLink: 'https://google.com',
12
13
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
13
14
  validateStep: () => ({isValid: true}),
14
15
  element: <div> Slide 1</div>,
15
16
  },
16
17
  {
18
+ id: 'step2',
17
19
  docLink: 'https://google.com',
18
20
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
19
21
  validateStep: () => ({isValid: true}),
20
22
  element: <div> Slide 2</div>,
21
23
  },
22
24
  {
25
+ id: 'step3',
23
26
  docLink: 'https://google.com',
24
27
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
25
28
  validateStep: () => ({isValid: false}),
26
29
  element: <div> Slide 3</div>,
27
30
  },
28
31
  {
32
+ id: 'step4',
29
33
  docLink: 'https://google.com',
30
34
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
31
35
  validateStep: () => ({isValid: false}),
@@ -46,13 +50,14 @@ describe('ModalWizard', () => {
46
50
  onNext={onNextSpy}
47
51
  onPrevious={onPreviousSpy}
48
52
  >
49
- {modelSteps.map((model_item) => (
53
+ {modelSteps.map((step) => (
50
54
  <ModalWizard.Step
51
- docLink={model_item.docLink}
55
+ key={step.id}
56
+ docLink={step.docLink}
52
57
  title={(currentStep) => 'Current Step is: ' + currentStep}
53
- validateStep={model_item.validateStep}
58
+ validateStep={step.validateStep}
54
59
  >
55
- {model_item.element}
60
+ {step.element}
56
61
  </ModalWizard.Step>
57
62
  ))}
58
63
  </ModalWizard>
@@ -165,6 +170,7 @@ describe('ModalWizard', () => {
165
170
 
166
171
  const modelSteps = [
167
172
  {
173
+ id: 'step1',
168
174
  docLink: 'https://google.com',
169
175
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
170
176
  validateStep: () => ({isValid: true}),
@@ -179,6 +185,7 @@ describe('ModalWizard', () => {
179
185
  <ModalWizard isDirty={isDirty} onClose={onClose} opened={true}>
180
186
  {modelSteps.map((model_item) => (
181
187
  <ModalWizard.Step
188
+ key={model_item.id}
182
189
  docLink={model_item.docLink}
183
190
  title={(currentStep) => 'Current Step is: ' + currentStep}
184
191
  validateStep={model_item.validateStep}
@@ -201,6 +208,7 @@ describe('ModalWizard', () => {
201
208
  const user = userEvent.setup();
202
209
  const modelSteps = [
203
210
  {
211
+ id: 'step1',
204
212
  docLink: 'https://google.com',
205
213
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
206
214
  validateStep: () => ({isValid: true}),
@@ -215,6 +223,7 @@ describe('ModalWizard', () => {
215
223
  <ModalWizard isDirty={isDirty} onClose={onClose} opened={true}>
216
224
  {modelSteps.map((model_item) => (
217
225
  <ModalWizard.Step
226
+ key={model_item.id}
218
227
  docLink={model_item.docLink}
219
228
  title={(currentStep) => 'Current Step is: ' + currentStep}
220
229
  validateStep={model_item.validateStep}
@@ -237,6 +246,7 @@ describe('ModalWizard', () => {
237
246
  const user = userEvent.setup();
238
247
  const modelSteps = [
239
248
  {
249
+ id: 'step1',
240
250
  docLink: 'https://google.com',
241
251
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
242
252
  validateStep: () => ({isValid: true}),
@@ -252,6 +262,7 @@ describe('ModalWizard', () => {
252
262
  <ModalWizard isDirty={isDirty} onClose={onClose} onFinish={onFinish} opened={true}>
253
263
  {modelSteps.map((model_item) => (
254
264
  <ModalWizard.Step
265
+ key={model_item.id}
255
266
  docLink={model_item.docLink}
256
267
  title={(currentStep) => 'Current Step is: ' + currentStep}
257
268
  validateStep={model_item.validateStep}
@@ -274,6 +285,7 @@ describe('ModalWizard', () => {
274
285
  const user = userEvent.setup();
275
286
  const modelSteps = [
276
287
  {
288
+ id: 'step1',
277
289
  docLink: 'https://google.com',
278
290
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
279
291
  validateStep: () => ({isValid: true}),
@@ -289,6 +301,7 @@ describe('ModalWizard', () => {
289
301
  <ModalWizard isDirty={isDirty} onClose={onClose} handleDirtyState={handleDirtyState} opened={true}>
290
302
  {modelSteps.map((model_item) => (
291
303
  <ModalWizard.Step
304
+ key={model_item.id}
292
305
  docLink={model_item.docLink}
293
306
  title={(currentStep) => 'Current Step is: ' + currentStep}
294
307
  validateStep={model_item.validateStep}
@@ -313,6 +326,7 @@ describe('ModalWizard', () => {
313
326
  const user = userEvent.setup();
314
327
  const modelSteps = [
315
328
  {
329
+ id: 'step1',
316
330
  docLink: 'https://google.com',
317
331
  title: (currentStep: string) => 'Current Step is: ' + currentStep,
318
332
  validateStep: () => ({isValid: true}),
@@ -328,6 +342,7 @@ describe('ModalWizard', () => {
328
342
  <ModalWizard isDirty={isDirty} onClose={onClose} handleDirtyState={handleDirtyState} opened={true}>
329
343
  {modelSteps.map((model_item) => (
330
344
  <ModalWizard.Step
345
+ key={model_item.id}
331
346
  docLink={model_item.docLink}
332
347
  title={(currentStep) => 'Current Step is: ' + currentStep}
333
348
  validateStep={model_item.validateStep}
@@ -3,15 +3,6 @@ import {createStyles} from '@mantine/core';
3
3
  const useStyles = createStyles<string>((theme) => ({
4
4
  table: {
5
5
  width: '100%',
6
- '& thead tr th': {
7
- borderBottom: 'none',
8
- },
9
- '& td:first-of-type': {
10
- paddingLeft: theme.spacing.xl,
11
- },
12
- '& tbody td': {
13
- verticalAlign: 'top',
14
- },
15
6
  },
16
7
 
17
8
  header: {
@@ -1,11 +1,12 @@
1
- import {Box, Center, Loader, Table as MantineTable} from '@mantine/core';
1
+ import {Box, Center, Loader} from '@mantine/core';
2
2
  import {useForm} from '@mantine/form';
3
3
  import {useDidUpdate} from '@mantine/hooks';
4
- import {ColumnDef, Row, TableState as TanstackTableState, getCoreRowModel, useReactTable} from '@tanstack/react-table';
4
+ import {ColumnDef, getCoreRowModel, Row, TableState as TanstackTableState, useReactTable} from '@tanstack/react-table';
5
5
  import debounce from 'lodash.debounce';
6
6
  import defaultsDeep from 'lodash.defaultsdeep';
7
- import {Children, Dispatch, ReactElement, useCallback, useEffect, useState} from 'react';
7
+ import {Children, cloneElement, Dispatch, ReactElement, useCallback, useEffect, useState} from 'react';
8
8
 
9
+ import {TableLayouts} from './layouts/TableLayouts';
9
10
  import useStyles from './Table.styles';
10
11
  import {TableFormType, TableProps, TableState, TableType} from './Table.types';
11
12
  import {TableActions} from './TableActions';
@@ -16,13 +17,13 @@ import {TableDateRangePicker} from './TableDateRangePicker';
16
17
  import {TableFilter} from './TableFilter';
17
18
  import {TableFooter} from './TableFooter';
18
19
  import {TableHeader} from './TableHeader';
20
+ import {TableLastUpdated} from './TableLastUpdated';
21
+ import {TableLoading} from './TableLoading';
19
22
  import {TablePagination} from './TablePagination';
20
23
  import {TablePerPage} from './TablePerPage';
21
24
  import {TablePredicate} from './TablePredicate';
22
25
  import {TableSelectableColumn} from './TableSelectableColumn';
23
26
  import {useRowSelection} from './useRowSelection';
24
- import {TableLoading} from './TableLoading';
25
- import {TableLayouts} from './layouts/TableLayouts';
26
27
 
27
28
  export const Table: TableType = <T,>({
28
29
  data,
@@ -40,12 +41,14 @@ export const Table: TableType = <T,>({
40
41
  multiRowSelectionEnabled,
41
42
  disableRowSelection,
42
43
  onRowSelectionChange,
44
+ additionalRootNodes,
43
45
  options = {},
44
46
  }: TableProps<T>) => {
45
47
  const convertedChildren = Children.toArray(children) as ReactElement[];
46
48
  const header = convertedChildren.find((child) => child.type === TableHeader);
47
49
  const footer = convertedChildren.find((child) => child.type === TableFooter);
48
50
  const consumer = convertedChildren.find((child) => child.type === TableConsumer);
51
+ const lastUpdated = convertedChildren.find((child) => child.type === TableLastUpdated);
49
52
 
50
53
  const {predicates, dateRange, ...initialStateWithoutForm} = initialState;
51
54
  const form = useForm<TableFormType>({
@@ -58,7 +61,10 @@ export const Table: TableType = <T,>({
58
61
  const {classes} = useStyles();
59
62
 
60
63
  const table = useReactTable({
61
- initialState: defaultsDeep(initialStateWithoutForm, {pagination: {pageSize: TablePerPage.DEFAULT_SIZE}}),
64
+ initialState: defaultsDeep(initialStateWithoutForm, {
65
+ pagination: {pageSize: TablePerPage.DEFAULT_SIZE},
66
+ globalFilter: '',
67
+ }),
62
68
  data,
63
69
  columns: multiRowSelectionEnabled ? [TableSelectableColumn as ColumnDef<T>].concat(columns) : columns,
64
70
  getCoreRowModel: getCoreRowModel(),
@@ -79,6 +85,7 @@ export const Table: TableType = <T,>({
79
85
  const {clearSelection, getSelectedRow, getSelectedRows, outsideClickRef} = useRowSelection(table, {
80
86
  multiRowSelectionEnabled,
81
87
  onRowSelectionChange,
88
+ additionalRootNodes,
82
89
  });
83
90
  const isFiltered =
84
91
  !!state.globalFilter ||
@@ -149,15 +156,11 @@ export const Table: TableType = <T,>({
149
156
  noDataChildren
150
157
  ) : (
151
158
  <>
152
- <MantineTable className={classes.table} horizontalSpacing="sm" verticalSpacing="xs" pb="sm">
159
+ <Box component="table" className={classes.table} pb="sm">
153
160
  <thead className={classes.header}>
154
161
  {!!header ? (
155
162
  <tr>
156
- <th
157
- // need to use inline style because Mantine define style on `.mantine-{id} thead tr th`
158
- style={{padding: 0, fontWeight: 'unset'}}
159
- colSpan={table.getAllColumns().length}
160
- >
163
+ <th style={{padding: 0}} colSpan={table.getAllColumns().length}>
161
164
  {header}
162
165
  </th>
163
166
  </tr>
@@ -185,8 +188,13 @@ export const Table: TableType = <T,>({
185
188
  </tr>
186
189
  )}
187
190
  </tbody>
188
- </MantineTable>
191
+ </Box>
189
192
  {footer}
193
+ {lastUpdated
194
+ ? cloneElement(lastUpdated, {
195
+ dependencies: [data, ...(lastUpdated.props.dependencies ?? [])],
196
+ })
197
+ : null}
190
198
  </>
191
199
  )}
192
200
  </TableContext.Provider>
@@ -198,6 +206,7 @@ Table.Actions = TableActions;
198
206
  Table.Filter = TableFilter;
199
207
  Table.Footer = TableFooter;
200
208
  Table.Header = TableHeader;
209
+ Table.LastUpdated = TableLastUpdated;
201
210
  Table.Pagination = TablePagination;
202
211
  Table.Predicate = TablePredicate;
203
212
  Table.PerPage = TablePerPage;
@@ -1,16 +1,17 @@
1
+ import {Icon} from '@coveord/plasma-react-icons';
1
2
  import {UseFormReturnType} from '@mantine/form';
2
3
  import {
3
4
  ColumnDef,
4
5
  CoreOptions,
6
+ InitialTableState as TanstackInitialTableState,
5
7
  Table,
6
8
  TableOptions,
7
- InitialTableState as TanstackInitialTableState,
8
9
  TableState as TanstackTableState,
9
10
  } from '@tanstack/table-core';
10
11
  import {Dispatch, ReactElement, ReactNode, RefObject} from 'react';
11
12
 
12
- import {Icon} from '@coveord/plasma-react-icons';
13
13
  import {DateRangePickerValue} from '../date-range-picker/DateRangePickerInlineCalendar';
14
+ import {TableLayouts} from './layouts/TableLayouts';
14
15
  import {TableActions} from './TableActions';
15
16
  import {TableAccordionColumn, TableCollapsibleColumn} from './TableCollapsibleColumn';
16
17
  import {TableConsumer} from './TableConsumer';
@@ -18,11 +19,11 @@ import {TableDateRangePicker} from './TableDateRangePicker';
18
19
  import {TableFilter} from './TableFilter';
19
20
  import {TableFooter} from './TableFooter';
20
21
  import {TableHeader} from './TableHeader';
22
+ import {TableLastUpdated} from './TableLastUpdated';
21
23
  import {TableLoading} from './TableLoading';
22
24
  import {TablePagination} from './TablePagination';
23
25
  import {TablePerPage} from './TablePerPage';
24
26
  import {TablePredicate} from './TablePredicate';
25
- import {TableLayouts} from './layouts/TableLayouts';
26
27
 
27
28
  export type RowSelectionWithData<TData> = Record<string, TData>;
28
29
  export interface RowSelectionState<TData> {
@@ -245,6 +246,15 @@ export interface TableProps<T> {
245
246
  * @default false
246
247
  */
247
248
  disableRowSelection?: boolean;
249
+ /**
250
+ * Nodes that are considered inside the table.
251
+ *
252
+ * Rows normally get unselected when clicking outside the table, but sometimes it has difficulties guessing what is inside or outside, for example when using modals.
253
+ * You can use this prop to force the table to consider some nodes to be inside the table.
254
+ *
255
+ * @see https://mantine.dev/hooks/use-click-outside/#multiple-nodes
256
+ */
257
+ additionalRootNodes?: HTMLElement[];
248
258
  /**
249
259
  * Additional options that can be passed to the table
250
260
  */
@@ -268,6 +278,7 @@ export interface TableType {
268
278
  Filter: typeof TableFilter;
269
279
  Footer: typeof TableFooter;
270
280
  Header: typeof TableHeader;
281
+ LastUpdated: typeof TableLastUpdated;
271
282
  Pagination: typeof TablePagination;
272
283
  PerPage: typeof TablePerPage;
273
284
  Predicate: typeof TablePredicate;
@@ -5,7 +5,7 @@ interface TableFooterProps extends DefaultProps {
5
5
  children?: ReactNode;
6
6
  }
7
7
  export const TableFooter: FunctionComponent<TableFooterProps> = ({children, ...others}) => (
8
- <Group position="apart" px="md" py="sm" {...others}>
8
+ <Group position="apart" px="xl" py="md" {...others}>
9
9
  {children}
10
10
  </Group>
11
11
  );
@@ -15,7 +15,7 @@ const useStyles = createStyles((theme) => ({
15
15
  borderBottom: `1px solid ${theme.colors.gray[3]}`,
16
16
  },
17
17
  multiSelectInfo: {
18
- justifySelf: 'flex-start',
18
+ display: 'flex',
19
19
  },
20
20
  }));
21
21