@overmap-ai/blocks 1.0.26 → 1.0.27
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 +37 -32
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +52 -42
- package/dist/blocks.umd.cjs.map +1 -1
- package/package.json +2 -2
package/dist/blocks.js
CHANGED
|
@@ -19,11 +19,6 @@ 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";
|
|
27
22
|
function getDefaultExportFromCjs(x) {
|
|
28
23
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
29
24
|
}
|
|
@@ -97,11 +92,11 @@ const nonThemeSeverityMapping = {
|
|
|
97
92
|
info: "gray"
|
|
98
93
|
};
|
|
99
94
|
const useSeverityColor = (severity) => {
|
|
100
|
-
const
|
|
95
|
+
const theme2 = useThemeContext();
|
|
101
96
|
if (!severity)
|
|
102
97
|
return void 0;
|
|
103
98
|
if (severity === "primary")
|
|
104
|
-
return
|
|
99
|
+
return theme2.accentColor;
|
|
105
100
|
return nonThemeSeverityMapping[severity];
|
|
106
101
|
};
|
|
107
102
|
const useViewportSize = () => {
|
|
@@ -3562,7 +3557,7 @@ const tableTopContainer = "_tableTopContainer_5i91d_21";
|
|
|
3562
3557
|
const tableContainer = "_tableContainer_5i91d_25";
|
|
3563
3558
|
const searchContainer = "_searchContainer_5i91d_30";
|
|
3564
3559
|
const columnFilterSelect = "_columnFilterSelect_5i91d_40";
|
|
3565
|
-
const table = "_table_5i91d_21";
|
|
3560
|
+
const table$1 = "_table_5i91d_21";
|
|
3566
3561
|
const tableHeaderCell = "_tableHeaderCell_5i91d_58";
|
|
3567
3562
|
const showSortIcon = "_showSortIcon_5i91d_74";
|
|
3568
3563
|
const tableRow = "_tableRow_5i91d_78";
|
|
@@ -3581,7 +3576,7 @@ const styles$1 = {
|
|
|
3581
3576
|
tableContainer,
|
|
3582
3577
|
searchContainer,
|
|
3583
3578
|
columnFilterSelect,
|
|
3584
|
-
table,
|
|
3579
|
+
table: table$1,
|
|
3585
3580
|
tableHeaderCell,
|
|
3586
3581
|
showSortIcon,
|
|
3587
3582
|
tableRow,
|
|
@@ -3593,6 +3588,16 @@ const styles$1 = {
|
|
|
3593
3588
|
pageText,
|
|
3594
3589
|
descriptionSecondLine
|
|
3595
3590
|
};
|
|
3591
|
+
const table = import("@overmap-ai/react-table-library/table.js");
|
|
3592
|
+
const { Body, Cell, Header, HeaderCell, HeaderRow, Row, Table: ReactLibraryTable } = table;
|
|
3593
|
+
const theme = import("@overmap-ai/react-table-library/theme.js");
|
|
3594
|
+
const { useTheme } = theme;
|
|
3595
|
+
const sort = import("@overmap-ai/react-table-library/sort.js");
|
|
3596
|
+
const { HeaderCellSort, useSort } = sort;
|
|
3597
|
+
const select = import("@overmap-ai/react-table-library/select.js");
|
|
3598
|
+
const { CellSelect, HeaderCellSelect, SelectClickTypes, SelectTypes, useRowSelect } = select;
|
|
3599
|
+
const pagination = import("@overmap-ai/react-table-library/pagination.js");
|
|
3600
|
+
const { usePagination } = pagination;
|
|
3596
3601
|
const _Table = forwardRef(function Table2(props, ref) {
|
|
3597
3602
|
var _a;
|
|
3598
3603
|
const {
|
|
@@ -3755,7 +3760,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3755
3760
|
isCarryForward: false
|
|
3756
3761
|
}
|
|
3757
3762
|
);
|
|
3758
|
-
const
|
|
3763
|
+
const pagination2 = usePagination(
|
|
3759
3764
|
tableData,
|
|
3760
3765
|
{
|
|
3761
3766
|
state: {
|
|
@@ -3767,7 +3772,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3767
3772
|
isServer: false
|
|
3768
3773
|
}
|
|
3769
3774
|
);
|
|
3770
|
-
const
|
|
3775
|
+
const sort2 = useSort(
|
|
3771
3776
|
tableData,
|
|
3772
3777
|
{
|
|
3773
3778
|
onChange: (_action, state) => {
|
|
@@ -3884,7 +3889,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3884
3889
|
});
|
|
3885
3890
|
const SelectedModeButton = isMobile ? IconButton : Button2;
|
|
3886
3891
|
const layout = useMemo(() => ({ custom: true, ...fixHeader && { fixedHeader: true } }), [fixHeader]);
|
|
3887
|
-
const
|
|
3892
|
+
const theme2 = useTheme({
|
|
3888
3893
|
Table: `
|
|
3889
3894
|
--data-table-library_grid-template-columns: ${gridTemplateColumns} !important;
|
|
3890
3895
|
`,
|
|
@@ -3907,14 +3912,14 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3907
3912
|
if (showPageNavigation) {
|
|
3908
3913
|
const numTotalPages = Math.ceil(rows.length / numRowsPerPage);
|
|
3909
3914
|
setTotalPages(numTotalPages);
|
|
3910
|
-
if (
|
|
3911
|
-
|
|
3915
|
+
if (pagination2.state.page < 0) {
|
|
3916
|
+
pagination2.fns.onSetPage(0);
|
|
3912
3917
|
}
|
|
3913
|
-
if (
|
|
3914
|
-
|
|
3918
|
+
if (pagination2.state.page > numTotalPages - 1) {
|
|
3919
|
+
pagination2.fns.onSetPage(numTotalPages - 1);
|
|
3915
3920
|
}
|
|
3916
3921
|
}
|
|
3917
|
-
}, [rowsPerPage, rows.length, numRowsPerPage,
|
|
3922
|
+
}, [rowsPerPage, rows.length, numRowsPerPage, pagination2, showPageNavigation]);
|
|
3918
3923
|
return /* @__PURE__ */ jsxs(Flex$1, { className: classNames({ [styles$1.outerTableContainer]: showContainer }), direction: "column", height: "100%", children: [
|
|
3919
3924
|
(!!title || !!description) && /* @__PURE__ */ jsxs("div", { className: styles$1.headerContainer, children: [
|
|
3920
3925
|
!!title && /* @__PURE__ */ jsx(Text$1, { weight: "bold", size: "5", children: title }),
|
|
@@ -3947,7 +3952,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3947
3952
|
color: "crimson",
|
|
3948
3953
|
onClick: () => {
|
|
3949
3954
|
setColumnFilterValues(defaultColumnFilterValues);
|
|
3950
|
-
|
|
3955
|
+
pagination2.fns.onSetPage(0);
|
|
3951
3956
|
},
|
|
3952
3957
|
"aria-label": "Clear filters",
|
|
3953
3958
|
children: /* @__PURE__ */ jsx(Cross2Icon, {})
|
|
@@ -3968,13 +3973,13 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3968
3973
|
] }),
|
|
3969
3974
|
children,
|
|
3970
3975
|
/* @__PURE__ */ jsx("div", { className: styles$1.tableContainer, children: /* @__PURE__ */ jsx(
|
|
3971
|
-
|
|
3976
|
+
ReactLibraryTable,
|
|
3972
3977
|
{
|
|
3973
3978
|
className: classNames(styles$1.table, className),
|
|
3974
3979
|
data: tableData,
|
|
3975
|
-
theme,
|
|
3976
|
-
sort,
|
|
3977
|
-
pagination: showPageNavigation &&
|
|
3980
|
+
theme: theme2,
|
|
3981
|
+
sort: sort2,
|
|
3982
|
+
pagination: showPageNavigation && pagination2,
|
|
3978
3983
|
select: tableSelect,
|
|
3979
3984
|
layout,
|
|
3980
3985
|
ref,
|
|
@@ -4040,7 +4045,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4040
4045
|
items: rowsPerPageOptions,
|
|
4041
4046
|
defaultValue: (_a = rowsPerPageOptions.find((rowPerPage) => rowPerPage.value === defaultRowsPerPage.toString())) == null ? void 0 : _a.value.toString(),
|
|
4042
4047
|
onValueChange: (v) => {
|
|
4043
|
-
|
|
4048
|
+
pagination2.fns.onSetSize(Number(v));
|
|
4044
4049
|
setNumRowsPerPage(Number(v));
|
|
4045
4050
|
},
|
|
4046
4051
|
placeholder: rowsPerPageOptions[0].itemContent,
|
|
@@ -4048,14 +4053,14 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4048
4053
|
}
|
|
4049
4054
|
)
|
|
4050
4055
|
] }),
|
|
4051
|
-
showPageNumber && /* @__PURE__ */ jsx(Flex$1, { justify: "center", children: /* @__PURE__ */ jsx(Text$1, { className: styles$1.pageText, size: "2", children: totalPages > 0 && `Page ${
|
|
4056
|
+
showPageNumber && /* @__PURE__ */ jsx(Flex$1, { justify: "center", children: /* @__PURE__ */ jsx(Text$1, { className: styles$1.pageText, size: "2", children: totalPages > 0 && `Page ${pagination2.state.page + 1} of ${totalPages}` }) }),
|
|
4052
4057
|
showPageNavigation && /* @__PURE__ */ jsxs(Flex$1, { className: styles$1.rowsPerPageContainer, gap: "2", justify: "end", children: [
|
|
4053
4058
|
/* @__PURE__ */ jsx(
|
|
4054
4059
|
IconButton,
|
|
4055
4060
|
{
|
|
4056
4061
|
variant: "surface",
|
|
4057
|
-
onClick: () =>
|
|
4058
|
-
disabled:
|
|
4062
|
+
onClick: () => pagination2.fns.onSetPage(0),
|
|
4063
|
+
disabled: pagination2.state.page === 0 || totalPages === 0,
|
|
4059
4064
|
"aria-label": "Go to first page",
|
|
4060
4065
|
children: /* @__PURE__ */ jsx(DoubleArrowLeftIcon, {})
|
|
4061
4066
|
}
|
|
@@ -4064,8 +4069,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4064
4069
|
IconButton,
|
|
4065
4070
|
{
|
|
4066
4071
|
variant: "surface",
|
|
4067
|
-
disabled:
|
|
4068
|
-
onClick: () =>
|
|
4072
|
+
disabled: pagination2.state.page === 0 || totalPages === 0,
|
|
4073
|
+
onClick: () => pagination2.fns.onSetPage(pagination2.state.page - 1),
|
|
4069
4074
|
"aria-label": "Previous page",
|
|
4070
4075
|
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
4071
4076
|
}
|
|
@@ -4074,8 +4079,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4074
4079
|
IconButton,
|
|
4075
4080
|
{
|
|
4076
4081
|
variant: "surface",
|
|
4077
|
-
disabled:
|
|
4078
|
-
onClick: () =>
|
|
4082
|
+
disabled: pagination2.state.page + 1 === totalPages || totalPages === 0,
|
|
4083
|
+
onClick: () => pagination2.fns.onSetPage(pagination2.state.page + 1),
|
|
4079
4084
|
"aria-label": "Next page",
|
|
4080
4085
|
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
4081
4086
|
}
|
|
@@ -4084,8 +4089,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4084
4089
|
IconButton,
|
|
4085
4090
|
{
|
|
4086
4091
|
variant: "surface",
|
|
4087
|
-
disabled:
|
|
4088
|
-
onClick: () =>
|
|
4092
|
+
disabled: pagination2.state.page + 1 === totalPages || totalPages === 0,
|
|
4093
|
+
onClick: () => pagination2.fns.onSetPage(totalPages - 1),
|
|
4089
4094
|
"aria-label": "Go to last page",
|
|
4090
4095
|
children: /* @__PURE__ */ jsx(DoubleArrowRightIcon, {})
|
|
4091
4096
|
}
|