@ai-matrx/records-ui 0.93.84 → 0.93.85

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,10 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.93.85
4
+ ### Unreleased
5
+
6
+ - **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.
7
+
3
8
  ## 0.93.84
4
9
 
5
10
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -31579,13 +31579,14 @@ function ViewFilter({ tableId, view, onApply, className }) {
31579
31579
 
31580
31580
  // src/toolbarFit.ts
31581
31581
  var import_react188 = require("react");
31582
- var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
31582
+ var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120, share: 0 };
31583
31583
  function toolbarFold(input) {
31584
31584
  const { available, needsNow, gap, folded } = input;
31585
31585
  const pieces = [
31586
31586
  { piece: input.look, stage: 1, guess: FOLDED_GUESS.look },
31587
31587
  { piece: input.chooser, stage: 2, guess: FOLDED_GUESS.chooser },
31588
- ...input.tools ? [{ piece: input.tools, stage: 3, guess: FOLDED_GUESS.tools }] : []
31588
+ ...input.tools ? [{ piece: input.tools, stage: 3, guess: FOLDED_GUESS.tools }] : [],
31589
+ ...input.tools && input.share ? [{ piece: input.share, stage: 4, guess: FOLDED_GUESS.share }] : []
31589
31590
  ];
31590
31591
  const widthAt = ({ piece, stage, guess }, fold) => {
31591
31592
  if (piece.now === 0 && piece.full === null) return 0;
@@ -31594,7 +31595,7 @@ function toolbarFold(input) {
31594
31595
  };
31595
31596
  const withGap = (width) => width > 0 ? width + gap : 0;
31596
31597
  const base = pieces.reduce((rest, p) => rest - withGap(p.piece.now), needsNow);
31597
- const stages = input.tools ? [0, 1, 2, 3] : [0, 1, 2];
31598
+ const stages = input.tools ? input.share ? [0, 1, 2, 3, 4] : [0, 1, 2, 3] : [0, 1, 2];
31598
31599
  const needs = stages.map((fold) => pieces.reduce((sum, p) => sum + withGap(widthAt(p, fold)), base));
31599
31600
  const fits = needs.findIndex((need) => need <= available + 0.5);
31600
31601
  if (fits >= 0) return stages[fits];
@@ -31635,9 +31636,10 @@ function useToolbarFit(row) {
31635
31636
  const widths = {
31636
31637
  look: { full: null, folded: null },
31637
31638
  chooser: { full: null, folded: null },
31638
- tools: { full: null, folded: null }
31639
+ tools: { full: null, folded: null },
31640
+ share: { full: null, folded: null }
31639
31641
  };
31640
- const stageOf = { look: 1, chooser: 2, tools: 3 };
31642
+ const stageOf = { look: 1, chooser: 2, tools: 3, share: 4 };
31641
31643
  let current = 0;
31642
31644
  let pending = 0;
31643
31645
  let stopped = false;
@@ -31647,7 +31649,7 @@ function useToolbarFit(row) {
31647
31649
  const available = row.clientWidth;
31648
31650
  if (available <= 0) return;
31649
31651
  const read = (name) => {
31650
- const el = name === "tools" ? row.querySelector(":scope > [data-toolbar-fit-slot]") : row.querySelector(`:scope > [data-toolbar-fit="${name}"]`);
31652
+ 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
31653
  const now = !el ? 0 : name === "tools" ? slotNeeds(el) : naturalWidth(el);
31652
31654
  const w = widths[name];
31653
31655
  if (el && now > 0) {
@@ -31660,8 +31662,11 @@ function useToolbarFit(row) {
31660
31662
  const look = read("look");
31661
31663
  const chooser = read("chooser");
31662
31664
  const tools = read("tools");
31665
+ const shareEl = row.querySelector('[data-toolbar-fit="share"]');
31666
+ const shareRead = shareEl ? read("share") : null;
31667
+ const share = shareRead && (shareRead.now > 0 || shareRead.full !== null) ? shareRead : void 0;
31663
31668
  const { needs, gap } = rowNeeds(row);
31664
- const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools });
31669
+ const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools, share });
31665
31670
  if (next !== current) {
31666
31671
  current = next;
31667
31672
  setFold(next);
@@ -32078,6 +32083,7 @@ function TablePage({
32078
32083
  const chooserInline = !designated && !phone && toolbarFold2 < 2;
32079
32084
  const chooserCompact = !designated && !phone && toolbarFold2 >= 2;
32080
32085
  const controlsInSheet = phone && !designated;
32086
+ const shareInMenu = phone || toolbarFold2 >= 4;
32081
32087
  (0, import_react189.useEffect)(() => {
32082
32088
  if (face.kind !== "designated") return;
32083
32089
  if (hostFromLink || opened.layout || layoutChosen) return;
@@ -32302,7 +32308,7 @@ function TablePage({
32302
32308
  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
32309
  ] }) : void 0;
32304
32310
  const pageActions = /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
32305
- organizationId ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
32311
+ 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
32312
  ShareControl,
32307
32313
  {
32308
32314
  kind: "table",
@@ -32312,10 +32318,10 @@ function TablePage({
32312
32318
  may: rights.share,
32313
32319
  whyNot: rights.read ? rights.why("share") : void 0,
32314
32320
  initiallyOpen: shareFromLink || shareAsked > 0,
32315
- ...phone ? { className: "hidden" } : {}
32321
+ ...shareInMenu ? { className: "hidden" } : {}
32316
32322
  },
32317
- phone ? `share-${shareAsked}` : "share"
32318
- ) : null,
32323
+ shareInMenu ? `share-${shareAsked}` : "share"
32324
+ ) }, "share") : null,
32319
32325
  /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_design_system96.DropdownMenu, { children: [
32320
32326
  /* @__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
32327
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("circle", { cx: "5", cy: "12", r: "1.75" }),
@@ -32338,7 +32344,7 @@ function TablePage({
32338
32344
  },
32339
32345
  entry.key
32340
32346
  )),
32341
- phone && rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
32347
+ shareInMenu && rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
32342
32348
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_design_system96.DropdownMenuSeparator, {}),
32343
32349
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_design_system96.DropdownMenuItem, { onSelect: () => setShareAsked((n) => n + 1), "data-table-menu-share": "", children: "Share\u2026" })
32344
32350
  ] }) : null,