@ai-matrx/records-ui 0.93.84 → 0.93.86

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.93.86
4
+ ### Unreleased
5
+
6
+ - **Share folds into the table's menu only when the row's own buttons do not fit** (merged-grid leftovers, 2026-09-30): fold 4 (0.93.85) also fired whenever the layout's slot held more than it could show, so a 736 px chat artifact lost Share from its row for nothing — the slot scrolls and keeps its pinned controls whole. Fold 4 now asks only about the fixed pieces (everything outside the slot, plus the slot at its least). Proof: `toolbarFit.test.tsx` ("a slot that holds more than fits is not a reason to move Share"), red on 0.93.85. Consumer action: none.
7
+
8
+ ## 0.93.85
9
+ ### Unreleased
10
+
11
+ - **The toolbar row's last buttons are never cut: Share folds into the table's menu** (merged-grid leftovers, 2026-09-30): in a table window at its smallest size the row needed 3 px more than it had even with everything folded, and the table menu's button was cut. `toolbarFit` gains fold 4 — the page's own Share moves into the table's menu (where a phone already has it) and comes back when the row has room. A host that draws the page's actions in its own header is unchanged. Proof: `toolbarFit.test.tsx`, red on 0.93.84 (2 of 3). Consumer action: none.
12
+
3
13
  ## 0.93.84
4
14
 
5
15
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -31580,6 +31580,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
31580
31580
  // src/toolbarFit.ts
31581
31581
  var import_react188 = require("react");
31582
31582
  var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
