@overmap-ai/blocks 1.0.26-table-row-loading.1 → 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/Checkbox/typings.d.ts +2 -0
- package/dist/blocks.js +71 -59
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +86 -69
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/style.css +36 -42
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, ReactElement } from "react";
|
|
2
2
|
import { Checkbox as RadixCheckbox } from "@radix-ui/themes";
|
|
3
|
+
import { FlexProps } from "../Flex";
|
|
3
4
|
export type RadixCheckboxProps = React.ComponentProps<typeof RadixCheckbox>;
|
|
4
5
|
export type CheckboxValue = boolean | "indeterminate";
|
|
5
6
|
export interface CheckboxProps extends RadixCheckboxProps {
|
|
@@ -8,6 +9,7 @@ export interface CheckboxProps extends RadixCheckboxProps {
|
|
|
8
9
|
label?: ReactNode;
|
|
9
10
|
doesLabelCheck?: boolean;
|
|
10
11
|
alwaysShow?: boolean;
|
|
12
|
+
checkboxPosition?: FlexProps["align"];
|
|
11
13
|
}
|
|
12
14
|
export interface SelectAllCheckboxProps extends Omit<CheckboxProps, "checked"> {
|
|
13
15
|
children: Array<ReactElement<CheckboxProps>>;
|
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 = () => {
|
|
@@ -3433,22 +3428,29 @@ function $e698a72e93240346$var$getState(checked) {
|
|
|
3433
3428
|
}
|
|
3434
3429
|
const $e698a72e93240346$export$be92b6f5f03c0fe9 = $e698a72e93240346$export$48513f6b9f8ce62d;
|
|
3435
3430
|
const $e698a72e93240346$export$adb584737d712b70 = $e698a72e93240346$export$59aad738f51d1c05;
|
|
3436
|
-
const
|
|
3437
|
-
const
|
|
3438
|
-
const
|
|
3439
|
-
const
|
|
3440
|
-
const
|
|
3441
|
-
const checkboxHidden = "_checkboxHidden_pb9za_51";
|
|
3431
|
+
const checkbox = "_checkbox_yl8iy_5";
|
|
3432
|
+
const checkboxIndicator = "_checkboxIndicator_yl8iy_22";
|
|
3433
|
+
const checkboxLabel = "_checkboxLabel_yl8iy_33";
|
|
3434
|
+
const noTextHighlight = "_noTextHighlight_yl8iy_37";
|
|
3435
|
+
const checkboxHidden = "_checkboxHidden_yl8iy_46";
|
|
3442
3436
|
const styles$2 = {
|
|
3443
|
-
checkboxContainer,
|
|
3444
3437
|
checkbox,
|
|
3445
3438
|
checkboxIndicator,
|
|
3446
3439
|
checkboxLabel,
|
|
3447
3440
|
noTextHighlight,
|
|
3448
3441
|
checkboxHidden
|
|
3449
3442
|
};
|
|
3450
|
-
const _Checkbox = forwardRef(function Checkbox2({
|
|
3451
|
-
|
|
3443
|
+
const _Checkbox = forwardRef(function Checkbox2({
|
|
3444
|
+
className,
|
|
3445
|
+
labelClassName,
|
|
3446
|
+
label,
|
|
3447
|
+
checked,
|
|
3448
|
+
onCheckedChange,
|
|
3449
|
+
checkboxPosition = "center",
|
|
3450
|
+
alwaysShow = true,
|
|
3451
|
+
...rest
|
|
3452
|
+
}, ref) {
|
|
3453
|
+
return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props }) => /* @__PURE__ */ jsxs(Flex$1, { align: checkboxPosition, ...props, children: [
|
|
3452
3454
|
/* @__PURE__ */ jsx(
|
|
3453
3455
|
$e698a72e93240346$export$be92b6f5f03c0fe9,
|
|
3454
3456
|
{
|
|
@@ -3548,24 +3550,24 @@ const SelectAllCheckbox = memo(function SelectAllCheckbox2({
|
|
|
3548
3550
|
childrenWithProps
|
|
3549
3551
|
] });
|
|
3550
3552
|
});
|
|
3551
|
-
const disabled = "
|
|
3552
|
-
const outerTableContainer = "
|
|
3553
|
-
const headerContainer = "
|
|
3554
|
-
const tableTopContainer = "
|
|
3555
|
-
const tableContainer = "
|
|
3556
|
-
const searchContainer = "
|
|
3557
|
-
const columnFilterSelect = "
|
|
3558
|
-
const table = "
|
|
3559
|
-
const tableHeaderCell = "
|
|
3560
|
-
const showSortIcon = "
|
|
3561
|
-
const tableRow = "
|
|
3562
|
-
const tableCell = "
|
|
3563
|
-
const noDataTextContainer = "
|
|
3564
|
-
const tableBottomContainer = "
|
|
3565
|
-
const rowsPerPageContainer = "
|
|
3566
|
-
const rowsPerPageText = "
|
|
3567
|
-
const pageText = "
|
|
3568
|
-
const descriptionSecondLine = "
|
|
3553
|
+
const disabled = "_disabled_5i91d_1";
|
|
3554
|
+
const outerTableContainer = "_outerTableContainer_5i91d_5";
|
|
3555
|
+
const headerContainer = "_headerContainer_5i91d_17";
|
|
3556
|
+
const tableTopContainer = "_tableTopContainer_5i91d_21";
|
|
3557
|
+
const tableContainer = "_tableContainer_5i91d_25";
|
|
3558
|
+
const searchContainer = "_searchContainer_5i91d_30";
|
|
3559
|
+
const columnFilterSelect = "_columnFilterSelect_5i91d_40";
|
|
3560
|
+
const table$1 = "_table_5i91d_21";
|
|
3561
|
+
const tableHeaderCell = "_tableHeaderCell_5i91d_58";
|
|
3562
|
+
const showSortIcon = "_showSortIcon_5i91d_74";
|
|
3563
|
+
const tableRow = "_tableRow_5i91d_78";
|
|
3564
|
+
const tableCell = "_tableCell_5i91d_93";
|
|
3565
|
+
const noDataTextContainer = "_noDataTextContainer_5i91d_103";
|
|
3566
|
+
const tableBottomContainer = "_tableBottomContainer_5i91d_109";
|
|
3567
|
+
const rowsPerPageContainer = "_rowsPerPageContainer_5i91d_113";
|
|
3568
|
+
const rowsPerPageText = "_rowsPerPageText_5i91d_123";
|
|
3569
|
+
const pageText = "_pageText_5i91d_128";
|
|
3570
|
+
const descriptionSecondLine = "_descriptionSecondLine_5i91d_132";
|
|
3569
3571
|
const styles$1 = {
|
|
3570
3572
|
disabled,
|
|
3571
3573
|
outerTableContainer,
|
|
@@ -3574,7 +3576,7 @@ const styles$1 = {
|
|
|
3574
3576
|
tableContainer,
|
|
3575
3577
|
searchContainer,
|
|
3576
3578
|
columnFilterSelect,
|
|
3577
|
-
table,
|
|
3579
|
+
table: table$1,
|
|
3578
3580
|
tableHeaderCell,
|
|
3579
3581
|
showSortIcon,
|
|
3580
3582
|
tableRow,
|
|
@@ -3586,6 +3588,16 @@ const styles$1 = {
|
|
|
3586
3588
|
pageText,
|
|
3587
3589
|
descriptionSecondLine
|
|
3588
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;
|
|
3589
3601
|
const _Table = forwardRef(function Table2(props, ref) {
|
|
3590
3602
|
var _a;
|
|
3591
3603
|
const {
|
|
@@ -3748,7 +3760,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3748
3760
|
isCarryForward: false
|
|
3749
3761
|
}
|
|
3750
3762
|
);
|
|
3751
|
-
const
|
|
3763
|
+
const pagination2 = usePagination(
|
|
3752
3764
|
tableData,
|
|
3753
3765
|
{
|
|
3754
3766
|
state: {
|
|
@@ -3760,7 +3772,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3760
3772
|
isServer: false
|
|
3761
3773
|
}
|
|
3762
3774
|
);
|
|
3763
|
-
const
|
|
3775
|
+
const sort2 = useSort(
|
|
3764
3776
|
tableData,
|
|
3765
3777
|
{
|
|
3766
3778
|
onChange: (_action, state) => {
|
|
@@ -3877,7 +3889,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3877
3889
|
});
|
|
3878
3890
|
const SelectedModeButton = isMobile ? IconButton : Button2;
|
|
3879
3891
|
const layout = useMemo(() => ({ custom: true, ...fixHeader && { fixedHeader: true } }), [fixHeader]);
|
|
3880
|
-
const
|
|
3892
|
+
const theme2 = useTheme({
|
|
3881
3893
|
Table: `
|
|
3882
3894
|
--data-table-library_grid-template-columns: ${gridTemplateColumns} !important;
|
|
3883
3895
|
`,
|
|
@@ -3900,14 +3912,14 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3900
3912
|
if (showPageNavigation) {
|
|
3901
3913
|
const numTotalPages = Math.ceil(rows.length / numRowsPerPage);
|
|
3902
3914
|
setTotalPages(numTotalPages);
|
|
3903
|
-
if (
|
|
3904
|
-
|
|
3915
|
+
if (pagination2.state.page < 0) {
|
|
3916
|
+
pagination2.fns.onSetPage(0);
|
|
3905
3917
|
}
|
|
3906
|
-
if (
|
|
3907
|
-
|
|
3918
|
+
if (pagination2.state.page > numTotalPages - 1) {
|
|
3919
|
+
pagination2.fns.onSetPage(numTotalPages - 1);
|
|
3908
3920
|
}
|
|
3909
3921
|
}
|
|
3910
|
-
}, [rowsPerPage, rows.length, numRowsPerPage,
|
|
3922
|
+
}, [rowsPerPage, rows.length, numRowsPerPage, pagination2, showPageNavigation]);
|
|
3911
3923
|
return /* @__PURE__ */ jsxs(Flex$1, { className: classNames({ [styles$1.outerTableContainer]: showContainer }), direction: "column", height: "100%", children: [
|
|
3912
3924
|
(!!title || !!description) && /* @__PURE__ */ jsxs("div", { className: styles$1.headerContainer, children: [
|
|
3913
3925
|
!!title && /* @__PURE__ */ jsx(Text$1, { weight: "bold", size: "5", children: title }),
|
|
@@ -3940,7 +3952,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3940
3952
|
color: "crimson",
|
|
3941
3953
|
onClick: () => {
|
|
3942
3954
|
setColumnFilterValues(defaultColumnFilterValues);
|
|
3943
|
-
|
|
3955
|
+
pagination2.fns.onSetPage(0);
|
|
3944
3956
|
},
|
|
3945
3957
|
"aria-label": "Clear filters",
|
|
3946
3958
|
children: /* @__PURE__ */ jsx(Cross2Icon, {})
|
|
@@ -3961,13 +3973,13 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3961
3973
|
] }),
|
|
3962
3974
|
children,
|
|
3963
3975
|
/* @__PURE__ */ jsx("div", { className: styles$1.tableContainer, children: /* @__PURE__ */ jsx(
|
|
3964
|
-
|
|
3976
|
+
ReactLibraryTable,
|
|
3965
3977
|
{
|
|
3966
3978
|
className: classNames(styles$1.table, className),
|
|
3967
3979
|
data: tableData,
|
|
3968
|
-
theme,
|
|
3969
|
-
sort,
|
|
3970
|
-
pagination: showPageNavigation &&
|
|
3980
|
+
theme: theme2,
|
|
3981
|
+
sort: sort2,
|
|
3982
|
+
pagination: showPageNavigation && pagination2,
|
|
3971
3983
|
select: tableSelect,
|
|
3972
3984
|
layout,
|
|
3973
3985
|
ref,
|
|
@@ -3985,7 +3997,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
3985
3997
|
className: classNames(styles$1.tableRow, rowClassName, row.className, {
|
|
3986
3998
|
[styles$1.disabled]: row.disabled
|
|
3987
3999
|
}),
|
|
3988
|
-
onClick: !row.
|
|
4000
|
+
onClick: !row.disabled && row.onClick,
|
|
3989
4001
|
children: row.loading ? /* @__PURE__ */ jsx(
|
|
3990
4002
|
Cell,
|
|
3991
4003
|
{
|
|
@@ -4033,7 +4045,7 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4033
4045
|
items: rowsPerPageOptions,
|
|
4034
4046
|
defaultValue: (_a = rowsPerPageOptions.find((rowPerPage) => rowPerPage.value === defaultRowsPerPage.toString())) == null ? void 0 : _a.value.toString(),
|
|
4035
4047
|
onValueChange: (v) => {
|
|
4036
|
-
|
|
4048
|
+
pagination2.fns.onSetSize(Number(v));
|
|
4037
4049
|
setNumRowsPerPage(Number(v));
|
|
4038
4050
|
},
|
|
4039
4051
|
placeholder: rowsPerPageOptions[0].itemContent,
|
|
@@ -4041,14 +4053,14 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4041
4053
|
}
|
|
4042
4054
|
)
|
|
4043
4055
|
] }),
|
|
4044
|
-
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}` }) }),
|
|
4045
4057
|
showPageNavigation && /* @__PURE__ */ jsxs(Flex$1, { className: styles$1.rowsPerPageContainer, gap: "2", justify: "end", children: [
|
|
4046
4058
|
/* @__PURE__ */ jsx(
|
|
4047
4059
|
IconButton,
|
|
4048
4060
|
{
|
|
4049
4061
|
variant: "surface",
|
|
4050
|
-
onClick: () =>
|
|
4051
|
-
disabled:
|
|
4062
|
+
onClick: () => pagination2.fns.onSetPage(0),
|
|
4063
|
+
disabled: pagination2.state.page === 0 || totalPages === 0,
|
|
4052
4064
|
"aria-label": "Go to first page",
|
|
4053
4065
|
children: /* @__PURE__ */ jsx(DoubleArrowLeftIcon, {})
|
|
4054
4066
|
}
|
|
@@ -4057,8 +4069,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4057
4069
|
IconButton,
|
|
4058
4070
|
{
|
|
4059
4071
|
variant: "surface",
|
|
4060
|
-
disabled:
|
|
4061
|
-
onClick: () =>
|
|
4072
|
+
disabled: pagination2.state.page === 0 || totalPages === 0,
|
|
4073
|
+
onClick: () => pagination2.fns.onSetPage(pagination2.state.page - 1),
|
|
4062
4074
|
"aria-label": "Previous page",
|
|
4063
4075
|
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
4064
4076
|
}
|
|
@@ -4067,8 +4079,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4067
4079
|
IconButton,
|
|
4068
4080
|
{
|
|
4069
4081
|
variant: "surface",
|
|
4070
|
-
disabled:
|
|
4071
|
-
onClick: () =>
|
|
4082
|
+
disabled: pagination2.state.page + 1 === totalPages || totalPages === 0,
|
|
4083
|
+
onClick: () => pagination2.fns.onSetPage(pagination2.state.page + 1),
|
|
4072
4084
|
"aria-label": "Next page",
|
|
4073
4085
|
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
4074
4086
|
}
|
|
@@ -4077,8 +4089,8 @@ const _Table = forwardRef(function Table2(props, ref) {
|
|
|
4077
4089
|
IconButton,
|
|
4078
4090
|
{
|
|
4079
4091
|
variant: "surface",
|
|
4080
|
-
disabled:
|
|
4081
|
-
onClick: () =>
|
|
4092
|
+
disabled: pagination2.state.page + 1 === totalPages || totalPages === 0,
|
|
4093
|
+
onClick: () => pagination2.fns.onSetPage(totalPages - 1),
|
|
4082
4094
|
"aria-label": "Go to last page",
|
|
4083
4095
|
children: /* @__PURE__ */ jsx(DoubleArrowRightIcon, {})
|
|
4084
4096
|
}
|