diff --git a/.changeset/olive-otters-tap.md b/.changeset/olive-otters-tap.md new file mode 100644 index 0000000000..73f30751e5 --- /dev/null +++ b/.changeset/olive-otters-tap.md @@ -0,0 +1,10 @@ +--- +'@accounter/client': patch +--- + +Replace Mantine's `Table`, `Paper`, `Popover`, `Grid`, `List` and `Text` in the business trip +report's tables with `ui/table`, `ui/card`, `Tooltip` and Tailwind. The subtree no longer imports +Mantine at all. + +`common/tooltip.tsx` now accepts a `ReactNode` for `content` as its type always claimed — React's +RDFa `content?: string` attribute was narrowing it to strings. diff --git a/eslint.config.mjs b/eslint.config.mjs index b5fc0e5191..94e6e31dfb 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -306,7 +306,7 @@ export default [ 'packages/client/src/components/charge-matching/**/*.{,c,m}{j,t}s{,x}', 'packages/client/src/components/charge-matches/**/*.{,c,m}{j,t}s{,x}', 'packages/client/src/components/clients/**/*.{,c,m}{j,t}s{,x}', - 'packages/client/src/components/common/business-trip-report/buttons/**/*.{,c,m}{j,t}s{,x}', + 'packages/client/src/components/common/business-trip-report/**/*.{,c,m}{j,t}s{,x}', 'packages/client/src/components/contracts/**/*.{,c,m}{j,t}s{,x}', 'packages/client/src/components/financial-accounts/**/*.{,c,m}{j,t}s{,x}', 'packages/client/src/components/landing/**/*.{,c,m}{j,t}s{,x}', diff --git a/packages/client/src/components/common/business-trip-report/parts/accommodations-row.tsx b/packages/client/src/components/common/business-trip-report/parts/accommodations-row.tsx index e72cf8e737..2a4406c312 100644 --- a/packages/client/src/components/common/business-trip-report/parts/accommodations-row.tsx +++ b/packages/client/src/components/common/business-trip-report/parts/accommodations-row.tsx @@ -11,6 +11,7 @@ import { useUpdateBusinessTripAccommodationsExpense } from '../../../../hooks/us import { Button } from '../../../ui/button.js'; import { Form, FormControl, FormField, FormItem, FormMessage } from '../../../ui/form.js'; import { Input } from '../../../ui/input.js'; +import { TableCell, TableRow } from '../../../ui/table.js'; import { NumberInput, Tooltip } from '../../index.js'; import { CategorizeIntoExistingExpense } from '../buttons/categorize-into-existing-expense.js'; import { DeleteBusinessTripExpense } from '../buttons/delete-business-trip-expense.js'; @@ -75,7 +76,7 @@ export const AccommodationsRow = ({ data, businessTripId, onChange }: Props): Re }; return ( - + - +
{isEditMode ? ( @@ -112,8 +113,8 @@ export const AccommodationsRow = ({ data, businessTripId, onChange }: Props): Re )}
- - +
+
{isEditMode ? (
@@ -144,8 +145,8 @@ export const AccommodationsRow = ({ data, businessTripId, onChange }: Props): Re
)} - - +
+ {isEditMode ? ( )} - - + + {onChange && ( <> @@ -211,7 +212,7 @@ export const AccommodationsRow = ({ data, businessTripId, onChange }: Props): Re /> )} - - + +
); }; diff --git a/packages/client/src/components/common/business-trip-report/parts/accommodations-table.tsx b/packages/client/src/components/common/business-trip-report/parts/accommodations-table.tsx index 50190149ad..c9595c396b 100644 --- a/packages/client/src/components/common/business-trip-report/parts/accommodations-table.tsx +++ b/packages/client/src/components/common/business-trip-report/parts/accommodations-table.tsx @@ -1,7 +1,14 @@ import type { ReactElement } from 'react'; -import { Table } from '@mantine/core'; import { BusinessTripReportAccommodationsTableFieldsFragmentDoc } from '../../../../gql/graphql.js'; import { getFragmentData, type FragmentType } from '../../../../gql/index.js'; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '../../../ui/table.js'; import { AddAccommodationExpense } from '../buttons/add-accommodation-expense.js'; import { AccommodationsRow } from './accommodations-row.js'; import { CoreExpenseHeader } from './core-expense-row.js'; @@ -41,17 +48,17 @@ export const AccommodationsTable = ({ return (
- - - +
+ + - - - - - - + Location + Nights + Attendees Stay + + + + {accommodationExpenses .sort((a, b) => { // sort by start date (if available, newest top) and then by name @@ -71,13 +78,13 @@ export const AccommodationsTable = ({ /> ))} {onChange && ( - - - + + )} - +
LocationNightsAttendees Stay -
+ + -
); diff --git a/packages/client/src/components/common/business-trip-report/parts/attendee-row.tsx b/packages/client/src/components/common/business-trip-report/parts/attendee-row.tsx index b5956a74ba..fabef8f06a 100644 --- a/packages/client/src/components/common/business-trip-report/parts/attendee-row.tsx +++ b/packages/client/src/components/common/business-trip-report/parts/attendee-row.tsx @@ -18,6 +18,7 @@ import { FormLabel, FormMessage, } from '../../../ui/form.js'; +import { TableCell, TableRow } from '../../../ui/table.js'; import { ToggleExpansionButton, Tooltip } from '../../index.js'; import { DatePickerInput } from '../../inputs/date-picker-input.js'; import { DeleteAttendee } from '../buttons/delete-attendee.js'; @@ -75,9 +76,9 @@ export const AttendeeRow = ({ data, businessTripId, onChange }: Props): ReactEle return ( - - {attendee.name} - + + {attendee.name} + {isEditMode ? ( - + + {isEditMode ? ( - + + + +); diff --git a/packages/client/src/components/common/tooltip.tsx b/packages/client/src/components/common/tooltip.tsx index 3dc005d944..8b233b9728 100644 --- a/packages/client/src/components/common/tooltip.tsx +++ b/packages/client/src/components/common/tooltip.tsx @@ -12,8 +12,13 @@ export function Tooltip({ disabled, asChild = false, ...props -}: React.ComponentProps & { +}: Omit, 'content'> & { children: ReactNode; + /** + * `content` is omitted from the base props before being redeclared: React's + * `HTMLAttributes` carries an RDFa `content?: string`, so intersecting the two narrowed + * this to `string & ReactNode` and rejected any JSX tooltip body. + */ content: ReactNode; disabled?: boolean; asChild?: boolean; diff --git a/packages/client/src/components/transactions-table/cells-legacy/account.tsx b/packages/client/src/components/transactions-table/cells-legacy/account.tsx index e47a1d573b..f66140c20b 100644 --- a/packages/client/src/components/transactions-table/cells-legacy/account.tsx +++ b/packages/client/src/components/transactions-table/cells-legacy/account.tsx @@ -2,6 +2,7 @@ import type { ReactElement } from 'react'; import { TransactionsTableAccountFieldsFragmentDoc } from '../../../gql/graphql.js'; import { getFragmentData, type FragmentType } from '../../../gql/index.js'; import { getAccountTypeLabel } from '../../financial-accounts/utils.js'; +import { TableCell } from '../../ui/table.js'; // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen /* GraphQL */ ` @@ -27,11 +28,11 @@ export const Account = ({ data }: Props): ReactElement => { const accountName = account.name; return ( - +

{accountType}

{accountName}

- +
); }; diff --git a/packages/client/src/components/transactions-table/cells-legacy/counterparty.tsx b/packages/client/src/components/transactions-table/cells-legacy/counterparty.tsx index 9ca368b516..3e59526c4b 100644 --- a/packages/client/src/components/transactions-table/cells-legacy/counterparty.tsx +++ b/packages/client/src/components/transactions-table/cells-legacy/counterparty.tsx @@ -10,6 +10,7 @@ import { SelectWithSearch, Tooltip } from '../../common/index.js'; import { InsertBusiness } from '../../common/modals/insert-business.js'; import { SimilarTransactionsModal } from '../../common/modals/similar-transactions-modal.js'; import { Button } from '../../ui/button.js'; +import { TableCell } from '../../ui/table.js'; // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen /* GraphQL */ ` @@ -75,7 +76,7 @@ export function Counterparty({ data, onChange, enableEdit }: Props): ReactElemen const [search, setSearch] = useState(sourceDescription); return ( - +
{counterparty?.id ? ( - + ); } diff --git a/packages/client/src/components/transactions-table/cells-legacy/debit-date.tsx b/packages/client/src/components/transactions-table/cells-legacy/debit-date.tsx index fe4119d355..1f380bfddf 100644 --- a/packages/client/src/components/transactions-table/cells-legacy/debit-date.tsx +++ b/packages/client/src/components/transactions-table/cells-legacy/debit-date.tsx @@ -2,6 +2,7 @@ import { type ReactElement } from 'react'; import { format } from 'date-fns'; import { TransactionsTableDebitDateFieldsFragmentDoc } from '../../../gql/graphql.js'; import { getFragmentData, type FragmentType } from '../../../gql/index.js'; +import { TableCell } from '../../ui/table.js'; // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen /* GraphQL */ ` @@ -21,7 +22,7 @@ export const DebitDate = ({ data }: Props): ReactElement => { const effectiveDate = 'effectiveDate' in transaction ? transaction.effectiveDate : undefined; return ( - +
{effectiveDate && format(new Date(effectiveDate), 'dd/MM/yy')}
{transaction.sourceEffectiveDate && ( @@ -30,6 +31,6 @@ export const DebitDate = ({ data }: Props): ReactElement => {
)}
- +
); }; diff --git a/packages/client/src/components/transactions-table/cells-legacy/description.tsx b/packages/client/src/components/transactions-table/cells-legacy/description.tsx index b2dfdaa5c2..41db7ff87c 100644 --- a/packages/client/src/components/transactions-table/cells-legacy/description.tsx +++ b/packages/client/src/components/transactions-table/cells-legacy/description.tsx @@ -1,6 +1,7 @@ import { type ReactElement } from 'react'; import { TransactionsTableDescriptionFieldsFragmentDoc } from '../../../gql/graphql.js'; import { getFragmentData, type FragmentType } from '../../../gql/index.js'; +import { TableCell } from '../../ui/table.js'; // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen /* GraphQL */ ` @@ -19,10 +20,10 @@ export const Description = ({ data }: Props): ReactElement => { const cellText = 'sourceDescription' in transaction ? transaction.sourceDescription : 'Missing'; return ( - +
{cellText}
- +
); }; diff --git a/packages/client/src/components/transactions-table/cells-legacy/event-date.tsx b/packages/client/src/components/transactions-table/cells-legacy/event-date.tsx index 395359c99c..950dfec725 100644 --- a/packages/client/src/components/transactions-table/cells-legacy/event-date.tsx +++ b/packages/client/src/components/transactions-table/cells-legacy/event-date.tsx @@ -2,6 +2,7 @@ import { type ReactElement } from 'react'; import { format } from 'date-fns'; import { TransactionsTableEventDateFieldsFragmentDoc } from '../../../gql/graphql.js'; import { getFragmentData, type FragmentType } from '../../../gql/index.js'; +import { TableCell } from '../../ui/table.js'; // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen /* GraphQL */ ` @@ -20,10 +21,10 @@ export const EventDate = ({ data }: Props): ReactElement => { const eventDate = 'eventDate' in transaction ? transaction.eventDate : undefined; return ( - +
{eventDate && format(new Date(eventDate), 'dd/MM/yy')}
- +
); }; diff --git a/packages/client/src/components/transactions-table/cells-legacy/source-id.tsx b/packages/client/src/components/transactions-table/cells-legacy/source-id.tsx index 67f971e902..3973c3800f 100644 --- a/packages/client/src/components/transactions-table/cells-legacy/source-id.tsx +++ b/packages/client/src/components/transactions-table/cells-legacy/source-id.tsx @@ -1,6 +1,7 @@ import { type ReactElement } from 'react'; import { TransactionsTableSourceIdFieldsFragmentDoc } from '../../../gql/graphql.js'; import { getFragmentData, type FragmentType } from '../../../gql/index.js'; +import { TableCell } from '../../ui/table.js'; // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen /* GraphQL */ ` @@ -18,10 +19,10 @@ export const SourceID = ({ data }: Props): ReactElement => { const transaction = getFragmentData(TransactionsTableSourceIdFieldsFragmentDoc, data); return ( - +
{transaction.referenceKey}
- +
); };