@usableapp/cardds 0.7.141 → 0.7.143

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.
@@ -0,0 +1,31 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ import type { IconName } from '../type/Icon.js';
3
+ export interface MessageBarProps extends Omit<ComponentProps<'textarea'>, 'value' | 'defaultValue' | 'onChange' | 'className' | 'style' | 'children'> {
4
+ /** CONTROLLED: the words in the box — with `onValueChange`; or `defaultValue` */
5
+ value?: string;
6
+ /** UNCONTROLLED: the words it starts with (default empty) */
7
+ defaultValue?: string;
8
+ /** it asks: the member typed — and, after a send, asks for the box to be empty again ('') */
9
+ onValueChange?: (value: string) => void;
10
+ /** the send button was pressed with words in the box: the words, as typed. What sending does is the app's */
11
+ onSend?: (value: string) => void;
12
+ /** the send button's accessible name ("Send", "ส่ง") — the app's word, cardds has none */
13
+ sendLabel: string;
14
+ /** the send button's icon (default `arrow-up`) */
15
+ sendIcon?: IconName;
16
+ /** what stands before the box: an extra action (an `IconBtn` — attach, a photo) */
17
+ lead?: ReactNode;
18
+ /** classes for the bar, not the textarea */
19
+ className?: string;
20
+ /** inline style for the bar, not the textarea */
21
+ style?: React.CSSProperties;
22
+ }
23
+ /**
24
+ * MessageBar — the box a chat's message is typed in, at the foot of a conversation (a `Thread` of `Bubble`s): lead · the box · send.
25
+ * The box starts one line tall and grows with the words up to five lines (`--message-bar-input-max-h`), then scrolls. The send button
26
+ * (an `IconBtn invert`) is off while the box holds only blanks; pressing it hands the words to `onSend` and asks for an empty box, and
27
+ * the cursor stays in the box, so the keyboard stays up. The Screen's `bottom` (`<Screen fill bottom={<MessageBar…>}>`): a layer over
28
+ * the content's foot that rides above the keyboard (`--kb`), the conversation's last words scroll clear of it. Controlled like an
29
+ * input: `value` + `onValueChange`, or `defaultValue`.
30
+ */
31
+ export declare function MessageBar({ value, defaultValue, onValueChange, onSend, sendLabel, sendIcon, lead, className, style, rows, ...textarea }: MessageBarProps): import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from '../cx.js';
3
+ import { useControlled } from '../state.js';
4
+ import { IconBtn } from '../actions/IconBtn.js';
5
+ /**
6
+ * MessageBar — the box a chat's message is typed in, at the foot of a conversation (a `Thread` of `Bubble`s): lead · the box · send.
7
+ * The box starts one line tall and grows with the words up to five lines (`--message-bar-input-max-h`), then scrolls. The send button
8
+ * (an `IconBtn invert`) is off while the box holds only blanks; pressing it hands the words to `onSend` and asks for an empty box, and
9
+ * the cursor stays in the box, so the keyboard stays up. The Screen's `bottom` (`<Screen fill bottom={<MessageBar…>}>`): a layer over
10
+ * the content's foot that rides above the keyboard (`--kb`), the conversation's last words scroll clear of it. Controlled like an
11
+ * input: `value` + `onValueChange`, or `defaultValue`.
12
+ */
13
+ export function MessageBar({ value, defaultValue = '', onValueChange, onSend, sendLabel, sendIcon = 'arrow-up', lead, className, style, rows = 1, ...textarea }) {
14
+ const [shown, request] = useControlled(value, defaultValue, onValueChange);
15
+ const empty = !shown.trim();
16
+ const send = () => {
17
+ if (empty)
18
+ return;
19
+ onSend?.(shown);
20
+ request('');
21
+ };
22
+ return (_jsxs("div", { className: cx('message-bar', className), style: style, children: [lead, _jsx("div", { className: "message-bar__box", "data-value": shown, children: _jsx("textarea", { className: "message-bar__input", rows: rows, ...textarea, value: shown, onChange: (e) => request(e.currentTarget.value) }) }), _jsx(IconBtn, { invert: true, icon: sendIcon, label: sendLabel, disabled: empty, onPointerDown: (e) => e.preventDefault(), onClick: send })] }));
23
+ }
package/dist/index.d.ts CHANGED
@@ -49,6 +49,7 @@ export * from './forms/FileBtn.js';
49
49
  export * from './forms/AddRow.js';
