reifyui 0.7.0 → 0.7.2

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
@@ -2541,6 +2541,7 @@ function SheetGrid({
2541
2541
  rows.map((row, ri) => /* @__PURE__ */ jsxs12(
2542
2542
  "tr",
2543
2543
  {
2544
+ "data-row-id": row.id,
2544
2545
  style: {
2545
2546
  ...rowHeight(row) ? { height: rowHeight(row) } : null,
2546
2547
  "--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
@@ -2582,6 +2583,7 @@ function SheetGrid({
2582
2583
  return /* @__PURE__ */ jsxs12(
2583
2584
  "td",
2584
2585
  {
2586
+ "data-col-id": col.id,
2585
2587
  className: "shg-cell" + (computed ? " shg-cell-compute" : "") + (c.status && computed ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
2586
2588
  style: peer ? { boxShadow: `inset 0 0 0 2px ${peer.color}` } : void 0,
2587
2589
  onClick: (e) => {
@@ -2842,6 +2844,21 @@ function ColumnMenu({ col, columns, anchor, columnTypes, renderColumnConfig, onA
2842
2844
  }
2843
2845
  );
2844
2846
  }
2847
+ function fitRowHeights(container, { rowIds, min = 34, max = 320, padding = 12 } = {}) {
2848
+ if (!container) return {};
2849
+ const out = {};
2850
+ const rows = container.querySelectorAll("tr[data-row-id]");
2851
+ for (const tr of rows) {
2852
+ const id = tr.getAttribute("data-row-id");
2853
+ if (rowIds && !rowIds.includes(id)) continue;
2854
+ let tallest = 0;
2855
+ for (const cell of tr.querySelectorAll("td[data-col-id] .shg-val")) {
2856
+ tallest = Math.max(tallest, cell.scrollHeight);
2857
+ }
2858
+ if (tallest) out[id] = Math.min(max, Math.max(min, Math.round(tallest + padding)));
2859
+ }
2860
+ return out;
2861
+ }
2845
2862
  function defaultCellText(cell) {
2846
2863
  const v = cell?.value;
2847
2864
  if (v == null) return "";
@@ -2909,7 +2926,6 @@ function FileTypeIcon({ name, size = 36 }) {
2909
2926
  }
2910
2927
 
2911
2928
  // src/components/FileCard.jsx
2912
- import { Fragment as Fragment9 } from "react";
2913
2929
  import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2914
2930
  function subtitle(name, origin, bytes) {
2915
2931
  const parts = [(extOf(name) || "file").toUpperCase()];
@@ -2923,15 +2939,7 @@ function bytesLabel2(n) {
2923
2939
  if (n < 1048576) return `${Math.round(n / 1024)} KB`;
2924
2940
  return `${(n / 1048576).toFixed(1)} MB`;
2925
2941
  }
2926
- function FileCard({
2927
- name,
2928
- origin,
2929
- bytes,
2930
- onPreview,
2931
- onDownload,
2932
- compact = false,
2933
- className = ""
2934
- }) {
2942
+ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, className = "" }) {
2935
2943
  const open = onPreview ? (e) => {
2936
2944
  e.stopPropagation();
2937
2945
  onPreview();
@@ -2939,7 +2947,7 @@ function FileCard({
2939
2947
  return /* @__PURE__ */ jsxs13(
2940
2948
  "div",
2941
2949
  {
2942
- className: "uic-filecard" + (compact ? " is-compact" : "") + (open ? " is-clickable" : "") + (className ? " " + className : ""),
2950
+ className: "uic-filecard" + (open ? " is-clickable" : "") + (className ? " " + className : ""),
2943
2951
  onClick: open,
2944
2952
  role: open ? "button" : void 0,
2945
2953
  tabIndex: open ? 0 : void 0,
@@ -2951,38 +2959,26 @@ function FileCard({
2951
2959
  } : void 0,
2952
2960
  title: name,
2953
2961
  children: [
2954
- /* @__PURE__ */ jsx15("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx15(FileTypeIcon, { name, size: compact ? 20 : 30 }) }),
2962
+ /* @__PURE__ */ jsx15("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx15(FileTypeIcon, { name, size: 32 }) }),
2955
2963
  /* @__PURE__ */ jsxs13("span", { className: "uic-filecard-meta", children: [
2956
2964
  /* @__PURE__ */ jsx15("span", { className: "uic-filecard-name", children: name }),
2957
- !compact && /* @__PURE__ */ jsx15("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
2965
+ /* @__PURE__ */ jsx15("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
2958
2966
  ] }),
2959
- /* @__PURE__ */ jsxs13(Fragment9, { children: [
2960
- onDownload && /* @__PURE__ */ jsx15(
2961
- "button",
2962
- {
2963
- type: "button",
2964
- className: "uic-filecard-btn",
2965
- "aria-label": `Download ${name}`,
2966
- title: "Download",
2967
- onClick: (e) => {
2968
- e.stopPropagation();
2969
- onDownload();
2970
- },
2971
- children: /* @__PURE__ */ jsx15(IcDownload, {})
2972
- }
2973
- ),
2974
- onPreview && /* @__PURE__ */ jsx15(
2975
- "button",
2976
- {
2977
- type: "button",
2978
- className: "uic-filecard-btn",
2979
- "aria-label": `Preview ${name}`,
2980
- title: "Preview",
2981
- onClick: open,
2982
- children: /* @__PURE__ */ jsx15(IcEye, {})
2983
- }
2984
- )
2985
- ] })
2967
+ onDownload && /* @__PURE__ */ jsx15(
2968
+ "button",
2969
+ {
2970
+ type: "button",
2971
+ className: "uic-filecard-dl",
2972
+ "aria-label": `Download ${name}`,
2973
+ title: "Download",
2974
+ onClick: (e) => {
2975
+ e.stopPropagation();
2976
+ onDownload();
2977
+ },
2978
+ children: /* @__PURE__ */ jsx15(IcDownload, { size: 18 })
2979
+ }
2980
+ ),
2981
+ onPreview && /* @__PURE__ */ jsx15("button", { type: "button", className: "uic-filecard-open", "aria-label": `Preview ${name}`, onClick: open, children: "Preview" })
2986
2982
  ]
2987
2983
  }
2988
2984
  );
@@ -3640,6 +3636,7 @@ export {
3640
3636
  createResponsesDispatcher,
3641
3637
  extOf,
3642
3638
  fetchBalance,
3639
+ fitRowHeights,
3643
3640
  getSession,
3644
3641
  getToken,
3645
3642
  googleSignIn,