@overmap-ai/blocks 1.0.16 → 1.0.17-linkify.1

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
@@ -9,6 +9,7 @@ import * as RadixDialogPrimitive from "@radix-ui/react-dialog";
9
9
  import { Resizable } from "re-resizable";
10
10
  import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
11
11
  import { CSSTransition, Transition } from "react-transition-group";
12
+ import Linkify from "linkify-react";
12
13
  import { Root as Root$1, Item as Item$1 } from "@radix-ui/react-toggle-group";
13
14
  import { Root as Root$2 } from "@radix-ui/react-toolbar";
14
15
  import * as RadixToast from "@radix-ui/react-toast";
@@ -187,6 +188,12 @@ function useTextFilter(values, filterFunction) {
187
188
  }, [filterFunction, filterValue, values]);
188
189
  return [filteredOptions, filterValue, setFilterValue];
189
190
  }
191
+ const splitTextForEllipsisAndExpansion = (text, numChars) => {
192
+ const indexOfSpace = text.indexOf(" ", numChars);
193
+ const firstLine = indexOfSpace === -1 ? text : text.substring(0, indexOfSpace);
194
+ const secondLine = indexOfSpace === -1 ? "" : text.substring(indexOfSpace);
195
+ return [firstLine, secondLine];
196
+ };
190
197
  const _Badge = forwardRef(function Badge2({ className, severity = "primary", color, children, ...rest }, ref) {
191
198
  const severityColor = useSeverityColor(severity);
192
199
  return /* @__PURE__ */ jsx(
@@ -1840,11 +1847,11 @@ const LeftAndRightPanels = memo(function Panels({
1840
1847
  }
1841
1848
  );
1842
1849
  });
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";
1850
+ const multiPagePopover = "_multiPagePopover_16xvh_1";
1851
+ const pageTitle = "_pageTitle_16xvh_12";
1852
+ const buttonContainer = "_buttonContainer_16xvh_16";
1853
+ const optionsButtonContainer = "_optionsButtonContainer_16xvh_21";
1854
+ const optionsButton = "_optionsButton_16xvh_21";
1848
1855
  const styles$9 = {
1849
1856
  multiPagePopover,
1850
1857
  pageTitle,
@@ -1875,7 +1882,7 @@ function getMultiPagePopoverContent(popoverOption, setMultiPagePopoverContent, d
1875
1882
  `${option.value}-page-${page}-button-${i}`
1876
1883
  ));
1877
1884
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1878
- popoverOption.title && /* @__PURE__ */ jsx("div", { className: styles$9.pageTitle, children: popoverOption.title }),
1885
+ popoverOption.title && /* @__PURE__ */ jsx(Text$2, { className: styles$9.pageTitle, size: "3", children: popoverOption.title }),
1879
1886
  popoverOption.content,
1880
1887
  /* @__PURE__ */ jsx(
1881
1888
  "div",
@@ -1941,6 +1948,7 @@ const _TextArea = forwardRef(function TextArea2({
1941
1948
  }
1942
1949
  return valueAsString.length;
1943
1950
  }, [inputLengthTemplate, rest.maxLength, rest.minLength, valueAsString.length]);
1951
+ console.log("in blocks", value);
1944
1952
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1945
1953
  /* @__PURE__ */ jsx(
1946
1954
  TextArea$1,
@@ -1956,6 +1964,17 @@ const _TextArea = forwardRef(function TextArea2({
1956
1964
  ...rest
1957
1965
  }
1958
1966
  ),
1967
+ /* @__PURE__ */ jsx("div", { className: "rt-TextAreaRoot overmap-textarea rt-r-size-2 rt-variant-surface", style: { resize }, children: /* @__PURE__ */ jsx("div", { className: "rt-TextAreaInput", children: /* @__PURE__ */ jsx(
1968
+ Linkify,
1969
+ {
1970
+ options: {
1971
+ target: "_blank",
1972
+ rel: "noopener"
1973
+ },
1974
+ children: value
1975
+ }
1976
+ ) }) }),
1977
+ /* @__PURE__ */ jsx("div", { className: "rt-TextAreaChrome" }),
1959
1978
  displayInputLength && /* @__PURE__ */ jsx(Text$2, { as: "p", className: styles$8.charCount, color: infoColor, align: "right", children: displayInputLengthValue })
1960
1979
  ] });
1961
1980
  });
