@usableapp/cardds 0.7.77 → 0.7.78

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.d.ts CHANGED
@@ -24,6 +24,7 @@ export * from './cards/Card.js';
24
24
  export * from './cards/CardHead.js';
25
25
  export * from './cards/CardFoot.js';
26
26
  export * from './cards/CardParts.js';
27
+ export * from './cards/CardFeed.js';
27
28
  export * from './cards/Stat.js';
28
29
  export * from './cards/Placeholder.js';
29
30
  export * from './sheets/SheetStack.js';
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ export * from './cards/Card.js';
28
28
  export * from './cards/CardHead.js';
29
29
  export * from './cards/CardFoot.js';
30
30
  export * from './cards/CardParts.js';
31
+ export * from './cards/CardFeed.js';
31
32
  export * from './cards/Stat.js';
32
33
  export * from './cards/Placeholder.js';
33
34
  export * from './sheets/SheetStack.js';
@@ -13,8 +13,12 @@ export interface HomeSheet {
13
13
  paper?: boolean;
14
14
  /** the sheet's pages as icon tabs in its head (a count shows as a small circle over the icon) — see `StackSheet` */
15
15
  tabs?: StackSheetTab[];
16
- /** the tab shown first (default: the first) */
16
+ /** CONTROLLED: the tab this sheet shows (its id) — with `onTabChange`. The app sets it to bring the sheet up on a named tab; without it the Home keeps the sheet's tab itself */
17
+ tab?: string;
18
+ /** UNCONTROLLED: the tab shown first (default: the first); the Home then keeps its own. Pair of `tab` */
17
19
  defaultTab?: string;
20
+ /** a tab of this sheet was tapped: its id */
21
+ onTabChange?: (tab: string) => void;
18
22
  /** the SHEET BODY — rendered only while the sheet is open (or kept, with `keep`); a function gets the chosen tab */
19
23
  body: ReactNode | ((tab?: string) => ReactNode);
20
24
  /** the SHEET FOOT: the CTA at the sheet's bottom (one row); a function gets the chosen tab */
@@ -50,5 +50,6 @@ export function Home({ top, title, sheets, open: openProp, defaultOpen = null, o
50
50
  }, [leaving]);
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
- 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: tabs[i], onTabChange: (t) => setTabs((v) => ({ ...v, [i]: t })), backLabel: backLabel, backAt: backAt, foot: typeof s.foot === 'function' ? s.foot(tabs[i]) : s.foot, children: shows(i) ? (typeof s.body === 'function' ? s.body(tabs[i]) : s.body) : null }, i))) }), children] }));
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
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.77",
3
+ "version": "0.7.78",
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.",