@usableapp/cardds 0.7.118 → 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.
@@ -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
  }
@@ -13,6 +13,8 @@ export interface StampProps extends Omit<ComponentProps<'span'>, 'onClick'> {
13
13
  bare?: boolean;
14
14
  /** the inline size: a stamp beside a status line's words (a card's `Foot`: the stamp, "X took it", a round button), one `Chip xs` tall (`--stamp-xs-size`). Always bare and flat (no shadow). Several, lapped with a "+8": `AvatarStack more` */
15
15
  xs?: boolean;
16
+ /** in a `Head`: the words keep no room for the stamp — they run the head's whole width and lie OVER it, the stamp in its place and size at the right under them (a long title that would wrap in the column beside it). Never hides a word */
17
+ under?: boolean;
16
18
  /** turned a little on its middle — the one stamp a start screen hands over */
17
19
  tilt?: 'left' | 'right';
18
20
  /** the whole stamp is a button: it renders a `<button>` */
@@ -31,7 +33,7 @@ export interface StampProps extends Omit<ComponentProps<'span'>, 'onClick'> {
31
33
  * the app it has landed, so it sends. The strike scales it down from twice its size, so it never moves the layout (it may cover its neighbours for a moment);
32
34
  * a `tilt` is kept, the stamp ends at its turn. Afterwards the same stamp stands in the same place with no strike: drop `arrive` or keep it, nothing is struck twice.
33
35
  */
34
- export declare function Stamp({ pictures, tone, name, words, bare, xs, tilt, onClick, arrive, onArrived, className, onAnimationEnd, ...rest }: StampProps): import("react").JSX.Element;
36
+ export declare function Stamp({ pictures, tone, name, words, bare, xs, under, tilt, onClick, arrive, onArrived, className, onAnimationEnd, ...rest }: StampProps): import("react").JSX.Element;
35
37
  export interface StampPlaceProps extends Omit<ComponentProps<'span'>, 'onClick'> {
36
38
  /** a gap nobody is asked to fill: a paler edge (an album's free places) */
37
39
  faint?: boolean;
@@ -11,11 +11,11 @@ import { useStrike } from './useStrike.js';
11
11
  * the app it has landed, so it sends. The strike scales it down from twice its size, so it never moves the layout (it may cover its neighbours for a moment);
12
12
  * a `tilt` is kept, the stamp ends at its turn. Afterwards the same stamp stands in the same place with no strike: drop `arrive` or keep it, nothing is struck twice.
13
13
  */
14
- export function Stamp({ pictures, tone = 'custard', name, words, bare, xs, tilt, onClick, arrive, onArrived, className, onAnimationEnd, ...rest }) {
14
+ export function Stamp({ pictures, tone = 'custard', name, words, bare, xs, under, tilt, onClick, arrive, onArrived, className, onAnimationEnd, ...rest }) {
15
15
  const shown = pictures.slice(0, 4);
16
16
  const { struck } = useStrike(arrive, onArrived, onAnimationEnd);
17
17
  const { tap, Box, boxProps } = pressable(onClick, 'span', rest);
18
- return (_jsx(Box, { className: cx('stamp', `stamp--${shown.length}`, bare && 'stamp--bare', xs && 'stamp--xs', tilt && `stamp--tilt-${tilt}`, tap && 'stamp--tap', arrive && 'stamp--arrive', className), onAnimationEnd: struck, ...boxProps, children: _jsx("span", { className: "stamp__paper", children: _jsxs("span", { className: cx('stamp__pic', `sticky--${tone}`), children: [shown.map((picture, i) => _jsx("span", { className: "stamp__art", "aria-hidden": "true", children: picture }, i)), (name != null || words != null) && (_jsxs("span", { className: "stamp__cap", children: [words != null && _jsx("span", { className: "stamp__words", children: words }), name != null && _jsx("span", { className: "stamp__name", children: name })] }))] }) }) }));
18
+ return (_jsx(Box, { className: cx('stamp', `stamp--${shown.length}`, bare && 'stamp--bare', xs && 'stamp--xs', under && 'stamp--under', tilt && `stamp--tilt-${tilt}`, tap && 'stamp--tap', arrive && 'stamp--arrive', className), onAnimationEnd: struck, ...boxProps, children: _jsx("span", { className: "stamp__paper", children: _jsxs("span", { className: cx('stamp__pic', `sticky--${tone}`), children: [shown.map((picture, i) => _jsx("span", { className: "stamp__art", "aria-hidden": "true", children: picture }, i)), (name != null || words != null) && (_jsxs("span", { className: "stamp__cap", children: [words != null && _jsx("span", { className: "stamp__words", children: words }), name != null && _jsx("span", { className: "stamp__name", children: name })] }))] }) }) }));
19
19
  }
20
20
  /**
21
21
  * StampPlace — an empty place for a stamp: a 4:5 frame of round dots the size a Stamp is (`--stamp-size`), a word or an Icon inside.
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
@@ -826,7 +826,8 @@ it up. cardds draws the paper; the pictures, their words and which stamp a membe
826
826
  at 375 a stamp is 103.67 × 129.58. A `false` or `null` child holds no place.
827
827
  - A stamp stands for a person in three more places. In a `Centre` — a `Stamp` or a `StampPlace` — it stands in the
828
828
  middle and the words and link under it centre. In a card's head — `<Card foot={<Btn primary block>…</Btn>}><Head><Words title={name} meta={greeting} /><Stamp bare …/></Head></Card>` — the words stand at the left and the stamp at the right,
829
- beside both lines; in a head that leads with a date (a `JourneyBadge`, then a `ChipRow`) it stands on a row of its own under the
829
+ beside both lines (`Stamp under`: the words keep no room for it, they run the head's whole width over the stamp, which lies under them in
830
+ its place and size — for a long title); in a head that leads with a date (a `JourneyBadge`, then a `ChipRow`) it stands on a row of its own under the
830
831
  date and the chips, in the order given. The card's one button presses it whole. In an `AvatarStack` it is a head, the small size
831
832
  (`more="+9"` for the count).
832
833
  - **`StampOn`** — a stamp stuck on a surface. `at` is the stamp's middle as a share of the surface (`{ x, y }`, 0 to 1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.118",
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.",