@@ -2967,25 +2986,28 @@ const SelectAllCheckbox = memo(function SelectAllCheckbox2({
2967
2986
  childrenWithProps
2968
2987
  ] });
2969
2988
  });
2970
- const tableContainer = "_tableContainer_boacd_1";
2971
- const headerContainer = "_headerContainer_boacd_14";
2972
- const tableTopContainer = "_tableTopContainer_boacd_18";
2973
- const searchContainer = "_searchContainer_boacd_22";
2974
- const columnFilterSelect = "_columnFilterSelect_boacd_32";
2975
- const table = "_table_boacd_1";
2976
- const tableHeaderCell = "_tableHeaderCell_boacd_50";
2977
- const showSortIcon = "_showSortIcon_boacd_59";
2978
- const tableRow = "_tableRow_boacd_63";
2979
- const tableCell = "_tableCell_boacd_78";
2980
- const noDataTextContainer = "_noDataTextContainer_boacd_88";
2981
- const tableBottomContainer = "_tableBottomContainer_boacd_94";
2982
- const rowsPerPageContainer = "_rowsPerPageContainer_boacd_98";
2983
- const rowsPerPageText = "_rowsPerPageText_boacd_108";
2984
- const pageText = "_pageText_boacd_113";
2989
+ const outerTableContainer = "_outerTableContainer_1wqc9_1";
2990
+ const headerContainer = "_headerContainer_1wqc9_13";
2991
+ const tableTopContainer = "_tableTopContainer_1wqc9_17";
2992
+ const tableContainer = "_tableContainer_1wqc9_21";
2993
+ const searchContainer = "_searchContainer_1wqc9_26";
2994
+ const columnFilterSelect = "_columnFilterSelect_1wqc9_36";
2995
+ const table = "_table_1wqc9_17";
2996
+ const tableHeaderCell = "_tableHeaderCell_1wqc9_54";
2997
+ const showSortIcon = "_showSortIcon_1wqc9_70";
2998
+ const tableRow = "_tableRow_1wqc9_74";
2999
+ const tableCell = "_tableCell_1wqc9_89";
3000
+ const noDataTextContainer = "_noDataTextContainer_1wqc9_99";
3001
+ const tableBottomContainer = "_tableBottomContainer_1wqc9_105";
3002
+ const rowsPerPageContainer = "_rowsPerPageContainer_1wqc9_109";
3003
+ const rowsPerPageText = "_rowsPerPageText_1wqc9_119";
3004
+ const pageText = "_pageText_1wqc9_124";
3005
+ const descriptionSecondLine = "_descriptionSecondLine_1wqc9_128";
2985
3006
  const styles$1 = {
2986
- tableContainer,
3007
+ outerTableContainer,
2987
3008
  headerContainer,
2988
3009
  tableTopContainer,
3010
+ tableContainer,
2989
3011
  searchContainer,
2990
3012
  columnFilterSelect,
2991
3013
  table,
@@ -2997,7 +3019,8 @@ const styles$1 = {
2997
3019
  tableBottomContainer,
2998
3020
  rowsPerPageContainer,
2999
3021
  rowsPerPageText,
3000
- pageText
3022
+ pageText,
3023
+ descriptionSecondLine
3001
3024
  };
3002
3025
  const _Table = forwardRef(function Table2(props, ref) {
3003
3026
  var _a;
@@ -3008,6 +3031,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3008
3031
  title = "",
3009
3032
  description = "",
3010
3033
  rowsPerPage = [10, 20, 30, 40, 50],
3034
+ fixHeader = false,
3011
3035
  showSearchBar,
3012
3036
  searchBarPlaceholder,
3013
3037
  showSelect,
@@ -3197,6 +3221,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3197
3221
  );
3198
3222
  const columnFilterPopoverContent = useMemo(
3199
3223
  () => ({
3224
+ title: "Filter by:",
3200
3225
  options: columns.filter((column) => column.filter).map((column) => ({
3201
3226
  label: column.label,
3202
3227
  value: column.id.toString(),
@@ -3257,7 +3282,15 @@ const _Table = forwardRef(function Table2(props, ref) {
3257
3282
  );
3258
3283
  const columnCells = columnsData.map((column) => {
3259
3284
  const Component = column.sort ? HeaderCellSort : HeaderCell;
3260
- return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props2 }) => /* @__PURE__ */ jsx(
3285
+ let firstLine = column.label;
3286
+ let secondLine = void 0;
3287
+ if (column.label && typeof column.label === "string") {
3288
+ const numChars = 31;
3289
+ const [first, second] = splitTextForEllipsisAndExpansion(column.label, numChars);
3290
+ firstLine = first;
3291
+ secondLine = second;
3292
+ }
3293
+ return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props2 }) => /* @__PURE__ */ jsxs(
3261
3294
  Component,
3262
3295
  {
3263
3296
  className: classNames(
@@ -3268,12 +3301,18 @@ const _Table = forwardRef(function Table2(props, ref) {
3268
3301
  ),
3269
3302
  sortKey: column.sort ? column.id.toString().toUpperCase() : "",
3270
3303
  ...props2,
3271
- children: column.label
3304
+ children: [
3305
+ firstLine && /* @__PURE__ */ jsx("div", { children: firstLine }),
3306
+ secondLine && /* @__PURE__ */ jsxs("div", { className: styles$1.descriptionSecondLine, children: [
3307
+ " ",
3308
+ secondLine
3309
+ ] })
3310
+ ]
3272
3311
  }
3273
3312
  ) }, column.id);
3274
3313
  });
3275
3314
  const SelectedModeButton = isMobile ? IconButton : Button2;
3276
- const layout = useMemo(() => ({ custom: true }), []);
3315
+ const layout = useMemo(() => ({ custom: true, ...fixHeader && { fixedHeader: true } }), [fixHeader]);
3277
3316
  const theme = useTheme({
3278
3317
  Table: `
3279
3318
  --data-table-library_grid-template-columns: ${gridTemplateColumns} !important;
@@ -3305,7 +3344,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3305
3344
  }
3306
3345
  }
3307
3346
  }, [rowsPerPage, rows.length, numRowsPerPage, pagination, showPageNavigation]);
3308
- return /* @__PURE__ */ jsxs("div", { className: classNames({ [styles$1.tableContainer]: showContainer }), children: [
3347
+ return /* @__PURE__ */ jsxs(Flex$1, { className: classNames({ [styles$1.outerTableContainer]: showContainer }), direction: "column", height: "100%", children: [
3309
3348
  (!!title || !!description) && /* @__PURE__ */ jsxs("div", { className: styles$1.headerContainer, children: [
3310
3349
  !!title && /* @__PURE__ */ jsx(Text$1, { weight: "bold", size: "5", children: title }),
3311
3350
  !!description && /* @__PURE__ */ jsx(Text$1, { as: "div", children: description })
@@ -3357,7 +3396,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3357
3396
  ] })
3358
3397
  ] }),
3359
3398
  children,
3360
- /* @__PURE__ */ jsx(
3399
+ /* @__PURE__ */ jsx("div", { className: styles$1.tableContainer, children: /* @__PURE__ */ jsx(
3361
3400
  Table$1,
3362
3401
  {
3363
3402
  className: classNames(styles$1.table, className),
@@ -3403,7 +3442,7 @@ const _Table = forwardRef(function Table2(props, ref) {
3403
3442
  ] })
3404
3443
  ] })
3405
3444
  }
3406
- ),
3445
+ ) }),
3407
3446
  showBottomBar && /* @__PURE__ */ jsxs(Flex$1, { className: styles$1.tableBottomContainer, wrap: "wrap", direction: isMobile ? "column" : "row", children: [
3408
3447
  showRowsPerPage && /* @__PURE__ */ jsxs(Flex$1, { className: styles$1.rowsPerPageContainer, children: [
3409
3448
  /* @__PURE__ */ jsx(Text$1, { className: styles$1.rowsPerPageText, size: "2", children: "Rows per page:" }),
@@ -3666,6 +3705,7 @@ export {
3666
3705
  Toolbar,
3667
3706
  Tooltip,
3668
3707
  divButtonProps,
3708
+ splitTextForEllipsisAndExpansion,
3669
3709
  unsafeShowToast,
3670
3710
  updateThemeAppearanceClass,
3671
3711
  useAlertDialog,