@usableapp/cardds 0.7.144 → 0.7.146

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.
@@ -17,6 +17,8 @@ export interface SheetProps extends Omit<ComponentProps<'article'>, 'onChange'>
17
17
  * AFTER it landed (`--motion-sheet-rest`) — its own timeout, every time. To leave the screen: set `away`, and take the
18
18
  * sheet out of the tree here — `onSettled={(s) => s === 'away' && setMounted(false)}` — so it slides out instead of vanishing */
19
19
  onSettled?: (state: SheetState) => void;
20
+ /** how much of the sheet shows at `half`, in tenths of its height: `half={6}` shows 60%. 1–9; default 5 (half). Every other state and the state's name stay as they are */
21
+ half?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
20
22
  /** the states a drag snaps to and a reveal may climb through — "peek half full", or an array (default all four) */
21
23
  states?: string | readonly Resting[];
22
24
  /** the grab handle; `false` for a sheet with no handle. cardds names it in the page's language (`<html lang>`) — a string is for different words only */
@@ -52,4 +54,4 @@ export interface SheetProps extends Omit<ComponentProps<'article'>, 'onChange'>
52
54
  * first's `onSettled`) — the app adds no timer.
53
55
  * The CURSOR is cardds's too: once it has come up it waits in the field marked `data-autofocus`, else the first field, else the heading — write no `autoFocus` or `.focus()` for it.
54
56
  */
