@usableapp/cardds 0.7.113 → 0.7.116
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 +48 -0
- package/bin/cardds.mjs +19 -1
- package/css/actions.css +33 -1
- package/css/base.css +2 -0
- package/css/layover.css +1 -9
- package/css/parts.css +6 -0
- package/css/sheet.css +36 -0
- package/css/stamp.css +21 -2
- package/css/tokens.css +2 -1
- package/dist/actions/BtnGroup.d.ts +47 -6
- package/dist/actions/BtnGroup.js +55 -5
- package/dist/actions/BtnRow.d.ts +6 -2
- package/dist/actions/BtnRow.js +5 -3
- package/dist/actions/Chip.d.ts +4 -2
- package/dist/actions/Chip.js +3 -3
- package/dist/actions/joined.d.ts +2 -0
- package/dist/actions/joined.js +4 -0
- package/dist/cardds.css +101 -13
- package/dist/catalog.json +1 -1
- package/dist/choice/CalendarWeeks.d.ts +15 -2
- package/dist/choice/CalendarWeeks.js +12 -5
- package/dist/choice/span.d.ts +41 -0
- package/dist/choice/span.js +97 -23
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/media/MapArea.d.ts +5 -3
- package/dist/media/MapArea.js +2 -1
- package/dist/media/MapPick.d.ts +14 -2
- package/dist/media/MapPick.js +41 -2
- package/dist/parts/Foot.d.ts +4 -1
- package/dist/parts/Foot.js +3 -2
- package/dist/parts/Words.d.ts +2 -2
- package/dist/post/PostDesk.js +38 -4
- package/dist/sheets/Modal.d.ts +1 -5
- package/dist/sheets/Modal.js +2 -7
- package/dist/stamp/Stamp.d.ts +4 -2
- package/dist/stamp/Stamp.js +3 -3
- package/dist/type/icons.d.ts +1 -1
- package/dist/type/icons.js +2 -2
- package/docs/reference.md +75 -3
- package/icons.svg +1 -0
- package/lib/guide.mjs +9 -8
- package/lint/rules.mjs +1 -1
- package/package.json +1 -1
- package/dist/actions/IconBtnGroup.d.ts +0 -35
- package/dist/actions/IconBtnGroup.js +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,54 @@
|
|
|
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.116 — 2026-10-25
|
|
6
|
+
|
|
7
|
+
`MapArea mark="none"`, a `keyboard` icon, `CalendarWeeks` holding several ranges, and controls in a scrolling body no longer cut with large text.
|
|
8
|
+
|
|
9
|
+
Components: all
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **`MapArea mark="none"`: no centre mark, for an app whose map engine draws its own marks.** Before, the centre always showed a `ring` or a `pin`. With `none` nothing stands at the centre and `ringRef` / `ringLabel` are not read, so need not be passed. `ring` and `pin` are unchanged. Story `MapArea/NoMark` (new).
|
|
13
|
+
- **Icon `keyboard`**, in the stroke of `mic`: a "type" choice beside a "speak" one (`BtnGroup select="one"` of `IconBtn`s). Shown in the icon story and a `BtnGroup` sample.
|
|
14
|
+
- **`CalendarWeeks ranges`: several runs of days at once.** `ranges` + `onRangesChange` (or `defaultRanges`), a list of `[first, last]` day keys in order (the same key twice for one day). A tap on a free day adds that day; a tap on a held day removes the whole range it is in; a drag along a row adds its run. A new range that overlaps or touches held ones is merged into one (Mon–Tue held, a tap on Wed = Mon–Wed); a disabled day keeps the ranges on its sides apart. Ranges outside the shown `weeks` (the app showed another month) are kept and handed back with every change; a range partly in sight shows its part and is handed back whole. Keys must sort as their days do (ISO `2026-06-05`). Given `ranges`, `span` and `selected` are not read; `span` itself is unchanged. Story `CalendarWeeks/Ranges` (new).
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **A control in a body long enough to scroll is no longer cut at its top with large system text.** The body's grid gave a row only its item's minimum (a `Btn`'s `--btn-h`) once the content overflowed, while the button with larger text was taller; a centred `form` button stood out of its row and the scroll edge cut it (seen on a sheet that is not `paper`, at 130% and 160%). Now every row of `.body` is as tall as what it holds (`grid-auto-rows: max-content`). At 100% nothing moves except rows that had the same overflow.
|
|
18
|
+
|
|
19
|
+
## 0.7.115 — 2026-10-24
|
|
20
|
+
|
|
21
|
+
A pick of words that reads as buttons (`BtnGroup look="choice"`), and map places that keep their names in a bubble (`MapPick tip`).
|
|
22
|
+
|
|
23
|
+
Components: BtnGroup, MapPick
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **`BtnGroup look="choice"`: a pick of words that reads as buttons (Lh 2026-10-24).** `look="strip"` drew its items as muted words on no paper, so a pick like เช้า · บ่าย · ทั้งวัน did not look pressable and the picked one was hard to see. `choice`: the `BtnGroupItem`s JOINED in one frame like the icon frame (`look="frame"`) — the button's paper and edge, a full tap (48) tall, the words sharing its width with a rule between them, the button's word size — the picked one the solid brand fill with its ground's ink (`--accent` / `--on-accent`, as a primary button). Before → after: `<BtnGroup label="ช่วงเวลา"><BtnGroupItem selected>…` → `<BtnGroup look="choice" select="one" label="ช่วงเวลา" value={time} onChange={setTime}><BtnGroupItem value="morning">…`. The `frame` and `strip` looks are unchanged. Knobs `--btngroup-choice-bg`, `--btngroup-choice-ink`, `--btngroup-choice-border`, `--btngroup-choice-rule`, `--btngroup-choice-radius`, `--btngroup-choice-on-bg`, `--btngroup-choice-on-ink`. Story `BtnGroup/Choice` (new); `BtnGroup/Controlled` drives a strip and a choice from one value.
|
|
27
|
+
- **`MapPick tip`: a place's name in a bubble, for places close together (timebank's meeting-place step, Lh 2026-10-24).** Before, every `MapPick` drew its name under its mark all the time, and close places laid their names over each other. With `tip` only the mark shows; pressing it picks the place and opens its name in a bubble over the mark (under it at the map's top edge, slid in at a side edge); a press elsewhere, another place too, or Escape closes it — one at a time. Controlled like an input: `open` + `onOpenChange`, or `defaultOpen`. Without `tip` nothing changes. Knobs `--map-pick-tip-bg`, `--map-pick-tip-ink`. Stories `MapPick/Tooltip`, `MapPick/Controlled` (new).
|
|
28
|
+
|
|
29
|
+
## 0.7.114 — 2026-10-24
|
|
30
|
+
|
|
31
|
+
Option rows get a writing rule; `Chip xs` and `Stamp xs`; a stamp on a card has no shadow; `IconBtnGroup` into `BtnGroup`, `BtnTrio` into `BtnRow round joined`; `PostDesk` keeps the written line above the bottom layer; `cardds init` names what `<html>` must carry.
|
|
32
|
+
|
|
33
|
+
Components: all
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- **A stamp on a card has no shadow, at every size (Lh 2026-10-24).** The head's stamp, a `FeedCard`'s lead, a `Foot` row's, `xs`: one rule in `css/stamp.css` by where it stands (`.card` that is not a sheet). Off a card — the album's cells, the tray, `PostDesk`, a start screen, a postcard's corner, a note — the shadow stays.
|
|
37
|
+
- **`Stamp xs`: the inline stamp, in a card's status row where a count chip stands (Lh 2026-10-24).** One `Chip xs` tall, 18.7 × 23.4: token `--stamp-xs` on `--fs-base`, knob `--stamp-xs-size`. Always bare, no shadow; 8 × 10 teeth instead of 12 × 15 so they still read, a wider frame round the picture. Up to three in an `AvatarStack`, lapped by `--sp-1`, with `more` ("+8") at the chip's scale (`--fs-2xs`, knob `--avatar-stack-xs-more-font-size`). Story `Stamp/Inline` (new).
|
|
38
|
+
- **`Chip xs`: the smallest label, for a count in a card's status row (Lh 2026-10-24).** Under `sm`: text `--fs-2xs` (15), line `--lh-tight`, about 23 tall; an `Icon` inside takes the words' size. A label only, never a tap target; in a `ChipRow` beside a full-size chip the row stretches it, so it stands in a `Foot` or a row of small chips. Knobs `--chip-xs-gap`, `--chip-xs-pad-y`, `--chip-xs-pad-x`, `--chip-xs-font-size`, `--chip-xs-line`, `--chip-xs-icon-size`. Story `Chip/Tiny` (new).
|
|
39
|
+
- **`cardds init` says what a project's `<html>` must carry.** It reads the entry's `<html>` (`index.html`, then `src/`, `web/`, `app/`, `public/`): names the language its `lang` gives the controls, or says to add `lang`; with `--color-*` bases set in `theme.css` and no `data-palette` on `<html>`, says to add `data-palette="own"`. The closing text adds the `<html lang data-palette>` line, the browser floor and the real-phone line. Tests: `tests/init.spec.js` (new, runs init in a temp project).
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- **`PostDesk`: the line being written stays above the bottom layer under a keyboard (Lh 2026-10-07).** With a keyboard up the page is shorter than the paper, and the paper's last lines lay under the `ActionBar`, where the browser still counts the cursor as seen. Now the page scrolls just far enough that the cursor's line clears the bottom layer — on focus, on every keystroke, on moving the cursor, and when the keyboard comes up; the paper never moves or shrinks. A `Step`'s page also has `scroll-padding-bottom: var(--bottom-h)`, so a field the browser brings into sight stops above the bottom layer, not under it.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- **Option rows: the title is the answer, the meta only the difference that decides (Lh 2026-10-24).** An option row on a sheet (`Row` · `Words title meta` · `Check`) now has a written rule, docs/reference.md "Option rows: the title and its meta": the title answers the sheet's question in the member's words (never "Choose…", never the question again); a meta only when the title alone leaves the member unable to decide, one line; none for a self-evident title, a restatement, a promotion or an instruction; every option has a meta or none does. The MCP guide, building-with-cardds and the `Words` `title`/`meta` JSDoc point at it. No code changes.
|
|
46
|
+
- **`control-name-repeat` says the right way first:** set `lang` on `<html>` and drop the prop; another language is `setWords` once at app start.
|
|
47
|
+
- **`IconBtnGroup` is gone into `BtnGroup`: one panel of buttons, two looks (Lh 2026-10-24).** `look="frame"` (the default) is what `IconBtnGroup` was — up to four `IconBtn`s in one frame, with `select`, `vertical`, `form`, `labelled`, unchanged; `look="strip"` is what `BtnGroup` was — `BtnGroupItem`s of words sharing the width. Classes and knobs keep their names (`.icon-btn-group`, `.segment`, `--icon-btn-group-*`, `--segment-rest-ink`). Before → after:
|
|
48
|
+
- `<IconBtnGroup …>` → `<BtnGroup …>` (same props).
|
|
49
|
+
- `<BtnGroup aria-label="Day"><BtnGroupItem selected={d === day} onClick={() => setDay(d)}>…` → `<BtnGroup look="strip" select="one" label="Day" value={day} onChange={setDay}><BtnGroupItem value={d}>…` — the strip is now controlled at the group like an input. A strip without `look="strip"` draws as a frame. `BtnGroupItem selected` by hand still works in a strip without `select`.
|
|
50
|
+
- Stories: the IconBtnGroup page's stories are on the BtnGroup page (`BtnGroup/InAFoot`, `BtnGroup/Form` …), new `BtnGroup/Controlled`.
|
|
51
|
+
- **`BtnTrio` is gone into `BtnRow round joined` (and `Foot round joined`) (Lh 2026-10-24).** `joined` links the round buttons by dots with a closer gap — the old trio's look, any count. Before → after: `<ModalAsk …><BtnTrio><IconBtn …/><IconBtn invert …/><IconBtn …/></BtnTrio></ModalAsk>` → `<ModalAsk …><BtnRow round joined>…</BtnRow></ModalAsk>`; in a ModalAsk it stands as before (as wide as its buttons, in the middle, 12 under the words). The dots keep `.btn-trio__dots` and the knobs `--btn-trio-gap`, `--btn-trio-dots-w`, `--btn-trio-dots-h`; the root class `.btn-trio` is gone (`.btn-row--joined`, `.foot--joined`). Story `BtnRow/RoundJoined` (new).
|
|
52
|
+
|
|
5
53
|
## 0.7.113 — 2026-10-24
|
|
6
54
|
|
|
7
55
|
A `Text scroll` box shows three lines and a half, at every text size (Lh 2026-10-24: at three whole lines nobody knew there was more).
|
package/bin/cardds.mjs
CHANGED
|
@@ -73,13 +73,31 @@ function init() {
|
|
|
73
73
|
else if (eslint) say(false, `${relative(cwd, eslint)}: add import cardds from '@usableapp/cardds/eslint' and cardds.configs.recommended to its array`);
|
|
74
74
|
else say(false, 'no ESLint here — `npm run cardds:check` carries the same rules');
|
|
75
75
|
|
|
76
|
+
// 4 · the page's <html>: its lang names the controls (without it they read English); a theme with colours of its own wants data-palette
|
|
77
|
+
const FIELD = ['index.html', 'src/index.html', 'web/index.html', 'app/index.html', 'public/index.html'];
|
|
78
|
+
const entry = FIELD.map((f) => join(cwd, f)).find(existsSync);
|
|
79
|
+
if (!entry) say(false, `no index.html found (looked in ${FIELD.join(', ')}) — put lang="th" (or the app's language) on <html>: cardds names its controls from it`);
|
|
80
|
+
else {
|
|
81
|
+
const name = relative(cwd, entry), tag = readFileSync(entry, 'utf8').match(/<html\b[^>]*>/i)?.[0] ?? '';
|
|
82
|
+
const lang = tag.match(/\slang\s*=\s*(?:"([^"]+)"|'([^']+)')/i)?.slice(1).find(Boolean);
|
|
83
|
+
const language = (code) => { try { return new Intl.DisplayNames(['en'], { type: 'language' }).of(code) ?? code; } catch { return code; } };
|
|
84
|
+
if (lang) say(true, `${name} <html lang="${lang}"> — cardds names its controls in ${language(lang)}`);
|
|
85
|
+
else say(false, `${name}: <html> has no lang — add lang="th" (or the app's language): cardds names its controls from it; without it they read in English`);
|
|
86
|
+
const ownColours = /--color-(?:surface|ink|paper|brand|on-brand)\s*:/.test(readFileSync(theme, 'utf8').replace(/\/\*[\s\S]*?\*\//g, ''));
|
|
87
|
+
if (ownColours && !/\sdata-palette\s*=/i.test(tag)) say(false, `${name}: ${relative(cwd, theme)} sets --color-* bases — add data-palette="own" to <html> (coloured mode: cards take a shadow for their wireframe border, controls a soft edge)`);
|
|
88
|
+
}
|
|
89
|
+
|
|
76
90
|
console.log(`
|
|
77
91
|
In the app's entry, once:
|
|
78
92
|
import '@usableapp/cardds/dist/cardds.css';
|
|
79
93
|
import './theme.css'; // after cardds.css
|
|
94
|
+
<html lang="th" data-palette="own"> // lang: the controls' language · data-palette="own": only with your own --color-* bases in theme.css
|
|
80
95
|
|
|
81
96
|
Start a screen from a template (Walkthrough · Home · CallSheet · Splash) or compose the components —
|
|
82
|
-
import them, never copy their markup: the behaviour lives in the component. Gallery: see docs/reference.md
|
|
97
|
+
import them, never copy their markup: the behaviour lives in the component. Gallery: see docs/reference.md.
|
|
98
|
+
|
|
99
|
+
Browser floor: Safari / iOS 16.4, Chrome 114, Firefox 128 (docs/reference.md).
|
|
100
|
+
A real phone: run the dev server with server: { host: true } and open the Network address on the phone (docs/reference.md "On a real phone").`);
|
|
83
101
|
return 0;
|
|
84
102
|
}
|
|
85
103
|
|
package/css/actions.css
CHANGED
|
@@ -166,6 +166,14 @@
|
|
|
166
166
|
so a card's foot stays its status line */
|
|
167
167
|
.btn-row--round { justify-content: center; align-items: center; gap: var(--btn-row-gap, var(--sp-6)); }
|
|
168
168
|
.btn-row > .btn { flex: 1; min-width: 0; }
|
|
169
|
+
/* joined (BtnRow round joined, Foot round joined — Lh 2026-10-24, was BtnTrio): a dotted link between each two round buttons, a closer gap */
|
|
170
|
+
.btn-row--joined { gap: var(--btn-trio-gap, var(--sp-3)); }
|
|
171
|
+
.btn-trio__dots {
|
|
172
|
+
width: var(--btn-trio-dots-w, var(--sp-5));
|
|
173
|
+
height: var(--btn-trio-dots-h, var(--sp-1));
|
|
174
|
+
background: radial-gradient(circle, currentColor var(--sp-0), transparent calc(var(--sp-0) + var(--px) / 2)) 0 0 / calc(var(--sp-5) / 2) 100% repeat-x;
|
|
175
|
+
opacity: var(--fade-soft);
|
|
176
|
+
}
|
|
169
177
|
|
|
170
178
|
/* ---- chip: status/attribute tag, optional signal dot ---- */
|
|
171
179
|
.chip {
|
|
@@ -201,6 +209,9 @@
|
|
|
201
209
|
/* --sm: a small LABEL (a name on a note, a tag in a tight head) — low and tight; never a tap target */
|
|
202
210
|
/* one height wherever it stands (Lh 2026-10-21): the body's line, so a head that cuts its words with an ellipsis keeps the Thai marks over them, and a foot's or a middle's chip reads the same */
|
|
203
211
|
.chip--sm { min-height: 0; gap: var(--chip-sm-gap, var(--sp-1)); padding: var(--chip-sm-pad-y, var(--sp-0)) var(--chip-sm-pad-x, var(--sp-2)); line-height: var(--chip-sm-line, var(--lh-body)); }
|
|
212
|
+
/* --xs: the smallest label — a count in a card's status row (👥 12), smaller than --sm; the icon follows its words (Lh 2026-10-24); never a tap target */
|
|
213
|
+
.chip--xs { min-height: 0; gap: var(--chip-xs-gap, var(--sp-0)); padding: var(--chip-xs-pad-y, var(--sp-0)) var(--chip-xs-pad-x, var(--sp-1)); font-size: var(--chip-xs-font-size, var(--fs-2xs)); line-height: var(--chip-xs-line, var(--lh-tight)); }
|
|
214
|
+
.chip--xs > .icon { width: var(--chip-xs-icon-size, 1em); height: var(--chip-xs-icon-size, 1em); }
|
|
204
215
|
/* soft: the accent washed into the chip's ground, no edge — a status to see, quieter than on (was the inbox Ribbon, Lh 2026-10-21) */
|
|
205
216
|
.chip--soft { background: var(--chip-soft-bg, var(--accent-wash)); color: var(--chip-soft-ink, var(--card-ink)); border-color: transparent; } /* the wash on the chip's own paper, opaque (--accent-wash): see-through, a dark tone came through under the light side's ink (ink.spec) */
|
|
206
217
|
.chip--on { background: var(--chip-on-bg, var(--accent)); --dark: var(--accent-dark); color: var(--chip-on-ink, var(--card-ink)); border-color: transparent; }
|
|
@@ -261,6 +272,26 @@
|
|
|
261
272
|
background: var(--accent);
|
|
262
273
|
color: var(--on-accent);
|
|
263
274
|
}
|
|
275
|
+
/* choice (BtnGroup look="choice", Lh 2026-10-24): words that read AS BUTTONS — a strip's items were muted words on no paper, so a
|
|
276
|
+
pick of เช้า · บ่าย · ทั้งวัน did not look pressable and its picked one was hard to see. ONE frame, as the icon frame
|
|
277
|
+
(.icon-btn-group): the button's paper and edge, a full tap tall, the words sharing its width with a rule between them; the picked
|
|
278
|
+
one the solid brand fill with the ink its ground declares (--on-accent, as a primary button). */
|
|
279
|
+
.segment--choice {
|
|
280
|
+
gap: 0;
|
|
281
|
+
min-height: var(--tap);
|
|
282
|
+
border: var(--border-w) solid var(--btngroup-choice-border, var(--outline));
|
|
283
|
+
border-radius: var(--btngroup-choice-radius, var(--r-chip));
|
|
284
|
+
overflow: hidden;
|
|
285
|
+
background: var(--btngroup-choice-bg, var(--action-bg));
|
|
286
|
+
color: var(--btngroup-choice-ink, var(--action-ink));
|
|
287
|
+
}
|
|
288
|
+
.segment--choice > .segment__item { min-height: var(--tap); padding: var(--sp-2) var(--sp-3); border-radius: 0; color: inherit; font-size: var(--fs-md); }
|
|
289
|
+
.segment--choice > .segment__item + .segment__item { border-inline-start: var(--border-w) solid var(--btngroup-choice-rule, var(--btngroup-choice-border, var(--outline))); }
|
|
290
|
+
.segment--choice > .segment__item[aria-selected="true"] {
|
|
291
|
+
background: var(--btngroup-choice-on-bg, var(--accent));
|
|
292
|
+
color: var(--btngroup-choice-on-ink, var(--on-accent));
|
|
293
|
+
}
|
|
294
|
+
.segment--choice > .segment__item:active:not(:disabled) { scale: 1; opacity: var(--press-dim); } /* a part of one frame DIMS, it never shrinks inside it */
|
|
264
295
|
|
|
265
296
|
/* ---- bottom CTA pack: the screen's bottom (Screen `bottom`) ----
|
|
266
297
|
A bar is always INSIDE its .screen, its last child (0.7.1: the bar fixed to the viewport from outside, and the
|
|
@@ -527,4 +558,5 @@
|
|
|
527
558
|
/* ---- where it sits in what sticky.css draws (docs/reference.md rule 15) ---- */
|
|
528
559
|
.sticky__foot > .chip { display: block; flex: none; min-width: 0; max-width: var(--sticky-foot-chip-max-w, 62%); overflow: hidden; text-overflow: ellipsis; text-align: start; }
|
|
529
560
|
/* ---- where it sits in what layover.css draws (docs/reference.md rule 15) ---- */
|
|
530
|
-
.modal__drawer > .btn-row { justify-self: stretch; margin-top: var(--modal-drawer-answers-gap, var(--sp-5)); white-space: nowrap; }
|
|
561
|
+
.modal__drawer > .btn-row:not(.btn-row--joined) { justify-self: stretch; margin-top: var(--modal-drawer-answers-gap, var(--sp-5)); white-space: nowrap; }
|
|
562
|
+
.modal__drawer > .btn-row--joined { margin-top: var(--sp-3); } /* the round answers stand as wide as they are, in the middle, close under the words */
|
package/css/base.css
CHANGED
|
@@ -312,6 +312,8 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
|
|
|
312
312
|
It ends with the bottom layer's room, as a walk's page does: it scrolls only when the layer would cover its words
|
|
313
313
|
(timebank onboard-04, 2026-09-27 — its last Link lay under the bar; Lh: same rule as the walk) */
|
|
314
314
|
.step > .page { margin: var(--_lead, 0) var(--screen-pad) 0; padding-bottom: var(--bottom-h, 0rem); }
|
|
315
|
+
/* a field brought into sight (focus, Tab) stops above the bottom layer, not under it */
|
|
316
|
+
.step > .page, .step > .pages > .page { scroll-padding-bottom: var(--bottom-h, 0rem); }
|
|
315
317
|
/* --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
|
|
316
318
|
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. */
|
|
317
319
|
.step > .page--bleed { margin-inline: 0; padding-inline: var(--screen-pad); padding-block-start: var(--sp-2); overflow-x: hidden; }
|
package/css/layover.css
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
.modal__drawer > h2:focus { outline: none; } /* the question takes the cursor when the modal arrives (for a screen reader, the keyboard's way in) — it is not a control: no ring */
|
|
78
78
|
/* the answers as WORD buttons (a BtnRow of Btns; Lh 2026-10-11): the row fills the ask with room over it and each button keeps its words on one
|
|
79
79
|
line — left to its words' width the row squeezed two buttons into round blobs, their words on two lines. A quiet button is an outline only,
|
|
80
|
-
so on the ask its edge is the ask's ink at full strength (light on the dark end, dark on --light). The
|
|
80
|
+
so on the ask its edge is the ask's ink at full strength (light on the dark end, dark on --light). The round answers (BtnRow round joined) are not touched. */
|
|
81
81
|
.modal__drawer .btn--quiet { --btn-quiet-border: var(--modal-drawer-quiet-border, currentColor); }
|
|
82
82
|
.modal__drawer .icon-btn { --icon-btn-bg: transparent; --icon-btn-ink: currentColor; --icon-btn-border: var(--ink-rail); }
|
|
83
83
|
.modal__drawer .icon-btn--invert { --icon-btn-size: var(--tap-lg); }
|
|
@@ -94,14 +94,6 @@
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
.btn-trio { display: flex; align-items: center; gap: var(--btn-trio-gap, var(--sp-3)); margin-top: var(--sp-3); }
|
|
98
|
-
.btn-trio__dots {
|
|
99
|
-
width: var(--btn-trio-dots-w, var(--sp-5));
|
|
100
|
-
height: var(--btn-trio-dots-h, var(--sp-1));
|
|
101
|
-
background: radial-gradient(circle, currentColor var(--sp-0), transparent calc(var(--sp-0) + var(--px) / 2)) 0 0 / calc(var(--sp-5) / 2) 100% repeat-x;
|
|
102
|
-
opacity: var(--fade-soft);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
97
|
/* ---- popover menu: a card anchored to its button, rows of icon + label ----
|
|
106
98
|
<button class="chip" popovertarget="when">Now ▾</button>
|
|
107
99
|
<div class="menu" id="when" popover><button class="menu__item"><svg class="icon"/>Now</button>…</div>
|
package/css/parts.css
CHANGED
|
@@ -227,6 +227,10 @@
|
|
|
227
227
|
display: grid;
|
|
228
228
|
gap: var(--body-gap, var(--card-gap));
|
|
229
229
|
align-content: start;
|
|
230
|
+
/* every row as tall as what it holds. A body that scrolls has no room to hand out, so an `auto` row stays at its item's minimum
|
|
231
|
+
contribution, which for a control with a min-height (a Btn's --btn-h) is that min-height, not the control: with larger text a
|
|
232
|
+
centred `form` button stood out of its row and the scroll edge cut its top */
|
|
233
|
+
grid-auto-rows: max-content;
|
|
230
234
|
min-height: 0;
|
|
231
235
|
padding-top: var(--body-pad-top, 0rem);
|
|
232
236
|
overflow-y: auto;
|
|
@@ -344,6 +348,8 @@
|
|
|
344
348
|
/* round (Foot round): the foot holds a few round IconBtns, each its own size (they never share the line), as ONE group in the middle with
|
|
345
349
|
a gap that does not follow the card's width. The gap is wider than the Btns' (a miss between two round targets): --foot-gap sets it */
|
|
346
350
|
.foot--round { justify-content: center; gap: var(--foot-gap, var(--sp-6)); }
|
|
351
|
+
/* joined (Foot round joined): the round buttons linked by dots (the dots are BtnRow's, actions.css), a closer gap */
|
|
352
|
+
.foot--joined { gap: var(--btn-trio-gap, var(--sp-3)); }
|
|
347
353
|
|
|
348
354
|
/* in a card with paper bands: the foot band (the head's look, above) is slim */
|
|
349
355
|
:is(.card--bands, .card--bands > .card__face) > .foot { margin-bottom: calc(-1 * var(--card-pad)); padding-block: var(--sp-3); }
|
package/css/sheet.css
CHANGED
|
@@ -402,6 +402,42 @@
|
|
|
402
402
|
.map-pick:has(:checked) > :is(.map-pick__mark, .map-pick__name) { background: var(--map-pick-on-bg, var(--accent)); color: var(--map-pick-on-ink, var(--on-accent)); }
|
|
403
403
|
.map-pick:has(:focus-visible) > .map-pick__mark { outline: var(--focus); outline-offset: var(--sp-0); }
|
|
404
404
|
.map-pick:has(:disabled) { opacity: var(--off); cursor: default; }
|
|
405
|
+
/* TIP (.map-pick--tip): places close together — only the mark stands on the map; its name is heard (as .t-sr) until the mark is
|
|
406
|
+
pressed, then shows in a bubble OVER the mark (a finger under it never hides it), with a tail to its point. `.is-open` is
|
|
407
|
+
rendered by MapPick; a press elsewhere or Escape takes it off. The open place lies over its neighbours. No popover: the
|
|
408
|
+
bubble stays in the map's box, under the sheet's head, and needs no anchor positioning (iOS 16.4). */
|
|
409
|
+
.map-pick--tip > .map-pick__name { width: var(--px); height: var(--px); margin: calc(-1 * var(--px)); padding: 0; overflow: hidden; clip-path: inset(50%); }
|
|
410
|
+
.map-pick--tip.is-open { z-index: var(--z-over-3); }
|
|
411
|
+
.map-pick--tip.is-open > .map-pick__name {
|
|
412
|
+
--_tip-bg: var(--map-pick-tip-bg, var(--surface));
|
|
413
|
+
top: auto;
|
|
414
|
+
bottom: calc(50% + var(--map-pick-size, var(--sp-6)) / 2 + var(--sp-2));
|
|
415
|
+
translate: calc(-50% + var(--_tip-dx, 0rem)) 0;
|
|
416
|
+
width: auto;
|
|
417
|
+
height: auto;
|
|
418
|
+
margin: 0;
|
|
419
|
+
padding: var(--sp-1) var(--sp-3);
|
|
420
|
+
overflow: visible;
|
|
421
|
+
clip-path: none;
|
|
422
|
+
border-radius: var(--map-pick-name-radius, var(--r-chip));
|
|
423
|
+
background: var(--_tip-bg);
|
|
424
|
+
color: var(--map-pick-tip-ink, var(--on-surface));
|
|
425
|
+
box-shadow: var(--map-pick-shadow, var(--shadow-float));
|
|
426
|
+
}
|
|
427
|
+
.map-pick--tip.is-open > .map-pick__name::after {
|
|
428
|
+
content: "";
|
|
429
|
+
position: absolute;
|
|
430
|
+
top: 100%;
|
|
431
|
+
left: calc(50% - var(--_tip-dx, 0rem));
|
|
432
|
+
translate: -50% 0;
|
|
433
|
+
border: var(--sp-1) solid transparent;
|
|
434
|
+
border-top-color: var(--_tip-bg);
|
|
435
|
+
}
|
|
436
|
+
/* no room over the mark (a place at the map's top edge): the bubble hangs under it, the tail on its top;
|
|
437
|
+
a place at a side edge: MapPick slides the bubble in by --_tip-dx and the tail stays on the point */
|
|
438
|
+
.map-pick--tip.is-below > .map-pick__name { bottom: auto; top: calc(50% + var(--map-pick-size, var(--sp-6)) / 2 + var(--sp-2)); }
|
|
439
|
+
.map-pick--tip.is-below > .map-pick__name::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--_tip-bg); }
|
|
440
|
+
.map-pick--tip.is-open:has(:checked) > .map-pick__name { --_tip-bg: var(--map-pick-on-bg, var(--accent)); color: var(--map-pick-on-ink, var(--on-accent)); }
|
|
405
441
|
|
|
406
442
|
/* EVERY sheet has one shape (Lh, 2026-09-21): the handle and the head stay at the top and never scroll · the
|
|
407
443
|
foot's button stands at the bottom, and ABOVE the keyboard when there is one · everything between them
|
package/css/stamp.css
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
at the head of a feed card (`.feed-card__lead`, card.css): one knob for the three.
|
|
22
22
|
ONE exception, by the owner's decision (Lh 2026-10-11): the stamp at a postcard's corner (post.css) is the postcard's own size, 72 × 90,
|
|
23
23
|
--post-corner-stamp-w, in neither. The desk's tray (post.css) holds stamps of the standard size.
|
|
24
|
+
THE INLINE SIZE (2026-10-24): `.stamp--xs` (below), --stamp-xs-size, one caption line tall, a stamp beside a status line's words.
|
|
24
25
|
THE THIRD SIZE (Lh 2026-10-17): `.stamp-book--fill` (below) makes each stamp as wide as its third, the gaps one --screen-pad. */
|
|
25
26
|
.stamp, .stamp-place {
|
|
26
27
|
box-sizing: border-box;
|
|
@@ -74,14 +75,23 @@
|
|
|
74
75
|
/* at the stamp's own size and under (and stuck on a note): the small line goes, the name grows */
|
|
75
76
|
/* --bare: the pictures alone, no words — a stamp stuck on something (a note, a postcard). The words belong to the album.
|
|
76
77
|
The pictures take the foot's room: each sits a little lower, so the group stands in the middle of the frame. */
|
|
77
|
-
.stamp--bare .stamp__cap, .stamp-on .stamp__cap, .post-corner .stamp__cap { display: none; }
|
|
78
|
-
.stamp--bare .stamp__art, .stamp-on .stamp__art, .post-corner .stamp__art { top: calc(var(--_y) + 9%); }
|
|
78
|
+
.stamp--bare .stamp__cap, .stamp-on .stamp__cap, .post-corner .stamp__cap, .stamp--xs .stamp__cap { display: none; }
|
|
79
|
+
.stamp--bare .stamp__art, .stamp-on .stamp__art, .post-corner .stamp__art, .stamp--xs .stamp__art { top: calc(var(--_y) + 9%); }
|
|
79
80
|
|
|
80
81
|
@container (max-width: 6rem) {
|
|
81
82
|
.stamp__words { display: none; }
|
|
82
83
|
.stamp__name { --_name: 12cqw; }
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
/* --xs: the stamp INLINE with a status line (a card's foot: the stamp, "X took it", a round button) — one caption line tall,
|
|
87
|
+
--stamp-xs-size (18.7 × 23.4 at the default bases, one Chip xs tall, on --fs-base: it follows the words it stands with; Lh 2026-10-24).
|
|
88
|
+
Too small for words: it is bare whatever it is handed. No shadow (Lh): it lies flat in the line. The teeth are fewer and larger (8 across,
|
|
89
|
+
10 down) so they still read, and the frame round the picture wider to clear them. Several, lapped, with a "+8": AvatarStack (below).
|
|
90
|
+
<span class="stamp stamp--1 stamp--xs">…</span> */
|
|
91
|
+
.stamp--xs { width: var(--stamp-xs-size, var(--stamp-xs)); flex: none; margin-inline: 0; filter: none; }
|
|
92
|
+
.stamp--xs .stamp__paper { --_pitch: calc(100cqw / 8); --_hole: 3.9cqw; }
|
|
93
|
+
.stamp--xs .stamp__pic { inset: var(--stamp-frame, 12cqw); }
|
|
94
|
+
|
|
85
95
|
/* --tilt: turned a little on its middle — the one stamp a start screen hands over */
|
|
86
96
|
.stamp--tilt-left, .stamp--tilt-right { margin-block: var(--sp-4); } /* the turned corners and the shadow need room: a centre scrolls and would cut them */
|
|
87
97
|
.stamp--tilt-left { rotate: calc(-1 * var(--stamp-tilt, calc(var(--tilt-base) * 5))); }
|
|
@@ -279,6 +289,10 @@
|
|
|
279
289
|
}
|
|
280
290
|
|
|
281
291
|
/* ---- where it sits in what card.css draws (docs/reference.md rule 15) ---- */
|
|
292
|
+
/* a stamp ON a card lies flat: no shadow, at every size (Lh 2026-10-24) — the head's (`end`), a feed card's lead, a foot row's, xs.
|
|
293
|
+
A sheet is a `.card` too, but what it holds stands off its paper: the album, the tray, a start screen's stamp keep their shadow, and so
|
|
294
|
+
does a stamp in an album's cell wherever the album lies */
|
|
295
|
+
.card:not(.sheet) .stamp:not(.stamp-cell > .stamp) { filter: none; }
|
|
282
296
|
.head > .stamp { grid-column: 2; grid-row: 1 / span 2; margin-inline: 0; }
|
|
283
297
|
/* ---- where it sits in what people.css draws (docs/reference.md rule 15) ---- */
|
|
284
298
|
/* a stamp in the stack is the stamp's small size (--stamp-sm-size: one rule in stamp.css, 48 × 60), lapped like the heads. Measured 2026-10-11 in a Row's
|
|
@@ -286,5 +300,10 @@
|
|
|
286
300
|
<span class="avatar-stack"><span class="stamp stamp--bare">…</span><span class="stamp stamp--bare">…</span><span class="avatar-stack__more">+9</span></span> */
|
|
287
301
|
.avatar-stack > .stamp { flex: none; margin-inline: 0; }
|
|
288
302
|
.avatar-stack > .stamp + .stamp { margin-left: calc(-1 * var(--sp-2)); }
|
|
303
|
+
/* xs stamps in the stack (Lh 2026-10-24: "[][][] +8" in a card's status row): each its inline size, a smaller lap, and the count at the
|
|
304
|
+
Chip xs's scale on the status words' line, not the title size */
|
|
305
|
+
.avatar-stack > .stamp--xs { width: var(--stamp-xs-size, var(--stamp-xs)); }
|
|
306
|
+
.avatar-stack > .stamp--xs + .stamp--xs { margin-left: calc(-1 * var(--sp-1)); }
|
|
307
|
+
.avatar-stack:has(> .stamp--xs) > .avatar-stack__more { margin-left: var(--avatar-stack-more-gap, var(--sp-1)); font: var(--avatar-stack-more-font, var(--type-label)); font-size: var(--avatar-stack-xs-more-font-size, var(--fs-2xs)); }
|
|
289
308
|
/* ---- where it sits in what post.css draws (docs/reference.md rule 15) ---- */
|
|
290
309
|
.post-corner__stamp > :is(.stamp, .stamp-place) { grid-area: 1 / 1; width: 100%; max-width: none; } /* the corner is the postcard's own size (72 × 90), outside the stamp's two sizes, by the owner's decision (2026-10-11); its box sizes the stamp, which fills it */
|
package/css/tokens.css
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--r-base: 1.3rem; /* 20.8 radius, 130% of 1rem (Lh 2026-10-05): --r-* (--r-chip stays fully round) */
|
|
28
28
|
--tap-base: 3rem; /* 48 the size of THINGS: touch targets and control heights (--tap*, --btn-h, --chip-h, --bar-h,
|
|
29
29
|
--header-h, --fab), icons, avatars, dots, the ring and the tiles. --sp-base is the room BETWEEN things.
|
|
30
|
-
Text-holders follow the type instead: --badge and --
|
|
30
|
+
Text-holders follow the type instead: --badge, --icon-xs and --stamp-xs (inline with captions) are on --fs-base.
|
|
31
31
|
Not on a base: --screen-w (the column), borders / rules / focus (fixed rem), shadows, motion. */
|
|
32
32
|
|
|
33
33
|
/* ---- spacing (4pt grid): the number in the name is the multiplier ---- */
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
--icon-sm: calc(var(--tap-base) * 7 / 12); /* one size everywhere; retune if small contexts appear */
|
|
68
68
|
--icon-lg: calc(var(--tap-base) * 2 / 3); /* 32 empty states */
|
|
69
69
|
--icon-xs: calc(var(--fs-base) * 0.775); /* 17 inline with captions/chips only (row meta, link arrows) — the caption's size */
|
|
70
|
+
--stamp-xs: calc(var(--fs-base) * 0.85); /* 18.7 × 23.4 the stamp inline with a status line: one Chip xs tall (Lh picked it 2026-10-24) */
|
|
70
71
|
|
|
71
72
|
/* ---- people & big elements ---- */
|
|
72
73
|
--avatar-sm: calc(var(--tap-base) * 5 / 6); /* 40 row lead */
|
|
@@ -1,11 +1,52 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
type Picked = string | null | string[];
|
|
3
|
+
export interface BtnGroupProps extends Omit<ComponentProps<'div'>, 'onChange' | 'defaultValue'> {
|
|
4
|
+
/** how the buttons stand (Lh 2026-10-24: one panel of buttons, two looks): `frame` — up to FOUR `IconBtn`s in ONE frame, sharing its
|
|
5
|
+
* width, a rule between them (a card's or a sheet's foot) · `strip` — `BtnGroupItem`s of words a small gap apart, sharing the width,
|
|
6
|
+
* the picked one filled (a tab strip, a day picker; as many as fit) · `choice` (Lh 2026-10-24) — `BtnGroupItem`s of words that READ
|
|
7
|
+
* AS BUTTONS: joined in ONE frame like `frame`'s, a full tap tall, a rule between them, the picked one a solid brand fill with its ink (a pick of
|
|
8
|
+
* a few words in a form or a sheet: เช้า · บ่าย · ทั้งวัน). Give it `select="one"` (or `many`). Default `frame` */
|
|
9
|
+
look?: 'frame' | 'strip' | 'choice';
|
|
10
|
+
/** the group's accessible name (what these buttons act on or choose) */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** buttons that STAY ON when pressed (Lh 2026-09-29): `one` — one on at a time, pressing another moves it (value: the on
|
|
13
|
+
* button's `value`, or null) · `many` — each on or off by itself (value: the on ones' values). None = plain commands, each on its
|
|
14
|
+
* own onClick. A `strip` is a choice: give it `select="one"` */
|
|
15
|
+
select?: 'one' | 'many';
|
|
16
|
+
/** which are on — each child names itself with its own `value` */
|
|
17
|
+
value?: Picked;
|
|
18
|
+
/** UNCONTROLLED: which are on at first, in the same shape as `value`; the group then keeps its own. Pair of `value` */
|
|
19
|
+
defaultValue?: Picked;
|
|
20
|
+
/** asks the app: `one` → the pressed value · `many` → the new list */
|
|
21
|
+
onChange?: (value: Picked) => void;
|
|
22
|
+
/** `frame` only: the buttons one OVER the other, the panel one button wide — at a `Row`'s end, where a panel across would take the
|
|
23
|
+
* words' room */
|
|
24
|
+
vertical?: boolean;
|
|
25
|
+
/** `frame` only: the panel as wide as its buttons (each one tap wide, or as wide as its word), in the middle of its column the way a
|
|
26
|
+
* `Btn form` is — in a `Page`, a `Centre`, a `CtaPack`, and in a card's or a sheet's foot, where it keeps that width instead of filling
|
|
27
|
+
* the row. Without it the panel is the width of what it stands in. Not with `vertical`: that is already one button wide, at a row's
|
|
28
|
+
* end — `form` wins and warns */
|
|
29
|
+
form?: boolean;
|
|
30
|
+
/** with `form`: SHOW the `label` as words at the panel's left, on one line, the two centred together — plain ink in the label's type,
|
|
31
|
+
* outside the frame, and the words are the group's name (`aria-labelledby`). Where the line is too narrow (a big text size on a small
|
|
32
|
+
* phone) the words wrap ABOVE the panel and both stay centred */
|
|
33
|
+
labelled?: boolean;
|
|
3
34
|
}
|
|
4
|
-
/** BtnGroup — a panel of buttons, one
|
|
5
|
-
|
|
35
|
+
/** BtnGroup — a panel of buttons, one job in two looks (`look`). `frame` (default): up to FOUR icon buttons in ONE frame, sharing its
|
|
36
|
+
* width, a rule between them in the frame's colour (Lh 2026-09-29). Each is an `IconBtn` (its `label` is its spoken name); a WORD may
|
|
37
|
+
* stand beside the icon as its child (`<IconBtn label="ชาย"><Icon name="man" />ชาย</IconBtn>`) — two named sides of a `Panes`. At home
|
|
38
|
+
* in a card's or a sheet's foot; `vertical` at a row's end; `form` as a small control of its own in the middle of a `Page` or a `Centre`
|
|
39
|
+
* (`<BtnGroup form labelled label="เปลี่ยนสีพื้น">` = the words, then the narrow panel, both centred). `strip`: `BtnGroupItem`s of words
|
|
40
|
+
* sharing the width (a tab strip, a day picker), a tablist. Plain: each button does its own thing on its onClick. With `select`, a pressed
|
|
41
|
+
* button stays filled: `one` or `many`. With `labelled` the root is the line holding the words and the panel — `className`, `style` and
|
|
42
|
+
* `ref` go there, the knobs too. */
|
|
43
|
+
export declare function BtnGroup({ look, label, labelled, form, select, value, defaultValue, onChange, vertical, className, children, ...rest }: BtnGroupProps): import("react").JSX.Element;
|
|
6
44
|
export interface BtnGroupItemProps extends ComponentProps<'button'> {
|
|
7
|
-
/** the
|
|
45
|
+
/** the picked tab (filled). A `BtnGroup select` sets it from its `value`; set it by hand only in a strip without `select` */
|
|
8
46
|
selected?: boolean;
|
|
47
|
+
/** the item's name in its group's `value` */
|
|
48
|
+
value?: string;
|
|
9
49
|
}
|
|
10
|
-
/** BtnGroupItem — one
|
|
50
|
+
/** BtnGroupItem — one item of words in a `BtnGroup look="strip"` or `look="choice"`. */
|
|
11
51
|
export declare function BtnGroupItem({ selected, className, ...rest }: BtnGroupItemProps): import("react").JSX.Element;
|
|
52
|
+
export {};
|
package/dist/actions/BtnGroup.js
CHANGED
|
@@ -1,10 +1,60 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Children, cloneElement, isValidElement, useId } from 'react';
|
|
2
3
|
import { cx } from '../cx.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { useControlled, warnOnce } from '../state.js';
|
|
5
|
+
/** BtnGroup — a panel of buttons, one job in two looks (`look`). `frame` (default): up to FOUR icon buttons in ONE frame, sharing its
|
|
6
|
+
* width, a rule between them in the frame's colour (Lh 2026-09-29). Each is an `IconBtn` (its `label` is its spoken name); a WORD may
|
|
7
|
+
* stand beside the icon as its child (`<IconBtn label="ชาย"><Icon name="man" />ชาย</IconBtn>`) — two named sides of a `Panes`. At home
|
|
8
|
+
* in a card's or a sheet's foot; `vertical` at a row's end; `form` as a small control of its own in the middle of a `Page` or a `Centre`
|
|
9
|
+
* (`<BtnGroup form labelled label="เปลี่ยนสีพื้น">` = the words, then the narrow panel, both centred). `strip`: `BtnGroupItem`s of words
|
|
10
|
+
* sharing the width (a tab strip, a day picker), a tablist. Plain: each button does its own thing on its onClick. With `select`, a pressed
|
|
11
|
+
* button stays filled: `one` or `many`. With `labelled` the root is the line holding the words and the panel — `className`, `style` and
|
|
12
|
+
* `ref` go there, the knobs too. */
|
|
13
|
+
export function BtnGroup({ look = 'frame', label, labelled, form, select, value, defaultValue, onChange, vertical, className, children, ...rest }) {
|
|
14
|
+
const words = useId();
|
|
15
|
+
const strip = look !== 'frame'; // `choice` is a strip of words in a button's look
|
|
16
|
+
if (!strip && Children.count(children) > 4)
|
|
17
|
+
warnOnce('icon-btn-group', 'cardds BtnGroup: more than 4 buttons in a frame — keep 4, put the rest in a Menu behind one of them');
|
|
18
|
+
if (strip && (form || vertical || labelled))
|
|
19
|
+
warnOnce('btn-group-strip-frame', 'cardds BtnGroup: `form`, `vertical` and `labelled` are the frame\'s — a strip always shares the width it stands in; they are ignored');
|
|
20
|
+
if (!strip && form && vertical)
|
|
21
|
+
warnOnce('icon-btn-group-form-vertical', 'cardds BtnGroup: `form` and `vertical` together — `vertical` is already one button wide at a row\'s end, `form` is the panel in the middle of its column; `form` is kept, `vertical` ignored');
|
|
22
|
+
if (!strip && labelled && !form)
|
|
23
|
+
warnOnce('icon-btn-group-labelled', 'cardds BtnGroup: `labelled` is for `form` (the words and the narrow panel as one centred line) — without `form` the label stays the spoken name only');
|
|
24
|
+
if (!strip && labelled && form && !label)
|
|
25
|
+
warnOnce('icon-btn-group-labelled-words', 'cardds BtnGroup: `labelled` shows the `label` — it has none, so no words are drawn');
|
|
26
|
+
const line = !strip && !!(form && labelled && label);
|
|
27
|
+
const [shown, request] = useControlled(value, defaultValue ?? (select === 'many' ? [] : null), onChange);
|
|
28
|
+
const on = (v) => (Array.isArray(shown) ? shown.includes(v) : shown === v);
|
|
29
|
+
const items = !select ? children : Children.map(children, (c) => {
|
|
30
|
+
if (!isValidElement(c))
|
|
31
|
+
return c;
|
|
32
|
+
const el = c;
|
|
33
|
+
const v = el.props.value;
|
|
34
|
+
if (v == null)
|
|
35
|
+
return c;
|
|
36
|
+
return cloneElement(el, {
|
|
37
|
+
// a strip's item is a tab and says it is picked; a frame's button says it is pressed
|
|
38
|
+
...(strip ? { selected: on(v) } : { 'aria-pressed': on(v) }),
|
|
39
|
+
onClick: (e) => {
|
|
40
|
+
el.props.onClick?.(e);
|
|
41
|
+
if (select === 'one')
|
|
42
|
+
request(v);
|
|
43
|
+
else {
|
|
44
|
+
const list = Array.isArray(shown) ? shown : [];
|
|
45
|
+
request(on(v) ? list.filter((x) => x !== v) : [...list, v]);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
if (strip)
|
|
51
|
+
return _jsx("div", { role: "tablist", "aria-label": label, className: cx('segment', look === 'choice' && 'segment--choice', className), ...rest, children: items });
|
|
52
|
+
const panel = (_jsx("div", { role: "group", "aria-label": line ? undefined : label, "aria-labelledby": line ? words : undefined, className: cx('icon-btn-group', form && 'icon-btn-group--form', vertical && !form && 'icon-btn-group--vertical', !line && className), ...(line ? {} : rest), children: items }));
|
|
53
|
+
if (!line)
|
|
54
|
+
return panel;
|
|
55
|
+
return _jsxs("div", { className: cx('icon-btn-line', className), ...rest, children: [_jsx("span", { id: words, className: "icon-btn-line__words", children: label }), panel] });
|
|
6
56
|
}
|
|
7
|
-
/** BtnGroupItem — one
|
|
57
|
+
/** BtnGroupItem — one item of words in a `BtnGroup look="strip"` or `look="choice"`. */
|
|
8
58
|
export function BtnGroupItem({ selected, className, ...rest }) {
|
|
9
59
|
return _jsx("button", { type: "button", role: "tab", "aria-selected": selected ? 'true' : undefined, className: cx('segment__item', className), ...rest });
|
|
10
60
|
}
|
package/dist/actions/BtnRow.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export interface BtnRowProps extends ComponentProps<'div'> {
|
|
|
3
3
|
/** a few big round `IconBtn`s (`size="xl"`), each its own size, as ONE group in the middle a fixed gap apart — the look of `Foot round`, in a card's
|
|
4
4
|
* content, so the card's `Foot` stays free for its status line. Knob `--btn-row-gap` (default `--sp-6` here, `--sp-2` for Btns) */
|
|
5
5
|
round?: boolean;
|
|
6
|
+
/** with `round`: a dotted link between each two buttons and a closer gap (× · ? · ✓ — the answers of a `ModalAsk`; was `BtnTrio`).
|
|
7
|
+
* Knobs `--btn-trio-gap`, `--btn-trio-dots-w`, `--btn-trio-dots-h` */
|
|
8
|
+
joined?: boolean;
|
|
6
9
|
}
|
|
7
|
-
/** BtnRow — twin CTAs inside a card's content sharing the width (Log time · Offer), or with `round` a group of round IconBtns there
|
|
8
|
-
|
|
10
|
+
/** BtnRow — twin CTAs inside a card's content sharing the width (Log time · Offer), or with `round` a group of round IconBtns there
|
|
11
|
+
* (`round joined`: linked by dots, the answers of a `ModalAsk`). In a foot use Foot instead. */
|
|
12
|
+
export declare function BtnRow({ round, joined, className, children, ...rest }: BtnRowProps): import("react").JSX.Element;
|
package/dist/actions/BtnRow.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from '../cx.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { joinDots } from './joined.js';
|
|
4
|
+
/** BtnRow — twin CTAs inside a card's content sharing the width (Log time · Offer), or with `round` a group of round IconBtns there
|
|
5
|
+
* (`round joined`: linked by dots, the answers of a `ModalAsk`). In a foot use Foot instead. */
|
|
6
|
+
export function BtnRow({ round, joined, className, children, ...rest }) {
|
|
7
|
+
return _jsx("div", { className: cx('btn-row', round && 'btn-row--round', joined && 'btn-row--joined', className), ...rest, children: joined ? joinDots(children) : children });
|
|
6
8
|
}
|
package/dist/actions/Chip.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface ChipProps extends ComponentProps<'span'> {
|
|
|
11
11
|
dot?: 'a' | 'b' | DotTone;
|
|
12
12
|
/** a small label: low and tight (a name on a note). Never with `as="button"` or `href` — it is under tap size */
|
|
13
13
|
sm?: boolean;
|
|
14
|
+
/** the smallest label: a count in a card's status row, the icon at its words' size. A label only, never a tap target */
|
|
15
|
+
xs?: boolean;
|
|
14
16
|
/** the element: span (default), a link, or a button */
|
|
15
17
|
as?: 'span' | 'a' | 'button';
|
|
16
18
|
/** makes the chip a link (an `a`) */
|
|
@@ -18,8 +20,8 @@ export interface ChipProps extends ComponentProps<'span'> {
|
|
|
18
20
|
/** the chip's words */
|
|
19
21
|
children?: ReactNode;
|
|
20
22
|
}
|
|
21
|
-
/** Chip — a status or attribute tag (with an optional signal Dot), or a small tap target; `sm` = a small label only; `soft` for a status that should be seen, `on` when it is the live one. For a choice use ChipPick (`sign` for the +/× interest picker). */
|
|
22
|
-
export declare function Chip({ on, soft, muted, dot, sm, as, href, className, children, ...rest }: ChipProps): import("react").DetailedReactHTMLElement<{
|
|
23
|
+
/** Chip — a status or attribute tag (with an optional signal Dot), or a small tap target; `sm` = a small label only, `xs` the smallest (a count in a status row); `soft` for a status that should be seen, `on` when it is the live one. For a choice use ChipPick (`sign` for the +/× interest picker). */
|
|
24
|
+
export declare function Chip({ on, soft, muted, dot, sm, xs, as, href, className, children, ...rest }: ChipProps): import("react").DetailedReactHTMLElement<{
|
|
23
25
|
ref?: import("react").Ref<HTMLSpanElement> | undefined;
|
|
24
26
|
key?: import("react").Key | null | undefined;
|
|
25
27
|
defaultChecked?: boolean | undefined;
|
package/dist/actions/Chip.js
CHANGED
|
@@ -3,10 +3,10 @@ import { createElement } from 'react';
|
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
4
|
import { tagged } from '../pressable.js';
|
|
5
5
|
import { Dot } from './Dot.js';
|
|
6
|
-
/** Chip — a status or attribute tag (with an optional signal Dot), or a small tap target; `sm` = a small label only; `soft` for a status that should be seen, `on` when it is the live one. For a choice use ChipPick (`sign` for the +/× interest picker). */
|
|
7
|
-
export function Chip({ on, soft, muted, dot, sm, as, href, className, children, ...rest }) {
|
|
6
|
+
/** Chip — a status or attribute tag (with an optional signal Dot), or a small tap target; `sm` = a small label only, `xs` the smallest (a count in a status row); `soft` for a status that should be seen, `on` when it is the live one. For a choice use ChipPick (`sign` for the +/× interest picker). */
|
|
7
|
+
export function Chip({ on, soft, muted, dot, sm, xs, as, href, className, children, ...rest }) {
|
|
8
8
|
const { el, props } = tagged(as, href);
|
|
9
|
-
return createElement(el, { ...props, className: cx('chip', on && 'chip--on', soft && !on && 'chip--soft', muted && 'chip--muted', sm && 'chip--sm', className), ...rest }, dot && _jsx(Dot, { b: dot === 'b', tone: dot === 'a' || dot === 'b' ? undefined : dot }), children);
|
|
9
|
+
return createElement(el, { ...props, className: cx('chip', on && 'chip--on', soft && !on && 'chip--soft', muted && 'chip--muted', sm && 'chip--sm', xs && 'chip--xs', className), ...rest }, dot && _jsx(Dot, { b: dot === 'b', tone: dot === 'a' || dot === 'b' ? undefined : dot }), children);
|
|
10
10
|
}
|
|
11
11
|
/** ChipPick — a chip that is a choice, on a sheet and never in a Card (the sheet is the paper the member fills in, Lh 2026-10-18): full-width in a ChipGrid (9:00 · 9:30 · …), or `sign` on a ChipRow (+ off, × on — the
|
|
12
12
|
* interest picker); the picked one fills with accent. A native radio/checkbox inside the label carries the state. */
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Children, Fragment, createElement } from 'react';
|
|
2
|
+
/* `joined` (BtnRow round, Foot round): a dotted link between each two buttons (was BtnTrio, Lh 2026-10-24). Not exported: the one
|
|
3
|
+
markup both rows draw */
|
|
4
|
+
export const joinDots = (children) => Children.toArray(children).map((child, i) => createElement(Fragment, { key: i }, i > 0 && createElement('span', { className: 'btn-trio__dots' }), child));
|