@usableapp/cardds 0.7.169 → 0.7.171
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 +27 -0
- package/css/actions.css +6 -3
- package/css/base.css +2 -2
- package/css/card.css +22 -8
- package/css/sheet.css +6 -1
- package/css/tokens.css +7 -0
- package/dist/cardds.css +43 -14
- package/dist/cards/Card.d.ts +17 -1
- package/dist/cards/Card.js +26 -6
- package/dist/catalog.json +1 -1
- package/docs/reference.md +23 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
> For: a project that consumes `@usableapp/cardds` and its AI — what changed between versions, written as before → after, so a screen can be brought up to date without reading the source. Newest first. A consumer never edits cardds; if something here leaves you without a way to do what you did before, report the gap. Each release section after 0.7.97 carries one `Components:` line, written by `node scripts/components-changed.mjs <previous tag>`: the components the release changed, or `all` when a file changed that any component can read (a token, the build), or `none`; check only the screens that import those.
|
|
4
4
|
|
|
5
|
+
## 0.7.171 — 2026-10-29
|
|
6
|
+
|
|
7
|
+
A `Card` can fold to its head, and a Thai mark over a lone page's first line or a SheetStep's title is no longer cut.
|
|
8
|
+
|
|
9
|
+
Components: all
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **`Card folds`** (timebank, Lh 2026-10-29): a card that shows only its `Head` and opens on a tap of the head. Controlled like every stateful part: `open` + `onOpenChange`, or `defaultOpen` (default `false`, folded). The rest (the content and the `Foot`) opens and folds as a grid row, the small `FeedCard`'s own fold; folded it is `inert`. The card draws its own chevron down as the head's last end (after the app's), turned up while open, as a `Banner`'s. The head dims under the finger, a control in it keeps its own press; the keyboard meets one unseen button after the head (`aria-expanded`, named by the head, or `openLabel`). Not on `row`, `sm`, `stack`, `paper="bands"`, nor with `back` or `onPress` (ignored with a warning). A folding card is never pressed whole. Stories `Card · Folds`, `FoldsControlled`.
|
|
13
|
+
- **`--glyph-rise-room`** (tokens.css): the room a scrolling box keeps over its first line, `calc(var(--fs-display) * 0.2)`.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- **Thai marks over a lone `Page`'s first line** (Lh 2026-10-29, ก่อนเริ่มใช้งาน on a `Screen top="lead"`): before, the stacked marks of เริ่ม ทั้ง ชี้ ปี่ in the page's h1 were cut — the `Step`'s lone `.page` is its own scroller with no top padding, and a scroller clips whatever rises out of it (the head's own glyph padding sits outside it). After, the page pads its top by `--glyph-rise-room` and takes it back from the lead (`margin-top`), so the words stand exactly where they stood, at every text size. `Page bleed` keeps its extra `--sp-2` on top of it.
|
|
17
|
+
- **SheetStep / SheetSettings title** (`.sheet-step__title`, `.sheet-settings__title`): before, the label's 1.2 line with `overflow: hidden` cut the stacked marks (ฉบับย่อ, อ่านฉบับเต็ม). After, it keeps the glyphs' room inside the clip and gives it back outside (`--glyph-rise` / `--glyph-drop`, as a head's title), so nothing moves.
|
|
18
|
+
|
|
19
|
+
## 0.7.170 — 2026-10-29
|
|
20
|
+
|
|
21
|
+
A dim sheet's scrim fades with the sheet, and `Card backFull` centres by eye.
|
|
22
|
+
|
|
23
|
+
Components: Sheet, Card
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- **Dim sheet stage scrim** (Lh, 2026-10-29): before, `.sheet-stage--dim::after` stayed full black for the whole slide down and vanished at once. After, it fades with the sheet over `--motion-sheet`, in and out, ending with the slide; it is `opacity: 0` and `pointer-events: none` when every sheet in the stage is away and no Modal stands there.
|
|
27
|
+
- **`Card backFull` centre** (Lh, 2026-10-29): before, the content's centre stood at 50% from the top edge. After, at 40% (the eye reads true centre as low). Retune with the knob `--card-back-optical` (a share, default `0.4`; `0.5` is the old place).
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- **`--card-back-optical`**: the share of the card's height above the content of a `backFull` card.
|
|
31
|
+
|
|
5
32
|
## 0.7.169 — 2026-10-29
|
|
6
33
|
|
|
7
34
|
Buttons in the `lit` finish are flat.
|
package/css/actions.css
CHANGED
|
@@ -488,7 +488,9 @@
|
|
|
488
488
|
.t-expand--more (Lh 2026-10-25) = a `Text expand` that does not fit: the whole box opens or folds. It is WORDS, so it neither
|
|
489
489
|
dims nor gives: its ink never changes under the finger (Lh 2026-10-25), the opening is the answer. Pointer only (below).
|
|
490
490
|
.bubble--press (Lh 2026-10-28) = a chat `Bubble` that is a link (`href`) or pressed (`onClick`): a message is as wide as a row, so it DIMS.
|
|
491
|
-
.link-block (Lh 2026-10-28) = a `LinkBlock`, a few pieces of a card's content as one link: as wide as the card, it DIMS.
|
|
491
|
+
.link-block (Lh 2026-10-28) = a `LinkBlock`, a few pieces of a card's content as one link: as wide as the card, it DIMS.
|
|
492
|
+
.card--folds > .head (Lh 2026-10-29) = the head of a `Card folds`: a tap opens or folds the card, so it DIMS (pointer and :active only —
|
|
493
|
+
the focus ring is the card's, from its unseen open button, card.css). A control in the head keeps its own press. */
|
|
492
494
|
:where(.btn, .icon-btn, .link, a.chip, button.chip, .chip--pick, a.tile, button.tile, .tile--pick, .day, .segment__item, .calendar__day,
|
|
493
495
|
.float-bar__item, .avatar-pick__item, .add-row, .picker__item, .dropdown__btn, .appbar__who, .check, .toggle, .mood__opt, .sheet__handle,
|
|
494
496
|
a.avatar, button.avatar, .menu__item, button.snackbar__body, .stamp--tap, button.stamp-cell, button.stamp-place, .post-letter__turn, .post-desk__slot, .post-desk__pick, .post-desk__reach, .stamp-on__remove, .map-pick, .count-in__cancel) {
|
|
@@ -496,7 +498,7 @@
|
|
|
496
498
|
touch-action: manipulation;
|
|
497
499
|
transition: scale var(--motion-press) var(--ease-out);
|
|
498
500
|
}
|
|
499
|
-
:where(a.row, button.row, label.row, .row-expand > summary, .banner__summary, a.card, label.card, .card--go, .card--press, .feed-card--small, .toggle-field, .post-box__edge, .bubble--press, .link-block) {
|
|
501
|
+
:where(a.row, button.row, label.row, .row-expand > summary, .banner__summary, a.card, label.card, .card--go, .card--press, .feed-card--small, .card--folds > .head, .toggle-field, .post-box__edge, .bubble--press, .link-block) {
|
|
500
502
|
cursor: pointer;
|
|
501
503
|
touch-action: manipulation;
|
|
502
504
|
transition: opacity var(--motion-press) var(--ease-out);
|
|
@@ -512,8 +514,9 @@
|
|
|
512
514
|
:where(.btn, .icon-btn, .link, a.chip, button.chip, .chip--pick, a.tile, button.tile, .tile--pick, .day, .segment__item, .calendar__day,
|
|
513
515
|
.float-bar__item, .avatar-pick__item, .add-row, .picker__item, .dropdown__btn, .appbar__who, .check, .toggle, .mood__opt, .sheet__handle,
|
|
514
516
|
a.avatar, button.avatar, .menu__item, button.snackbar__body, .stamp--tap, button.stamp-cell, button.stamp-place, .post-letter__turn, .post-desk__slot, .post-desk__pick, .post-desk__reach, .stamp-on__remove, .map-pick):active:not(:disabled, [aria-disabled="true"], :has(:disabled)) { scale: var(--press-scale); }
|
|
515
|
-
:where(a.row, button.row, label.row, .row-expand > summary, .banner__summary, a.card, label.card, .card--go, .card--press, .feed-card--small, .toggle-field, .post-box__edge, .bubble--press, .link-block):active:not([aria-disabled="true"], :has(:disabled)) { opacity: var(--press-dim); }
|
|
517
|
+
:where(a.row, button.row, label.row, .row-expand > summary, .banner__summary, a.card, label.card, .card--go, .card--press, .feed-card--small, .card--folds > .head, .toggle-field, .post-box__edge, .bubble--press, .link-block):active:not([aria-disabled="true"], :has(:disabled)) { opacity: var(--press-dim); }
|
|
516
518
|
.card--press:active:has(:is(a[href], button, [role=button], input, select, textarea, summary):active) { opacity: 1; } /* the finger is on a link or a button inside: that one answers, the card stays */
|
|
519
|
+
.card--folds > .head:active:has(:is(a[href], button, [role=button], input, select, textarea, summary):active) { opacity: 1; } /* a button in a folding card's head answers itself, the head stays */
|
|
517
520
|
/* SHADE — what has something BEHIND it (a peeked sheet over the pile, a postcard's face over its back, a post letter's sheet over the other) must not turn see-through:
|
|
518
521
|
it darkens a touch instead (--press-shade) */
|
|
519
522
|
:where(.sheet-stack--tap > .card:not(.is-open), .postcard__turn, .post-letter__sheet:not(:has(.icon-btn:active))) { cursor: pointer; touch-action: manipulation; transition: filter var(--motion-press) var(--ease-out); }
|
package/css/base.css
CHANGED
|
@@ -358,12 +358,12 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
358
358
|
the screen's gap, moved in here from above the step; the inset, taken back from the bleed.
|
|
359
359
|
It ends with the bottom layer's room, as a walk's page does: it scrolls only when the layer would cover its words
|
|
360
360
|
(timebank onboard-04, 2026-09-27 — its last Link lay under the bar; Lh: same rule as the walk) */
|
|
361
|
-
.step > .page { margin: var(--_lead,
|
|
361
|
+
.step > .page { margin: calc(var(--_lead, 0rem) - var(--glyph-rise-room)) var(--screen-pad) 0; padding-top: var(--glyph-rise-room); padding-bottom: var(--bottom-h, 0rem); } /* the lone page is its own scroller: its top keeps the glyphs' room (tokens.css --glyph-rise-room), taken back from the lead, so a Thai mark over the first line is never cut by its edge */
|
|
362
362
|
/* a field brought into sight (focus, Tab) stops above the bottom layer, not under it */
|
|
363
363
|
.step > .page, .step > .pages > .page { scroll-padding-bottom: var(--bottom-h, 0rem); }
|
|
364
364
|
/* --bleed: the page's box runs to the screen's edges, the inset is its own padding — what leans, slides or casts a shadow past
|
|
365
365
|
the inset (a postcard) is cut at the glass, not at the inset; a little room on top for a turned corner. Nothing pans sideways. */
|
|
366
|
-
.step > .page--bleed { margin-inline: 0; padding-inline: var(--screen-pad); padding-block-start: var(--sp-2); overflow-x: hidden; }
|
|
366
|
+
.step > .page--bleed { margin-inline: 0; padding-inline: var(--screen-pad); padding-block-start: calc(var(--glyph-rise-room) + var(--sp-2)); overflow-x: hidden; }
|
|
367
367
|
.step > .pages > .page {
|
|
368
368
|
padding-inline: var(--screen-pad); /* the words keep the inset INSIDE it */
|
|
369
369
|
margin-top: var(--_lead, 0rem); /* the lead is each PAGE's margin (15% with no top, the screen's gap under a bar): the words start there and scroll up to the box's edge */
|
package/css/card.css
CHANGED
|
@@ -92,7 +92,11 @@
|
|
|
92
92
|
.card__face > * { min-width: 0; }
|
|
93
93
|
:is(.card, .card__face):has(> .stamp-on--under, > .card__middle > .stamp-on--under) { isolation: isolate; } /* the card is the stacking context the stamp's -1 lies in: below the card's words, above its paper */
|
|
94
94
|
.card__middle { flex: 1 0 auto; display: flex; flex-direction: column; gap: var(--card-gap); height: var(--card-middle-h, auto); overflow: hidden; } /* a flex column, not a grid: the middle's height is the flexed one, so one thing on a face (a QR, a code) may take the whole middle with height: 100% (a grid's auto row never stretched to it, and the thing stood at the top of an empty band) */
|
|
95
|
-
|
|
95
|
+
/* Card backFull: the back is the whole card, no head and no foot — one code, one sentence and its button, a thank-you, in the middle both ways */
|
|
96
|
+
.card__middle--full { --_above: var(--card-back-optical, 0.4); justify-content: center; align-items: center; text-align: center; } /* the content's centre stands --card-back-optical (a share, default 0.4) down from the top edge, not 0.5: the eye reads true centre as low. Spacer rows below (::before) and above (::after) split the free room 0.4 : 0.6 */
|
|
97
|
+
.card__middle--full::before, .card__middle--full::after { content: ""; display: block; flex: 0 0 auto; } /* the spacers cancel the gap they would add: each pulls back over the gap on its inner side */
|
|
98
|
+
.card__middle--full::before { flex-grow: var(--_above); margin-bottom: calc(-1 * var(--card-gap)); }
|
|
99
|
+
.card__middle--full::after { flex-grow: calc(1 - var(--_above)); margin-top: calc(-1 * var(--card-gap)); }
|
|
96
100
|
.card__middle--full > :is(.pin, .field, .composer, .form-note) { align-self: stretch; } /* a thing to type in keeps the card's width (centred, a Pin's cells would shrink to nothing) */
|
|
97
101
|
.card__middle--full > .bullets { align-self: stretch; text-align: start; } /* a list of steps keeps the card's width and reads from the start edge (centred, each line's pic would float with its words) */
|
|
98
102
|
.card__turn { position: absolute; inset: 0; width: var(--px); height: var(--px); padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); }
|
|
@@ -324,18 +328,28 @@
|
|
|
324
328
|
@keyframes feed-end-wag { 0%, 100% { rotate: calc(var(--feed-end-wag, 14deg) * -1); } 50% { rotate: var(--feed-end-wag, 14deg); } }
|
|
325
329
|
@media (prefers-reduced-motion: no-preference) { .feed-end__tail { animation: feed-end-wag var(--motion-wag) var(--ease-in-out) infinite; } }
|
|
326
330
|
.card-feed__end { text-align: center; }
|
|
327
|
-
|
|
328
|
-
.
|
|
329
|
-
.
|
|
331
|
+
/* the same fold on a lone card (`Card folds`, Lh 2026-10-29): the head always shows, the rest (content and foot) is the grid row that
|
|
332
|
+
goes 1fr ↔ 0fr; folded (.is-folded) it is cut and hidden as a small feed card's is. The head is the press (actions.css, the DIM list);
|
|
333
|
+
the keyboard's way is the unseen .card__open after it, and its focus ring is the card's. The chevron (.card__chevron) is the card's, the head's last end.
|
|
334
|
+
<article class="card card--folds is-folded"><div class="head" id="…">…</div><button class="card__open" aria-expanded="false" aria-controls="…r"></button>
|
|
335
|
+
<div class="card__more" id="…r" inert><div class="card__rest">content · <div class="foot">…</div></div></div></article> */
|
|
336
|
+
.card--folds { row-gap: 0; }
|
|
337
|
+
.card__chevron { --icon-motion: rotate var(--motion-quick) var(--ease); } /* the card's own chevron, the head's last end: down while folded, turned up while open (as a Banner's) */
|
|
338
|
+
.card--folds:not(.is-folded) .card__chevron { --icon-turn: 180deg; }
|
|
339
|
+
.card__open { position: absolute; inset: 0; width: var(--px); height: var(--px); padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); }
|
|
340
|
+
.card--folds:has(> .card__open:focus-visible) { outline: var(--focus); outline-offset: var(--sp-1); }
|
|
341
|
+
:is(.feed-card__more, .card__more) { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; }
|
|
342
|
+
:is(.feed-card--small > .feed-card__more, .card--folds.is-folded > .card__more) { grid-template-rows: 0fr; }
|
|
343
|
+
:is(.feed-card__rest, .card__rest) {
|
|
330
344
|
min-height: 0;
|
|
331
345
|
display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--card-gap);
|
|
332
346
|
clip-path: inset(0 calc(-1 * var(--card-pad)) calc(-1 * var(--sp-2)));
|
|
333
347
|
}
|
|
334
|
-
.feed-card__rest > :first-child { margin-top: var(--card-gap); }
|
|
335
|
-
.feed-card--small .feed-card__rest { overflow: clip; visibility: hidden; }
|
|
348
|
+
:is(.feed-card__rest, .card__rest) > :first-child { margin-top: var(--card-gap); }
|
|
349
|
+
:is(.feed-card--small .feed-card__rest, .card--folds.is-folded > .card__more > .card__rest) { overflow: clip; visibility: hidden; }
|
|
336
350
|
@media (prefers-reduced-motion: no-preference) {
|
|
337
|
-
.feed-card__more { transition: grid-template-rows var(--motion-sheet) var(--ease); }
|
|
338
|
-
.feed-card--small .feed-card__rest { transition: visibility 0s var(--motion-sheet); }
|
|
351
|
+
:is(.feed-card__more, .card__more) { transition: grid-template-rows var(--motion-sheet) var(--ease); }
|
|
352
|
+
:is(.feed-card--small .feed-card__rest, .card--folds.is-folded > .card__more > .card__rest) { transition: visibility 0s var(--motion-sheet); }
|
|
339
353
|
}
|
|
340
354
|
|
|
341
355
|
/* ---- panes: a few panes side by side inside a card or a sheet, one in sight (Lh 2026-10-02) ----
|
package/css/sheet.css
CHANGED
|
@@ -479,7 +479,11 @@
|
|
|
479
479
|
inset: 0;
|
|
480
480
|
background: var(--scrim);
|
|
481
481
|
z-index: var(--z-over);
|
|
482
|
+
pointer-events: none;
|
|
483
|
+
transition: opacity var(--motion-sheet) var(--ease); /* the scrim is its own layer: it fades with the sheet's slide, in and out, ending together */
|
|
482
484
|
}
|
|
485
|
+
/* no sheet up (every sheet in the stage is `away`, and no Modal stands there): the scrim is gone — the Sheet sets `sheet--away` the moment it is told to leave, so this fades as it slides down */
|
|
486
|
+
.sheet-stage--dim:has(> .sheet--away):not(:has(> .sheet:not(.sheet--away), > .modal))::after { opacity: 0; }
|
|
483
487
|
.sheet-stage--dim .sheet { z-index: var(--z-over-2); }
|
|
484
488
|
.sheet-stage--dim > .sheet-stage__hero { z-index: var(--z-over-2); }
|
|
485
489
|
|
|
@@ -515,7 +519,8 @@
|
|
|
515
519
|
--card-muted: var(--card-ink); /* a tint of the ink: its secondary words are the full ink (no lighter shade holds 4.5:1 there) */
|
|
516
520
|
border-top: var(--sheet-step-border-w, 0rem) solid var(--sheet-step-border, currentColor); /* a rule instead of the bar: set this, the bar's bg transparent, radius 0 */
|
|
517
521
|
}
|
|
518
|
-
:is(.sheet-step__title, .sheet-settings__title) { font: var(--sheet-step-title-font, var(--type-label)); margin: 0; flex: 0 1 auto; min-width: 0; outline: none; /* the label size, not a body title: a pile of rows must stay small (Lh 2026-09-24) */ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
522
|
+
:is(.sheet-step__title, .sheet-settings__title) { font: var(--sheet-step-title-font, var(--type-label)); margin: 0; flex: 0 1 auto; min-width: 0; outline: none; /* the label size, not a body title: a pile of rows must stay small (Lh 2026-09-24) */ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
523
|
+
padding-block: var(--glyph-rise) var(--glyph-drop); margin-block: calc(-1 * var(--glyph-rise)) calc(-1 * var(--glyph-drop)); /* the label's 1.2 line is shorter than a stacked Thai mark (ฉบับย่อ, อ่านฉบับเต็ม were cut): room inside the clip, given back outside (tokens.css, the glyphs' room) */ }
|
|
519
524
|
.sheet-step__num { /* `numbered`: the step's number in a disc BEFORE its title (Lh 2026-09-25) — a disc of the card's colour on the bar, the number in the ink */
|
|
520
525
|
flex: none; display: grid; place-items: center; box-sizing: border-box; inline-size: var(--sheet-step-num-size, 1.408em); block-size: var(--sheet-step-num-size, 1.408em); /* em, not rem (Lh 2026-10-03, as the StackSheet's count): the disc is cut from ITS OWN number's size —
|
|
521
526
|
at a large text size the number grew and a 24px disc did not, so the digit sat on its bottom edge; 1.408em of a 17px caption = the 24px it always was */
|
package/css/tokens.css
CHANGED
|
@@ -244,6 +244,13 @@
|
|
|
244
244
|
reaches 0.30em under the baseline; a tight line box, 1.15, ends 0.175em under it) */
|
|
245
245
|
--glyph-rise: 0.2em;
|
|
246
246
|
--glyph-drop: 0.15em;
|
|
247
|
+
/* …and the room a SCROLLING box keeps over its first line (Lh 2026-10-29, ก่อนเริ่มใช้งาน on a lone Page: the marks of เริ่ม ทั้ง ชี้ ปี่ were
|
|
248
|
+
cut by the page's own scroll edge, which clips whatever rises out of it — a child's padding cannot reach past its scroller). The
|
|
249
|
+
scroller pads its top by it and takes it back from its margin, so the words stand where they stood and a mark rising over the first
|
|
250
|
+
line is inside the box. A box cannot read its first child's em, so it is the rise of the biggest words that may open it (the display
|
|
251
|
+
size, --fs-display, and so it grows with a member's larger text). Measured (Noto Sans Thai Looped, shaped): a stacked tone over an
|
|
252
|
+
upper vowel reaches 1.19em over the baseline at weight 900, an h1 line (1.15) ends 1.025em over it — 0.165em out */
|
|
253
|
+
--glyph-rise-room: calc(var(--fs-display) * 0.2);
|
|
247
254
|
/* THE EIGHT KINDS: each has its face, weight, size (--fs-* above), leading and tracking, and its style --type-<kind> is made of them */
|
|
248
255
|
--fw-display: var(--fw-heavy); --lh-display: 1.15; --track-display: -0.02em; /* leading: Thai marks stack to 1.1em up and 0.3em down — 1.02 clipped them (2026-09-10) */
|
|
249
256
|
--fw-h1: var(--fw-black); --lh-h1: 1.15; --track-h1: -0.015em; /* tight, the display's floor: a stacked mark (1.13em up) clears the line above (Lh 2026-10-25: 1.2 read loose) */
|
package/dist/cardds.css
CHANGED
|
@@ -314,6 +314,13 @@
|
|
|
314
314
|
reaches 0.30em under the baseline; a tight line box, 1.15, ends 0.175em under it) */
|
|
315
315
|
--glyph-rise: 0.2em;
|
|
316
316
|
--glyph-drop: 0.15em;
|
|
317
|
+
/* …and the room a SCROLLING box keeps over its first line (Lh 2026-10-29, ก่อนเริ่มใช้งาน on a lone Page: the marks of เริ่ม ทั้ง ชี้ ปี่ were
|
|
318
|
+
cut by the page's own scroll edge, which clips whatever rises out of it — a child's padding cannot reach past its scroller). The
|
|
319
|
+
scroller pads its top by it and takes it back from its margin, so the words stand where they stood and a mark rising over the first
|
|
320
|
+
line is inside the box. A box cannot read its first child's em, so it is the rise of the biggest words that may open it (the display
|
|
321
|
+
size, --fs-display, and so it grows with a member's larger text). Measured (Noto Sans Thai Looped, shaped): a stacked tone over an
|
|
322
|
+
upper vowel reaches 1.19em over the baseline at weight 900, an h1 line (1.15) ends 1.025em over it — 0.165em out */
|
|
323
|
+
--glyph-rise-room: calc(var(--fs-display) * 0.2);
|
|
317
324
|
/* THE EIGHT KINDS: each has its face, weight, size (--fs-* above), leading and tracking, and its style --type-<kind> is made of them */
|
|
318
325
|
--fw-display: var(--fw-heavy); --lh-display: 1.15; --track-display: -0.02em; /* leading: Thai marks stack to 1.1em up and 0.3em down — 1.02 clipped them (2026-09-10) */
|
|
319
326
|
--fw-h1: var(--fw-black); --lh-h1: 1.15; --track-h1: -0.015em; /* tight, the display's floor: a stacked mark (1.13em up) clears the line above (Lh 2026-10-25: 1.2 read loose) */
|
|
@@ -1003,12 +1010,12 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
1003
1010
|
the screen's gap, moved in here from above the step; the inset, taken back from the bleed.
|
|
1004
1011
|
It ends with the bottom layer's room, as a walk's page does: it scrolls only when the layer would cover its words
|
|
1005
1012
|
(timebank onboard-04, 2026-09-27 — its last Link lay under the bar; Lh: same rule as the walk) */
|
|
1006
|
-
.step > .page { margin: var(--_lead,
|
|
1013
|
+
.step > .page { margin: calc(var(--_lead, 0rem) - var(--glyph-rise-room)) var(--screen-pad) 0; padding-top: var(--glyph-rise-room); padding-bottom: var(--bottom-h, 0rem); } /* the lone page is its own scroller: its top keeps the glyphs' room (tokens.css --glyph-rise-room), taken back from the lead, so a Thai mark over the first line is never cut by its edge */
|
|
1007
1014
|
/* a field brought into sight (focus, Tab) stops above the bottom layer, not under it */
|
|
1008
1015
|
.step > .page, .step > .pages > .page { scroll-padding-bottom: var(--bottom-h, 0rem); }
|
|
1009
1016
|
/* --bleed: the page's box runs to the screen's edges, the inset is its own padding — what leans, slides or casts a shadow past
|
|
1010
1017
|
the inset (a postcard) is cut at the glass, not at the inset; a little room on top for a turned corner. Nothing pans sideways. */
|
|
1011
|
-
.step > .page--bleed { margin-inline: 0; padding-inline: var(--screen-pad); padding-block-start: var(--sp-2); overflow-x: hidden; }
|
|
1018
|
+
.step > .page--bleed { margin-inline: 0; padding-inline: var(--screen-pad); padding-block-start: calc(var(--glyph-rise-room) + var(--sp-2)); overflow-x: hidden; }
|
|
1012
1019
|
.step > .pages > .page {
|
|
1013
1020
|
padding-inline: var(--screen-pad); /* the words keep the inset INSIDE it */
|
|
1014
1021
|
margin-top: var(--_lead, 0rem); /* the lead is each PAGE's margin (15% with no top, the screen's gap under a bar): the words start there and scroll up to the box's edge */
|
|
@@ -1145,7 +1152,11 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
1145
1152
|
.card__face > * { min-width: 0; }
|
|
1146
1153
|
:is(.card, .card__face):has(> .stamp-on--under, > .card__middle > .stamp-on--under) { isolation: isolate; } /* the card is the stacking context the stamp's -1 lies in: below the card's words, above its paper */
|
|
1147
1154
|
.card__middle { flex: 1 0 auto; display: flex; flex-direction: column; gap: var(--card-gap); height: var(--card-middle-h, auto); overflow: hidden; } /* a flex column, not a grid: the middle's height is the flexed one, so one thing on a face (a QR, a code) may take the whole middle with height: 100% (a grid's auto row never stretched to it, and the thing stood at the top of an empty band) */
|
|
1148
|
-
|
|
1155
|
+
/* Card backFull: the back is the whole card, no head and no foot — one code, one sentence and its button, a thank-you, in the middle both ways */
|
|
1156
|
+
.card__middle--full { --_above: var(--card-back-optical, 0.4); justify-content: center; align-items: center; text-align: center; } /* the content's centre stands --card-back-optical (a share, default 0.4) down from the top edge, not 0.5: the eye reads true centre as low. Spacer rows below (::before) and above (::after) split the free room 0.4 : 0.6 */
|
|
1157
|
+
.card__middle--full::before, .card__middle--full::after { content: ""; display: block; flex: 0 0 auto; } /* the spacers cancel the gap they would add: each pulls back over the gap on its inner side */
|
|
1158
|
+
.card__middle--full::before { flex-grow: var(--_above); margin-bottom: calc(-1 * var(--card-gap)); }
|
|
1159
|
+
.card__middle--full::after { flex-grow: calc(1 - var(--_above)); margin-top: calc(-1 * var(--card-gap)); }
|
|
1149
1160
|
.card__middle--full > :is(.pin, .field, .composer, .form-note) { align-self: stretch; } /* a thing to type in keeps the card's width (centred, a Pin's cells would shrink to nothing) */
|
|
1150
1161
|
.card__middle--full > .bullets { align-self: stretch; text-align: start; } /* a list of steps keeps the card's width and reads from the start edge (centred, each line's pic would float with its words) */
|
|
1151
1162
|
.card__turn { position: absolute; inset: 0; width: var(--px); height: var(--px); padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); }
|
|
@@ -1377,18 +1388,28 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
1377
1388
|
@keyframes feed-end-wag { 0%, 100% { rotate: calc(var(--feed-end-wag, 14deg) * -1); } 50% { rotate: var(--feed-end-wag, 14deg); } }
|
|
1378
1389
|
@media (prefers-reduced-motion: no-preference) { .feed-end__tail { animation: feed-end-wag var(--motion-wag) var(--ease-in-out) infinite; } }
|
|
1379
1390
|
.card-feed__end { text-align: center; }
|
|
1380
|
-
|
|
1381
|
-
.
|
|
1382
|
-
.
|
|
1391
|
+
/* the same fold on a lone card (`Card folds`, Lh 2026-10-29): the head always shows, the rest (content and foot) is the grid row that
|
|
1392
|
+
goes 1fr ↔ 0fr; folded (.is-folded) it is cut and hidden as a small feed card's is. The head is the press (actions.css, the DIM list);
|
|
1393
|
+
the keyboard's way is the unseen .card__open after it, and its focus ring is the card's. The chevron (.card__chevron) is the card's, the head's last end.
|
|
1394
|
+
<article class="card card--folds is-folded"><div class="head" id="…">…</div><button class="card__open" aria-expanded="false" aria-controls="…r"></button>
|
|
1395
|
+
<div class="card__more" id="…r" inert><div class="card__rest">content · <div class="foot">…</div></div></div></article> */
|
|
1396
|
+
.card--folds { row-gap: 0; }
|
|
1397
|
+
.card__chevron { --icon-motion: rotate var(--motion-quick) var(--ease); } /* the card's own chevron, the head's last end: down while folded, turned up while open (as a Banner's) */
|
|
1398
|
+
.card--folds:not(.is-folded) .card__chevron { --icon-turn: 180deg; }
|
|
1399
|
+
.card__open { position: absolute; inset: 0; width: var(--px); height: var(--px); padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); }
|
|
1400
|
+
.card--folds:has(> .card__open:focus-visible) { outline: var(--focus); outline-offset: var(--sp-1); }
|
|
1401
|
+
:is(.feed-card__more, .card__more) { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; }
|
|
1402
|
+
:is(.feed-card--small > .feed-card__more, .card--folds.is-folded > .card__more) { grid-template-rows: 0fr; }
|
|
1403
|
+
:is(.feed-card__rest, .card__rest) {
|
|
1383
1404
|
min-height: 0;
|
|
1384
1405
|
display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--card-gap);
|
|
1385
1406
|
clip-path: inset(0 calc(-1 * var(--card-pad)) calc(-1 * var(--sp-2)));
|
|
1386
1407
|
}
|
|
1387
|
-
.feed-card__rest > :first-child { margin-top: var(--card-gap); }
|
|
1388
|
-
.feed-card--small .feed-card__rest { overflow: clip; visibility: hidden; }
|
|
1408
|
+
:is(.feed-card__rest, .card__rest) > :first-child { margin-top: var(--card-gap); }
|
|
1409
|
+
:is(.feed-card--small .feed-card__rest, .card--folds.is-folded > .card__more > .card__rest) { overflow: clip; visibility: hidden; }
|
|
1389
1410
|
@media (prefers-reduced-motion: no-preference) {
|
|
1390
|
-
.feed-card__more { transition: grid-template-rows var(--motion-sheet) var(--ease); }
|
|
1391
|
-
.feed-card--small .feed-card__rest { transition: visibility 0s var(--motion-sheet); }
|
|
1411
|
+
:is(.feed-card__more, .card__more) { transition: grid-template-rows var(--motion-sheet) var(--ease); }
|
|
1412
|
+
:is(.feed-card--small .feed-card__rest, .card--folds.is-folded > .card__more > .card__rest) { transition: visibility 0s var(--motion-sheet); }
|
|
1392
1413
|
}
|
|
1393
1414
|
|
|
1394
1415
|
/* ---- panes: a few panes side by side inside a card or a sheet, one in sight (Lh 2026-10-02) ----
|
|
@@ -2499,7 +2520,11 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
2499
2520
|
inset: 0;
|
|
2500
2521
|
background: var(--scrim);
|
|
2501
2522
|
z-index: var(--z-over);
|
|
2523
|
+
pointer-events: none;
|
|
2524
|
+
transition: opacity var(--motion-sheet) var(--ease); /* the scrim is its own layer: it fades with the sheet's slide, in and out, ending together */
|
|
2502
2525
|
}
|
|
2526
|
+
/* no sheet up (every sheet in the stage is `away`, and no Modal stands there): the scrim is gone — the Sheet sets `sheet--away` the moment it is told to leave, so this fades as it slides down */
|
|
2527
|
+
.sheet-stage--dim:has(> .sheet--away):not(:has(> .sheet:not(.sheet--away), > .modal))::after { opacity: 0; }
|
|
2503
2528
|
.sheet-stage--dim .sheet { z-index: var(--z-over-2); }
|
|
2504
2529
|
.sheet-stage--dim > .sheet-stage__hero { z-index: var(--z-over-2); }
|
|
2505
2530
|
|
|
@@ -2535,7 +2560,8 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
2535
2560
|
--card-muted: var(--card-ink); /* a tint of the ink: its secondary words are the full ink (no lighter shade holds 4.5:1 there) */
|
|
2536
2561
|
border-top: var(--sheet-step-border-w, 0rem) solid var(--sheet-step-border, currentColor); /* a rule instead of the bar: set this, the bar's bg transparent, radius 0 */
|
|
2537
2562
|
}
|
|
2538
|
-
:is(.sheet-step__title, .sheet-settings__title) { font: var(--sheet-step-title-font, var(--type-label)); margin: 0; flex: 0 1 auto; min-width: 0; outline: none; /* the label size, not a body title: a pile of rows must stay small (Lh 2026-09-24) */ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
2563
|
+
:is(.sheet-step__title, .sheet-settings__title) { font: var(--sheet-step-title-font, var(--type-label)); margin: 0; flex: 0 1 auto; min-width: 0; outline: none; /* the label size, not a body title: a pile of rows must stay small (Lh 2026-09-24) */ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
2564
|
+
padding-block: var(--glyph-rise) var(--glyph-drop); margin-block: calc(-1 * var(--glyph-rise)) calc(-1 * var(--glyph-drop)); /* the label's 1.2 line is shorter than a stacked Thai mark (ฉบับย่อ, อ่านฉบับเต็ม were cut): room inside the clip, given back outside (tokens.css, the glyphs' room) */ }
|
|
2539
2565
|
.sheet-step__num { /* `numbered`: the step's number in a disc BEFORE its title (Lh 2026-09-25) — a disc of the card's colour on the bar, the number in the ink */
|
|
2540
2566
|
flex: none; display: grid; place-items: center; box-sizing: border-box; inline-size: var(--sheet-step-num-size, 1.408em); block-size: var(--sheet-step-num-size, 1.408em); /* em, not rem (Lh 2026-10-03, as the StackSheet's count): the disc is cut from ITS OWN number's size —
|
|
2541
2567
|
at a large text size the number grew and a 24px disc did not, so the digit sat on its bottom edge; 1.408em of a 17px caption = the 24px it always was */
|
|
@@ -3454,7 +3480,9 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
3454
3480
|
.t-expand--more (Lh 2026-10-25) = a `Text expand` that does not fit: the whole box opens or folds. It is WORDS, so it neither
|
|
3455
3481
|
dims nor gives: its ink never changes under the finger (Lh 2026-10-25), the opening is the answer. Pointer only (below).
|
|
3456
3482
|
.bubble--press (Lh 2026-10-28) = a chat `Bubble` that is a link (`href`) or pressed (`onClick`): a message is as wide as a row, so it DIMS.
|
|
3457
|
-
.link-block (Lh 2026-10-28) = a `LinkBlock`, a few pieces of a card's content as one link: as wide as the card, it DIMS.
|
|
3483
|
+
.link-block (Lh 2026-10-28) = a `LinkBlock`, a few pieces of a card's content as one link: as wide as the card, it DIMS.
|
|
3484
|
+
.card--folds > .head (Lh 2026-10-29) = the head of a `Card folds`: a tap opens or folds the card, so it DIMS (pointer and :active only —
|
|
3485
|
+
the focus ring is the card's, from its unseen open button, card.css). A control in the head keeps its own press. */
|
|
3458
3486
|
:where(.btn, .icon-btn, .link, a.chip, button.chip, .chip--pick, a.tile, button.tile, .tile--pick, .day, .segment__item, .calendar__day,
|
|
3459
3487
|
.float-bar__item, .avatar-pick__item, .add-row, .picker__item, .dropdown__btn, .appbar__who, .check, .toggle, .mood__opt, .sheet__handle,
|
|
3460
3488
|
a.avatar, button.avatar, .menu__item, button.snackbar__body, .stamp--tap, button.stamp-cell, button.stamp-place, .post-letter__turn, .post-desk__slot, .post-desk__pick, .post-desk__reach, .stamp-on__remove, .map-pick, .count-in__cancel) {
|
|
@@ -3462,7 +3490,7 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
3462
3490
|
touch-action: manipulation;
|
|
3463
3491
|
transition: scale var(--motion-press) var(--ease-out);
|
|
3464
3492
|
}
|
|
3465
|
-
:where(a.row, button.row, label.row, .row-expand > summary, .banner__summary, a.card, label.card, .card--go, .card--press, .feed-card--small, .toggle-field, .post-box__edge, .bubble--press, .link-block) {
|
|
3493
|
+
:where(a.row, button.row, label.row, .row-expand > summary, .banner__summary, a.card, label.card, .card--go, .card--press, .feed-card--small, .card--folds > .head, .toggle-field, .post-box__edge, .bubble--press, .link-block) {
|
|
3466
3494
|
cursor: pointer;
|
|
3467
3495
|
touch-action: manipulation;
|
|
3468
3496
|
transition: opacity var(--motion-press) var(--ease-out);
|
|
@@ -3478,8 +3506,9 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
3478
3506
|
:where(.btn, .icon-btn, .link, a.chip, button.chip, .chip--pick, a.tile, button.tile, .tile--pick, .day, .segment__item, .calendar__day,
|
|
3479
3507
|
.float-bar__item, .avatar-pick__item, .add-row, .picker__item, .dropdown__btn, .appbar__who, .check, .toggle, .mood__opt, .sheet__handle,
|
|
3480
3508
|
a.avatar, button.avatar, .menu__item, button.snackbar__body, .stamp--tap, button.stamp-cell, button.stamp-place, .post-letter__turn, .post-desk__slot, .post-desk__pick, .post-desk__reach, .stamp-on__remove, .map-pick):active:not(:disabled, [aria-disabled="true"], :has(:disabled)) { scale: var(--press-scale); }
|
|
3481
|
-
:where(a.row, button.row, label.row, .row-expand > summary, .banner__summary, a.card, label.card, .card--go, .card--press, .feed-card--small, .toggle-field, .post-box__edge, .bubble--press, .link-block):active:not([aria-disabled="true"], :has(:disabled)) { opacity: var(--press-dim); }
|
|
3509
|
+
:where(a.row, button.row, label.row, .row-expand > summary, .banner__summary, a.card, label.card, .card--go, .card--press, .feed-card--small, .card--folds > .head, .toggle-field, .post-box__edge, .bubble--press, .link-block):active:not([aria-disabled="true"], :has(:disabled)) { opacity: var(--press-dim); }
|
|
3482
3510
|
.card--press:active:has(:is(a[href], button, [role=button], input, select, textarea, summary):active) { opacity: 1; } /* the finger is on a link or a button inside: that one answers, the card stays */
|
|
3511
|
+
.card--folds > .head:active:has(:is(a[href], button, [role=button], input, select, textarea, summary):active) { opacity: 1; } /* a button in a folding card's head answers itself, the head stays */
|
|
3483
3512
|
/* SHADE — what has something BEHIND it (a peeked sheet over the pile, a postcard's face over its back, a post letter's sheet over the other) must not turn see-through:
|
|
3484
3513
|
it darkens a touch instead (--press-shade) */
|
|
3485
3514
|
:where(.sheet-stack--tap > .card:not(.is-open), .postcard__turn, .post-letter__sheet:not(:has(.icon-btn:active))) { cursor: pointer; touch-action: manipulation; transition: filter var(--motion-press) var(--ease-out); }
|
package/dist/cards/Card.d.ts
CHANGED
|
@@ -80,6 +80,21 @@ export interface CardProps extends ComponentProps<'article'> {
|
|
|
80
80
|
pressLabel?: string;
|
|
81
81
|
/** the cross's spoken name (default: the words' `remove`) — name what goes: "Remove 'buy medicine'" */
|
|
82
82
|
removeLabel?: string;
|
|
83
|
+
/** THE FOLD — the card can fold to its head: folded, only its `Head` shows; a tap on the head (not on a control in it) opens the rest
|
|
84
|
+
* (the content and the `Foot`), another folds it again. The rest opens and folds as a grid row, nothing jumps; folded it is `inert`.
|
|
85
|
+
* The card draws its own chevron down as the head's last `end` (after the app's own ends), turned up while open, as a Banner's.
|
|
86
|
+
* The keyboard and a screen reader meet ONE unseen button after the head, named by the head (or `openLabel`), that says open or folded.
|
|
87
|
+
* The card finds its `Head` by type, as a two-faced card does. Not on a `row`, `sm`, `stack`, `paper="bands"` card, nor with `back` or `onPress`:
|
|
88
|
+
* there it is ignored. A folding card is never pressed whole (the head is its press). Knob: none — the motion is the sheet's (`--motion-sheet`) */
|
|
89
|
+
folds?: boolean;
|
|
90
|
+
/** CONTROLLED: the card is open (only with `folds`) — pair it with `onOpenChange`. The app owns it */
|
|
91
|
+
open?: boolean;
|
|
92
|
+
/** UNCONTROLLED: the card starts open (default `false`: folded to its head) */
|
|
93
|
+
defaultOpen?: boolean;
|
|
94
|
+
/** a tap on the head (or the unseen button) asked to open or to fold: the state it asks for */
|
|
95
|
+
onOpenChange?: (open: boolean) => void;
|
|
96
|
+
/** the unseen open button's spoken name (default: the head's own words) */
|
|
97
|
+
openLabel?: string;
|
|
83
98
|
}
|
|
84
99
|
/**
|
|
85
100
|
* Card — ONE boundary: head · content · foot. Cards are content the system offers (the words, the thing to read).
|
|
@@ -92,8 +107,9 @@ export interface CardProps extends ComponentProps<'article'> {
|
|
|
92
107
|
* PRESSED WHOLE WITH CONTROLS INSIDE (`onPress` + `pressLabel`): the card is pressed anywhere off its own links and buttons, which keep their own press; one unseen button serves the keyboard.
|
|
93
108
|
* TWO FACES (`back`): the whole card turns over on a tap off a control (the flip mechanic it shares with Postcard); the head and the foot
|
|
94
109
|
* read the same on both faces, the middle is one fixed height; `backFull` gives the back the whole card, centred, with neither. `paper="bands"`: paper head and foot bands edge to edge, the tint between.
|
|
110
|
+
* FOLDS (`folds`): folded to its head, a tap on the head opens the rest — controlled (`open` + `onOpenChange`) or `defaultOpen`.
|
|
95
111
|
*/
|
|
96
|
-
export declare function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as, stack, leave, onLeft, onPress, pressLabel, onRemove, removeLabel, back, backFull, face, defaultFace, onFaceChange, toBackLabel, toFrontLabel, startInView, className, style, children, onClick, ref, ...rest }: CardProps): import("react").DetailedReactHTMLElement<{
|
|
112
|
+
export declare function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as, stack, leave, onLeft, onPress, pressLabel, onRemove, removeLabel, back, backFull, face, defaultFace, onFaceChange, toBackLabel, toFrontLabel, startInView, folds, open, defaultOpen, onOpenChange, openLabel, className, style, children, onClick, ref, ...rest }: CardProps): import("react").DetailedReactHTMLElement<{
|
|
97
113
|
onClick: (e: MouseEvent<HTMLElement>) => void;
|
|
98
114
|
inert?: boolean | undefined;
|
|
99
115
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
package/dist/cards/Card.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { Children, createElement, isValidElement, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Children, cloneElement, createElement, isValidElement, useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
4
|
import { useControlled, useLatest, warnOnce } from '../state.js';
|
|
5
5
|
import { Head } from '../parts/Head.js';
|
|
@@ -20,8 +20,9 @@ import { StackHeadCtx, StackPullCtx, ownHead, stackPaint, useStackCard } from '.
|
|
|
20
20
|
* PRESSED WHOLE WITH CONTROLS INSIDE (`onPress` + `pressLabel`): the card is pressed anywhere off its own links and buttons, which keep their own press; one unseen button serves the keyboard.
|
|
21
21
|
* TWO FACES (`back`): the whole card turns over on a tap off a control (the flip mechanic it shares with Postcard); the head and the foot
|
|
22
22
|
* read the same on both faces, the middle is one fixed height; `backFull` gives the back the whole card, centred, with neither. `paper="bands"`: paper head and foot bands edge to edge, the tint between.
|
|
23
|
+
* FOLDS (`folds`): folded to its head, a tap on the head opens the rest — controlled (`open` + `onOpenChange`) or `defaultOpen`.
|
|
23
24
|
*/
|
|
24
|
-
export function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as = 'article', stack, leave, onLeft, onPress, pressLabel, onRemove, removeLabel, back, backFull, face, defaultFace = 'front', onFaceChange, toBackLabel, toFrontLabel, startInView, className, style, children, onClick, ref, ...rest }) {
|
|
25
|
+
export function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as = 'article', stack, leave, onLeft, onPress, pressLabel, onRemove, removeLabel, back, backFull, face, defaultFace = 'front', onFaceChange, toBackLabel, toFrontLabel, startInView, folds, open, defaultOpen = false, onOpenChange, openLabel, className, style, children, onClick, ref, ...rest }) {
|
|
25
26
|
if (onRemove && !row)
|
|
26
27
|
warnOnce('card-remove-row', 'cardds Card: `onRemove` draws its cross on a `row` card only');
|
|
27
28
|
if (back != null && (row || sm || stack))
|
|
@@ -31,6 +32,16 @@ export function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as
|
|
|
31
32
|
if (onPress && !pressLabel)
|
|
32
33
|
warnOnce('card-press-label', 'cardds Card: `onPress` needs a `pressLabel` — the unseen button needs a spoken name');
|
|
33
34
|
const turns = back != null && !row && !sm && !stack;
|
|
35
|
+
if (folds && (row || sm || stack || paper === 'bands' || back != null || onPress))
|
|
36
|
+
warnOnce('card-folds-kind', 'cardds Card: `folds` folds a plain card — not a `row`, `sm`, `stack` or `paper="bands"` card, nor one with `back` or `onPress`; it is ignored');
|
|
37
|
+
const kids = Children.toArray(children);
|
|
38
|
+
const headKid = kids.find((c) => isValidElement(c) && c.type === Head);
|
|
39
|
+
if (folds && !headKid)
|
|
40
|
+
warnOnce('card-folds-head', 'cardds Card: `folds` needs a `Head` child — the head is what shows folded and what opens it; it is ignored');
|
|
41
|
+
const folding = !!folds && !!headKid && !row && !sm && !stack && paper !== 'bands' && back == null && !onPress;
|
|
42
|
+
const [opened, askOpen] = useControlled(open, defaultOpen, onOpenChange);
|
|
43
|
+
const folded = folding && !opened;
|
|
44
|
+
const foldId = useId();
|
|
34
45
|
const [shown, ask] = useControlled(face, defaultFace, onFaceChange);
|
|
35
46
|
const flipped = turns && shown === 'back';
|
|
36
47
|
const pressed = onPress != null && back == null && !stack;
|
|
@@ -68,7 +79,7 @@ export function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as
|
|
|
68
79
|
return () => { live = false; };
|
|
69
80
|
}, [away]);
|
|
70
81
|
const [go, setGo] = useState(false);
|
|
71
|
-
const findGo = useLatest(() => setGo(!turns && !pressed && own.current != null && goControl(own.current) != null));
|
|
82
|
+
const findGo = useLatest(() => setGo(!turns && !pressed && !folding && own.current != null && goControl(own.current) != null));
|
|
72
83
|
useLayoutEffect(() => findGo.current()); // every render: what the card holds is its children's
|
|
73
84
|
useEffect(() => {
|
|
74
85
|
const card = own.current;
|
|
@@ -95,6 +106,11 @@ export function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as
|
|
|
95
106
|
onPress?.();
|
|
96
107
|
return;
|
|
97
108
|
}
|
|
109
|
+
if (folding) {
|
|
110
|
+
if (!e.defaultPrevented && card && ownHead(card, target) && !onControl(card, target))
|
|
111
|
+
askOpen(!opened);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
98
114
|
if (!e.defaultPrevented && card?.contains(target)) {
|
|
99
115
|
const control = goControl(card);
|
|
100
116
|
if (control && !control.contains(target)) {
|
|
@@ -126,7 +142,7 @@ export function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as
|
|
|
126
142
|
const props = {
|
|
127
143
|
...rest,
|
|
128
144
|
ref: setRef,
|
|
129
|
-
className: cx('card', tone && tone !== 1 && `card--${tone}`, paper === true && 'sheet--paper', paper === 'bands' && 'card--bands', turns && 'card--turns flip', flipped && 'is-flipped', sm && 'card--sm', row && 'card--row', cover && 'card--cover', fold && 'card--fold', centre && 'card--centre', wide && 'card--wide', band && 'card--band', go && 'card--go', pressed && 'card--press', leaver && 'card--leaver', away && 'card--away', painted.className, className),
|
|
145
|
+
className: cx('card', tone && tone !== 1 && `card--${tone}`, paper === true && 'sheet--paper', paper === 'bands' && 'card--bands', turns && 'card--turns flip', flipped && 'is-flipped', sm && 'card--sm', row && 'card--row', cover && 'card--cover', fold && 'card--fold', centre && 'card--centre', wide && 'card--wide', band && 'card--band', go && 'card--go', pressed && 'card--press', folding && 'card--folds', folded && 'is-folded', leaver && 'card--leaver', away && 'card--away', painted.className, className),
|
|
130
146
|
style: painted.style || style ? { ...painted.style, ...style } : undefined,
|
|
131
147
|
...(stack ? { 'aria-busy': painted.busy } : {}),
|
|
132
148
|
...(away ? { inert: true } : {}),
|
|
@@ -134,8 +150,12 @@ export function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as
|
|
|
134
150
|
};
|
|
135
151
|
const cross = row && onRemove ? (_jsx("button", { type: "button", className: "card__remove", "aria-label": removeLabel ?? word('remove'), onClick: (e) => { e.preventDefault(); e.stopPropagation(); onRemove(); }, children: _jsx(Icon, { name: "x" }) }, "remove")) : null;
|
|
136
152
|
const press = pressed ? (_jsx("button", { type: "button", className: "card__press", "aria-label": pressLabel, onClick: (e) => { e.stopPropagation(); onPress?.(); } }, "press")) : null;
|
|
153
|
+
if (folding) {
|
|
154
|
+
const headId = headKid.props.id ?? `${foldId}h`;
|
|
155
|
+
const rest = kids.filter((c) => c !== headKid);
|
|
156
|
+
return createElement(as, props, inner(_jsxs(_Fragment, { children: [cloneElement(headKid, { id: headId, end: _jsxs(_Fragment, { children: [headKid.props.end, _jsx(Icon, { name: "chevron-down", size: "sm", className: "card__chevron" })] }) }), _jsx("button", { type: "button", className: "card__open", "aria-expanded": opened, "aria-controls": `${foldId}r`, ...(openLabel ? { 'aria-label': openLabel } : { 'aria-labelledby': headId }), onClick: () => askOpen(!opened) }), _jsx("div", { className: "card__more", id: `${foldId}r`, inert: folded, children: _jsx("div", { className: "card__rest", children: rest }) })] })));
|
|
157
|
+
}
|
|
137
158
|
if (turns) {
|
|
138
|
-
const kids = Children.toArray(children);
|
|
139
159
|
const ownHeadKid = kids.find((c) => isValidElement(c) && c.type === Head);
|
|
140
160
|
const ownFootKid = kids.find((c) => isValidElement(c) && c.type === Foot);
|
|
141
161
|
const front = kids.filter((c) => c !== ownHeadKid && c !== ownFootKid);
|