31583
+ var SLOT_MIN = 36;
31583
31584
  function toolbarFold(input) {
31584
31585
  const { available, needsNow, gap, folded } = input;
31585
31586
  const pieces = [
@@ -31593,13 +31594,18 @@ function toolbarFold(input) {
31593
31594
  return piece.full ?? piece.now;
31594
31595
  };
31595
31596
  const withGap = (width) => width > 0 ? width + gap : 0;
31596
- const base = pieces.reduce((rest, p) => rest - withGap(p.piece.now), needsNow);
31597
+ const shareNow = input.share ? withGap(input.share.now) : 0;
31598
+ const base = pieces.reduce((rest, p) => rest - withGap(p.piece.now), needsNow - shareNow);
31597
31599
  const stages = input.tools ? [0, 1, 2, 3] : [0, 1, 2];
31598
- const needs = stages.map((fold) => pieces.reduce((sum, p) => sum + withGap(widthAt(p, fold)), base));
31600
+ const shareOn = input.share ? withGap(input.share.full ?? input.share.now) : 0;
31601
+ const needs = stages.map((fold) => pieces.reduce((sum, p) => sum + withGap(widthAt(p, fold)), base + shareOn));
31599
31602
  const fits = needs.findIndex((need) => need <= available + 0.5);
31600
31603
  if (fits >= 0) return stages[fits];
31601
31604
  const least = Math.min(...needs);
31602
- return stages[needs.findIndex((need) => need <= least + 0.5)];
31605
+ const most = stages[needs.findIndex((need) => need <= least + 0.5)];
31606
+ if (most < 3 || !input.tools || !input.share) return most;
31607
+ const fixed = pieces.reduce((sum, p) => sum + withGap(p.stage === 3 ? SLOT_MIN : widthAt(p, 3)), base + shareOn);
31608
+ return fixed > available + 0.5 ? 4 : 3;
31603
31609
  }
31604
31610
  function naturalWidth(el) {
31605
31611
  const html = el;
@@ -31635,9 +31641,10 @@ function useToolbarFit(row) {
31635
31641
  const widths = {
31636
31642
  look: { full: null, folded: null },
31637
31643
  chooser: { full: null, folded: null },
31638
- tools: { full: null, folded: null }
31644
+ tools: { full: null, folded: null },
31645
+ share: { full: null, folded: null }
31639
31646
  };
31640
- const stageOf = { look: 1, chooser: 2, tools: 3 };
31647
+ const stageOf = { look: 1, chooser: 2, tools: 3, share: 4 };
31641
31648
  let current = 0;
31642
31649
  let pending = 0;
31643
31650
  let stopped = false;
@@ -31647,7 +31654,7 @@ function useToolbarFit(row) {
31647
31654
  const available = row.clientWidth;
31648
31655
  if (available <= 0) return;
31649
31656
  const read = (name) => {
31650
- const el = name === "tools" ? row.querySelector(":scope > [data-toolbar-fit-slot]") : row.querySelector(`:scope > [data-toolbar-fit="${name}"]`);
31657
+ const el = name === "tools" ? row.querySelector(":scope > [data-toolbar-fit-slot]") : name === "share" ? row.querySelector('[data-toolbar-fit="share"]') : row.querySelector(`:scope > [data-toolbar-fit="${name}"]`);
31651
31658
  const now = !el ? 0 : name === "tools" ? slotNeeds(el) : naturalWidth(el);
31652
31659
  const w = widths[name];
31653
31660
  if (el && now > 0) {
@@ -31660,8 +31667,11 @@ function useToolbarFit(row) {
31660
31667
  const look = read("look");
31661
31668
  const chooser = read("chooser");
31662
31669
  const tools = read("tools");
31670
+ const shareEl = row.querySelector('[data-toolbar-fit="share"]');
31671
+ const shareRead = shareEl ? read("share") : null;
31672
+ const share = shareRead && (shareRead.now > 0 || shareRead.full !== null) ? shareRead : void 0;
31663
31673
  const { needs, gap } = rowNeeds(row);
31664
- const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools });
31674
+ const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools, share });
31665
31675
  if (next !== current) {
31666
31676
  current = next;
31667
31677
  setFold(next);
@@ -32078,6 +32088,7 @@ function TablePage({
32078
32088
  const chooserInline = !designated && !phone && toolbarFold2 < 2;
32079
32089
  const chooserCompact = !designated && !phone && toolbarFold2 >= 2;
32080
32090
  const controlsInSheet = phone && !designated;
32091
+ const shareInMenu = phone || toolbarFold2 >= 4;
32081
32092
  (0, import_react189.useEffect)(() => {
32082
32093
  if (face.kind !== "designated") return;
32083
32094
  if (hostFromLink || opened.layout || layoutChosen) return;
@@ -32302,7 +32313,7 @@ function TablePage({
32302
32313
  rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_design_system96.Button, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
32303
32314
  ] }) : void 0;
32304
32315
  const pageActions = /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
32305
- organizationId ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
32316
+ organizationId ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
32306
32317
  ShareControl,
32307
32318
  {
32308
32319
  kind: "table",
@@ -32312,10 +32323,10 @@ function TablePage({
32312
32323
  may: rights.share,
32313
32324
  whyNot: rights.read ? rights.why("share") : void 0,
32314
32325
  initiallyOpen: shareFromLink || shareAsked > 0,
32315
- ...phone ? { className: "hidden" } : {}
32326
+ ...shareInMenu ? { className: "hidden" } : {}
32316
32327
  },
32317
- phone ? `share-${shareAsked}` : "share"
32318
- ) : null,
32328
+ shareInMenu ? `share-${shareAsked}` : "share"
32329
+ ) }, "share") : null,
32319
32330
  /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_design_system96.DropdownMenu, { children: [
32320
32331
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_design_system96.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_design_system96.Button, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
32321
32332
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("circle", { cx: "5", cy: "12", r: "1.75" }),
@@ -32338,7 +32349,7 @@ function TablePage({
32338
32349
  },
32339
32350
  entry.key
32340
32351
  )),
32341
- phone && rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
32352
+ shareInMenu && rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
32342
32353
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_design_system96.DropdownMenuSeparator, {}),
32343
32354
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_design_system96.DropdownMenuItem, { onSelect: () => setShareAsked((n) => n + 1), "data-table-menu-share": "", children: "Share\u2026" })
32344
32355
  ] }) : null,