@signiphi/page-assembly 0.2.0-beta.11 → 0.2.0-beta.13

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/index.js CHANGED
@@ -1441,11 +1441,17 @@ function getBaseFieldName(encodedName) {
1441
1441
  }
1442
1442
  return baseName;
1443
1443
  }
1444
+ function stripFieldTypeSuffix(value) {
1445
+ const stripped = value.replace(/_(signature|initials|date)$/i, "");
1446
+ return stripped || value;
1447
+ }
1444
1448
  function getSignerFromFieldName(encodedName) {
1445
1449
  if (encodedName.includes("__SIGNER__")) {
1446
1450
  const parts = encodedName.split("__SIGNER__");
1447
1451
  if (parts[1]) {
1448
- return parts[1].split("__")[0] || parts[1];
1452
+ const segment = parts[1].split("__")[0] || parts[1];
1453
+ const isTerminal = segment === parts[1];
1454
+ return isTerminal ? stripFieldTypeSuffix(segment) : segment;
1449
1455
  }
1450
1456
  }
1451
1457
  return void 0;
@@ -1966,6 +1972,7 @@ function mapFieldPositionsAfterAssembly(fields, pageMapping) {
1966
1972
  return pageMapping.has(mappingKey) || pageMapping.size === 0;
1967
1973
  });
1968
1974
  }
1975
+ var VISIBLE_PAGE_ROWS = 2;
1969
1976
  var isMultiSelectModifier = (event) => {
1970
1977
  return event.ctrlKey || event.metaKey;
1971
1978
  };
@@ -2292,21 +2299,48 @@ var ReorderablePageGrid = ({
2292
2299
  newPages.splice(hoverIndex, 0, draggedPage);
2293
2300
  onReorderPages(file.id, newPages);
2294
2301
  }, [file.id, file.pages, onReorderPages]);
2295
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4", children: file.pages.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(
2296
- DraggablePageThumbnail,
2302
+ const gridRef = React7.useRef(null);
2303
+ const [maxHeight, setMaxHeight] = React7.useState(void 0);
2304
+ React7.useEffect(() => {
2305
+ const grid = gridRef.current;
2306
+ if (!grid || typeof ResizeObserver === "undefined") return;
2307
+ const measure = () => {
2308
+ const firstThumbnail = grid.firstElementChild;
2309
+ if (!firstThumbnail) return;
2310
+ const rowHeight = firstThumbnail.getBoundingClientRect().height;
2311
+ if (rowHeight <= 0) return;
2312
+ const rowGap = parseFloat(getComputedStyle(grid).rowGap) || 0;
2313
+ setMaxHeight(Math.ceil(rowHeight * VISIBLE_PAGE_ROWS + rowGap * (VISIBLE_PAGE_ROWS - 1)));
2314
+ };
2315
+ measure();
2316
+ const observer = new ResizeObserver(measure);
2317
+ observer.observe(grid);
2318
+ if (grid.firstElementChild) observer.observe(grid.firstElementChild);
2319
+ return () => observer.disconnect();
2320
+ }, [file.pages]);
2321
+ return /* @__PURE__ */ jsxRuntime.jsx(
2322
+ "div",
2297
2323
  {
2298
- page,
2299
- fileId: file.id,
2300
- index,
2301
- isSelected: selectedPageIds.includes(page.id),
2302
- onSingleSelect: onSingleSelectPage,
2303
- onToggleSelect: onTogglePageSelect,
2304
- onRangeSelect: onRangeSelectPage,
2305
- movePageInFile,
2306
- isDraggingPageRef
2307
- },
2308
- page.id
2309
- )) });
2324
+ ref: gridRef,
2325
+ className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4 overflow-y-auto overflow-x-hidden",
2326
+ style: { maxHeight },
2327
+ children: file.pages.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(
2328
+ DraggablePageThumbnail,
2329
+ {
2330
+ page,
2331
+ fileId: file.id,
2332
+ index,
2333
+ isSelected: selectedPageIds.includes(page.id),
2334
+ onSingleSelect: onSingleSelectPage,
2335
+ onToggleSelect: onTogglePageSelect,
2336
+ onRangeSelect: onRangeSelectPage,
2337
+ movePageInFile,
2338
+ isDraggingPageRef
2339
+ },
2340
+ page.id
2341
+ ))
2342
+ }
2343
+ );
2310
2344
  };
2311
2345
  var FileDropZone = ({
2312
2346
  targetIndex,