@overmap-ai/blocks 1.0.9-form-table-view.0 → 1.0.9

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.
@@ -23,6 +23,7 @@ export interface TableColumn {
23
23
  search?: boolean;
24
24
  filter?: boolean;
25
25
  width?: string;
26
+ maxWidth?: string;
26
27
  className?: string;
27
28
  filterValues?: FilterValue[];
28
29
  }
@@ -56,6 +57,8 @@ export interface TableProps {
56
57
  */
57
58
  showTopBar?: boolean;
58
59
  showBottomBar?: boolean;
60
+ showTopButtons?: boolean;
61
+ topButtons?: ReactNode[];
59
62
  emptyMessage?: string;
60
63
  className?: string;
61
64
  columnClassName?: string;
package/dist/blocks.js CHANGED
@@ -2938,19 +2938,19 @@ const SelectAllCheckbox = memo(function SelectAllCheckbox2({
2938
2938
  childrenWithProps
2939
2939
  ] });
2940
2940
  });
2941
- const tableContainer = "_tableContainer_go3yk_1";
2942
- const headerContainer = "_headerContainer_go3yk_14";
2943
- const tableTopContainer = "_tableTopContainer_go3yk_18";
2944
- const searchContainer = "_searchContainer_go3yk_22";
2945
- const columnFilterSelect = "_columnFilterSelect_go3yk_32";
2946
- const table = "_table_go3yk_1";
2947
- const tableHeaderCell = "_tableHeaderCell_go3yk_50";
2948
- const tableRow = "_tableRow_go3yk_56";
2949
- const tableCell = "_tableCell_go3yk_71";
2950
- const noDataTextContainer = "_noDataTextContainer_go3yk_78";
2951
- const tableBottomContainer = "_tableBottomContainer_go3yk_84";
2952
- const rowsPerPageContainer = "_rowsPerPageContainer_go3yk_88";
2953
- const rowsPerPageText = "_rowsPerPageText_go3yk_98";
2941
+ const tableContainer = "_tableContainer_t2fb9_1";
2942
+ const headerContainer = "_headerContainer_t2fb9_14";
2943
+ const tableTopContainer = "_tableTopContainer_t2fb9_18";
2944
+ const searchContainer = "_searchContainer_t2fb9_22";
2945
+ const columnFilterSelect = "_columnFilterSelect_t2fb9_32";
2946
+ const table = "_table_t2fb9_1";
2947
+ const tableHeaderCell = "_tableHeaderCell_t2fb9_50";
2948
+ const tableRow = "_tableRow_t2fb9_56";
2949
+ const tableCell = "_tableCell_t2fb9_71";
2950
+ const noDataTextContainer = "_noDataTextContainer_t2fb9_81";
2951
+ const tableBottomContainer = "_tableBottomContainer_t2fb9_87";
2952
+ const rowsPerPageContainer = "_rowsPerPageContainer_t2fb9_91";
2953
+ const rowsPerPageText = "_rowsPerPageText_t2fb9_101";
2954
2954
  const styles$1 = {
2955
2955
  tableContainer,
2956
2956
  headerContainer,
@@ -2984,6 +2984,8 @@ const _Table = forwardRef(function Table2(props, ref) {
2984
2984
  showPageNavigation,
2985
2985
  showTopBar = true,
2986
2986
  showBottomBar = true,
2987
+ showTopButtons,
2988
+ topButtons,
2987
2989
  emptyMessage = "There is no data",
2988
2990
  children,
2989
2991
  className,
@@ -3093,7 +3095,10 @@ const _Table = forwardRef(function Table2(props, ref) {
3093
3095
  [data]
3094
3096
  );
3095
3097
  const gridTemplateColumns = useMemo(
3096
- () => (showSelect ? "auto " : "") + columnsData.reduce((accum, column) => accum + `${column.width || "auto"} `, ""),
3098
+ () => (showSelect ? "auto " : "") + columnsData.reduce(
3099
+ (accum, column) => accum + `${column.width ? column.width : column.maxWidth ? `minmax(auto, ${column.maxWidth})` : "auto"} `,
3100
+ ""
3101
+ ),
3097
3102
  [columnsData, showSelect]
3098
3103
  );
3099
3104
  const handleSearch = useCallback((e) => {
@@ -3252,12 +3257,12 @@ const _Table = forwardRef(function Table2(props, ref) {
3252
3257
  }, [rowsPerPage, rows.length, numRowsPerPage, pagination, showPageNavigation]);
3253
3258
  return /* @__PURE__ */ jsxs("div", { className: classNames({ [styles$1.tableContainer]: showContainer }), children: [
3254
3259
  (!!title || !!description) && /* @__PURE__ */ jsxs("div", { className: styles$1.headerContainer, children: [
3255
- !!title && /* @__PURE__ */ jsx(Text$1, { weight: "bold", size: "7", children: title }),
3260
+ !!title && /* @__PURE__ */ jsx(Text$1, { weight: "bold", size: "5", children: title }),
3256
3261
  !!description && /* @__PURE__ */ jsx(Text$1, { as: "div", children: description })
3257
3262
  ] }),
3258
- showTopBar && /* @__PURE__ */ jsxs(Flex$1, { justify: "between", className: styles$1.tableTopContainer, children: [
3263
+ showTopBar && /* @__PURE__ */ jsxs(Flex$1, { direction: "column", children: [
3259
3264
  /* @__PURE__ */ jsxs(Flex$1, { gap: "2", children: [
3260
- showSearchBar && /* @__PURE__ */ jsx("div", { className: styles$1.searchContainer, children: /* @__PURE__ */ jsx(
3265
+ showSearchBar && /* @__PURE__ */ jsx(Flex$1, { direction: "column", children: /* @__PURE__ */ jsx("div", { className: styles$1.searchContainer, children: /* @__PURE__ */ jsx(
3261
3266
  Input,
3262
3267
  {
3263
3268
  value: search,
@@ -3265,7 +3270,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3265
3270
  leftSlot: /* @__PURE__ */ jsx(MagnifyingGlassIcon, {}),
3266
3271
  placeholder: searchBarPlaceholder || "Filter tasks..."
3267
3272
  }
3268
- ) }),
3273
+ ) }) }),
3269
3274
  showFilterButton && /* @__PURE__ */ jsx(
3270
3275
  MultiPagePopover,
3271
3276
  {
@@ -3291,14 +3296,19 @@ const _Table = forwardRef(function Table2(props, ref) {
3291
3296
  }
3292
3297
  )
3293
3298
  ] }),
3294
- showSelect && selected.length !== 0 && /* @__PURE__ */ jsxs(Flex$1, { gap: "2", children: [
3295
- /* @__PURE__ */ jsxs(SelectedModeButton, { variant: "soft", "aria-label": "Edit rows", children: [
3296
- /* @__PURE__ */ jsx(Pencil1Icon, {}),
3297
- !isMobile && "Edit"
3299
+ /* @__PURE__ */ jsxs(Flex$1, { justify: "between", className: styles$1.tableTopContainer, children: [
3300
+ showTopButtons && topButtons && /* @__PURE__ */ jsxs(Flex$1, { gap: "2", children: [
3301
+ ...topButtons
3298
3302
  ] }),
3299
- /* @__PURE__ */ jsxs(SelectedModeButton, { color: "red", "aria-label": "Delete rows", children: [
3300
- /* @__PURE__ */ jsx(TrashIcon, {}),
3301
- !isMobile && "Delete"
3303
+ showSelect && selected.length !== 0 && /* @__PURE__ */ jsxs(Flex$1, { gap: "2", children: [
3304
+ /* @__PURE__ */ jsxs(SelectedModeButton, { variant: "soft", "aria-label": "Edit rows", children: [
3305
+ /* @__PURE__ */ jsx(Pencil1Icon, {}),
3306
+ !isMobile && "Edit"
3307
+ ] }),
3308
+ /* @__PURE__ */ jsxs(SelectedModeButton, { color: "red", "aria-label": "Delete rows", children: [
3309
+ /* @__PURE__ */ jsx(TrashIcon, {}),
3310
+ !isMobile && "Delete"
3311
+ ] })
3302
3312
  ] })
3303
3313
  ] })
3304
3314
  ] }),