@veritone-ce/design-system 2.3.14 → 2.4.1

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 (55) hide show
  1. package/dist/cjs/StatusChip/index.js +65 -0
  2. package/dist/cjs/StatusChip/styles.module.scss.js +7 -0
  3. package/dist/cjs/Table/AutoTable/common.js +144 -0
  4. package/dist/cjs/Table/AutoTable/controlled.js +102 -0
  5. package/dist/cjs/Table/AutoTable/index.js +110 -0
  6. package/dist/cjs/Table/AutoTable/virtual.js +176 -0
  7. package/dist/cjs/Table/TableCell/index.js +50 -0
  8. package/dist/cjs/Table/TableCell/styles.module.scss.js +7 -0
  9. package/dist/cjs/Table/TableRow/index.js +34 -0
  10. package/dist/cjs/Table/TableRow/styles.module.scss.js +7 -0
  11. package/dist/cjs/Table/index.js +76 -0
  12. package/dist/cjs/Table/styles.module.scss.js +7 -0
  13. package/dist/cjs/Typography/index.js +2 -1
  14. package/dist/cjs/Typography/variants.module.scss.js +1 -1
  15. package/dist/cjs/index.js +27 -10
  16. package/dist/cjs/styles/createPalette.js +24 -4
  17. package/dist/cjs/styles/typography.js +9 -1
  18. package/dist/cjs/styles.css +1 -1
  19. package/dist/esm/StatusChip/index.js +61 -0
  20. package/dist/esm/StatusChip/styles.module.scss.js +3 -0
  21. package/dist/esm/Table/AutoTable/common.js +138 -0
  22. package/dist/esm/Table/AutoTable/controlled.js +98 -0
  23. package/dist/esm/Table/AutoTable/index.js +106 -0
  24. package/dist/esm/Table/AutoTable/virtual.js +171 -0
  25. package/dist/esm/Table/TableCell/index.js +46 -0
  26. package/dist/esm/Table/TableCell/styles.module.scss.js +3 -0
  27. package/dist/esm/Table/TableRow/index.js +30 -0
  28. package/dist/esm/Table/TableRow/styles.module.scss.js +3 -0
  29. package/dist/esm/Table/index.js +69 -0
  30. package/dist/esm/Table/styles.module.scss.js +3 -0
  31. package/dist/esm/Typography/index.js +2 -1
  32. package/dist/esm/Typography/variants.module.scss.js +1 -1
  33. package/dist/esm/index.js +6 -0
  34. package/dist/esm/styles/createPalette.js +24 -4
  35. package/dist/esm/styles/scss/theme.generated.scss +83 -17
  36. package/dist/esm/styles/typography.js +9 -1
  37. package/dist/esm/styles.css +1 -1
  38. package/dist/types/Checkbox/index.d.ts +2 -0
  39. package/dist/types/Dialog/components.d.ts +5 -5
  40. package/dist/types/Drawer/components.d.ts +5 -5
  41. package/dist/types/StatusChip/index.d.ts +12 -0
  42. package/dist/types/Table/AutoTable/common.d.ts +31 -0
  43. package/dist/types/Table/AutoTable/controlled.d.ts +13 -0
  44. package/dist/types/Table/AutoTable/index.d.ts +47 -0
  45. package/dist/types/Table/AutoTable/types.d.ts +106 -0
  46. package/dist/types/Table/AutoTable/virtual.d.ts +23 -0
  47. package/dist/types/Table/TableCell/index.d.ts +14 -0
  48. package/dist/types/Table/TableRow/index.d.ts +10 -0
  49. package/dist/types/Table/index.d.ts +68 -0
  50. package/dist/types/Typography/index.d.ts +1 -1
  51. package/dist/types/index.d.ts +10 -0
  52. package/dist/types/styles/createPalette.d.ts +2 -0
  53. package/dist/types/styles/palette.d.ts +2 -0
  54. package/dist/types/styles/typography.d.ts +1 -1
  55. package/package.json +2 -1
