@veritone-ce/design-system 1.12.46 → 1.12.48
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.
- package/dist/cjs/assets/theme.js +7 -5
- package/dist/cjs/components/Button/index.js +17 -15
- package/dist/cjs/components/FileUploader/index.js +166 -156
- package/dist/cjs/components/IconButton/index.js +27 -0
- package/dist/cjs/components/MenuFlyout/index.js +2 -0
- package/dist/cjs/components/Table/AutoTable/common.js +143 -0
- package/dist/cjs/components/Table/AutoTable/controlled.js +120 -0
- package/dist/cjs/components/Table/AutoTable/index.js +118 -0
- package/dist/cjs/components/Table/AutoTable/types.js +5 -0
- package/dist/cjs/components/Table/AutoTable/virtual.js +154 -0
- package/dist/cjs/components/Table/index.js +83 -35
- package/dist/cjs/index.js +117 -68
- package/dist/esm/assets/theme.js +7 -5
- package/dist/esm/components/Button/index.js +17 -15
- package/dist/esm/components/FileUploader/index.js +163 -153
- package/dist/esm/components/IconButton/index.js +17 -0
- package/dist/esm/components/MenuFlyout/index.js +2 -0
- package/dist/esm/components/Table/AutoTable/common.js +133 -0
- package/dist/esm/components/Table/AutoTable/controlled.js +115 -0
- package/dist/esm/components/Table/AutoTable/index.js +107 -0
- package/dist/esm/components/Table/AutoTable/types.js +1 -0
- package/dist/esm/components/Table/AutoTable/virtual.js +149 -0
- package/dist/esm/components/Table/index.js +80 -33
- package/dist/esm/index.js +6 -2
- package/dist/types/components/Button/index.d.ts +2 -0
- package/dist/types/components/FileUploader/index.d.ts +18 -14
- package/dist/types/components/IconButton/index.d.ts +16 -0
- package/dist/types/components/MenuFlyout/index.d.ts +4 -4
- package/dist/types/components/Table/AutoTable/common.d.ts +25 -0
- package/dist/types/components/Table/AutoTable/controlled.d.ts +13 -0
- package/dist/types/components/Table/AutoTable/index.d.ts +44 -0
- package/dist/types/components/Table/AutoTable/types.d.ts +106 -0
- package/dist/types/components/Table/AutoTable/virtual.d.ts +19 -0
- package/dist/types/components/Table/index.d.ts +45 -8
- package/dist/types/index.d.ts +13 -4
- package/package.json +4 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
var _excluded = ["stickyHeader", "loading", "zeroStateMessage", "sx", "className"];
|
|
4
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
|
+
import { flexRender } from '@tanstack/react-table';
|
|
13
|
+
import { Table, TableBody, TableCell, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel, TableZeroState } from '../index.js';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { Box, CircularProgress } from '@mui/material';
|
|
16
|
+
import { visuallyHidden } from '@mui/utils';
|
|
17
|
+
import { useAutoTable } from './common.js';
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
export default function ControlledAutoTable(_ref) {
|
|
21
|
+
var _options$manualRowCou;
|
|
22
|
+
var stickyHeader = _ref.stickyHeader,
|
|
23
|
+
loading = _ref.loading,
|
|
24
|
+
zeroStateMessage = _ref.zeroStateMessage,
|
|
25
|
+
sx = _ref.sx,
|
|
26
|
+
className = _ref.className,
|
|
27
|
+
options = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var table = useAutoTable(options);
|
|
29
|
+
var manualRowCount = (_options$manualRowCou = options.manualRowCount) !== null && _options$manualRowCou !== void 0 ? _options$manualRowCou : options.data.length;
|
|
30
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
31
|
+
sx: sx,
|
|
32
|
+
className: className,
|
|
33
|
+
children: /*#__PURE__*/_jsxs(Table, {
|
|
34
|
+
sx: _objectSpread({
|
|
35
|
+
borderCollapse: 'separate'
|
|
36
|
+
}, stickyHeader ? {
|
|
37
|
+
'& th': {
|
|
38
|
+
position: 'sticky',
|
|
39
|
+
top: _typeof(stickyHeader) === 'object' ? stickyHeader.offset : 0,
|
|
40
|
+
zIndex: 2,
|
|
41
|
+
backgroundColor: function backgroundColor(theme) {
|
|
42
|
+
return theme.palette.background["default"];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} : {}),
|
|
46
|
+
children: [/*#__PURE__*/_jsx(TableHead, {
|
|
47
|
+
children: table.getHeaderGroups().map(function (headerGroup) {
|
|
48
|
+
return /*#__PURE__*/_jsx(TableRow, {
|
|
49
|
+
children: headerGroup.headers.map(function (header) {
|
|
50
|
+
var isSorted = header.column.getIsSorted();
|
|
51
|
+
return /*#__PURE__*/_jsx(TableCell, {
|
|
52
|
+
variant: "header",
|
|
53
|
+
children: header.isPlaceholder ? null : header.column.getCanSort() ? /*#__PURE__*/_jsxs(TableSortLabel, {
|
|
54
|
+
active: isSorted !== false,
|
|
55
|
+
direction: isSorted !== false ? isSorted : 'asc',
|
|
56
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
57
|
+
children: [flexRender(header.column.columnDef.header, header.getContext()), isSorted !== false ? /*#__PURE__*/_jsx(Box, {
|
|
58
|
+
component: "span",
|
|
59
|
+
sx: visuallyHidden,
|
|
60
|
+
children: isSorted === 'desc' ? 'sorted descending' : 'sorted ascending'
|
|
61
|
+
}) : null]
|
|
62
|
+
}) : flexRender(header.column.columnDef.header, header.getContext())
|
|
63
|
+
}, header.id);
|
|
64
|
+
})
|
|
65
|
+
}, headerGroup.id);
|
|
66
|
+
})
|
|
67
|
+
}), loading ? /*#__PURE__*/_jsx(TableBody, {
|
|
68
|
+
children: /*#__PURE__*/_jsx(TableRow, {
|
|
69
|
+
children: /*#__PURE__*/_jsx(TableCell, {
|
|
70
|
+
colSpan: table.getAllFlatColumns().length,
|
|
71
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
}) : options.data.length === 0 ? /*#__PURE__*/_jsx(TableBody, {
|
|
75
|
+
children: /*#__PURE__*/_jsx(TableRow, {
|
|
76
|
+
children: /*#__PURE__*/_jsx(TableCell, {
|
|
77
|
+
colSpan: table.getAllFlatColumns().length,
|
|
78
|
+
children: /*#__PURE__*/_jsx(TableZeroState, {
|
|
79
|
+
children: zeroStateMessage !== null && zeroStateMessage !== void 0 ? zeroStateMessage : 'No data found'
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}) : /*#__PURE__*/_jsx(TableBody, {
|
|
84
|
+
children: table.getRowModel().rows.map(function (row) {
|
|
85
|
+
return /*#__PURE__*/_jsx(TableRow, {
|
|
86
|
+
children: row.getAllCells().map(function (cell) {
|
|
87
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
88
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
89
|
+
}, cell.id);
|
|
90
|
+
})
|
|
91
|
+
}, row.id);
|
|
92
|
+
})
|
|
93
|
+
}), options.enablePagination && (options.manualPagination ? manualRowCount : options.data.length) > table.initialState.pagination.pageSize && /*#__PURE__*/_jsx(TableFooter, {
|
|
94
|
+
children: /*#__PURE__*/_jsx(TableRow, {
|
|
95
|
+
children: /*#__PURE__*/_jsx(TablePagination, {
|
|
96
|
+
colSpan: table.getAllFlatColumns().length,
|
|
97
|
+
count: options.manualPagination ? manualRowCount : table.getFilteredRowModel().rows.length,
|
|
98
|
+
rowsPerPage: table.getState().pagination.pageSize,
|
|
99
|
+
page: table.getState().pagination.pageIndex,
|
|
100
|
+
onPageChange: function onPageChange(_, newPage) {
|
|
101
|
+
table.setPageIndex(newPage);
|
|
102
|
+
options.onPageChange(newPage);
|
|
103
|
+
},
|
|
104
|
+
rowsPerPageOptions: [10, 25, 50, 100],
|
|
105
|
+
onRowsPerPageChange: function onRowsPerPageChange(e) {
|
|
106
|
+
var size = e.target.value ? Number(e.target.value) : 10;
|
|
107
|
+
table.setPageSize(size);
|
|
108
|
+
options.onRowsPerPageChange(size);
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
})]
|
|
113
|
+
})
|
|
114
|
+
});
|
|
115
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import VirtualControlledAutoTable from './virtual.js';
|
|
17
|
+
import ControlledAutoTable from './controlled.js';
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
export { createColumnHelper } from './common.js';
|
|
20
|
+
function AutoTable(props) {
|
|
21
|
+
var _props$enableSorting, _props$defaultSorting, _props$enableRowSelec, _props$enablePaginati;
|
|
22
|
+
// manage sorting
|
|
23
|
+
var enableSorting = (_props$enableSorting = props.enableSorting) !== null && _props$enableSorting !== void 0 ? _props$enableSorting : true;
|
|
24
|
+
var _useManagedStateSwitc = useManagedStateSwitch(props.sorting, props.onSortingChange, (_props$defaultSorting = props.defaultSorting) !== null && _props$defaultSorting !== void 0 ? _props$defaultSorting : []),
|
|
25
|
+
_useManagedStateSwitc2 = _slicedToArray(_useManagedStateSwitc, 2),
|
|
26
|
+
managedSorting = _useManagedStateSwitc2[0],
|
|
27
|
+
setManagedSorting = _useManagedStateSwitc2[1];
|
|
28
|
+
|
|
29
|
+
// manage selection
|
|
30
|
+
var enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : props.rowSelection !== undefined;
|
|
31
|
+
var _useManagedStateSwitc3 = useManagedStateSwitch(props.rowSelection, props.onRowSelectionChange, {}),
|
|
32
|
+
_useManagedStateSwitc4 = _slicedToArray(_useManagedStateSwitc3, 2),
|
|
33
|
+
managedRowSelection = _useManagedStateSwitc4[0],
|
|
34
|
+
setManagedRowSelection = _useManagedStateSwitc4[1];
|
|
35
|
+
|
|
36
|
+
// manage pagination
|
|
37
|
+
var enablePagination = (_props$enablePaginati = props.enablePagination) !== null && _props$enablePaginati !== void 0 ? _props$enablePaginati : true;
|
|
38
|
+
var _useManagedStateSwitc5 = useManagedStateSwitch(props.page, props.onPageChange, 0),
|
|
39
|
+
_useManagedStateSwitc6 = _slicedToArray(_useManagedStateSwitc5, 2),
|
|
40
|
+
managedPage = _useManagedStateSwitc6[0],
|
|
41
|
+
setManagedPage = _useManagedStateSwitc6[1];
|
|
42
|
+
var _useManagedStateSwitc7 = useManagedStateSwitch(props.rowsPerPage, props.onRowsPerPageChange, 10),
|
|
43
|
+
_useManagedStateSwitc8 = _slicedToArray(_useManagedStateSwitc7, 2),
|
|
44
|
+
managedRowsPerPage = _useManagedStateSwitc8[0],
|
|
45
|
+
setManagedRowsPerPage = _useManagedStateSwitc8[1];
|
|
46
|
+
var options = {
|
|
47
|
+
data: props.data,
|
|
48
|
+
columns: props.columns,
|
|
49
|
+
meta: props.meta,
|
|
50
|
+
getRowId: props.getRowId,
|
|
51
|
+
// sorting
|
|
52
|
+
sorting: managedSorting,
|
|
53
|
+
enableSorting: enableSorting,
|
|
54
|
+
onSortingChange: setManagedSorting,
|
|
55
|
+
manualSorting: props.manualSorting,
|
|
56
|
+
// selection
|
|
57
|
+
rowSelection: managedRowSelection,
|
|
58
|
+
enableRowSelection: enableRowSelection,
|
|
59
|
+
onRowSelectionChange: setManagedRowSelection,
|
|
60
|
+
// pagination
|
|
61
|
+
pagination: {
|
|
62
|
+
pageIndex: managedPage,
|
|
63
|
+
pageSize: enablePagination ? managedRowsPerPage : props.data.length
|
|
64
|
+
},
|
|
65
|
+
enablePagination: enablePagination,
|
|
66
|
+
onPageChange: setManagedPage,
|
|
67
|
+
onRowsPerPageChange: setManagedRowsPerPage,
|
|
68
|
+
manualPagination: props.manualRowCount !== undefined,
|
|
69
|
+
manualRowCount: props.manualRowCount
|
|
70
|
+
};
|
|
71
|
+
if (props.virtualizer) {
|
|
72
|
+
return /*#__PURE__*/_jsx(VirtualControlledAutoTable, _objectSpread(_objectSpread(_objectSpread({}, options), props.virtualizer), {}, {
|
|
73
|
+
stickyHeader: props.stickyHeader,
|
|
74
|
+
loading: props.loading,
|
|
75
|
+
zeroStateMessage: props.zeroStateMessage,
|
|
76
|
+
sx: props.sx,
|
|
77
|
+
className: props.className
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
return /*#__PURE__*/_jsx(ControlledAutoTable, _objectSpread(_objectSpread({}, options), {}, {
|
|
81
|
+
stickyHeader: props.stickyHeader,
|
|
82
|
+
loading: props.loading,
|
|
83
|
+
zeroStateMessage: props.zeroStateMessage,
|
|
84
|
+
sx: props.sx,
|
|
85
|
+
className: props.className
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
export default AutoTable;
|
|
89
|
+
|
|
90
|
+
// switch between controlled (passed in) and uncontrolled (automatic) state
|
|
91
|
+
function useManagedStateSwitch(controlled, setControlled, uncontrolledDefault) {
|
|
92
|
+
var _React$useState = React.useState(uncontrolledDefault),
|
|
93
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
94
|
+
uncontrolled = _React$useState2[0],
|
|
95
|
+
setUncontrolled = _React$useState2[1];
|
|
96
|
+
var _ref = controlled !== undefined ? [controlled, function (u) {
|
|
97
|
+
setControlled === null || setControlled === void 0 ? void 0 : setControlled(u);
|
|
98
|
+
}] : [uncontrolled, function (u) {
|
|
99
|
+
setUncontrolled(u);
|
|
100
|
+
// allow listening, even if not using controlled value
|
|
101
|
+
setControlled === null || setControlled === void 0 ? void 0 : setControlled(u);
|
|
102
|
+
}],
|
|
103
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
104
|
+
managed = _ref2[0],
|
|
105
|
+
setManaged = _ref2[1];
|
|
106
|
+
return [managed, setManaged];
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
var _excluded = ["stickyHeader", "loading", "zeroStateMessage", "scrollOffset", "getScrollElement", "renderWhenNotVisible", "rowSize", "headerSize", "overscan", "sx", "className"];
|
|
4
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
|
+
import { flexRender } from '@tanstack/react-table';
|
|
13
|
+
import { Table, TableBody, TableCell, TableHead, TableRow, TableSortLabel, TableZeroState } from '../index.js';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { Box, CircularProgress, styled } from '@mui/material';
|
|
16
|
+
import { visuallyHidden } from '@mui/utils';
|
|
17
|
+
import { useAutoTable } from './common.js';
|
|
18
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
var TableContainer = styled(Box)(function (_ref) {
|
|
22
|
+
var virtualizerTotalHeight = _ref.virtualizerTotalHeight;
|
|
23
|
+
return {
|
|
24
|
+
height: "".concat(virtualizerTotalHeight, "px")
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
export default function VirtualControlledAutoTable(_ref2) {
|
|
28
|
+
var stickyHeader = _ref2.stickyHeader,
|
|
29
|
+
loading = _ref2.loading,
|
|
30
|
+
zeroStateMessage = _ref2.zeroStateMessage,
|
|
31
|
+
scrollOffset = _ref2.scrollOffset,
|
|
32
|
+
getScrollElement = _ref2.getScrollElement,
|
|
33
|
+
renderWhenNotVisible = _ref2.renderWhenNotVisible,
|
|
34
|
+
rowSize = _ref2.rowSize,
|
|
35
|
+
_ref2$headerSize = _ref2.headerSize,
|
|
36
|
+
headerSize = _ref2$headerSize === void 0 ? 50 : _ref2$headerSize,
|
|
37
|
+
overscan = _ref2.overscan,
|
|
38
|
+
sx = _ref2.sx,
|
|
39
|
+
className = _ref2.className,
|
|
40
|
+
options = _objectWithoutProperties(_ref2, _excluded);
|
|
41
|
+
var table = useAutoTable(options);
|
|
42
|
+
// const manualRowCount = options.manualRowCount ?? options.data.length
|
|
43
|
+
|
|
44
|
+
var _table$getRowModel = table.getRowModel(),
|
|
45
|
+
rows = _table$getRowModel.rows;
|
|
46
|
+
|
|
47
|
+
// get this table's offset from parent container
|
|
48
|
+
var offsetFromScrollEl = scrollOffset !== null && scrollOffset !== void 0 ? scrollOffset : 0; // listOffset;
|
|
49
|
+
|
|
50
|
+
var virtualizer = useVirtualizer({
|
|
51
|
+
getScrollElement: getScrollElement,
|
|
52
|
+
scrollMargin: offsetFromScrollEl,
|
|
53
|
+
count: rows.length,
|
|
54
|
+
overscan: overscan !== null && overscan !== void 0 ? overscan : 10,
|
|
55
|
+
estimateSize: function estimateSize() {
|
|
56
|
+
return rowSize;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// this will completely hide the table rows if it is not within the visible threshold
|
|
61
|
+
// maybe this will be default behavior in @tanstack/react-virtual one day
|
|
62
|
+
var visibilityOverscan = virtualizer.options.overscan * rowSize;
|
|
63
|
+
var tableIsVisible = renderWhenNotVisible || virtualizer.scrollOffset >= offsetFromScrollEl - visibilityOverscan && virtualizer.scrollOffset <= offsetFromScrollEl + virtualizer.getTotalSize() + visibilityOverscan;
|
|
64
|
+
var virtualItems = virtualizer.getVirtualItems();
|
|
65
|
+
var totalHeight = virtualizer.getTotalSize() + headerSize;
|
|
66
|
+
return /*#__PURE__*/_jsx(TableContainer, {
|
|
67
|
+
virtualizerTotalHeight: totalHeight,
|
|
68
|
+
sx: sx,
|
|
69
|
+
className: className,
|
|
70
|
+
children: /*#__PURE__*/_jsxs(Table, {
|
|
71
|
+
sx: _objectSpread({
|
|
72
|
+
borderCollapse: 'separate'
|
|
73
|
+
}, stickyHeader ? {
|
|
74
|
+
'& th': {
|
|
75
|
+
position: 'sticky',
|
|
76
|
+
top: _typeof(stickyHeader) === 'object' ? stickyHeader.offset : 0,
|
|
77
|
+
zIndex: 2,
|
|
78
|
+
backgroundColor: function backgroundColor(theme) {
|
|
79
|
+
return theme.palette.background["default"];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} : {}),
|
|
83
|
+
children: [/*#__PURE__*/_jsx(TableHead, {
|
|
84
|
+
sx: {
|
|
85
|
+
height: headerSize
|
|
86
|
+
},
|
|
87
|
+
children: table.getHeaderGroups().map(function (headerGroup) {
|
|
88
|
+
return /*#__PURE__*/_jsx(TableRow, {
|
|
89
|
+
children: headerGroup.headers.map(function (header) {
|
|
90
|
+
var isSorted = header.column.getIsSorted();
|
|
91
|
+
return /*#__PURE__*/_jsx(TableCell, {
|
|
92
|
+
variant: "header",
|
|
93
|
+
children: header.isPlaceholder ? null : header.column.getCanSort() ? /*#__PURE__*/_jsxs(TableSortLabel, {
|
|
94
|
+
active: isSorted !== false,
|
|
95
|
+
direction: isSorted !== false ? isSorted : 'asc',
|
|
96
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
97
|
+
children: [flexRender(header.column.columnDef.header, header.getContext()), isSorted !== false ? /*#__PURE__*/_jsx(Box, {
|
|
98
|
+
component: "span",
|
|
99
|
+
sx: visuallyHidden,
|
|
100
|
+
children: isSorted === 'desc' ? 'sorted descending' : 'sorted ascending'
|
|
101
|
+
}) : null]
|
|
102
|
+
}) : flexRender(header.column.columnDef.header, header.getContext())
|
|
103
|
+
}, header.id);
|
|
104
|
+
})
|
|
105
|
+
}, headerGroup.id);
|
|
106
|
+
})
|
|
107
|
+
}), loading ? /*#__PURE__*/_jsx(TableBody, {
|
|
108
|
+
children: /*#__PURE__*/_jsx(TableRow, {
|
|
109
|
+
children: /*#__PURE__*/_jsx(TableCell, {
|
|
110
|
+
colSpan: table.getAllFlatColumns().length,
|
|
111
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
}) : options.data.length === 0 ? /*#__PURE__*/_jsx(TableBody, {
|
|
115
|
+
children: /*#__PURE__*/_jsx(TableRow, {
|
|
116
|
+
children: /*#__PURE__*/_jsx(TableCell, {
|
|
117
|
+
colSpan: table.getAllFlatColumns().length,
|
|
118
|
+
children: /*#__PURE__*/_jsx(TableZeroState, {
|
|
119
|
+
children: zeroStateMessage !== null && zeroStateMessage !== void 0 ? zeroStateMessage : 'No data found'
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
}) : tableIsVisible && /*#__PURE__*/_jsx(TableBody, {
|
|
124
|
+
sx: {
|
|
125
|
+
'&::after': {
|
|
126
|
+
display: 'block',
|
|
127
|
+
content: "''",
|
|
128
|
+
// this ensures the table takes up as much size as the total elements by adding padding to the end
|
|
129
|
+
height: "".concat(virtualItems.length * rowSize, "px")
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
children: virtualItems.map(function (virtualRow, index) {
|
|
133
|
+
var row = rows[virtualRow.index];
|
|
134
|
+
return /*#__PURE__*/_jsx(TableRow, {
|
|
135
|
+
sx: {
|
|
136
|
+
height: "".concat(virtualRow.size, "px"),
|
|
137
|
+
transform: "translateY(".concat(virtualRow.start - offsetFromScrollEl - index * virtualRow.size, "px)")
|
|
138
|
+
},
|
|
139
|
+
children: row.getAllCells().map(function (cell) {
|
|
140
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
141
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
142
|
+
}, cell.id);
|
|
143
|
+
})
|
|
144
|
+
}, row.id);
|
|
145
|
+
})
|
|
146
|
+
})]
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["variant"]
|
|
2
|
+
var _excluded = ["variant"],
|
|
3
|
+
_excluded2 = ["checked", "indeterminate", "disabled", "onChange", "sx", "className", "checkboxSx", "checkboxClassName"];
|
|
3
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -7,9 +8,11 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
7
8
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
import { Table as MuiTable, TableBody as MuiTableBody, TableCell as MuiTableCell,
|
|
11
|
+
import { Box, Table as MuiTable, TableBody as MuiTableBody, TableCell as MuiTableCell, TableFooter as MuiTableFooter, TableHead as MuiTableHead, TablePagination as MuiTablePagination, TableRow as MuiTableRow, TableSortLabel as MuiTableSortLabel } from '@mui/material';
|
|
11
12
|
import React from 'react';
|
|
12
13
|
import { styled } from '@mui/material/styles';
|
|
14
|
+
import Typography from '../Typography/index.js';
|
|
15
|
+
import Checkbox from '../Checkbox/index.js';
|
|
13
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
17
|
export var Table = function Table(props) {
|
|
15
18
|
return /*#__PURE__*/_jsx(MuiTable, {
|
|
@@ -28,11 +31,21 @@ export var TableBody = function TableBody(props) {
|
|
|
28
31
|
children: props.children
|
|
29
32
|
});
|
|
30
33
|
};
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
var StyledMuiTableCell = styled(MuiTableCell)(function (_ref) {
|
|
35
|
+
var theme = _ref.theme,
|
|
36
|
+
noVerticalPadding = _ref.noVerticalPadding;
|
|
37
|
+
return {
|
|
38
|
+
fontSize: theme.typography.body1.fontSize,
|
|
39
|
+
borderBottomColor: theme.palette.text.disabled,
|
|
40
|
+
padding: "".concat(noVerticalPadding ? '0px' : '14.25px', " ", '16px')
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
export var TableCell = function TableCell(_ref2) {
|
|
44
|
+
var _props$noVerticalPadd;
|
|
45
|
+
var _ref2$variant = _ref2.variant,
|
|
46
|
+
variant = _ref2$variant === void 0 ? 'data' : _ref2$variant,
|
|
47
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
48
|
+
return /*#__PURE__*/_jsx(StyledMuiTableCell, {
|
|
36
49
|
"data-testid": props['data-testid'],
|
|
37
50
|
component: variant === 'header' ? 'th' : 'td',
|
|
38
51
|
align: props.align,
|
|
@@ -42,24 +55,41 @@ export var TableCell = function TableCell(_ref) {
|
|
|
42
55
|
scope: props.scope,
|
|
43
56
|
abbr: props.abbr,
|
|
44
57
|
sortDirection: props.sortDirection,
|
|
58
|
+
noVerticalPadding: (_props$noVerticalPadd = props.noVerticalPadding) !== null && _props$noVerticalPadd !== void 0 ? _props$noVerticalPadd : false,
|
|
45
59
|
sx: props.sx,
|
|
46
60
|
className: props.className,
|
|
47
61
|
children: props.children
|
|
48
62
|
});
|
|
49
63
|
};
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
lineHeight: '21px',
|
|
53
|
-
fontWeight: 400
|
|
54
|
-
}
|
|
64
|
+
var StyledSelectionTableCell = styled(TableCell)({
|
|
65
|
+
width: '50px'
|
|
55
66
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
var StyledSelectionCheckbox = styled(Checkbox)({
|
|
68
|
+
padding: 0
|
|
69
|
+
});
|
|
70
|
+
export var SelectionTableCell = function SelectionTableCell(_ref3) {
|
|
71
|
+
var checked = _ref3.checked,
|
|
72
|
+
indeterminate = _ref3.indeterminate,
|
|
73
|
+
disabled = _ref3.disabled,
|
|
74
|
+
onChange = _ref3.onChange,
|
|
75
|
+
sx = _ref3.sx,
|
|
76
|
+
className = _ref3.className,
|
|
77
|
+
checkboxSx = _ref3.checkboxSx,
|
|
78
|
+
checkboxClassName = _ref3.checkboxClassName,
|
|
79
|
+
cellProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
80
|
+
return /*#__PURE__*/_jsx(StyledSelectionTableCell, _objectSpread(_objectSpread({}, cellProps), {}, {
|
|
81
|
+
noVerticalPadding: true,
|
|
82
|
+
sx: sx,
|
|
83
|
+
className: className,
|
|
84
|
+
children: /*#__PURE__*/_jsx(StyledSelectionCheckbox, {
|
|
85
|
+
checked: checked,
|
|
86
|
+
indeterminate: indeterminate,
|
|
87
|
+
disabled: disabled,
|
|
88
|
+
onChange: onChange,
|
|
89
|
+
sx: checkboxSx,
|
|
90
|
+
className: checkboxClassName
|
|
91
|
+
})
|
|
92
|
+
}));
|
|
63
93
|
};
|
|
64
94
|
export var TableFooter = function TableFooter(props) {
|
|
65
95
|
return /*#__PURE__*/_jsx(MuiTableFooter, {
|
|
@@ -90,20 +120,8 @@ export var TablePagination = function TablePagination(props) {
|
|
|
90
120
|
onRowsPerPageChange: props.onRowsPerPageChange
|
|
91
121
|
});
|
|
92
122
|
};
|
|
93
|
-
var StyledMuiTableRow = styled(MuiTableRow)(function (_ref2) {
|
|
94
|
-
var theme = _ref2.theme;
|
|
95
|
-
return {
|
|
96
|
-
'& .MuiTableCell-root': {
|
|
97
|
-
borderBottomColor: theme.palette.text.disabled,
|
|
98
|
-
padding: '14.25px 16px',
|
|
99
|
-
'&.MuiTableCell-paddingNone': {
|
|
100
|
-
padding: 0
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
});
|
|
105
123
|
export var TableRow = function TableRow(props) {
|
|
106
|
-
return /*#__PURE__*/_jsx(
|
|
124
|
+
return /*#__PURE__*/_jsx(MuiTableRow, {
|
|
107
125
|
"data-testid": props['data-testid'],
|
|
108
126
|
hover: props.hover,
|
|
109
127
|
selected: props.selected,
|
|
@@ -113,5 +131,34 @@ export var TableRow = function TableRow(props) {
|
|
|
113
131
|
});
|
|
114
132
|
};
|
|
115
133
|
export var TableSortLabel = function TableSortLabel(props) {
|
|
116
|
-
return /*#__PURE__*/_jsx(MuiTableSortLabel,
|
|
134
|
+
return /*#__PURE__*/_jsx(MuiTableSortLabel, {
|
|
135
|
+
active: props.active,
|
|
136
|
+
direction: props.direction,
|
|
137
|
+
hideSortIcon: props.hideSortIcon,
|
|
138
|
+
onClick: props.onClick,
|
|
139
|
+
disabled: props.disabled,
|
|
140
|
+
children: props.children
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
var StyledTableZeroStateBase = styled(Box)({
|
|
144
|
+
width: '100%',
|
|
145
|
+
display: 'flex',
|
|
146
|
+
justifyContent: 'center',
|
|
147
|
+
alignItems: 'center'
|
|
148
|
+
});
|
|
149
|
+
export var TableZeroState = function TableZeroState(props) {
|
|
150
|
+
return /*#__PURE__*/_jsx(StyledTableZeroStateBase, {
|
|
151
|
+
sx: props.sx,
|
|
152
|
+
className: props.className,
|
|
153
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
154
|
+
sx: function sx(theme) {
|
|
155
|
+
return {
|
|
156
|
+
fontWeight: theme.typography.body2.fontWeight,
|
|
157
|
+
fontSize: theme.typography.body2.fontSize,
|
|
158
|
+
color: theme.palette.text.disabled
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
children: props.children
|
|
162
|
+
})
|
|
163
|
+
});
|
|
117
164
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -7,8 +7,9 @@ export { default as Breadcrumbs } from './components/Breadcrumbs/index.js';
|
|
|
7
7
|
export { default as Button } from './components/Button/index.js';
|
|
8
8
|
export { default as Checkbox } from './components/Checkbox/index.js';
|
|
9
9
|
export { default as Drawer } from './components/Drawer/index.js';
|
|
10
|
-
export { default as FileUploader } from './components/FileUploader/index.js';
|
|
10
|
+
export { default as FileUploader, useFileUploader } from './components/FileUploader/index.js';
|
|
11
11
|
export { default as FormControlLabel } from './components/FormControlLabel/index.js';
|
|
12
|
+
export { default as IconButton } from './components/IconButton/index.js';
|
|
12
13
|
export { default as Input } from './components/Input/index.js';
|
|
13
14
|
export { default as LinearProgress } from './components/LinearProgress/index.js';
|
|
14
15
|
export { default as Link } from './components/Link/index.js';
|
|
@@ -27,7 +28,10 @@ export { default as StatusChip } from './components/StatusChip/index.js';
|
|
|
27
28
|
export { default as Step } from './components/Step/index.js';
|
|
28
29
|
export { default as StepLabel } from './components/StepLabel/index.js';
|
|
29
30
|
export { default as Stepper } from './components/Stepper/index.js';
|
|
30
|
-
export { Table, TableBody, TableCell,
|
|
31
|
+
export { Table, TableBody, TableCell, SelectionTableCell, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel, TableZeroState } from './components/Table/index.js';
|
|
32
|
+
export { default as AutoTable, createColumnHelper } from './components/Table/AutoTable/index.js';
|
|
33
|
+
export { default as ControlledAutoTable } from './components/Table/AutoTable/controlled.js';
|
|
34
|
+
export { default as VirtualControlledAutoTable } from './components/Table/AutoTable/virtual.js';
|
|
31
35
|
export { default as Tabs } from './components/Tabs/index.js';
|
|
32
36
|
export { default as ThemeProvider } from './components/ThemeProvider/index.js';
|
|
33
37
|
export { default as Toast } from './components/Toast/index.js';
|
|
@@ -14,6 +14,8 @@ export type ButtonProps = {
|
|
|
14
14
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
15
15
|
sx?: SxProps<Theme>;
|
|
16
16
|
className?: string;
|
|
17
|
+
containerSx?: SxProps<Theme>;
|
|
18
|
+
containerClassName?: string;
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
- Use a button for common user click actions. Several variations available.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
-
import { Accept
|
|
3
|
+
import { Accept } from 'react-dropzone';
|
|
4
4
|
export interface FileState {
|
|
5
5
|
name: string;
|
|
6
6
|
uploadProgress: number;
|
|
@@ -8,27 +8,31 @@ export interface FileState {
|
|
|
8
8
|
withError: boolean;
|
|
9
9
|
feedbackText: string;
|
|
10
10
|
}
|
|
11
|
-
export type
|
|
11
|
+
export type FileUploaderProps = {
|
|
12
12
|
'data-testid'?: string;
|
|
13
|
-
extensions: string[];
|
|
14
13
|
filesState: FileState[];
|
|
14
|
+
accept: Accept;
|
|
15
|
+
multiple?: boolean;
|
|
16
|
+
uploading?: boolean;
|
|
17
|
+
uploaded?: boolean;
|
|
18
|
+
onDrop(files: File[]): void;
|
|
15
19
|
onDelete(fileIndex: number): void;
|
|
16
|
-
rootProps?: DropzoneRootProps;
|
|
17
|
-
inputProps?: DropzoneInputProps;
|
|
18
20
|
sx?: SxProps<Theme>;
|
|
19
21
|
className?: string;
|
|
20
22
|
};
|
|
21
|
-
export
|
|
23
|
+
export default function FileUploader(props: FileUploaderProps): import("react").JSX.Element;
|
|
22
24
|
type FileUploadFn = (f: File) => AsyncGenerator<number>;
|
|
23
|
-
export type
|
|
24
|
-
'data-testid'?: string;
|
|
25
|
-
accept: Accept;
|
|
26
|
-
multiple?: boolean;
|
|
25
|
+
export type UseFileUploaderOptions = {
|
|
27
26
|
uploadFile: FileUploadFn;
|
|
28
27
|
onComplete?(f: File): void;
|
|
29
28
|
onError?(v: Error): void;
|
|
30
|
-
sx?: SxProps<Theme>;
|
|
31
|
-
className?: string;
|
|
32
29
|
};
|
|
33
|
-
declare
|
|
34
|
-
|
|
30
|
+
export declare function useFileUploader(options: UseFileUploaderOptions): {
|
|
31
|
+
files: FileState[];
|
|
32
|
+
onDrop(acceptedFiles: File[]): void;
|
|
33
|
+
removeFile: (fileIndex: number) => void;
|
|
34
|
+
uploading: boolean;
|
|
35
|
+
uploaded: boolean;
|
|
36
|
+
uploadFiles(): Promise<PromiseSettledResult<void>[]>;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MouseEventHandler } from 'react';
|
|
3
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
export type IconButtonProps = {
|
|
5
|
+
'data-testid'?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
sx?: SxProps<Theme>;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
- Use a button for common user click actions. Several variations available.
|
|
14
|
+
**/
|
|
15
|
+
declare const IconButton: (props: IconButtonProps) => React.JSX.Element;
|
|
16
|
+
export default IconButton;
|