@usableapp/cardds 0.7.140 → 0.7.141

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.
@@ -4,10 +4,13 @@ export interface WordsProps extends Omit<ComponentProps<'span'>, 'title'> {
4
4
  title?: ReactNode;
5
5
  /** the caption under it (may hold a Dot); on an option row, only the difference that decides, one line, on every option of the list or on none */
6
6
  meta?: ReactNode;
7
+ /** the caption OVER the title (who asks, over the ask): it and the title stand together as one block, so beside a `Stamp` both lines take the
8
+ * words' column and the title wraps there as it does without it */
9
+ over?: ReactNode;
7
10
  /** the title as a heading element in that type level; without it the title is a span in title type. In a `Head` the title is always a heading: `h2` unless this says otherwise (`h1` for the one-feature page) */
8
11
  level?: 'h1' | 'h2' | 'display';
9
12
  }
10
- /** Words — the words of a line, filling the room between the lead and the end: a `title` over a `meta` caption;
13
+ /** Words — the words of a line, filling the room between the lead and the end: a `title` over a `meta` caption, maybe under an `over` caption;
11
14
  * its children come under them, or instead of them (a Wave for a voice note). In a `Head` there is no box round them: the title and the meta
12
15
  * stand in the head, and a `className`, an `id` or any other attribute goes on the title. */
13
- export declare function Words({ title, meta, level, className, children, ...rest }: WordsProps): import("react").JSX.Element;
16
+ export declare function Words({ title, meta, over, level, className, children, ...rest }: WordsProps): import("react").JSX.Element;
@@ -1,11 +1,11 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useContext } from 'react';
3
3
  import { cx } from '../cx.js';
4
4
  import { HeadCtx, onTitleKey } from './headCtx.js';
5
- /** Words — the words of a line, filling the room between the lead and the end: a `title` over a `meta` caption;
5
+ /** Words — the words of a line, filling the room between the lead and the end: a `title` over a `meta` caption, maybe under an `over` caption;
6
6
  * its children come under them, or instead of them (a Wave for a voice note). In a `Head` there is no box round them: the title and the meta
7
7
  * stand in the head, and a `className`, an `id` or any other attribute goes on the title. */
8
- export function Words({ title, meta, level, className, children, ...rest }) {
8
+ export function Words({ title, meta, over, level, className, children, ...rest }) {
9
9
  const head = useContext(HeadCtx);
10
10
  if (head) {
11
11
  const as = level ?? 'h2';
@@ -13,8 +13,9 @@ export function Words({ title, meta, level, className, children, ...rest }) {
13
13
  const { onKeyDown, ...own } = rest;
14
14
  const attrs = head.tab != null ? { tabIndex: head.tab, onKeyDown: (e) => { onKeyDown?.(e); if (!e.defaultPrevented)
15
15
  onTitleKey(e); } } : { onKeyDown };
16
- return (_jsxs(_Fragment, { children: [title != null && _jsx(Title, { className: cx('words__title', `t-${as}`, head.long && 'is-long', className), ...own, ...attrs, children: title }), meta != null && _jsx("span", { className: "words__meta t-caption t-muted", children: meta }), children] }));
16
+ const titled = title != null && _jsx(Title, { className: cx('words__title', `t-${as}`, head.long && 'is-long', className), ...own, ...attrs, children: title });
17
+ return (_jsxs(_Fragment, { children: [over != null ? _jsxs("div", { className: "words__over-title", children: [_jsx("span", { className: "words__over t-caption", children: over }), titled] }) : titled, meta != null && _jsx("span", { className: "words__meta t-caption t-muted", children: meta }), children] }));
17
18
  }
18
19
  const Title = level === 'h1' ? 'h1' : level ? 'h2' : 'span';
19
- return (_jsxs("span", { className: cx('words', className), ...rest, children: [title != null && _jsx(Title, { className: cx('words__title', level && `t-${level}`), children: title }), meta != null && _jsx("span", { className: "words__meta", children: meta }), children] }));
20
+ return (_jsxs("span", { className: cx('words', className), ...rest, children: [over != null && _jsx("span", { className: "words__over t-caption", children: over }), title != null && _jsx(Title, { className: cx('words__title', level && `t-${level}`), children: title }), meta != null && _jsx("span", { className: "words__meta", children: meta }), children] }));
20
21
  }
package/docs/reference.md CHANGED
@@ -875,7 +875,8 @@ it up. cardds draws the paper; the pictures, their words and which stamp a membe
875
875
  middle and the words and link under it centre. In a card's head — `<Card foot={<Btn primary block>…</Btn>}><Head><Words title={name} meta={greeting} /><Stamp bare …/></Head></Card>` — the words stand at the left and the stamp at the right,
876
876
  beside both lines (`Stamp under`: the words keep no room for it, they run the head's whole width over the stamp, which lies under them in
877
877
  its place and size — for a long title); in a head that leads with a date (a `JourneyBadge`, then a `ChipRow`) it stands on a row of its own under the
878
- date and the chips, in the order given. The card's one button presses it whole. In an `AvatarStack` it is a head, the small size
878
+ date and the chips, in the order given. Who asks over the ask is `Words over`: `<Head><Words level="h1" over="Somsri asks for help" title={ask} /><Stamp …/></Head>`
879
+ — the caption over the title, the two one block beside the stamp, the title wrapping there. The card's one button presses it whole. In an `AvatarStack` it is a head, the small size
879
880
  (`more="+9"` for the count).
880
881
  - **`StampOn`** — a stamp stuck on a surface. `at` is the stamp's middle as a share of the surface (`{ x, y }`, 0 to 1),
881
882
  `turn` its angle in degrees. With `onAtChange` the member drags it (the arrow keys move it too) and it asks with the
@@ -1315,7 +1316,7 @@ reads every value from a token in `css/tokens.css` (or a palette, a finish, a pr
1315
1316
  - **type**: the eight kinds (display, h1, h2, title, body, label, caption, stat) each have `--face-<kind>`, `--fw-<kind>`,
1316
1317
  `--fs-<kind>`, `--lh-<kind>` and `--track-<kind>`, and `--type-<kind>` is made of them. A piece set on a size outside the
1317
1318
  kinds composes its `font:` from the scales: `--fs-*`, weight `--fw-regular` … `--fw-black`, leading `--lh-mark` … `--lh-ruled`.
1318
- Gallery `Text · Kinds` shows them resolved. An h1's caption, over it or under it, keeps to the heading's leading
1319
+ Gallery `Text · Kinds` shows them resolved. An h1's caption, over it (`Words over`) or under it (`Words meta`), keeps to the heading's leading
1319
1320
  (`--lh-h1-caption`); a caption over an h1 that wraps starts where a one-line one does, its next line goes down and the
1320
1321
  h1 with it (gallery `Text · HeadingWraps`).
1321
1322
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.140",
3
+ "version": "0.7.141",
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).",