55
- export declare function Sheet({ state, defaultState, onStateChange, onSettled, states, handle, mark, refreshing, tone, paper, className, children, onFocus, ...rest }: SheetProps): import("react").JSX.Element;
57
+ export declare function Sheet({ state, defaultState, onStateChange, onSettled, half, states, handle, mark, refreshing, tone, paper, className, style, children, onFocus, ...rest }: SheetProps): import("react").JSX.Element;
@@ -38,7 +38,7 @@ function markLong(node, long) {
38
38
  * first's `onSettled`) — the app adds no timer.
39
39
  * The CURSOR is cardds's too: once it has come up it waits in the field marked `data-autofocus`, else the first field, else the heading — write no `autoFocus` or `.focus()` for it.
40
40
  */
41
- export function Sheet({ state, defaultState = 'half', onStateChange, onSettled, states, handle = true, mark = 'line', refreshing, tone, paper, className, children, onFocus, ...rest }) {
41
+ export function Sheet({ state, defaultState = 'half', onStateChange, onSettled, half, states, handle = true, mark = 'line', refreshing, tone, paper, className, style, children, onFocus, ...rest }) {
42
42
  const [current, request] = useControlled(state, defaultState, onStateChange);
43
43
  const ref = useRef(null);
44
44
  const handleRef = useRef(null);
@@ -130,5 +130,5 @@ export function Sheet({ state, defaultState = 'half', onStateChange, onSettled,
130
130
  return; // the click that follows a drag is not a tap
131
131
  request(current === 'peek' ? (allowed().includes(home.current) ? home.current : allowed().find((s) => s !== 'peek') ?? 'half') : 'peek', 'tap');
132
132
  };
133
- return (_jsxs("article", { ref: ref, className: cx('card sheet', tone && tone !== 1 && `card--${tone}`, paper && 'sheet--paper', `sheet--${shown}`, refreshing && 'is-loading', className), "aria-busy": refreshing || undefined, inert: current === 'away' || held || undefined, onFocus: focus, ...rest, children: [handle !== false && (_jsx("button", { ref: handleRef, className: cx('sheet__handle', mark === 'dots' && 'sheet__handle--dots'), type: "button", "aria-label": typeof handle === 'string' ? handle : word('resize'), onClick: tap, onPointerDown: down, onPointerMove: move, onPointerUp: up, onPointerCancel: up })), Children.map(children, (node) => markLong(node, titleLong))] }));
133
+ return (_jsxs("article", { ref: ref, className: cx('card sheet', tone && tone !== 1 && `card--${tone}`, paper && 'sheet--paper', `sheet--${shown}`, refreshing && 'is-loading', className), "aria-busy": refreshing || undefined, inert: current === 'away' || held || undefined, onFocus: focus, style: half ? { ...style, '--sheet-half': (10 - half) / 10 } : style, ...rest, children: [handle !== false && (_jsx("button", { ref: handleRef, className: cx('sheet__handle', mark === 'dots' && 'sheet__handle--dots'), type: "button", "aria-label": typeof handle === 'string' ? handle : word('resize'), onClick: tap, onPointerDown: down, onPointerMove: move, onPointerUp: up, onPointerCancel: up })), Children.map(children, (node) => markLong(node, titleLong))] }));
134
134
  }
@@ -13,8 +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: only the thin contact shadow every stamp has. Several, lapped with a "+8": `AvatarStack more` */
15
15
  xs?: boolean;
16
- /** the paper's edge: `'perforated'` (default) the punched teeth, `'plain'` a smooth rectangle of paper with no teeth — the same 4:5 size and shadow, at every size and in every holder */
17
- edge?: 'perforated' | 'plain';
16
+ /** the white paper frame between the teeth and the picture: `true` (default) the paper's band round the picture, `false` none — the tone fills the paper right out to the teeth. The teeth, the 4:5 size, the shadow, the pictures and the words stay, at every size and in every holder */
17
+ frame?: boolean;
18
18
  /** kept back: the stamp keeps its box and draws nothing, hidden from screen readers too — until the app is ready to show it; when this turns false it appears in the same box, so nothing beside it moves */
19
19
  held?: boolean;
20
20
  /** 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 */
@@ -29,7 +29,7 @@ export interface StampProps extends Omit<ComponentProps<'span'>, 'onClick'> {
29
29
  onArrived?: () => void;
30
30
  }
31
31
  /**
32
- * Stamp — a paper stamp, 4:5, perforated (or `edge="plain"`): the pictures fill the inner frame on a tone, the words sit on the picture's foot.
32
+ * Stamp — a paper stamp, 4:5, always perforated: the pictures fill the inner frame on a tone (`frame={false}`: no white frame, the tone runs out to the teeth), the words sit on the picture's foot.
33
33
  * Every stamp is ONE size wherever it stands (`--stamp-size`, two taps wide: 96 × 120) — what holds it only places it; a holder narrower than that shows it whole, smaller.
34
34
  * The one small stamp is a stamp stuck on something (`StampOn`); `xs` is the inline one, beside a status line's words. Every inner length follows the stamp's width.
35
35
  * The outer box holds the size and the shadow; the paper inside is the one whose edge is punched (a mask would cut the shadow too).
@@ -38,7 +38,7 @@ export interface StampProps extends Omit<ComponentProps<'span'>, 'onClick'> {
38
38
  * 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);
39
39
  * 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.
40
40
  */
41
- export declare function Stamp({ pictures, tone, name, words, bare, xs, edge, held, under, tilt, onClick, arrive, onArrived, className, onAnimationEnd, ...rest }: StampProps): import("react").JSX.Element;
41
+ export declare function Stamp({ pictures, tone, name, words, bare, xs, frame, held, under, tilt, onClick, arrive, onArrived, className, onAnimationEnd, ...rest }: StampProps): import("react").JSX.Element;
42
42
  export interface StampPlaceProps extends Omit<ComponentProps<'span'>, 'onClick'> {
43
43
  /** a gap nobody is asked to fill: a paler edge (an album's free places) */
44
44
  faint?: boolean;
@@ -3,7 +3,7 @@ import { cx } from '../cx.js';
3
3
  import { pressable } from '../pressable.js';
4
4
  import { useStrike } from './useStrike.js';
5
5
  /**
6
- * Stamp — a paper stamp, 4:5, perforated (or `edge="plain"`): the pictures fill the inner frame on a tone, the words sit on the picture's foot.
6
+ * Stamp — a paper stamp, 4:5, always perforated: the pictures fill the inner frame on a tone (`frame={false}`: no white frame, the tone runs out to the teeth), the words sit on the picture's foot.
7
7
  * Every stamp is ONE size wherever it stands (`--stamp-size`, two taps wide: 96 × 120) — what holds it only places it; a holder narrower than that shows it whole, smaller.
8
8
  * The one small stamp is a stamp stuck on something (`StampOn`); `xs` is the inline one, beside a status line's words. Every inner length follows the stamp's width.
9
9
  * The outer box holds the size and the shadow; the paper inside is the one whose edge is punched (a mask would cut the shadow too).
@@ -12,11 +12,11 @@ import { useStrike } from './useStrike.js';
12
12
  * 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);
13
13
  * 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.
14
14
  */
15
- export function Stamp({ pictures, tone = 'custard', name, words, bare, xs, edge, held, under, tilt, onClick, arrive, onArrived, className, onAnimationEnd, ...rest }) {
15
+ export function Stamp({ pictures, tone = 'custard', name, words, bare, xs, frame = true, held, under, tilt, onClick, arrive, onArrived, className, onAnimationEnd, ...rest }) {
16
16
  const shown = pictures.slice(0, 4);
17
17
  const { struck } = useStrike(arrive, onArrived, onAnimationEnd);
18
18
  const { tap, Box, boxProps } = pressable(onClick, 'span', rest);
19
- return (_jsx(Box, { className: cx('stamp', `stamp--${shown.length}`, bare && 'stamp--bare', xs && 'stamp--xs', edge === 'plain' && 'stamp--plain', held && 'stamp--held', under && 'stamp--under', tilt && `stamp--tilt-${tilt}`, tap && 'stamp--tap', arrive && 'stamp--arrive', className), onAnimationEnd: struck, "aria-hidden": held || undefined, ...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
+ return (_jsx(Box, { className: cx('stamp', `stamp--${shown.length}`, bare && 'stamp--bare', xs && 'stamp--xs', !frame && 'stamp--frameless', held && 'stamp--held', under && 'stamp--under', tilt && `stamp--tilt-${tilt}`, tap && 'stamp--tap', arrive && 'stamp--arrive', className), onAnimationEnd: struck, "aria-hidden": held || undefined, ...boxProps, children: _jsx("span", { className: cx('stamp__paper', !frame && `sticky--${tone}`), 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 })] }))] }) }) }));
20
20
  }
