@usableapp/cardds 0.7.120 → 0.7.121

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.
@@ -21,6 +21,8 @@ export interface HomeSheet {
21
21
  onTabChange?: (tab: string) => void;
22
22
  /** the SHEET BODY — rendered only while the sheet is open (or kept, with `keep`); a function gets the chosen tab */
23
23
  body: ReactNode | ((tab?: string) => ReactNode);
24
+ /** a row pinned under the SHEET HEAD, outside the body's scroll and pull — see `StackSheet top`; a function gets the chosen tab (return null for no row) */
25
+ top?: ReactNode | ((tab?: string) => ReactNode);
24
26
  /** the SHEET FOOT: the CTA at the sheet's bottom (one row); a function gets the chosen tab */
25
27
  foot?: ReactNode | ((tab?: string) => ReactNode);
26
28
  }
@@ -51,5 +51,5 @@ export function Home({ top, title, sheets, open: openProp, defaultOpen = null, o
51
51
  const [tabs, setTabs] = useState(() => Object.fromEntries(sheets.map((x, i) => [i, x.defaultTab ?? x.tabs?.[0]?.id])));
52
52
  const shows = (i) => i === shown || i === leaving || (keep && seen.has(i));
53
53
  const tabOf = (i) => sheets[i].tab ?? tabs[i];
54
- return (_jsxs(Screen, { fill: true, top: top, ...rest, children: [_jsx(Text, { level: "h1", as: "h1", sr: true, children: title }), _jsx(SheetStack, { closed: true, open: shown, onOpenChange: request, onRefresh: onRefresh, refreshing: refreshing, mark: mark, rise: rise, base: base, children: sheets.map((s, i) => (_jsx(StackSheet, { tone: s.tone ?? TONES[i], paper: s.paper, title: s.title, icon: s.icon, tabs: s.tabs, tab: tabOf(i), onTabChange: (t) => { setTabs((v) => ({ ...v, [i]: t })); s.onTabChange?.(t); }, backLabel: backLabel, backAt: backAt, foot: typeof s.foot === 'function' ? s.foot(tabOf(i)) : s.foot, children: shows(i) ? (typeof s.body === 'function' ? s.body(tabOf(i)) : s.body) : null }, i))) }), children] }));
54
+ return (_jsxs(Screen, { fill: true, top: top, ...rest, children: [_jsx(Text, { level: "h1", as: "h1", sr: true, children: title }), _jsx(SheetStack, { closed: true, open: shown, onOpenChange: request, onRefresh: onRefresh, refreshing: refreshing, mark: mark, rise: rise, base: base, children: sheets.map((s, i) => (_jsx(StackSheet, { tone: s.tone ?? TONES[i], paper: s.paper, title: s.title, icon: s.icon, tabs: s.tabs, tab: tabOf(i), onTabChange: (t) => { setTabs((v) => ({ ...v, [i]: t })); s.onTabChange?.(t); }, backLabel: backLabel, backAt: backAt, top: shows(i) ? (typeof s.top === 'function' ? s.top(tabOf(i)) : s.top) : null, foot: typeof s.foot === 'function' ? s.foot(tabOf(i)) : s.foot, children: shows(i) ? (typeof s.body === 'function' ? s.body(tabOf(i)) : s.body) : null }, i))) }), children] }));
55
55
  }
package/docs/reference.md CHANGED
@@ -300,6 +300,8 @@ the card is the material, the sheet is what it is in the stack.
300
300
  that tab shows, and a tapped tab asks `onTabChange(tab)`. Something outside
301
301
  the stack (a card in the base) brings a sheet up on a named tab by setting
302
302
  that sheet's `tab` and the Home's `open` together. Story `Home · Feed`.
303
+ A sheet's `top` reaches `StackSheet top`; like `body` and `foot` it may be a
304
+ function of the tab, returning null where that tab has no row.
303
305
  - **Five sheets max.** Slots are declared per `:nth-child` in `stack.css`; a
304
306
  sixth would render at slot 0, on top of the first.
305
307
  - **Every head needs its own `.sheet-stack__back`** if the stack is `--tap`. It stays
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.120",
3
+ "version": "0.7.121",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "description": "card-first mobile design system, React-first: the components in src/ are thin wrappers over the CSS contract (css/*.css stays the only truth); gallery/ shows every story live (npm run dev), tests/ measures the geometry.",