@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.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("@radix-ui/themes"), require("react"), require("react-responsive"), require("@radix-ui/react-icons"), require("@radix-ui/react-context-menu"), require("@radix-ui/react-dropdown-menu"), require("react-device-detect"), require("@radix-ui/react-dialog"), require("re-resizable"), require("react-transition-group"), require("react-dom"), require("@radix-ui/react-slot"), require("@radix-ui/react-dismissable-layer"), require("@radix-ui/react-toggle-group"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-toast"), require("react-error-boundary"), require("feather-icons-react")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "@radix-ui/themes", "react", "react-responsive", "@radix-ui/react-icons", "@radix-ui/react-context-menu", "@radix-ui/react-dropdown-menu", "react-device-detect", "@radix-ui/react-dialog", "re-resizable", "react-transition-group", "react-dom", "@radix-ui/react-slot", "@radix-ui/react-dismissable-layer", "@radix-ui/react-toggle-group", "@radix-ui/react-toolbar", "@radix-ui/react-toast", "react-error-boundary", "feather-icons-react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.blocks = {}, global.jsxRuntime, global.themes, global.React, global.reactResponsive, global.reactIcons, global.RadixContextMenu, global.RadixDropdownMenu, global.reactDeviceDetect, global.RadixDialogPrimitive, global.reResizable, global.reactTransitionGroup, global.ReactDOM, global.reactSlot, global.reactDismissableLayer, global.reactToggleGroup, global.reactToolbar, global.RadixToast, global.reactErrorBoundary, global.FeatherIcon));
|
|
3
|
-
})(this, function(exports2, jsxRuntime, themes, React, reactResponsive, reactIcons, RadixContextMenu, RadixDropdownMenu, reactDeviceDetect, RadixDialogPrimitive, reResizable, reactTransitionGroup, ReactDOM, reactSlot, reactDismissableLayer, reactToggleGroup, reactToolbar, RadixToast, reactErrorBoundary, FeatherIcon) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("@radix-ui/themes"), require("react"), require("react-responsive"), require("@radix-ui/react-icons"), require("@radix-ui/react-context-menu"), require("@radix-ui/react-dropdown-menu"), require("react-device-detect"), require("@radix-ui/react-dialog"), require("re-resizable"), require("react-transition-group"), require("react-dom"), require("@radix-ui/react-slot"), require("@radix-ui/react-dismissable-layer"), require("@radix-ui/react-toggle-group"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-toast"), require("react-error-boundary"), require("feather-icons-react"), require("@table-library/react-table-library/table.js"), require("@table-library/react-table-library/theme.js"), require("@table-library/react-table-library/sort.js"), require("@table-library/react-table-library/select.js"), require("@table-library/react-table-library/pagination.js")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "@radix-ui/themes", "react", "react-responsive", "@radix-ui/react-icons", "@radix-ui/react-context-menu", "@radix-ui/react-dropdown-menu", "react-device-detect", "@radix-ui/react-dialog", "re-resizable", "react-transition-group", "react-dom", "@radix-ui/react-slot", "@radix-ui/react-dismissable-layer", "@radix-ui/react-toggle-group", "@radix-ui/react-toolbar", "@radix-ui/react-toast", "react-error-boundary", "feather-icons-react", "@table-library/react-table-library/table.js", "@table-library/react-table-library/theme.js", "@table-library/react-table-library/sort.js", "@table-library/react-table-library/select.js", "@table-library/react-table-library/pagination.js"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.blocks = {}, global.jsxRuntime, global.themes, global.React, global.reactResponsive, global.reactIcons, global.RadixContextMenu, global.RadixDropdownMenu, global.reactDeviceDetect, global.RadixDialogPrimitive, global.reResizable, global.reactTransitionGroup, global.ReactDOM, global.reactSlot, global.reactDismissableLayer, global.reactToggleGroup, global.reactToolbar, global.RadixToast, global.reactErrorBoundary, global.FeatherIcon, global.table_js, global.theme_js, global.sort_js, global.select_js, global.pagination_js));
|
|
3
|
+
})(this, function(exports2, jsxRuntime, themes, React, reactResponsive, reactIcons, RadixContextMenu, RadixDropdownMenu, reactDeviceDetect, RadixDialogPrimitive, reResizable, reactTransitionGroup, ReactDOM, reactSlot, reactDismissableLayer, reactToggleGroup, reactToolbar, RadixToast, reactErrorBoundary, FeatherIcon, table_js, theme_js, sort_js, select_js, pagination_js) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -95,11 +95,11 @@
|
|
|
95
95
|
info: "gray"
|
|
96
96
|
};
|
|
97
97
|
const useSeverityColor = (severity) => {
|
|
98
|
-
const
|
|
98
|
+
const theme = themes.useThemeContext();
|
|
99
99
|
if (!severity)
|
|
100
100
|
return void 0;
|
|
101
101
|
if (severity === "primary")
|
|
102
|
-
return
|
|
102
|
+
return theme.accentColor;
|
|
103
103
|
return nonThemeSeverityMapping[severity];
|
|
104
104
|
};
|
|
105
105
|
const useViewportSize = () => {
|
|
@@ -3553,7 +3553,7 @@
|
|
|
3553
3553
|
const tableContainer = "_tableContainer_5i91d_25";
|
|
3554
3554
|
const searchContainer = "_searchContainer_5i91d_30";
|
|
3555
3555
|
const columnFilterSelect = "_columnFilterSelect_5i91d_40";
|
|
3556
|
-
const table
|
|
3556
|
+
const table = "_table_5i91d_21";
|
|
3557
3557
|
const tableHeaderCell = "_tableHeaderCell_5i91d_58";
|
|
3558
3558
|
const showSortIcon = "_showSortIcon_5i91d_74";
|
|
3559
3559
|
const tableRow = "_tableRow_5i91d_78";
|
|
@@ -3572,7 +3572,7 @@
|
|
|
3572
3572
|
tableContainer,
|
|
3573
3573
|
searchContainer,
|
|
3574
3574
|
columnFilterSelect,
|
|
3575
|
-
table
|
|
3575
|
+
table,
|
|
3576
3576
|
tableHeaderCell,
|
|
3577
3577
|
showSortIcon,
|
|
3578
3578
|
tableRow,
|
|
@@ -3584,16 +3584,6 @@
|
|
|
3584
3584
|
pageText,
|
|
3585
3585
|
descriptionSecondLine
|
|
3586
3586
|
};
|
|
3587
|
-
const table = import("@overmap-ai/react-table-library/table.js");
|
|
3588
|
-
const { Body, Cell, Header, HeaderCell, HeaderRow, Row, Table: ReactLibraryTable } = table;
|
|
3589
|
-
const theme = import("@overmap-ai/react-table-library/theme.js");
|
|
3590
|
-
const { useTheme } = theme;
|
|
3591
|
-
const sort = import("@overmap-ai/react-table-library/sort.js");
|
|
3592
|
-
const { HeaderCellSort, useSort } = sort;
|
|
3593
|
-
const select = import("@overmap-ai/react-table-library/select.js");
|
|
3594
|
-
const { CellSelect, HeaderCellSelect, SelectClickTypes, SelectTypes, useRowSelect } = select;
|
|
3595
|
-
const pagination = import("@overmap-ai/react-table-library/pagination.js");
|
|
3596
|
-
const { usePagination } = pagination;
|
|
3597
3587
|
const _Table = React.forwardRef(function Table2(props, ref) {
|
|
3598
3588
|
var _a;
|
|
3599
3589
|
const {
|
|
@@ -3742,7 +3732,7 @@
|
|
|
3742
3732
|
setSearch(e.target.value);
|
|
3743
3733
|
}, []);
|
|
3744
3734
|
const tableData = { nodes: rows };
|
|
3745
|
-
const tableSelect = useRowSelect(
|
|
3735
|
+
const tableSelect = select_js.useRowSelect(
|
|
3746
3736
|
tableData,
|
|
3747
3737
|
{
|
|
3748
3738
|
onChange: (_action, state) => {
|
|
@@ -3750,13 +3740,13 @@
|
|
|
3750
3740
|
}
|
|
3751
3741
|
},
|
|
3752
3742
|
{
|
|
3753
|
-
rowSelect: SelectTypes.MultiSelect,
|
|
3754
|
-
buttonSelect: SelectTypes.MultiSelect,
|
|
3755
|
-
clickType: SelectClickTypes.ButtonClick,
|
|
3743
|
+
rowSelect: select_js.SelectTypes.MultiSelect,
|
|
3744
|
+
buttonSelect: select_js.SelectTypes.MultiSelect,
|
|
3745
|
+
clickType: select_js.SelectClickTypes.ButtonClick,
|
|
3756
3746
|
isCarryForward: false
|
|
3757
3747
|
}
|
|
3758
3748
|
);
|
|
3759
|
-
const
|
|
3749
|
+
const pagination = pagination_js.usePagination(
|
|
3760
3750
|
tableData,
|
|
3761
3751
|
{
|
|
3762
3752
|
state: {
|
|
@@ -3768,7 +3758,7 @@
|
|
|
3768
3758
|
isServer: false
|
|
3769
3759
|
}
|
|
3770
3760
|
);
|
|
3771
|
-
const
|
|
3761
|
+
const sort = sort_js.useSort(
|
|
3772
3762
|
tableData,
|
|
3773
3763
|
{
|
|
3774
3764
|
onChange: (_action, state) => {
|
|
@@ -3853,7 +3843,7 @@
|
|
|
3853
3843
|
[columnFilterValues, columns, getFilterValues]
|
|
3854
3844
|
);
|
|
3855
3845
|
const columnCells = columnsData.map((column) => {
|
|
3856
|
-
const Component = column.sort ? HeaderCellSort : HeaderCell;
|
|
3846
|
+
const Component = column.sort ? sort_js.HeaderCellSort : table_js.HeaderCell;
|
|
3857
3847
|
let firstLine = column.label;
|
|
3858
3848
|
let secondLine = void 0;
|
|
3859
3849
|
if (column.label && typeof column.label === "string") {
|
|
@@ -3885,7 +3875,7 @@
|
|
|
3885
3875
|
});
|
|
3886
3876
|
const SelectedModeButton = reactDeviceDetect.isMobile ? IconButton : Button2;
|
|
3887
3877
|
const layout = React.useMemo(() => ({ custom: true, ...fixHeader && { fixedHeader: true } }), [fixHeader]);
|
|
3888
|
-
const
|
|
3878
|
+
const theme = theme_js.useTheme({
|
|
3889
3879
|
Table: `
|
|
3890
3880
|
--data-table-library_grid-template-columns: ${gridTemplateColumns} !important;
|
|
3891
3881
|
`,
|
|
@@ -3908,14 +3898,14 @@
|
|
|
3908
3898
|
if (showPageNavigation) {
|
|
3909
3899
|
const numTotalPages = Math.ceil(rows.length / numRowsPerPage);
|
|
3910
3900
|
setTotalPages(numTotalPages);
|
|
3911
|
-
if (
|
|
3912
|
-
|
|
3901
|
+
if (pagination.state.page < 0) {
|
|
3902
|
+
pagination.fns.onSetPage(0);
|
|
3913
3903
|
}
|
|
3914
|
-
if (
|
|
3915
|
-
|
|
3904
|
+
if (pagination.state.page > numTotalPages - 1) {
|
|
3905
|
+
pagination.fns.onSetPage(numTotalPages - 1);
|
|
3916
3906
|
}
|
|
3917
3907
|
}
|
|
3918
|
-
}, [rowsPerPage, rows.length, numRowsPerPage,
|
|
3908
|
+
}, [rowsPerPage, rows.length, numRowsPerPage, pagination, showPageNavigation]);
|
|
3919
3909
|
return /* @__PURE__ */ jsxRuntime.jsxs(themes.Flex, { className: classNames({ [styles$1.outerTableContainer]: showContainer }), direction: "column", height: "100%", children: [
|
|
3920
3910
|
(!!title || !!description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$1.headerContainer, children: [
|
|
3921
3911
|
!!title && /* @__PURE__ */ jsxRuntime.jsx(Text$1, { weight: "bold", size: "5", children: title }),
|
|
@@ -3948,7 +3938,7 @@
|
|
|
3948
3938
|
color: "crimson",
|
|
3949
3939
|
onClick: () => {
|
|
3950
3940
|
setColumnFilterValues(defaultColumnFilterValues);
|
|
3951
|
-
|
|
3941
|
+
pagination.fns.onSetPage(0);
|
|
3952
3942
|
},
|
|
3953
3943
|
"aria-label": "Clear filters",
|
|
3954
3944
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.Cross2Icon, {})
|
|
@@ -3969,33 +3959,33 @@
|
|
|
3969
3959
|
] }),
|
|
3970
3960
|
children,
|
|
3971
3961
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$1.tableContainer, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3972
|
-
|
|
3962
|
+
table_js.Table,
|
|
3973
3963
|
{
|
|
3974
3964
|
className: classNames(styles$1.table, className),
|
|
3975
3965
|
data: tableData,
|
|
3976
|
-
theme
|
|
3977
|
-
sort
|
|
3978
|
-
pagination: showPageNavigation &&
|
|
3966
|
+
theme,
|
|
3967
|
+
sort,
|
|
3968
|
+
pagination: showPageNavigation && pagination,
|
|
3979
3969
|
select: tableSelect,
|
|
3980
3970
|
layout,
|
|
3981
3971
|
ref,
|
|
3982
3972
|
children: (tableList) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3983
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(HeaderRow, { children: [
|
|
3984
|
-
showSelect && /* @__PURE__ */ jsxRuntime.jsx(HeaderCellSelect, { className: styles$1.tableHeaderCell }),
|
|
3973
|
+
/* @__PURE__ */ jsxRuntime.jsx(table_js.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(table_js.HeaderRow, { children: [
|
|
3974
|
+
showSelect && /* @__PURE__ */ jsxRuntime.jsx(select_js.HeaderCellSelect, { className: styles$1.tableHeaderCell }),
|
|
3985
3975
|
...columnCells
|
|
3986
3976
|
] }) }),
|
|
3987
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Body, { children: [
|
|
3988
|
-
tableList.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(themes.TableRow, { className: styles$1.noDataTextContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: emptyMessage }) }),
|
|
3977
|
+
/* @__PURE__ */ jsxRuntime.jsxs(table_js.Body, { children: [
|
|
3978
|
+
tableList.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(themes.TableRow, { className: styles$1.noDataTextContainer, children: /* @__PURE__ */ jsxRuntime.jsx(table_js.Cell, { children: emptyMessage }) }),
|
|
3989
3979
|
tableList.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3990
|
-
Row,
|
|
3980
|
+
table_js.Row,
|
|
3991
3981
|
{
|
|
3992
3982
|
item: row,
|
|
3993
3983
|
className: classNames(styles$1.tableRow, rowClassName, row.className, {
|
|
3994
3984
|
[styles$1.disabled]: row.disabled
|
|
3995
3985
|
}),
|
|
3996
|
-
onClick: !row.disabled && row.onClick,
|
|
3986
|
+
onClick: !row.loading && !row.disabled && row.onClick,
|
|
3997
3987
|
children: row.loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3998
|
-
Cell,
|
|
3988
|
+
table_js.Cell,
|
|
3999
3989
|
{
|
|
4000
3990
|
style: {
|
|
4001
3991
|
gridColumn: `1 / span ${columns.length}`
|
|
@@ -4004,11 +3994,11 @@
|
|
|
4004
3994
|
},
|
|
4005
3995
|
`loading-${row.id}`
|
|
4006
3996
|
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4007
|
-
showSelect && /* @__PURE__ */ jsxRuntime.jsx(CellSelect, { item: row }, row.id),
|
|
3997
|
+
showSelect && /* @__PURE__ */ jsxRuntime.jsx(select_js.CellSelect, { item: row }, row.id),
|
|
4008
3998
|
columns.map((column, i) => {
|
|
4009
3999
|
const cell = row[column.id];
|
|
4010
4000
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4011
|
-
Cell,
|
|
4001
|
+
table_js.Cell,
|
|
4012
4002
|
{
|
|
4013
4003
|
className: classNames(
|
|
4014
4004
|
styles$1.tableCell,
|
|
@@ -4041,7 +4031,7 @@
|
|
|
4041
4031
|
items: rowsPerPageOptions,
|
|
4042
4032
|
defaultValue: (_a = rowsPerPageOptions.find((rowPerPage) => rowPerPage.value === defaultRowsPerPage.toString())) == null ? void 0 : _a.value.toString(),
|
|
4043
4033
|
onValueChange: (v) => {
|
|
4044
|
-
|
|
4034
|
+
pagination.fns.onSetSize(Number(v));
|
|
4045
4035
|
setNumRowsPerPage(Number(v));
|
|
4046
4036
|
},
|
|
4047
4037
|
placeholder: rowsPerPageOptions[0].itemContent,
|
|
@@ -4049,14 +4039,14 @@
|
|
|
4049
4039
|
}
|
|
4050
4040
|
)
|
|
4051
4041
|
] }),
|
|
4052
|
-
showPageNumber && /* @__PURE__ */ jsxRuntime.jsx(themes.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Text$1, { className: styles$1.pageText, size: "2", children: totalPages > 0 && `Page ${
|
|
4042
|
+
showPageNumber && /* @__PURE__ */ jsxRuntime.jsx(themes.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Text$1, { className: styles$1.pageText, size: "2", children: totalPages > 0 && `Page ${pagination.state.page + 1} of ${totalPages}` }) }),
|
|
4053
4043
|
showPageNavigation && /* @__PURE__ */ jsxRuntime.jsxs(themes.Flex, { className: styles$1.rowsPerPageContainer, gap: "2", justify: "end", children: [
|
|
4054
4044
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4055
4045
|
IconButton,
|
|
4056
4046
|
{
|
|
4057
4047
|
variant: "surface",
|
|
4058
|
-
onClick: () =>
|
|
4059
|
-
disabled:
|
|
4048
|
+
onClick: () => pagination.fns.onSetPage(0),
|
|
4049
|
+
disabled: pagination.state.page === 0 || totalPages === 0,
|
|
4060
4050
|
"aria-label": "Go to first page",
|
|
4061
4051
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DoubleArrowLeftIcon, {})
|
|
4062
4052
|
}
|
|
@@ -4065,8 +4055,8 @@
|
|
|
4065
4055
|
IconButton,
|
|
4066
4056
|
{
|
|
4067
4057
|
variant: "surface",
|
|
4068
|
-
disabled:
|
|
4069
|
-
onClick: () =>
|
|
4058
|
+
disabled: pagination.state.page === 0 || totalPages === 0,
|
|
4059
|
+
onClick: () => pagination.fns.onSetPage(pagination.state.page - 1),
|
|
4070
4060
|
"aria-label": "Previous page",
|
|
4071
4061
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronLeftIcon, {})
|
|
4072
4062
|
}
|
|
@@ -4075,8 +4065,8 @@
|
|
|
4075
4065
|
IconButton,
|
|
4076
4066
|
{
|
|
4077
4067
|
variant: "surface",
|
|
4078
|
-
disabled:
|
|
4079
|
-
onClick: () =>
|
|
4068
|
+
disabled: pagination.state.page + 1 === totalPages || totalPages === 0,
|
|
4069
|
+
onClick: () => pagination.fns.onSetPage(pagination.state.page + 1),
|
|
4080
4070
|
"aria-label": "Next page",
|
|
4081
4071
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronRightIcon, {})
|
|
4082
4072
|
}
|
|
@@ -4085,8 +4075,8 @@
|
|
|
4085
4075
|
IconButton,
|
|
4086
4076
|
{
|
|
4087
4077
|
variant: "surface",
|
|
4088
|
-
disabled:
|
|
4089
|
-
onClick: () =>
|
|
4078
|
+
disabled: pagination.state.page + 1 === totalPages || totalPages === 0,
|
|
4079
|
+
onClick: () => pagination.fns.onSetPage(totalPages - 1),
|
|
4090
4080
|
"aria-label": "Go to last page",
|
|
4091
4081
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DoubleArrowRightIcon, {})
|
|
4092
4082
|
}
|