21
21
  /**
22
22
  * 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
@@ -445,6 +445,8 @@ whose markup has rules, because the sheet's box is the step itself:
445
445
  onStateChange={setS}>` (controlled) or `<Sheet defaultState="half">` (it keeps its own). The sheet's own behaviour —
446
446
  the handle's tap and drag, the focus raise, the climb when the keyboard moves the cut — lives in the component and
447
447
  only ever ASKS through `onStateChange(state, reason)`; nothing outside the sheet is touched.
448
+ How much shows at `half` is the sheet's own prop: `half` = tenths of its height, 1–9 (default 5); `<Sheet half={6}>`
449
+ shows 60% at half. Translate, scroll-padding and drag-snap all read it; the state is still called `half`.
448
450
  A sheet always ARRIVES and LEAVES by sliding: mounted already up, it starts `away` for one frame and slides in. To
449
451
  take it off the screen set `state="away"` and unmount it in `onSettled` (`s === 'away'`) — unmounting it while it is up
450
452
  only makes it vanish (dev warning). Story: `Sheet · MountedOnDemand`.
@@ -842,7 +844,7 @@ ground of my own stamp.
842
844
  A stamp is a small paper picture a member keeps and sticks on a note or a postcard for a neighbour. Sending never uses
843
845
  it up. cardds draws the paper; the pictures, their words and which stamp a member owns are the app's.
844
846
 
845
- - **`Stamp`** — a perforated 4:5 stamp; `edge="plain"` is a smooth rectangle of paper with no teeth, the same size and shadow, wherever a stamp goes (`xs`, `tilt`, `arrive`, `onClick`, a `StampOn`, a `StampBook`, an `AvatarStack`). `pictures` is one to four nodes, the app's own art (an svg, an img), in placement
847
+ - **`Stamp`** — a perforated 4:5 stamp, always with teeth; `frame={false}` drops the white paper frame round the picture, so the tone runs out to the teeth (the same size, shadow and words), wherever a stamp goes (`xs`, `tilt`, `arrive`, `onClick`, a `StampOn`, a `StampBook`, an `AvatarStack`). `pictures` is one to four nodes, the app's own art (an svg, an img), in placement
846
848
  order: the stamp places, sizes and turns them by how many there are. `tone` is the ground, one of `STICKY_TONES` (the
847
849
  same list and the same `--sticky-<tone>-bg` knobs as a note's paper). `name` is the big line on the picture's foot,
848
850
  `words` the small line above it. `tilt` turns it, `onClick` makes the whole stamp a button. Every inner length follows
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.144",
3
+ "version": "0.7.146",
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).",