@usableapp/cardds 0.7.119 → 0.7.120
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 +9 -0
- package/css/parts.css +28 -2
- package/dist/cardds.css +28 -2
- package/dist/catalog.json +1 -1
- package/dist/sheets/StackSheet.d.ts +4 -2
- package/dist/sheets/StackSheet.js +3 -3
- package/docs/reference.md +1 -1
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@ export interface StackSheetProps extends Omit<ComponentProps<'article'>, 'title'
|
|
|
27
27
|
defaultTab?: string;
|
|
28
28
|
/** a tab was tapped: its id */
|
|
29
29
|
onTabChange?: (tab: string) => void;
|
|
30
|
+
/** a row pinned under the SHEET HEAD, outside the body's scroll and pull (a form button over a list): it never scrolls nor moves with a pull to refresh */
|
|
31
|
+
top?: ReactNode;
|
|
30
32
|
/** the SHEET FOOT: the CTA at the sheet's bottom (one row) */
|
|
31
33
|
foot?: ReactNode;
|
|
32
34
|
/** the back button's label (shown once the sheet is open) — cardds names it in the page's language (`<html lang>`); pass it only for different words */
|
|
@@ -39,9 +41,9 @@ export interface StackSheetProps extends Omit<ComponentProps<'article'>, 'title'
|
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* StackSheet — ONE sheet of a `SheetStack`, in the one sheet shape: SHEET HEAD (back · title · tabs or an icon) pinned at the top ·
|
|
42
|
-
* SHEET BODY (the children; scrolls) · SHEET FOOT (`foot`, the CTA) at the bottom. Its tabs are icon buttons. The chosen one is filled
|
|
44
|
+
* `top` (pinned under the head, optional) · SHEET BODY (the children; scrolls) · SHEET FOOT (`foot`, the CTA) at the bottom. Its tabs are icon buttons. The chosen one is filled
|
|
43
45
|
* only while this sheet is open — a closed home shows every icon plain; the disc fades in with the rise and out with the fold.
|
|
44
46
|
* A count shows as a small circle over its icon. The body is the app's: render the page of the chosen tab (and nothing while the sheet
|
|
45
47
|
* is closed — see `Home`). A direct child of `SheetStack`. Once open, cardds puts the cursor in the field marked `data-autofocus`, else the first field, else the heading — write no focus code.
|
|
46
48
|
*/
|
|
47
|
-
export declare function StackSheet({ title, tone, paper, icon, tabs, tab: tabProp, defaultTab, onTabChange, foot, backLabel, backAt, stack, className, children, ...rest }: StackSheetProps): import("react").JSX.Element;
|
|
49
|
+
export declare function StackSheet({ title, tone, paper, icon, tabs, tab: tabProp, defaultTab, onTabChange, top, foot, backLabel, backAt, stack, className, children, ...rest }: StackSheetProps): import("react").JSX.Element;
|
|
@@ -15,12 +15,12 @@ import { word } from '../words.js';
|
|
|
15
15
|
import { runOver } from './sheetMeasure.js';
|
|
16
16
|
/**
|
|
17
17
|
* StackSheet — ONE sheet of a `SheetStack`, in the one sheet shape: SHEET HEAD (back · title · tabs or an icon) pinned at the top ·
|
|
18
|
-
* SHEET BODY (the children; scrolls) · SHEET FOOT (`foot`, the CTA) at the bottom. Its tabs are icon buttons. The chosen one is filled
|
|
18
|
+
* `top` (pinned under the head, optional) · SHEET BODY (the children; scrolls) · SHEET FOOT (`foot`, the CTA) at the bottom. Its tabs are icon buttons. The chosen one is filled
|
|
19
19
|
* only while this sheet is open — a closed home shows every icon plain; the disc fades in with the rise and out with the fold.
|
|
20
20
|
* A count shows as a small circle over its icon. The body is the app's: render the page of the chosen tab (and nothing while the sheet
|
|
21
21
|
* is closed — see `Home`). A direct child of `SheetStack`. Once open, cardds puts the cursor in the field marked `data-autofocus`, else the first field, else the heading — write no focus code.
|
|
22
22
|
*/
|
|
23
|
-
export function StackSheet({ title, tone, paper, icon, tabs, tab: tabProp, defaultTab, onTabChange, foot, backLabel = word('back'), backAt = 'none', stack, className, children, ...rest }) {
|
|
23
|
+
export function StackSheet({ title, tone, paper, icon, tabs, tab: tabProp, defaultTab, onTabChange, top, foot, backLabel = word('back'), backAt = 'none', stack, className, children, ...rest }) {
|
|
24
24
|
const [tab, pick] = useControlled(tabProp, defaultTab ?? tabs?.[0]?.id, onTabChange);
|
|
25
25
|
// a title longer than its room does not wrap: it runs sideways, like a song title in a short slot — the room it overflows by
|
|
26
26
|
// is measured here (the tabs may grow with the text size) and handed to the CSS as --_over / --_run, the Sheet's measurer
|
|
@@ -34,5 +34,5 @@ export function StackSheet({ title, tone, paper, icon, tabs, tab: tabProp, defau
|
|
|
34
34
|
measure();
|
|
35
35
|
return watchSize([h, run], measure);
|
|
36
36
|
}, [title]);
|
|
37
|
-
return (_jsxs(Card, { stack: stack, tone: tone, paper: paper, className: cx('stack-sheet', className), ...rest, children: [_jsxs(Head, { ref: headRef, long: long, children: [backAt === 'start' && _jsx(StackBack, { label: backLabel }), _jsx(Words, { title: _jsx("span", { className: "stack-sheet__run", children: title }) }), tabs?.length ? (_jsx("span", { className: "stack-sheet__tabs", role: "tablist", children: tabs.map((t) => (_jsxs(IconBtn, { sm: true, invert: t.id === tab, role: "tab", "aria-selected": t.id === tab, label: t.label, className: "stack-sheet__tab", onClick: () => pick(t.id), children: [_jsx(Icon, { name: t.icon }), t.count ? _jsx(Badge, { className: "stack-sheet__count", children: t.count > 99 ? '99+' : t.count }) : null] }, t.id))) })) : icon, backAt === 'end' && _jsx(StackBack, { end: true, label: backLabel })] }), _jsx(Body, { role: tabs?.length ? 'tabpanel' : undefined, children: children }), foot != null && _jsx(Foot, { children: foot })] }));
|
|
37
|
+
return (_jsxs(Card, { stack: stack, tone: tone, paper: paper, className: cx('stack-sheet', className), ...rest, children: [_jsxs(Head, { ref: headRef, long: long, children: [backAt === 'start' && _jsx(StackBack, { label: backLabel }), _jsx(Words, { title: _jsx("span", { className: "stack-sheet__run", children: title }) }), tabs?.length ? (_jsx("span", { className: "stack-sheet__tabs", role: "tablist", children: tabs.map((t) => (_jsxs(IconBtn, { sm: true, invert: t.id === tab, role: "tab", "aria-selected": t.id === tab, label: t.label, className: "stack-sheet__tab", onClick: () => pick(t.id), children: [_jsx(Icon, { name: t.icon }), t.count ? _jsx(Badge, { className: "stack-sheet__count", children: t.count > 99 ? '99+' : t.count }) : null] }, t.id))) })) : icon, backAt === 'end' && _jsx(StackBack, { end: true, label: backLabel })] }), top != null && _jsx("div", { className: "stack-sheet__top", children: top }), _jsx(Body, { role: tabs?.length ? 'tabpanel' : undefined, children: children }), foot != null && _jsx(Foot, { children: foot })] }));
|
|
38
38
|
}
|
package/docs/reference.md
CHANGED
|
@@ -282,7 +282,7 @@ the card is the material, the sheet is what it is in the stack.
|
|
|
282
282
|
A tap, or a pull up, opens any sheet over it. The open title or its back
|
|
283
283
|
button, tapped or pulled down, drops it home. A pull down in the open
|
|
284
284
|
content, already at the top, asks `onRefresh` — omit it and that pull only
|
|
285
|
-
scrolls. A tab in the head stays a click. Every sheet wears a grip — four
|
|
285
|
+
scrolls. A `StackSheet`'s `top` is a row pinned under its head (a form button over a list): outside the scroll and the pull, it never moves with them. A tab in the head stays a click. Every sheet wears a grip — four
|
|
286
286
|
small dots at the middle of its top edge, a mark that it slides, not a
|
|
287
287
|
control. `mark="line"` on the `SheetStack` (or `Home`) draws one line
|
|
288
288
|
there instead, as a single `Sheet`'s; while a sheet is `refreshing`, either
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usableapp/cardds",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.120",
|
|
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.",
|