50
50
  export * from './forms/Pin.js';
51
51
  export * from './forms/Composer.js';
52
+ export * from './forms/MessageBar.js';
52
53
  export * from './choice/Check.js';
53
54
  export * from './choice/DayStrip.js';
54
55
  export * from './choice/Calendar.js';
package/dist/index.js CHANGED
@@ -53,6 +53,7 @@ export * from './forms/FileBtn.js';
53
53
  export * from './forms/AddRow.js';
54
54
  export * from './forms/Pin.js';
55
55
  export * from './forms/Composer.js';
56
+ export * from './forms/MessageBar.js';
56
57
  export * from './choice/Check.js';
57
58
  export * from './choice/DayStrip.js';
58
59
  export * from './choice/Calendar.js';
@@ -1,6 +1,6 @@
1
1
  import type { ComponentProps, ReactNode } from 'react';
2
2
  export interface AppBarProps extends Omit<ComponentProps<'header'>, 'title'> {
3
- /** the app or brand mark on the left (an Icon) */
3
+ /** the app or brand mark on the left (an Icon, an Avatar, or a `Stamp`: a stamp here is the bar's inner height tall, `--appbar-stamp-size`) */
4
4
  icon?: ReactNode;
5
5
  /** the context: which app, which place, which account */
6
6
  title: ReactNode;
@@ -9,7 +9,7 @@ export interface ScreenProps extends ComponentProps<'div'> {
9
9
  as?: 'div' | 'main' | 'section';
10
10
  /** TOP: a `TopBar` / `AppBar`, or `"lead"` — no bar, the content starts `--screen-lead` (15% of the screen) down */
11
11
  top?: ReactNode | 'lead';
12
- /** BOTTOM: an `ActionBar` (or a `FloatBar`) — a LAYER over the content's foot, as tall as its rows need.
12
+ /** BOTTOM: an `ActionBar` (or a `FloatBar`, or a chat's `MessageBar`) — a LAYER over the content's foot, as tall as its rows need.
13
13
  * Never with a `Sheet` in the content: a sheet finishes on its own foot (warns once). */
14
14
  bottom?: ReactNode;
15
15
  /** `false` while the app does not yet know WHICH screen this is (signed in or not, a member with or without a request…):
@@ -21,7 +21,7 @@ export function Screen({ fill, palette, as = 'div', top, bottom, ready = true, c
21
21
  /* the BOTTOM layer's height, published on the screen as --bottom-h (Lh 2026-09-23): the walk's pages end with that much room
22
22
  more, so every last word scrolls up clear of the layer. Measured, because the layer is as tall as its rows and the text size. */
23
23
  useEffect(() => {
24
- const el = own.current, bar = el?.querySelector(':scope > .action-bar');
24
+ const el = own.current, bar = el?.querySelector(':scope > :is(.action-bar, .message-bar)');
25
25
  if (!el || !bar) {
26
26
  el?.style.removeProperty('--bottom-h');
27
27
  return;
package/docs/reference.md CHANGED
@@ -328,7 +328,7 @@ of `Screen`:
328
328
  |---|---|---|
329
329
  | **top** | `top` | `TopBar` · `AppBar` · `"lead"` (no bar: the content starts `--screen-lead`, 15% of the screen, down) |
330
330
  | **content** | children | a `Step` (`Pages` · `Page` · `Page` + `Sheet`) · `Centre` · `SheetStack` … |
331
- | **bottom** | `bottom` | `ActionBar` (rows: `controls` · the one `cta` row — the pager bar ← → or one wide button · a `ctaLink`) · `FloatBar` · nothing |
331
+ | **bottom** | `bottom` | `ActionBar` (rows: `controls` · the one `cta` row — the pager bar ← → or one wide button · a `ctaLink`) · `FloatBar` · `MessageBar` (a chat) · nothing |
332
332
 
333
333
  ```tsx
334
334
  <Screen fill top="lead" bottom={<ActionBar variant="pager">…</ActionBar>}>
@@ -341,6 +341,13 @@ of `Screen`:
341
341
  covers what is under it — on purpose, nothing is added to the content to make room. The keyboard lifts the layer (`--kb`).
342
342
  - **The bar is INSIDE the screen** — `bottom`, never a sibling after `</Screen>`, never pinned with a hand-set `position`.
343
343
  A `FloatBar` in `bottom` floats the same way.
344
+ - **A chat's bottom is its `MessageBar`** — the box the member types a message in, under a `Thread` of `Bubble`s in a
345
+ `Step` › `Page` (`<Screen fill top={…} bottom={<MessageBar…>}>`). lead (an extra action, an `IconBtn`) · the box · an
346
+ `IconBtn invert` send that is off while the box holds only blanks. The box starts one line tall and grows with the words up
347
+ to five lines (`--message-bar-input-max-h`), then scrolls. Controlled like an input (`value` + `onValueChange`, or
348
+ `defaultValue`); `onSend(words)` hands them to the app, then the bar asks for an empty box; the cursor stays in the box, so
349
+ the keyboard stays up. It is a layer like the `ActionBar`: measured into `--bottom-h`, lifted by `--kb`. It is not the
350
+ `Composer` (the one big write-in on a sheet) and not a sheet's form: a message is sent from where it is read.
344
351
  - **A screen with a `Sheet` has no bottom.** The sheet finishes on its own `Foot`; `Screen` warns once when both
345
352
  are there.
346
353
  - **Templates** are `Screen`s with the three parts filled (`Walkthrough` = top `lead` · content `Pages` · bottom
@@ -847,6 +854,8 @@ it up. cardds draws the paper; the pictures, their words and which stamp a membe
847
854
  stamp in an `AvatarStack` are `--stamp-sm-size` wide (one tap: 48 × 60), on any surface and in any row. And the inline
848
855
  one: `Stamp xs` stands beside a status line's words (a card's `Foot`: the stamp, "X took it", a round button), one
849
856
  `Chip xs` tall, `--stamp-xs-size` (18.7 × 23.4, on `--fs-base`); always bare, flat but for the contact shadow, its teeth fewer and larger.
857
+ A `Stamp` as an `AppBar`'s `icon` is the bar's inner height tall (`--header-h` less the bar's block padding: 35 × 44), so it reads
858
+ bigger than the title and its second line and the fixed bar never grows; bare and flat whatever it is handed. Knob `--appbar-stamp-size`.
850
859
  Several lap in an `AvatarStack` with `more` ("+8"), the count then at the chip's scale. In a card's head band the stamp keeps the head's padding below it as well as above (`--card-pad`, not the seam), so the head is never shorter
851
860
  than the stamp plus its padding, plain or `under`. A stamp the app is not ready to show yet is `held`: it keeps its box, draws nothing,
852
861
  is hidden from screen readers, and appears in the same box when `held` turns false, so nothing beside it moves (any size). The stamps in
@@ -854,7 +863,8 @@ it up. cardds draws the paper; the pictures, their words and which stamp a membe
854
863
  the postcard's own size, 72 × 90 (`--post-corner-stamp-w`), in neither. `words` is not drawn on a stamp 96 wide or
855
864
  narrower, so at the standard size only `name` shows, and it is larger.
856
865
  - **Every stamp has a thin contact shadow** (2026-10-26): at every size, `xs` and a `StampOn` too, on a card or off it — paper a hair off
857
- its ground, so its edge shows on any ground, a white one included (`--shadow-contact`, knob `--stamp-shadow`). What follows is the shadow it gets on top of that.
866
+ its ground, so its edge shows on any ground, a white one included (knob `--stamp-shadow`, a hair lighter than `--shadow-contact`). By default it is
867
+ the only shadow a stamp has (Lh 2026-10-26: contact only); `--stamp-drop` adds a lift off a card, none by default. What follows is where a stamp gets more.
858
868
  - **A stamp on a card lies flat** (Lh 2026-10-24): no lift, only the contact shadow, at every size — a `FeedCard`'s lead, a
859
869
  `Foot` row's, `xs`. A stamp in a card's head is glued down (Lh 2026-10-25): plain, `under` or `sm`, a hair of shadow
860
870
  under paper (`--shadow-glued`, knob `--stamp-under-drop`); `bare` and `xs` stay flat (contact shadow only). One rule by where it stands (`stamp.css`), nothing to pass. A stamp off a card keeps its shadow: the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.141",
3
+ "version": "0.7.143",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "description": "card-first mobile design system, React-first: the components in src/ are thin wrappers over the CSS contract (css/*.css stays the only truth); gallery/ shows every story live (npm run dev).",