@overmap-ai/blocks 1.0.25-try-to-fix-react-table-library-imports.3 → 1.0.25
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/blocks.js +33 -38
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +43 -53
- package/dist/blocks.umd.cjs.map +1 -1
- package/package.json +2 -2
package/dist/blocks.js
CHANGED
|
@@ -19,6 +19,11 @@ import * as RadixToast from "@radix-ui/react-toast";
|
|
|
19
19
|
import { ToastProvider as ToastProvider$1, ToastViewport as ToastViewport$1 } from "@radix-ui/react-toast";
|
|
20
20
|
import { useErrorBoundary, ErrorBoundary } from "react-error-boundary";
|
|
21
21
|
import FeatherIcon from "feather-icons-react";
|
|
22
|
+
import { HeaderCell, Table as Table$1, Header, HeaderRow, Body, Cell, Row } from "@table-library/react-table-library/table.js";
|
|
23
|
+
import { useTheme } from "@table-library/react-table-library/theme.js";
|
|
24
|
+
import { useSort, HeaderCellSort } from "@table-library/react-table-library/sort.js";
|
|
25
|
+
import { useRowSelect, SelectTypes, SelectClickTypes, HeaderCellSelect, CellSelect } from "@table-library/react-table-library/select.js";
|
|
26
|
+
import { usePagination } from "@table-library/react-table-library/pagination.js";
|
|
22
27
|
function getDefaultExportFromCjs(x) {
|
|
23
28
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
24
29
|
}
|
|
@@ -92,11 +97,11 @@ const nonThemeSeverityMapping = {
|
|
|
92
97
|
info: "gray"
|
|
93
98
|
};
|
|
94
99
|
const useSeverityColor = (severity) => {
|
|
95
|
-
const
|
|
100
|
+
const theme = useThemeContext();
|
|
96
101
|
if (!severity)
|
|
97
102
|
return void 0;
|
|
98
103
|
if (severity === "primary")
|
|
99
|
-
return
|
|
104
|
+
return theme.accentColor;
|
|
100
105
|
return nonThemeSeverityMapping[severity];
|
|
101
106
|
};
|
|
102
107
|
const useViewportSize = () => {
|
|
@@ -3550,7 +3555,7 @@ const tableTopContainer = "_tableTopContainer_5i91d_21";
|
|
|
3550
3555
|
const tableContainer = "_tableContainer_5i91d_25";
|
|
3551
3556
|
const searchContainer = "_searchContainer_5i91d_30";
|
|
3552
3557
|
const columnFilterSelect = "_columnFilterSelect_5i91d_40";
|
|
3553
|
-
const table
|
|
3558
|
+
const table = "_table_5i91d_21";
|
|
3554
3559
|
const tableHeaderCell = "_tableHeaderCell_5i91d_58";
|
|
3555
3560
|
const showSortIcon = "_showSortIcon_5i91d_74";
|
|
3556
3561
|
const tableRow = "_tableRow_5i91d_78";
|
|
@@ -3569,7 +3574,7 @@ const styles$1 = {
|
|
|
3569
3574
|
tableContainer,
|
|
3570
3575
|
searchContainer,
|
|
3571
3576
|
columnFilterSelect,
|
|
3572
|
-
table
|
|
3577
|
+
table,
|
|
3573
3578
|
tableHeaderCell,
|
|
3574
3579
|
showSortIcon,
|
|
3575
3580
|
tableRow,
|
|
@@ -3581,16 +3586,6 @@ const styles$1 = {
|
|
|
3581
3586
|
pageText,
|
|
3582
3587
|
descriptionSecondLine
|
|
3583
3588
|
};
|
|
3584
|
-
const table = import("@overmap-ai/react-table-library/table.js");
|
|
3585
|
-
const { Body, Cell, Header, HeaderCell, HeaderRow, Row, Table: ReactLibraryTable } = table;
|
|
3586
|
-
const theme = import("@overmap-ai/react-table-library/theme.js");
|
|
3587
|
-
const { useTheme } = theme;
|
|
3588
|
-
const sort = import("@overmap-ai/react-table-library/sort.js");
|
|
3589
|
-
const { HeaderCellSort, useSort } = sort;
|
|
3590
|
-
const select = import("@overmap-ai/react-table-library/select.js");
|
|
3591
|
-
const { CellSelect, HeaderCellSelect, SelectClickTypes, SelectTypes, useRowSelect } = select;
|
|
3592
|
-
const pagination = import("@overmap-ai/react-table-library/pagination.js");
|
|
3593
|
-
const { usePagination } = pagination;
|
|
3594
3589
|
const _Table = forwardRef(function Table2(props, ref) {
|
|
3595
3590
|
var _a;
|
|
3596
3591
|
const {
|
|
@@ -3753,7 +3748,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3753
3748
|
isCarryForward: false
|
|
3754
3749
|
}
|
|
3755
3750
|
);
|
|
3756
|
-
const
|
|
3751
|
+
const pagination = usePagination(
|
|
3757
3752
|
tableData,
|
|
3758
3753
|
{
|
|
3759
3754
|
state: {
|
|
@@ -3765,7 +3760,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3765
3760
|
isServer: false
|
|
3766
3761
|
}
|
|
3767
3762
|
);
|
|
3768
|
-
const
|
|
3763
|
+
const sort = useSort(
|
|
3769
3764
|
tableData,
|
|
3770
3765
|
{
|
|
3771
3766
|
onChange: (_action, state) => {
|
|
@@ -3882,7 +3877,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3882
3877
|
});
|
|
3883
3878
|
const SelectedModeButton = isMobile ? IconButton : Button2;
|
|
3884
3879
|
const layout = useMemo(() => ({ custom: true, ...fixHeader && { fixedHeader: true } }), [fixHeader]);
|
|
3885
|
-
const
|
|
3880
|
+
const theme = useTheme({
|
|
3886
3881
|
Table: `
|
|
3887
3882
|
--data-table-library_grid-template-columns: ${gridTemplateColumns} !important;
|
|
3888
3883
|
`,
|
|
@@ -3905,14 +3900,14 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3905
3900
|
if (showPageNavigation) {
|
|
3906
3901
|
const numTotalPages = Math.ceil(rows.length / numRowsPerPage);
|
|
3907
3902
|
setTotalPages(numTotalPages);
|
|
3908
|
-
if (
|
|
3909
|
-
|
|
3903
|
+
if (pagination.state.page < 0) {
|
|
3904
|
+
pagination.fns.onSetPage(0);
|
|
3910
3905
|
}
|
|
3911
|
-
if (
|
|
3912
|
-
|
|
3906
|
+
if (pagination.state.page > numTotalPages - 1) {
|
|
3907
|
+
pagination.fns.onSetPage(numTotalPages - 1);
|
|
3913
3908
|
}
|
|
3914
3909
|
}
|
|
3915
|
-
}, [rowsPerPage, rows.length, numRowsPerPage,
|
|
3910
|
+
}, [rowsPerPage, rows.length, numRowsPerPage, pagination, showPageNavigation]);
|
|
3916
3911
|
return /* @__PURE__ */ jsxs(Flex$1, { className: classNames({ [styles$1.outerTableContainer]: showContainer }), direction: "column", height: "100%", children: [
|
|
3917
3912
|
(!!title || !!description) && /* @__PURE__ */ jsxs("div", { className: styles$1.headerContainer, children: [
|
|
3918
3913
|
!!title && /* @__PURE__ */ jsx(Text$1, { weight: "bold", size: "5", children: title }),
|
|
@@ -3945,7 +3940,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3945
3940
|
color: "crimson",
|
|
3946
3941
|
onClick: () => {
|
|
3947
3942
|
setColumnFilterValues(defaultColumnFilterValues);
|
|
3948
|
-
|
|
3943
|
+
pagination.fns.onSetPage(0);
|
|
3949
3944
|
},
|
|
3950
3945
|
"aria-label": "Clear filters",
|
|
3951
3946
|
children: /* @__PURE__ */ jsx(Cross2Icon, {})
|
|
@@ -3966,13 +3961,13 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3966
3961
|
] }),
|
|
3967
3962
|
children,
|
|
3968
3963
|
/* @__PURE__ */ jsx("div", { className: styles$1.tableContainer, children: /* @__PURE__ */ jsx(
|
|
3969
|
-
|
|
3964
|
+
Table$1,
|
|
3970
3965
|
{
|
|
3971
3966
|
className: classNames(styles$1.table, className),
|
|
3972
3967
|
data: tableData,
|
|
3973
|
-
theme
|
|
3974
|
-
sort
|
|
3975
|
-
pagination: showPageNavigation &&
|
|
3968
|
+
theme,
|
|
3969
|
+
sort,
|
|
3970
|
+
pagination: showPageNavigation && pagination,
|
|
3976
3971
|
select: tableSelect,
|
|
3977
3972
|
layout,
|
|
3978
3973
|
ref,
|
|
@@ -3990,7 +3985,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3990
3985
|
className: classNames(styles$1.tableRow, rowClassName, row.className, {
|
|
3991
3986
|
[styles$1.disabled]: row.disabled
|
|
3992
3987
|
}),
|
|
3993
|
-
onClick: !row.disabled && row.onClick,
|
|
3988
|
+
onClick: !row.loading && !row.disabled && row.onClick,
|
|
3994
3989
|
children: row.loading ? /* @__PURE__ */ jsx(
|
|
3995
3990
|
Cell,
|
|
3996
3991
|
{
|
|
@@ -4038,7 +4033,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4038
4033
|
items: rowsPerPageOptions,
|
|
4039
4034
|
defaultValue: (_a = rowsPerPageOptions.find((rowPerPage) => rowPerPage.value === defaultRowsPerPage.toString())) == null ? void 0 : _a.value.toString(),
|
|
4040
4035
|
onValueChange: (v) => {
|
|
4041
|
-
|
|
4036
|
+
pagination.fns.onSetSize(Number(v));
|
|
4042
4037
|
setNumRowsPerPage(Number(v));
|
|
4043
4038
|
},
|
|
4044
4039
|
placeholder: rowsPerPageOptions[0].itemContent,
|
|
@@ -4046,14 +4041,14 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4046
4041
|
}
|
|
4047
4042
|
)
|
|
4048
4043
|
] }),
|
|
4049
|
-
showPageNumber && /* @__PURE__ */ jsx(Flex$1, { justify: "center", children: /* @__PURE__ */ jsx(Text$1, { className: styles$1.pageText, size: "2", children: totalPages > 0 && `Page ${
|
|
4044
|
+
showPageNumber && /* @__PURE__ */ jsx(Flex$1, { justify: "center", children: /* @__PURE__ */ jsx(Text$1, { className: styles$1.pageText, size: "2", children: totalPages > 0 && `Page ${pagination.state.page + 1} of ${totalPages}` }) }),
|
|
4050
4045
|
showPageNavigation && /* @__PURE__ */ jsxs(Flex$1, { className: styles$1.rowsPerPageContainer, gap: "2", justify: "end", children: [
|
|
4051
4046
|
/* @__PURE__ */ jsx(
|
|
4052
4047
|
IconButton,
|
|
4053
4048
|
{
|
|
4054
4049
|
variant: "surface",
|
|
4055
|
-
onClick: () =>
|
|
4056
|
-
disabled:
|
|
4050
|
+
onClick: () => pagination.fns.onSetPage(0),
|
|
4051
|
+
disabled: pagination.state.page === 0 || totalPages === 0,
|
|
4057
4052
|
"aria-label": "Go to first page",
|
|
4058
4053
|
children: /* @__PURE__ */ jsx(DoubleArrowLeftIcon, {})
|
|
4059
4054
|
}
|
|
@@ -4062,8 +4057,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4062
4057
|
IconButton,
|
|
4063
4058
|
{
|
|
4064
4059
|
variant: "surface",
|
|
4065
|
-
disabled:
|
|
4066
|
-
onClick: () =>
|
|
4060
|
+
disabled: pagination.state.page === 0 || totalPages === 0,
|
|
4061
|
+
onClick: () => pagination.fns.onSetPage(pagination.state.page - 1),
|
|
4067
4062
|
"aria-label": "Previous page",
|
|
4068
4063
|
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
4069
4064
|
}
|
|
@@ -4072,8 +4067,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4072
4067
|
IconButton,
|
|
4073
4068
|
{
|
|
4074
4069
|
variant: "surface",
|
|
4075
|
-
disabled:
|
|
4076
|
-
onClick: () =>
|
|
4070
|
+
disabled: pagination.state.page + 1 === totalPages || totalPages === 0,
|
|
4071
|
+
onClick: () => pagination.fns.onSetPage(pagination.state.page + 1),
|
|
4077
4072
|
"aria-label": "Next page",
|
|
4078
4073
|
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
4079
4074
|
}
|
|
@@ -4082,8 +4077,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4082
4077
|
IconButton,
|
|
4083
4078
|
{
|
|
4084
4079
|
variant: "surface",
|
|
4085
|
-
disabled:
|
|
4086
|
-
onClick: () =>
|
|
4080
|
+
disabled: pagination.state.page + 1 === totalPages || totalPages === 0,
|
|
4081
|
+
onClick: () => pagination.fns.onSetPage(totalPages - 1),
|
|
4087
4082
|
"aria-label": "Go to last page",
|
|
4088
4083
|
children: /* @__PURE__ */ jsx(DoubleArrowRightIcon, {})
|
|
4089
4084
|
}
|