@@ -0,0 +1,138 @@
1
+ 'use strict';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useReactTable, getCoreRowModel, getSortedRowModel, getPaginationRowModel } from '@tanstack/react-table';
4
+ import React__default from 'react';
5
+ import TableCell from '../TableCell/index.js';
6
+ import { Box } from '@mui/material';
7
+
8
+ function createColumnHelper() {
9
+ return {
10
+ accessor: (accessor, column) => {
11
+ return typeof accessor === "function" ? {
12
+ ...column,
13
+ accessorFn: accessor
14
+ } : {
15
+ ...column,
16
+ accessorKey: accessor
17
+ };
18
+ },
19
+ display: (column) => column
20
+ // group: column => column
21
+ };
22
+ }
23
+ function useAutoTable(options) {
24
+ const columnsProp = options.columns;
25
+ const mappedColumns = React__default.useMemo(
26
+ () => mapColumnDefs(columnsProp),
27
+ [columnsProp]
28
+ );
29
+ return useReactTable({
30
+ data: options.data,
31
+ columns: mappedColumns,
32
+ manualSorting: options.manualSorting,
33
+ manualPagination: options.manualPagination,
34
+ enableSorting: options.enableSorting,
35
+ enableRowSelection: options.enableRowSelection,
36
+ meta: options.meta,
37
+ getRowId: options.getRowId,
38
+ defaultColumn: {
39
+ cell: (info) => /* @__PURE__ */ jsx(TableCell, { children: info.renderValue() })
40
+ },
41
+ initialState: {
42
+ pagination: {
43
+ pageSize: options.pagination.pageSize
44
+ }
45
+ },
46
+ state: {
47
+ pagination: options.pagination,
48
+ sorting: options.sorting,
49
+ rowSelection: options.rowSelection
50
+ },
51
+ onSortingChange: (updater) => {
52
+ const value = typeof updater === "function" ? updater(options.sorting) : updater;
53
+ options.onSortingChange(value);
54
+ },
55
+ onRowSelectionChange: (updater) => {
56
+ const value = typeof updater === "function" ? updater(options.rowSelection) : updater;
57
+ options.onRowSelectionChange(value);
58
+ },
59
+ onPaginationChange: () => {
60
+ },
61
+ getCoreRowModel: getCoreRowModel(),
62
+ getSortedRowModel: getSortedRowModel(),
63
+ getPaginationRowModel: getPaginationRowModel()
64
+ });
65
+ }
66
+ function mapColumnDefs(columnDefs) {
67
+ return columnDefs.map(mapColumnDef);
68
+ }
69
+ function mapColumnDef(columnDef) {
70
+ const meta = {
71
+ noVerticalPadding: columnDef.noVerticalPadding
72
+ };
73
+ const mappedDef = {
74
+ id: columnDef.id,
75
+ accessorFn: columnDef.accessorFn,
76
+ accessorKey: columnDef.accessorKey,
77
+ meta,
78
+ getUniqueValues: columnDef.getUniqueValues,
79
+ header: columnDef.header !== void 0 ? makeHeaderMappingComponent(columnDef.header) : void 0,
80
+ cell: columnDef.cell !== void 0 ? makeCellMappingComponent(columnDef.cell) : void 0,
81
+ enableMultiSort: columnDef.enableMultiSort,
82
+ enableSorting: columnDef.enableSorting,
83
+ invertSorting: columnDef.invertSorting,
84
+ sortDescFirst: columnDef.sortDescFirst,
85
+ sortingFn: columnDef.sortingFn,
86
+ sortUndefined: columnDef.sortUndefined
87
+ };
88
+ Object.keys(mappedDef).forEach((key) => {
89
+ const k = key;
90
+ if (mappedDef[k] === void 0) {
91
+ delete mappedDef[k];
92
+ }
93
+ });
94
+ return mappedDef;
95
+ }
96
+ function makeHeaderMappingComponent(header) {
97
+ if (typeof header === "string") {
98
+ return header;
99
+ }
100
+ return (props) => header({
101
+ column: props.column,
102
+ header: props.header,
103
+ table: props.table,
104
+ meta: props.table.options.meta
105
+ });
106
+ }
107
+ function makeCellMappingComponent(cell) {
108
+ if (typeof cell === "string") {
109
+ return cell;
110
+ }
111
+ return (props) => cell({
112
+ cell: props.cell,
113
+ column: props.column,
114
+ getValue: props.getValue,
115
+ renderValue: props.renderValue,
116
+ row: props.row,
117
+ table: props.table,
118
+ meta: props.table.options.meta
119
+ });
120
+ }
121
+ const DefaultErrorContainer = () => {
122
+ return /* @__PURE__ */ jsx(
123
+ Box,
124
+ {
125
+ sx: {
126
+ width: "100%",
127
+ display: "flex",
128
+ justifyContent: "center",
129
+ alignItems: "center",
130
+ paddingTop: "10px",
131
+ paddingBottom: "10px"
132
+ },
133
+ children: /* @__PURE__ */ jsx("div", { children: "Some error message" })
134
+ }
135
+ );
136
+ };
137
+
138
+ export { DefaultErrorContainer, createColumnHelper, mapColumnDef, mapColumnDefs, useAutoTable };
@@ -0,0 +1,98 @@
1
+ 'use strict';
2
+ 'use client';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+ import { flexRender } from '@tanstack/react-table';
5
+ import { Table, TableHead, TableSortLabel, TableBody, TableMessage, TableFooter } from '../index.js';
6
+ import TableRow from '../TableRow/index.js';
7
+ import TableCell from '../TableCell/index.js';
8
+ import React__default from 'react';
9
+ import { visuallyHidden } from '@mui/utils';
10
+ import { useAutoTable, DefaultErrorContainer } from './common.js';
11
+ import TablePagination from '../../TablePagination/index.js';
12
+ import CircularProgress from '../../CircularProgress/index.js';
13
+
14
+ function ControlledAutoTable({
15
+ stickyHeader,
16
+ loading,
17
+ zeroStateMessage,
18
+ error,
19
+ ErrorContainer = DefaultErrorContainer,
20
+ className,
21
+ ...options
22
+ }) {
23
+ const table = useAutoTable(options);
24
+ const rows = options.data;
25
+ const manualRowCount = options.manualRowCount ?? rows.length;
26
+ const showMessage = error || loading || rows.length === 0;
27
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsxs(
28
+ Table,
29
+ {
30
+ sx: {
31
+ borderCollapse: "separate",
32
+ ...stickyHeader ? {
33
+ "& th": {
34
+ position: "sticky",
35
+ top: typeof stickyHeader === "object" ? stickyHeader.offset : 0,
36
+ zIndex: 2,
37
+ backgroundColor: (theme) => theme.palette.background.default
38
+ }
39
+ } : {}
40
+ },
41
+ children: [
42
+ /* @__PURE__ */ jsx(TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => {
43
+ const isSorted = header.column.getIsSorted();
44
+ return /* @__PURE__ */ jsx(TableCell, { variant: "header", children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsxs(
45
+ TableSortLabel,
46
+ {
47
+ active: isSorted !== false,
48
+ direction: isSorted !== false ? isSorted : "asc",
49
+ onClick: header.column.getToggleSortingHandler(),
50
+ children: [
51
+ flexRender(
52
+ header.column.columnDef.header,
53
+ header.getContext()
54
+ ),
55
+ isSorted !== false ? /* @__PURE__ */ jsx("span", { style: visuallyHidden, children: isSorted === "desc" ? "sorted descending" : "sorted ascending" }) : null
56
+ ]
57
+ }
58
+ ) : flexRender(
59
+ header.column.columnDef.header,
60
+ header.getContext()
61
+ ) }, header.id);
62
+ }) }, headerGroup.id)) }),
63
+ showMessage ? /* @__PURE__ */ jsx(TableBody, { children: /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: table.getAllFlatColumns().length, children: error ? /* @__PURE__ */ jsx(ErrorContainer, { error }) : loading ? /* @__PURE__ */ jsx(
64
+ "div",
65
+ {
66
+ style: {
67
+ display: "flex",
68
+ justifyContent: "center",
69
+ paddingTop: "10px",
70
+ paddingBottom: "10px"
71
+ },
72
+ children: /* @__PURE__ */ jsx(CircularProgress, {})
73
+ }
74
+ ) : rows.length === 0 ? /* @__PURE__ */ jsx(TableMessage, { children: zeroStateMessage ?? "No data found" }) : null }) }) }) : /* @__PURE__ */ jsx(TableBody, { children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(TableRow, { children: row.getAllCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) }),
75
+ options.enablePagination && (options.manualPagination ? manualRowCount : options.data.length) > table.initialState.pagination.pageSize && /* @__PURE__ */ jsx(TableFooter, { children: /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx("td", { colSpan: table.getAllFlatColumns().length, children: /* @__PURE__ */ jsx(
76
+ TablePagination,
77
+ {
78
+ count: options.manualPagination ? manualRowCount : table.getFilteredRowModel().rows.length,
79
+ rowsPerPage: table.getState().pagination.pageSize,
80
+ page: table.getState().pagination.pageIndex + 1,
81
+ onChangePage: (newPage) => {
82
+ table.setPageIndex(newPage - 1);
83
+ options.onPageChange(newPage - 1);
84
+ },
85
+ rowsPerPageOptions: [10, 25, 50, 100],
86
+ onRowsPerPageChange: (rowsPerPage) => {
87
+ const size = rowsPerPage ?? 10;
88
+ table.setPageSize(size);
89
+ options.onRowsPerPageChange(size);
90
+ }
91
+ }
92
+ ) }) }) })
93
+ ]
94
+ }
95
+ ) });
96
+ }
97
+
98
+ export { ControlledAutoTable as default };
@@ -0,0 +1,106 @@
1
+ 'use strict';
2
+ 'use client';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import React__default from 'react';
5
+ import VirtualControlledAutoTable from './virtual.js';
6
+ import ControlledAutoTable from './controlled.js';
7
+ import '@tanstack/react-table';
8
+ import '../TableCell/index.js';
9
+ import '@mui/material';
10
+
11
+ function AutoTable(props) {
12
+ const enableSorting = props.enableSorting ?? true;
13
+ const [managedSorting, setManagedSorting] = useManagedStateSwitch(
14
+ props.sorting,
15
+ props.onSortingChange,
16
+ props.defaultSorting ?? []
17
+ );
18
+ const enableRowSelection = props.enableRowSelection ?? props.rowSelection !== void 0;
19
+ const [managedRowSelection, setManagedRowSelection] = useManagedStateSwitch(
20
+ props.rowSelection,
21
+ props.onRowSelectionChange,
22
+ {}
23
+ );
24
+ const enablePagination = props.enablePagination ?? true;
25
+ const [managedPage, setManagedPage] = useManagedStateSwitch(
26
+ props.page,
27
+ props.onPageChange,
28
+ 0
29
+ );
30
+ const [managedRowsPerPage, setManagedRowsPerPage] = useManagedStateSwitch(
31
+ props.rowsPerPage,
32
+ props.onRowsPerPageChange,
33
+ 10
34
+ );
35
+ const options = {
36
+ data: props.data,
37
+ columns: props.columns,
38
+ meta: props.meta,
39
+ getRowId: props.getRowId,
40
+ // sorting
41
+ sorting: managedSorting,
42
+ enableSorting,
43
+ onSortingChange: setManagedSorting,
44
+ manualSorting: props.manualSorting,
45
+ // selection
46
+ rowSelection: managedRowSelection,
47
+ enableRowSelection,
48
+ onRowSelectionChange: setManagedRowSelection,
49
+ // pagination
50
+ pagination: {
51
+ pageIndex: managedPage,
52
+ pageSize: enablePagination ? managedRowsPerPage : props.data.length
53
+ },
54
+ enablePagination,
55
+ onPageChange: setManagedPage,
56
+ onRowsPerPageChange: setManagedRowsPerPage,
57
+ manualPagination: props.manualRowCount !== void 0,
58
+ manualRowCount: props.manualRowCount
59
+ };
60
+ if (props.virtualizer) {
61
+ return /* @__PURE__ */ jsx(
62
+ VirtualControlledAutoTable,
63
+ {
64
+ ...options,
65
+ ...props.virtualizer,
66
+ stickyHeader: props.stickyHeader,
67
+ loading: props.loading,
68
+ zeroStateMessage: props.zeroStateMessage,
69
+ error: props.error,
70
+ ErrorContainer: props.ErrorContainer,
71
+ sx: props.sx,
72
+ className: props.className
73
+ }
74
+ );
75
+ }
76
+ return /* @__PURE__ */ jsx(
77
+ ControlledAutoTable,
78
+ {
79
+ ...options,
80
+ stickyHeader: props.stickyHeader,
81
+ loading: props.loading,
82
+ zeroStateMessage: props.zeroStateMessage,
83
+ error: props.error,
84
+ ErrorContainer: props.ErrorContainer,
85
+ className: props.className
86
+ }
87
+ );
88
+ }
89
+ function useManagedStateSwitch(controlled, setControlled, uncontrolledDefault) {
90
+ const [uncontrolled, setUncontrolled] = React__default.useState(uncontrolledDefault);
91
+ const [managed, setManaged] = controlled !== void 0 ? [
92
+ controlled,
93
+ (u) => {
94
+ setControlled?.(u);
95
+ }
96
+ ] : [
97
+ uncontrolled,
98
+ (u) => {
99
+ setUncontrolled(u);
100
+ setControlled?.(u);
101
+ }
102
+ ];
103
+ return [managed, setManaged];
104
+ }
105
+
106
+ export { AutoTable as default };
@@ -0,0 +1,171 @@
1
+ 'use strict';
2
+ 'use client';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import { flexRender } from '@tanstack/react-table';
5
+ import { Table, TableHead, TableSortLabel, TableBody, TableMessage } from '../index.js';
6
+ import TableRow from '../TableRow/index.js';
7
+ import TableCell from '../TableCell/index.js';
8
+ import React__default from 'react';
9
+ import { styled, Box, CircularProgress } from '@mui/material';
10
+ import { visuallyHidden } from '@mui/utils';
11
+ import { useAutoTable, DefaultErrorContainer } from './common.js';
12
+ import { useVirtualizer } from '@tanstack/react-virtual';
13
+
14
+ const TableMessageMaxHeight = 100;
15
+ const TableContainer = styled(Box)(
16
+ ({ virtualizerTotalHeight }) => ({
17
+ height: `${virtualizerTotalHeight}px`
18
+ })
19
+ );
20
+ function VirtualControlledAutoTable({
21
+ stickyHeader,
22
+ loading,
23
+ zeroStateMessage,
24
+ error,
25
+ ErrorContainer = DefaultErrorContainer,
26
+ scrollOffset,
27
+ getScrollElement,
28
+ renderWhenNotVisible = true,
29
+ rowSize,
30
+ headerSize = 50,
31
+ overscan,
32
+ debug,
33
+ sx,
34
+ className,
35
+ ...options
36
+ }) {
37
+ const table = useAutoTable(options);
38
+ const { rows } = table.getRowModel();
39
+ const offsetFromScrollEl = scrollOffset ?? 0;
40
+ const virtualizer = useVirtualizer({
41
+ getScrollElement,
42
+ scrollMargin: offsetFromScrollEl,
43
+ count: rows.length,
44
+ overscan: overscan ?? 10,
45
+ estimateSize: () => rowSize
46
+ });
47
+ const showMessage = error || loading || rows.length === 0;
48
+ const rowsHeight = rows.length * rowSize;
49
+ const totalHeight = headerSize + (showMessage ? TableMessageMaxHeight : rowsHeight);
50
+ const visibilityOverscan = virtualizer.options.overscan * rowSize;
51
+ const visibilityBounds = {
52
+ lower: offsetFromScrollEl - visibilityOverscan,
53
+ upper: offsetFromScrollEl + totalHeight + visibilityOverscan
54
+ };
55
+ const tableIsVisible = renderWhenNotVisible || virtualizer.scrollOffset + virtualizer.scrollRect.height >= visibilityBounds.lower && virtualizer.scrollOffset <= visibilityBounds.upper;
56
+ const virtualItems = virtualizer.getVirtualItems();
57
+ return /* @__PURE__ */ jsxs(
58
+ TableContainer,
59
+ {
60
+ virtualizerTotalHeight: totalHeight,
61
+ sx,
62
+ className,
63
+ children: [
64
+ debug && /* @__PURE__ */ jsx("div", { style: { position: "relative" }, children: /* @__PURE__ */ jsxs(
65
+ "div",
66
+ {
67
+ style: {
68
+ position: "absolute",
69
+ top: 0,
70
+ left: 0,
71
+ color: "red",
72
+ zIndex: 100,
73
+ fontSize: 10
74
+ },
75
+ children: [
76
+ /* @__PURE__ */ jsx("span", { style: { marginRight: 5 }, children: virtualizer.scrollOffset }),
77
+ /* @__PURE__ */ jsx("span", { style: { marginRight: 5 }, children: virtualizer.scrollOffset + virtualizer.scrollRect.height }),
78
+ /* @__PURE__ */ jsx("span", { style: { marginRight: 5 }, children: offsetFromScrollEl }),
79
+ /* @__PURE__ */ jsx("span", { style: { marginRight: 5 }, children: visibilityBounds.lower }),
80
+ /* @__PURE__ */ jsx("span", { style: { marginRight: 5 }, children: visibilityBounds.upper })
81
+ ]
82
+ }
83
+ ) }),
84
+ /* @__PURE__ */ jsxs(
85
+ Table,
86
+ {
87
+ sx: {
88
+ borderCollapse: "separate",
89
+ ...stickyHeader ? {
90
+ "& th": {
91
+ position: "sticky",
92
+ top: typeof stickyHeader === "object" ? stickyHeader.offset : 0,
93
+ zIndex: 2,
94
+ backgroundColor: (theme) => theme.palette.background.default
95
+ }
96
+ } : {}
97
+ },
98
+ children: [
99
+ /* @__PURE__ */ jsx(TableHead, { sx: { height: headerSize }, children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => {
100
+ const isSorted = header.column.getIsSorted();
101
+ return /* @__PURE__ */ jsx(TableCell, { variant: "header", children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsxs(
102
+ TableSortLabel,
103
+ {
104
+ active: isSorted !== false,
105
+ direction: isSorted !== false ? isSorted : "asc",
106
+ onClick: header.column.getToggleSortingHandler(),
107
+ children: [
108
+ flexRender(
109
+ header.column.columnDef.header,
110
+ header.getContext()
111
+ ),
112
+ isSorted !== false ? /* @__PURE__ */ jsx(Box, { component: "span", sx: visuallyHidden, children: isSorted === "desc" ? "sorted descending" : "sorted ascending" }) : null
113
+ ]
114
+ }
115
+ ) : flexRender(
116
+ header.column.columnDef.header,
117
+ header.getContext()
118
+ ) }, header.id);
119
+ }) }, headerGroup.id)) }),
120
+ showMessage ? /* @__PURE__ */ jsx(TableBody, { children: /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(
121
+ TableCell,
122
+ {
123
+ colSpan: table.getAllFlatColumns().length,
124
+ children: /* @__PURE__ */ jsx(Box, { children: error ? /* @__PURE__ */ jsx(ErrorContainer, { error }) : loading ? /* @__PURE__ */ jsx(
125
+ Box,
126
+ {
127
+ sx: {
128
+ display: "flex",
129
+ justifyContent: "center",
130
+ paddingTop: "10px",
131
+ paddingBottom: "10px"
132
+ },
133
+ children: /* @__PURE__ */ jsx(CircularProgress, {})
134
+ }
135
+ ) : rows.length === 0 ? /* @__PURE__ */ jsx(TableMessage, { children: zeroStateMessage ?? "No data found" }) : null })
136
+ }
137
+ ) }) }) : tableIsVisible && /* @__PURE__ */ jsx(
138
+ TableBody,
139
+ {
140
+ sx: {
141
+ "&::after": {
142
+ display: "block",
143
+ content: "''",
144
+ // this ensures the table takes up as much size as the total elements by adding padding to the end
145
+ height: `${(rows.length - virtualItems.length) * rowSize}px`
146
+ }
147
+ },
148
+ children: virtualItems.map((virtualRow) => {
149
+ const row = rows[virtualRow.index];
150
+ return /* @__PURE__ */ jsx(
151
+ TableRow,
152
+ {
153
+ children: row.getAllCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(
154
+ cell.column.columnDef.cell,
155
+ cell.getContext()
156
+ ) }, cell.id))
157
+ },
158
+ row.id
159
+ );
160
+ })
161
+ }
162
+ )
163
+ ]
164
+ }
165
+ )
166
+ ]
167
+ }
168
+ );
169
+ }
170
+
171
+ export { TableMessageMaxHeight, VirtualControlledAutoTable as default };
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+ 'use client';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import React__default, { forwardRef } from 'react';
5
+ import styles from './styles.module.scss.js';
6
+ import '@capsizecss/core';
7
+ import 'color2k';
8
+ import '../../styles/css-vars.js';
9
+ import { cx } from '../../styles/cx.js';
10
+ import '../../styles/defaultTheme.js';
11
+ import '@mui/system';
12
+ import '../../Box/index.js';
13
+ import '../../styles/styled.js';
14
+
15
+ const TableCell = forwardRef(
16
+ ({
17
+ children,
18
+ "data-testid": dataTestId,
19
+ noVerticalPadding,
20
+ variant = "data",
21
+ className,
22
+ style,
23
+ ...props
24
+ }, ref) => {
25
+ const Tag = React__default.useMemo(
26
+ () => variant === "header" ? "th" : "td",
27
+ [variant]
28
+ );
29
+ return /* @__PURE__ */ jsx(
30
+ Tag,
31
+ {
32
+ ref,
33
+ ...props,
34
+ "data-testid": dataTestId,
35
+ className: cx(styles.tableCell, className),
36
+ style: {
37
+ padding: `${noVerticalPadding ? "0px" : "14.25px"} ${"16px"}`,
38
+ ...style
39
+ },
40
+ children
41
+ }
42
+ );
43
+ }
44
+ );
45
+
46
+ export { TableCell as default };
@@ -0,0 +1,3 @@
1
+ var styles = {"tableCell":"vt_ce_TableCell_tableCell__a1247ad8"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+ 'use client';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { forwardRef } from 'react';
5
+ import styles from './styles.module.scss.js';
6
+ import '@capsizecss/core';
7
+ import 'color2k';
8
+ import '../../styles/css-vars.js';
9
+ import { cx } from '../../styles/cx.js';
10
+ import '../../styles/defaultTheme.js';
11
+ import '@mui/system';
12
+ import '../../Box/index.js';
13
+ import '../../styles/styled.js';
14
+
15
+ const TableRow = forwardRef(
16
+ ({ children, "data-testid": dataTestId, className, ...props }, ref) => {
17
+ return /* @__PURE__ */ jsx(
18
+ "tr",
19
+ {
20
+ ref,
21
+ ...props,
22
+ "data-testid": dataTestId,
23
+ className: cx(styles.tableRow, className),
24
+ children
25
+ }
26
+ );
27
+ }
28
+ );
29
+
30
+ export { TableRow as default };
@@ -0,0 +1,3 @@
1
+ var styles = {"tableRow":"vt_ce_TableRow_tableRow__20cdba2f"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { Table as Table$1, TableBody as TableBody$1, TableFooter as TableFooter$1, TableHead as TableHead$1, TableSortLabel as TableSortLabel$1 } from '@mui/material';
4
+ import Typography from '../Typography/index.js';
5
+ import styles from './styles.module.scss.js';
6
+
7
+ const Table = (props) => {
8
+ return /* @__PURE__ */ jsx(
9
+ Table$1,
10
+ {
11
+ "data-testid": props["data-testid"],
12
+ stickyHeader: props.stickyHeader,
13
+ sx: props.sx,
14
+ className: props.className,
15
+ children: props.children
16
+ }
17
+ );
18
+ };
19
+ const TableBody = (props) => {
20
+ return /* @__PURE__ */ jsx(
21
+ TableBody$1,
22
+ {
23
+ "data-testid": props["data-testid"],
24
+ sx: props.sx,
25
+ className: props.className,
26
+ children: props.children
27
+ }
28
+ );
29
+ };
30
+ const TableFooter = (props) => {
31
+ return /* @__PURE__ */ jsx(
32
+ TableFooter$1,
33
+ {
34
+ "data-testid": props["data-testid"],
35
+ sx: props.sx,
36
+ className: props.className,
37
+ children: props.children
38
+ }
39
+ );
40
+ };
41
+ const TableHead = (props) => {
42
+ return /* @__PURE__ */ jsx(
43
+ TableHead$1,
44
+ {
45
+ "data-testid": props["data-testid"],
46
+ sx: props.sx,
47
+ className: props.className,
48
+ children: props.children
49
+ }
50
+ );
51
+ };
52
+ const TableSortLabel = (props) => {
53
+ return /* @__PURE__ */ jsx(
54
+ TableSortLabel$1,
55
+ {
56
+ active: props.active,
57
+ direction: props.direction,
58
+ hideSortIcon: props.hideSortIcon,
59
+ onClick: props.onClick,
60
+ disabled: props.disabled,
61
+ children: props.children
62
+ }
63
+ );
64
+ };
65
+ const TableMessage = (props) => {
66
+ return /* @__PURE__ */ jsx("div", { className: styles.tableMessageWrapper, children: /* @__PURE__ */ jsx(Typography, { className: styles.tableMessage, children: props.children }) });
67
+ };
68
+
69
+ export { Table, TableBody, TableFooter, TableHead, TableMessage, TableSortLabel };
@@ -0,0 +1,3 @@
1
+ var styles = {"tableMessageWrapper":"vt_ce_Table_tableMessageWrapper__bd25fe47","tableMessage":"vt_ce_Table_tableMessage__f6316814","checkbox":"vt_ce_Table_checkbox__fcf60b18","selectionTableCell":"vt_ce_Table_selectionTableCell__1edf8bad"};
2
+
3
+ export { styles as default };
@@ -42,7 +42,8 @@ const variantComponents = {
42
42
  paragraph3: "p",
43
43
  button: "span",
44
44
  buttonSmall: "span",
45
- input: "span"
45
+ input: "span",
46
+ statusChip: "span"
46
47
  };
47
48
 
48
49
  export { Typography as default };