@overmap-ai/blocks 1.0.17-table-style-changes.2 → 1.0.17-table-style-changes.4

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.
@@ -43,6 +43,7 @@ export interface TableProps {
43
43
  description?: string | ReactNode;
44
44
  defaultRowsPerPage?: number;
45
45
  rowsPerPage?: number[];
46
+ fixHeader?: boolean;
46
47
  showSearchBar?: boolean;
47
48
  searchBarPlaceholder?: string;
48
49
  showSelect?: boolean;
package/dist/blocks.js CHANGED
@@ -187,6 +187,12 @@ function useTextFilter(values, filterFunction) {
187
187
  }, [filterFunction, filterValue, values]);
188
188
  return [filteredOptions, filterValue, setFilterValue];
189
189
  }
190
+ const splitTextForEllipsisAndExpansion = (text, numChars) => {
191
+ const indexOfSpace = text.indexOf(" ", numChars);
192
+ const firstLine = indexOfSpace === -1 ? text : text.substring(0, indexOfSpace);
193
+ const secondLine = indexOfSpace === -1 ? "" : text.substring(indexOfSpace);
194
+ return [firstLine, secondLine];
195
+ };
190
196
  const _Badge = forwardRef(function Badge2({ className, severity = "primary", color, children, ...rest }, ref) {
191
197
  const severityColor = useSeverityColor(severity);
192
198
  return /* @__PURE__ */ jsx(
@@ -1840,11 +1846,11 @@ const LeftAndRightPanels = memo(function Panels({
1840
1846
  }
1841
1847
  );
1842
1848
  });
1843
- const multiPagePopover = "_multiPagePopover_spfw7_1";
1844
- const pageTitle = "_pageTitle_spfw7_12";
1845
- const buttonContainer = "_buttonContainer_spfw7_17";
1846
- const optionsButtonContainer = "_optionsButtonContainer_spfw7_22";
1847
- const optionsButton = "_optionsButton_spfw7_22";
1849
+ const multiPagePopover = "_multiPagePopover_1kjhq_1";
1850
+ const pageTitle = "_pageTitle_1kjhq_12";
1851
+ const buttonContainer = "_buttonContainer_1kjhq_17";
1852
+ const optionsButtonContainer = "_optionsButtonContainer_1kjhq_22";
1853
+ const optionsButton = "_optionsButton_1kjhq_22";
1848
1854
  const styles$9 = {
1849
1855
  multiPagePopover,
1850
1856
  pageTitle,
@@ -2967,26 +2973,28 @@ const SelectAllCheckbox = memo(function SelectAllCheckbox2({
2967
2973
  childrenWithProps
2968
2974
  ] });
2969
2975
  });
2970
- const tableContainer = "_tableContainer_1qkkq_1";
2971
- const headerContainer = "_headerContainer_1qkkq_13";
2972
- const tableTopContainer = "_tableTopContainer_1qkkq_17";
2973
- const searchContainer = "_searchContainer_1qkkq_21";
2974
- const columnFilterSelect = "_columnFilterSelect_1qkkq_31";
2975
- const table = "_table_1qkkq_1";
2976
- const tableHeaderCell = "_tableHeaderCell_1qkkq_49";
2977
- const showSortIcon = "_showSortIcon_1qkkq_65";
2978
- const tableRow = "_tableRow_1qkkq_69";
2979
- const tableCell = "_tableCell_1qkkq_84";
2980
- const noDataTextContainer = "_noDataTextContainer_1qkkq_94";
2981
- const tableBottomContainer = "_tableBottomContainer_1qkkq_100";
2982
- const rowsPerPageContainer = "_rowsPerPageContainer_1qkkq_104";
2983
- const rowsPerPageText = "_rowsPerPageText_1qkkq_114";
2984
- const pageText = "_pageText_1qkkq_119";
2985
- const descriptionSecondLine = "_descriptionSecondLine_1qkkq_123";
2976
+ const outerTableContainer = "_outerTableContainer_qzwqt_1";
2977
+ const headerContainer = "_headerContainer_qzwqt_13";
2978
+ const tableTopContainer = "_tableTopContainer_qzwqt_17";
2979
+ const tableContainer = "_tableContainer_qzwqt_21";
2980
+ const searchContainer = "_searchContainer_qzwqt_26";
2981
+ const columnFilterSelect = "_columnFilterSelect_qzwqt_36";
2982
+ const table = "_table_qzwqt_17";
2983
+ const tableHeaderCell = "_tableHeaderCell_qzwqt_54";
2984
+ const showSortIcon = "_showSortIcon_qzwqt_70";
2985
+ const tableRow = "_tableRow_qzwqt_74";
2986
+ const tableCell = "_tableCell_qzwqt_89";
2987
+ const noDataTextContainer = "_noDataTextContainer_qzwqt_99";
2988
+ const tableBottomContainer = "_tableBottomContainer_qzwqt_105";
2989
+ const rowsPerPageContainer = "_rowsPerPageContainer_qzwqt_109";
2990
+ const rowsPerPageText = "_rowsPerPageText_qzwqt_119";
2991
+ const pageText = "_pageText_qzwqt_124";
2992
+ const descriptionSecondLine = "_descriptionSecondLine_qzwqt_128";
2986
2993
  const styles$1 = {
2987
- tableContainer,
2994
+ outerTableContainer,
2988
2995
  headerContainer,
2989
2996
  tableTopContainer,
2997
+ tableContainer,
2990
2998
  searchContainer,
2991
2999
  columnFilterSelect,
2992
3000
  table,
@@ -3010,6 +3018,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3010
3018
  title = "",
3011
3019
  description = "",
3012
3020
  rowsPerPage = [10, 20, 30, 40, 50],
3021
+ fixHeader = false,
3013
3022
  showSearchBar,
3014
3023
  searchBarPlaceholder,
3015
3024
  showSelect,
@@ -3199,6 +3208,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3199
3208
  );
3200
3209
  const columnFilterPopoverContent = useMemo(
3201
3210
  () => ({
3211
+ title: "Filter by:",
3202
3212
  options: columns.filter((column) => column.filter).map((column) => ({
3203
3213
  label: column.label,
3204
3214
  value: column.id.toString(),
@@ -3263,9 +3273,9 @@ const _Table = forwardRef(function Table2(props, ref) {
3263
3273
  let secondLine = void 0;
3264
3274
  if (column.label && typeof column.label === "string") {
3265
3275
  const numChars = 31;
3266
- const indexOfSpace = column.label.indexOf(" ", numChars);
3267
- firstLine = indexOfSpace === -1 ? column.label : column.label.substring(0, indexOfSpace);
3268
- secondLine = indexOfSpace === -1 ? "" : column.label.substring(indexOfSpace);
3276
+ const [first, second] = splitTextForEllipsisAndExpansion(column.label, numChars);
3277
+ firstLine = first;
3278
+ secondLine = second;
3269
3279
  }
3270
3280
  return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props2 }) => /* @__PURE__ */ jsxs(
3271
3281
  Component,
@@ -3289,7 +3299,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3289
3299
  ) }, column.id);
3290
3300
  });
3291
3301
  const SelectedModeButton = isMobile ? IconButton : Button2;
3292
- const layout = useMemo(() => ({ custom: true }), []);
3302
+ const layout = useMemo(() => ({ custom: true, ...fixHeader && { fixHeader: true } }), [fixHeader]);
3293
3303
  const theme = useTheme({
3294
3304
  Table: `
3295
3305
  --data-table-library_grid-template-columns: ${gridTemplateColumns} !important;
@@ -3321,7 +3331,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3321
3331
  }
3322
3332
  }
3323
3333
  }, [rowsPerPage, rows.length, numRowsPerPage, pagination, showPageNavigation]);
3324
- return /* @__PURE__ */ jsxs("div", { className: classNames({ [styles$1.tableContainer]: showContainer }), children: [
3334
+ return /* @__PURE__ */ jsxs(Flex$1, { className: classNames({ [styles$1.outerTableContainer]: showContainer }), direction: "column", height: "100%", children: [
3325
3335
  (!!title || !!description) && /* @__PURE__ */ jsxs("div", { className: styles$1.headerContainer, children: [
3326
3336
  !!title && /* @__PURE__ */ jsx(Text$1, { weight: "bold", size: "5", children: title }),
3327
3337
  !!description && /* @__PURE__ */ jsx(Text$1, { as: "div", children: description })
@@ -3373,7 +3383,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3373
3383
  ] })
3374
3384
  ] }),
3375
3385
  children,
3376
- /* @__PURE__ */ jsx(
3386
+ /* @__PURE__ */ jsx("div", { className: styles$1.tableContainer, children: /* @__PURE__ */ jsx(
3377
3387
  Table$1,
3378
3388
  {
3379
3389
  className: classNames(styles$1.table, className),
@@ -3419,7 +3429,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3419
3429
  ] })
3420
3430
  ] })
3421
3431
  }
3422
- ),
3432
+ ) }),
3423
3433
  showBottomBar && /* @__PURE__ */ jsxs(Flex$1, { className: styles$1.tableBottomContainer, wrap: "wrap", direction: isMobile ? "column" : "row", children: [
3424
3434
  showRowsPerPage && /* @__PURE__ */ jsxs(Flex$1, { className: styles$1.rowsPerPageContainer, children: [
3425
3435
  /* @__PURE__ */ jsx(Text$1, { className: styles$1.rowsPerPageText, size: "2", children: "Rows per page:" }),
@@ -3682,6 +3692,7 @@ export {
3682
3692
  Toolbar,
3683
3693
  Tooltip,
3684
3694
  divButtonProps,
3695
+ splitTextForEllipsisAndExpansion,
3685
3696
  unsafeShowToast,
3686
3697
  updateThemeAppearanceClass,
3687
3698
  useAlertDialog,