@usableapp/cardds 0.7.160 → 0.7.162
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 +43 -0
- package/css/actions.css +27 -34
- package/css/base.css +8 -5
- package/css/card.css +5 -5
- package/css/journey.css +5 -7
- package/css/layover.css +0 -1
- package/css/lists.css +2 -2
- package/css/media.css +5 -0
- package/css/numbers.css +1 -1
- package/css/palette.css +1 -1
- package/css/parts.css +78 -40
- package/css/sheet.css +1 -1
- package/css/stack.css +13 -5
- package/css/stamp.css +30 -30
- package/css/tokens.css +37 -4
- package/dist/actions/Btn.d.ts +59 -28
- package/dist/actions/Btn.js +17 -5
- package/dist/actions/BtnGroup.d.ts +3 -3
- package/dist/actions/BtnGroup.js +2 -2
- package/dist/actions/BtnRow.d.ts +2 -2
- package/dist/actions/BtnRow.js +1 -1
- package/dist/actions/Chip.d.ts +1 -1
- package/dist/actions/Fab.d.ts +11 -7
- package/dist/actions/Fab.js +6 -5
- package/dist/actions/LinkBlock.d.ts +4 -2
- package/dist/actions/LinkBlock.js +6 -3
- package/dist/cardds.css +213 -136
- package/dist/cards/CardParts.d.ts +1 -1
- package/dist/cards/CardParts.js +1 -1
- package/dist/catalog.json +1 -1
- package/dist/choice/Calendar.js +2 -2
- package/dist/forms/Composer.d.ts +2 -2
- package/dist/forms/Field.d.ts +1 -1
- package/dist/forms/Field.js +1 -1
- package/dist/forms/FileBtn.d.ts +8 -7
- package/dist/forms/FileBtn.js +3 -3
- package/dist/forms/MessageBar.d.ts +2 -2
- package/dist/forms/MessageBar.js +4 -4
- package/dist/forms/Pin.js +2 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/journey/JourneyBadge.d.ts +7 -4
- package/dist/journey/JourneyBadge.js +3 -3
- package/dist/lists/Bubble.d.ts +6 -6
- package/dist/lists/Row.js +5 -2
- package/dist/media/Postcard.d.ts +1 -1
- package/dist/media/Postcard.js +2 -2
- package/dist/media/Tile.d.ts +4 -6
- package/dist/media/Tile.js +2 -2
- package/dist/parts/End.d.ts +1 -1
- package/dist/parts/End.js +1 -1
- package/dist/parts/Foot.d.ts +3 -3
- package/dist/parts/Foot.js +1 -1
- package/dist/parts/Head.d.ts +3 -1
- package/dist/parts/Head.js +7 -2
- package/dist/parts/Words.d.ts +3 -1
- package/dist/parts/Words.js +13 -3
- package/dist/parts/endRoom.d.ts +11 -0
- package/dist/parts/endRoom.js +40 -0
- package/dist/post/PostDesk.js +2 -3
- package/dist/post/PostLetter.js +2 -2
- package/dist/scaffold/ActionBar.d.ts +4 -4
- package/dist/scaffold/ActionBar.js +3 -3
- package/dist/scaffold/AppBar.d.ts +1 -1
- package/dist/scaffold/FloatBar.d.ts +1 -1
- package/dist/scaffold/TopBar.d.ts +2 -2
- package/dist/sheets/Modal.d.ts +2 -2
- package/dist/sheets/Modal.js +2 -2
- package/dist/sheets/Sheet.d.ts +1 -1
- package/dist/sheets/Sheet.js +1 -1
- package/dist/sheets/SheetStack.js +3 -4
- package/dist/sheets/StackBack.d.ts +1 -1
- package/dist/sheets/StackBack.js +2 -3
- package/dist/sheets/StackSheet.d.ts +1 -1
- package/dist/sheets/StackSheet.js +2 -3
- package/dist/sheets/sheetDrag.js +2 -2
- package/dist/sheets/stackCard.js +5 -6
- package/dist/stamp/Stamp.d.ts +4 -2
- package/dist/stamp/Stamp.js +2 -2
- package/dist/state.d.ts +2 -0
- package/dist/state.js +9 -0
- package/dist/sticky/Sticky.d.ts +1 -1
- package/dist/sticky/StickyAnswer.d.ts +1 -1
- package/dist/sticky/StickyHeading.d.ts +2 -2
- package/dist/templates/CallSheet.js +1 -1
- package/dist/templates/Walkthrough.js +2 -2
- package/dist/type/Icon.d.ts +1 -1
- package/dist/type/Icon.js +1 -1
- package/dist/type/textScale.d.ts +4 -3
- package/dist/type/textScale.js +4 -3
- package/docs/reference.md +45 -25
- package/lint/rules.mjs +7 -7
- package/package.json +3 -1
- package/scripts/codemod-parts.mjs +1 -1
- package/dist/actions/IconBtn.d.ts +0 -326
- package/dist/actions/IconBtn.js +0 -19
package/dist/choice/Calendar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useControlled } from '../state.js';
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
|
-
import {
|
|
4
|
+
import { Btn } from '../actions/Btn.js';
|
|
5
5
|
import { word } from '../words.js';
|
|
6
6
|
import { calendarDay } from './calendarDay.js';
|
|
7
7
|
import { useSpan } from './span.js';
|
|
@@ -18,7 +18,7 @@ export function Calendar({ title, days = 30, start = 1, selected, defaultSelecte
|
|
|
18
18
|
onSpanChange: onSpanChange && ((s) => onSpanChange([s[0] + 1, s[1] + 1])),
|
|
19
19
|
blocked: (i) => i < 0 || i >= days || disabled.includes(i + 1),
|
|
20
20
|
});
|
|
21
|
-
return (_jsxs("div", { className: cx('calendar', spanning && 'calendar--span', className), ...rest, children: [_jsxs("div", { className: "calendar__head", children: [_jsx("span", { className: "t-title", children: title }), nav ?? (_jsxs("span", { className: "icon-row", children: [_jsx(
|
|
21
|
+
return (_jsxs("div", { className: cx('calendar', spanning && 'calendar--span', className), ...rest, children: [_jsxs("div", { className: "calendar__head", children: [_jsx("span", { className: "t-title", children: title }), nav ?? (_jsxs("span", { className: "icon-row", children: [_jsx(Btn, { shape: "round", size: "sm", icon: "chevron-left", label: prevLabel, onClick: onPrev }), _jsx(Btn, { shape: "round", size: "sm", icon: "chevron-right", label: nextLabel, onClick: onNext })] }))] }), _jsxs("div", { className: "calendar__grid", ...(spanning ? run.box : {}), children: [weekdays.map((d) => _jsx("span", { className: "calendar__wd", children: d }, d)), Array.from({ length: days }, (_, i) => i + 1).map((d) => (calendarDay({
|
|
22
22
|
key: d, num: d, mark: marks.includes(d), mark2: marks2.includes(d), selected: !spanning && d === day, disabled: disabled.includes(d),
|
|
23
23
|
style: d === 1 ? { '--start': start } : undefined,
|
|
24
24
|
onPick: () => (spanning ? run.tap(d - 1) : pick(d)),
|
package/dist/forms/Composer.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { type MentionPerson } from './mention.js';
|
|
|
3
3
|
export interface ComposerProps extends Omit<ComponentProps<'textarea'>, 'className' | 'style' | 'children'> {
|
|
4
4
|
/** the caption between the two buttons ("Your request is born") */
|
|
5
5
|
hint?: ReactNode;
|
|
6
|
-
/** the left button of the bar (
|
|
6
|
+
/** the left button of the bar (a round Btn — voice) */
|
|
7
7
|
lead?: ReactNode;
|
|
8
|
-
/** the right button of the bar (
|
|
8
|
+
/** the right button of the bar (a `Btn shape="round" tone="primary"` — send) */
|
|
9
9
|
send?: ReactNode;
|
|
10
10
|
/** the people the member can name with `@` in the first area: typing `@` lists them under it, a pick writes `@name ` and marks it as one piece. Without it, `@` is a letter */
|
|
11
11
|
people?: MentionPerson[];
|
package/dist/forms/Field.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type IconName } from '../type/Icon.js';
|
|
|
3
3
|
export interface FieldProps extends Omit<ComponentProps<'input'>, 'className' | 'style'> {
|
|
4
4
|
/** a leading icon (phone-call, plane, calendar-days) */
|
|
5
5
|
icon?: IconName;
|
|
6
|
-
/** an action inside the field, flush right —
|
|
6
|
+
/** an action inside the field, flush right — a `Btn shape="round" size="sm" tone="primary"` */
|
|
7
7
|
action?: ReactNode;
|
|
8
8
|
/** the accessible name when the placeholder is not enough */
|
|
9
9
|
label?: string;
|
package/dist/forms/Field.js
CHANGED
|
@@ -110,7 +110,7 @@ export function Field({ icon, action, label, error, format: formatProp, digits:
|
|
|
110
110
|
ref.current?.focus();
|
|
111
111
|
ref.current?.select();
|
|
112
112
|
}
|
|
113
|
-
//
|
|
113
|
+
// when the app's error comes or changes
|
|
114
114
|
}, [error]);
|
|
115
115
|
const onBlurField = (e) => {
|
|
116
116
|
onBlur?.(e);
|
package/dist/forms/FileBtn.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
primary
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import type { BtnSize, BtnTone } from '../actions/Btn.js';
|
|
3
|
+
export interface FileBtnProps extends Omit<ComponentProps<'input'>, 'type' | 'className' | 'style' | 'children' | 'size'> {
|
|
4
|
+
/** a Btn's tone: `default` · `primary` (the one forward move) · `quiet` (ink on whatever it sits on, a faint outline) · `warn` */
|
|
5
|
+
tone?: BtnTone;
|
|
6
|
+
/** a Btn's size, on the one ladder (`sm` 44 · `md` 48, default · `lg` 56 · `xl` 88) */
|
|
7
|
+
size?: BtnSize;
|
|
7
8
|
/** full width */
|
|
8
9
|
block?: boolean;
|
|
9
10
|
/** the button's words (and an Icon, if any) */
|
|
@@ -12,8 +13,8 @@ export interface FileBtnProps extends Omit<ComponentProps<'input'>, 'type' | 'cl
|
|
|
12
13
|
className?: string;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
* FileBtn — a Btn that opens the device's file picker: the button IS the label of a hidden file input, so the
|
|
16
|
+
* FileBtn — a Btn (a pill: `tone`, `size`, `block` as a Btn's) that opens the device's file picker: the button IS the label of a hidden file input, so the
|
|
16
17
|
* whole button is the tap target and nothing is forwarded by script. `accept="image/*" capture="environment"`
|
|
17
18
|
* opens the camera; without `capture` the gallery. The picked file arrives in `onChange` like any input. On a sheet, never in a Card: the sheet is the paper the member fills in (Lh 2026-10-18).
|
|
18
19
|
*/
|
|
19
|
-
export declare function FileBtn({
|
|
20
|
+
export declare function FileBtn({ tone, size, block, className, children, ...input }: FileBtnProps): import("react").JSX.Element;
|
package/dist/forms/FileBtn.js
CHANGED
|
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { cx } from '../cx.js';
|
|
3
3
|
import { useStepCursor } from '../sheets/stepCursor.js';
|
|
4
4
|
/**
|
|
5
|
-
* FileBtn — a Btn that opens the device's file picker: the button IS the label of a hidden file input, so the
|
|
5
|
+
* FileBtn — a Btn (a pill: `tone`, `size`, `block` as a Btn's) that opens the device's file picker: the button IS the label of a hidden file input, so the
|
|
6
6
|
* whole button is the tap target and nothing is forwarded by script. `accept="image/*" capture="environment"`
|
|
7
7
|
* opens the camera; without `capture` the gallery. The picked file arrives in `onChange` like any input. On a sheet, never in a Card: the sheet is the paper the member fills in (Lh 2026-10-18).
|
|
8
8
|
*/
|
|
9
|
-
export function FileBtn({
|
|
9
|
+
export function FileBtn({ tone, size, block, className, children, ...input }) {
|
|
10
10
|
const cursor = useStepCursor();
|
|
11
|
-
return (_jsxs("label", { className: cx('btn',
|
|
11
|
+
return (_jsxs("label", { className: cx('btn', size && size !== 'md' && `btn--${size}`, tone && tone !== 'default' && `btn--${tone}`, block && 'btn--block', className), children: [_jsx("input", { type: "file", className: "t-sr", ...input, ...cursor }), children] }));
|
|
12
12
|
}
|
|
@@ -14,7 +14,7 @@ export interface MessageBarProps extends Omit<ComponentProps<'textarea'>, 'value
|
|
|
14
14
|
sendLabel: string;
|
|
15
15
|
/** the send button's icon (default `arrow-up`) */
|
|
16
16
|
sendIcon?: IconName;
|
|
17
|
-
/** what stands before the box: an extra action (
|
|
17
|
+
/** what stands before the box: an extra action (a round `Btn` — attach, a photo) */
|
|
18
18
|
lead?: ReactNode;
|
|
19
19
|
/** the people the member can name with `@`: typing `@` lists them above the bar, a pick writes `@name ` and marks it as one piece. Without it, `@` is a letter */
|
|
20
20
|
people?: MentionPerson[];
|
|
@@ -35,7 +35,7 @@ export interface MessageBarProps extends Omit<ComponentProps<'textarea'>, 'value
|
|
|
35
35
|
/**
|
|
36
36
|
* 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.
|
|
37
37
|
* 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
|
|
38
|
-
* (
|
|
38
|
+
* (a `Btn shape="round" tone="primary"`) is off while the box holds only blanks; pressing it hands the words to `onSend` and asks for an empty box, and
|
|
39
39
|
* the cursor stays in the box, so the keyboard stays up. Two homes: the Screen's `bottom` (`<Screen fill bottom={<MessageBar…>}>`), a layer over
|
|
40
40
|
* the content's foot that rides above the keyboard (`--kb`), the conversation's last words scroll clear of it; or a SHEET's foot — a chat that
|
|
41
41
|
* opens as a Sheet (`<Foot><MessageBar…/></Foot>`): the bar takes the foot's line and its padding, stands on the sheet's bottom edge above the
|
package/dist/forms/MessageBar.js
CHANGED
|
@@ -3,11 +3,11 @@ import { useRef } from 'react';
|
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
4
|
import { setRefs, useControlled, warnOnce } from '../state.js';
|
|
5
5
|
import { useMention } from './mention.js';
|
|
6
|
-
import {
|
|
6
|
+
import { Btn } from '../actions/Btn.js';
|
|
7
7
|
/**
|
|
8
8
|
* 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.
|
|
9
9
|
* 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
|
|
10
|
-
* (
|
|
10
|
+
* (a `Btn shape="round" tone="primary"`) is off while the box holds only blanks; pressing it hands the words to `onSend` and asks for an empty box, and
|
|
11
11
|
* the cursor stays in the box, so the keyboard stays up. Two homes: the Screen's `bottom` (`<Screen fill bottom={<MessageBar…>}>`), a layer over
|
|
12
12
|
* the content's foot that rides above the keyboard (`--kb`), the conversation's last words scroll clear of it; or a SHEET's foot — a chat that
|
|
13
13
|
* opens as a Sheet (`<Foot><MessageBar…/></Foot>`): the bar takes the foot's line and its padding, stands on the sheet's bottom edge above the
|
|
@@ -30,7 +30,7 @@ export function MessageBar({ value, defaultValue = '', onValueChange, onSend, se
|
|
|
30
30
|
onSend?.(shown);
|
|
31
31
|
request('');
|
|
32
32
|
};
|
|
33
|
-
return (_jsxs("div", { className: cx('message-bar', className), style: style, children: [mention.list, quote != null && (_jsxs("div", { className: "message-bar__quote", children: [_jsx("span", { className: "message-bar__quote-words", children: quote }), onQuoteClose && _jsx(
|
|
33
|
+
return (_jsxs("div", { className: cx('message-bar', className), style: style, children: [mention.list, quote != null && (_jsxs("div", { className: "message-bar__quote", children: [_jsx("span", { className: "message-bar__quote-words", children: quote }), onQuoteClose && _jsx(Btn, { shape: "round", size: "sm", icon: "x", label: quoteCloseLabel ?? '', onPointerDown: (e) => e.preventDefault(), onClick: onQuoteClose })] })), lead, _jsxs("div", { className: "message-bar__box", "data-value": shown, children: [mention.under && _jsx("div", { ref: under, className: "message-bar__input mention-under", "aria-hidden": "true", children: mention.under }), _jsx("textarea", { ref: setRefs(box, ref), className: "message-bar__input", rows: rows, ...textarea, value: shown, onChange: (e) => request(e.currentTarget.value), onKeyDown: (e) => { onKeyDown?.(e); if (!e.defaultPrevented)
|
|
34
34
|
mention.onKeyDown(e); }, onSelect: (e) => { onSelect?.(e); mention.look(); }, onBlur: (e) => { onBlur?.(e); mention.leave(); }, onScroll: (e) => { onScroll?.(e); if (under.current)
|
|
35
|
-
under.current.scrollTop = e.currentTarget.scrollTop; } })] }), _jsx(
|
|
35
|
+
under.current.scrollTop = e.currentTarget.scrollTop; } })] }), _jsx(Btn, { shape: "round", tone: "primary", icon: sendIcon, label: sendLabel, disabled: empty, onPointerDown: (e) => e.preventDefault(), onClick: send })] }));
|
|
36
36
|
}
|
package/dist/forms/Pin.js
CHANGED
|
@@ -52,7 +52,7 @@ export function Pin({ length = 6, value, defaultValue = '', label = word('digit'
|
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
if (autoFocus)
|
|
54
54
|
cell(Math.min(code.length, length - 1))?.focus();
|
|
55
|
-
//
|
|
55
|
+
// on mount only
|
|
56
56
|
}, [autoFocus]);
|
|
57
57
|
const [bad, setBad] = useState(false); // a format check failed, and nothing was typed since
|
|
58
58
|
const [shake, setShake] = useState(false); // plays once per miss; off again at its animationend
|
|
@@ -100,7 +100,6 @@ export function Pin({ length = 6, value, defaultValue = '', label = word('digit'
|
|
|
100
100
|
return;
|
|
101
101
|
cell(0)?.focus();
|
|
102
102
|
miss(); // each new error, once
|
|
103
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- each new error, once
|
|
104
103
|
}, [error]);
|
|
105
104
|
/* the app emptied the code (a new try: it went back after a mismatch): the red goes with it */
|
|
106
105
|
useEffect(() => {
|
|
@@ -109,7 +108,7 @@ export function Pin({ length = 6, value, defaultValue = '', label = word('digit'
|
|
|
109
108
|
setBad(false);
|
|
110
109
|
say(null);
|
|
111
110
|
restart.current = false;
|
|
112
|
-
//
|
|
111
|
+
// when the code is emptied from outside
|
|
113
112
|
}, [code]);
|
|
114
113
|
const input = (i) => (e) => {
|
|
115
114
|
wake(); // a digit arrived: the keyboard is there — and the cell the Pin moves on to is ready too
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ export * from './sheets/SheetSteps.js';
|
|
|
35
35
|
export * from './sheets/SheetSettings.js';
|
|
36
36
|
export * from './sheets/Modal.js';
|
|
37
37
|
export * from './actions/Btn.js';
|
|
38
|
-
export * from './actions/IconBtn.js';
|
|
39
38
|
export * from './actions/Chip.js';
|
|
40
39
|
export * from './actions/Dot.js';
|
|
41
40
|
export * from './actions/Dropdown.js';
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,6 @@ export * from './sheets/SheetSteps.js';
|
|
|
39
39
|
export * from './sheets/SheetSettings.js';
|
|
40
40
|
export * from './sheets/Modal.js';
|
|
41
41
|
export * from './actions/Btn.js';
|
|
42
|
-
export * from './actions/IconBtn.js';
|
|
43
42
|
export * from './actions/Chip.js';
|
|
44
43
|
export * from './actions/Dot.js';
|
|
45
44
|
export * from './actions/Dropdown.js';
|
|
@@ -11,9 +11,12 @@ export interface JourneyBadgeProps extends ComponentProps<'span'> {
|
|
|
11
11
|
/** pinned to a CardMedia's corner (rating, price, a distance). On a CardMedia: the paper (`--card-1-bg`), its corner concentric with the media's;
|
|
12
12
|
* a theme's `--tile-badge-bg` / `--tile-badge-radius` still win. Ruled (Lh 2026-10-21) */
|
|
13
13
|
corner?: boolean;
|
|
14
|
-
/** a date in a card's head: as tall as the title block beside it, no taller
|
|
15
|
-
*
|
|
14
|
+
/** a date in a card's head: as tall as the title block beside it, no taller than its own three lines (day · number · month).
|
|
15
|
+
* Write it as the head's last child, after the title block */
|
|
16
16
|
stretch?: boolean;
|
|
17
|
+
/** with `stretch`: two lines instead of three — the label over the value, the `sub` beside the value (day over number · month).
|
|
18
|
+
* The app picks it (say, beside a one-line title); the badge's size never does */
|
|
19
|
+
subBeside?: boolean;
|
|
17
20
|
}
|
|
18
|
-
/** JourneyBadge — a tiny label over a big value: gate, seat, date, rating. `stretch`: a date in a head
|
|
19
|
-
export declare function JourneyBadge({ label, value, sub, plain, corner, stretch, className, style, ...rest }: JourneyBadgeProps): import("react").JSX.Element;
|
|
21
|
+
/** JourneyBadge — a tiny label over a big value: gate, seat, date, rating. `stretch`: a date in a head as tall as the title block, no taller than its own three lines; `subBeside` puts it on two. */
|
|
22
|
+
export declare function JourneyBadge({ label, value, sub, plain, corner, stretch, subBeside, className, style, ...rest }: JourneyBadgeProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from '../cx.js';
|
|
3
|
-
/** JourneyBadge — a tiny label over a big value: gate, seat, date, rating. `stretch`: a date in a head
|
|
4
|
-
export function JourneyBadge({ label, value, sub, plain, corner, stretch, className, style, ...rest }) {
|
|
3
|
+
/** JourneyBadge — a tiny label over a big value: gate, seat, date, rating. `stretch`: a date in a head as tall as the title block, no taller than its own three lines; `subBeside` puts it on two. */
|
|
4
|
+
export function JourneyBadge({ label, value, sub, plain, corner, stretch, subBeside, className, style, ...rest }) {
|
|
5
5
|
const chars = typeof value === 'string' ? value.length + (typeof sub === 'string' ? sub.length / 2 : 0) : 0; // shortcut: words that are not plain strings fall back to the knob
|
|
6
|
-
return (_jsxs("span", { className: cx('tile-badge', plain && 'tile-badge--plain', corner && 'tile-badge--corner', stretch && 'tile-badge--stretch', className), style: stretch && chars ? { '--_badge-chars': chars, ...style } : style, ...rest, children: [_jsx("span", { className: "tile-badge__label", children: label }), _jsx("span", { className: "tile-badge__value", children: value }), sub != null && _jsx("span", { className: "tile-badge__label", children: sub })] }));
|
|
6
|
+
return (_jsxs("span", { className: cx('tile-badge', plain && 'tile-badge--plain', corner && 'tile-badge--corner', stretch && 'tile-badge--stretch', stretch && subBeside && 'tile-badge--sub-beside', className), style: stretch && chars ? { '--_badge-chars': chars, ...style } : style, ...rest, children: [_jsx("span", { className: "tile-badge__label", children: label }), _jsx("span", { className: "tile-badge__value", children: value }), sub != null && _jsx("span", { className: "tile-badge__label", children: sub })] }));
|
|
7
7
|
}
|
package/dist/lists/Bubble.d.ts
CHANGED
|
@@ -30,11 +30,11 @@ export declare function Bubble({ side, meta, href, target, rel, onClick, highlig
|
|
|
30
30
|
target: string | undefined;
|
|
31
31
|
rel: string | undefined;
|
|
32
32
|
onClick: (() => void) | undefined;
|
|
33
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
34
|
-
onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
35
33
|
slot?: string | undefined | undefined;
|
|
36
34
|
style?: import("react").CSSProperties | undefined;
|
|
37
35
|
title?: string | undefined | undefined;
|
|
36
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
37
|
+
onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
38
38
|
dir?: string | undefined | undefined;
|
|
39
39
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
40
40
|
color?: string | undefined | undefined;
|
|
@@ -313,11 +313,11 @@ export declare function Bubble({ side, meta, href, target, rel, onClick, highlig
|
|
|
313
313
|
tabIndex: number;
|
|
314
314
|
onClick: () => void;
|
|
315
315
|
onKeyDown: (e: KeyboardEvent<HTMLDivElement>) => void;
|
|
316
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
317
|
-
onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
318
316
|
slot?: string | undefined | undefined;
|
|
319
317
|
style?: import("react").CSSProperties | undefined;
|
|
320
318
|
title?: string | undefined | undefined;
|
|
319
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
320
|
+
onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
321
321
|
dir?: string | undefined | undefined;
|
|
322
322
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
323
323
|
color?: string | undefined | undefined;
|
|
@@ -591,11 +591,11 @@ export declare function Bubble({ side, meta, href, target, rel, onClick, highlig
|
|
|
591
591
|
} | {
|
|
592
592
|
className: string;
|
|
593
593
|
onKeyDown: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
594
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
595
|
-
onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
596
594
|
slot?: string | undefined | undefined;
|
|
597
595
|
style?: import("react").CSSProperties | undefined;
|
|
598
596
|
title?: string | undefined | undefined;
|
|
597
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
598
|
+
onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
599
599
|
dir?: string | undefined | undefined;
|
|
600
600
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
601
601
|
color?: string | undefined | undefined;
|
package/dist/lists/Row.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement, createElement, isValidElement, useId, useLayoutEffect, useRef } from 'react';
|
|
2
|
+
import { cloneElement, createElement, isValidElement, useContext, useId, useLayoutEffect, useRef } from 'react';
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
4
|
import { Icon } from '../type/Icon.js';
|
|
5
5
|
import { glide, reducedMotion, setRefs, stopMoves, useDisclosure } from '../state.js';
|
|
6
|
+
import { RowEndRoomCtx, withEndRoom } from '../parts/endRoom.js';
|
|
7
|
+
import { Words } from '../parts/Words.js';
|
|
6
8
|
/**
|
|
7
9
|
* Row — a frameless row inside a card: lead · words · end, its children in that order. 48px+ tall, a tap target.
|
|
8
10
|
* The lead is a `Lead` box, or a bare Avatar / AvatarStack; the words are a `Words`; the end is an `End` (a value and its caption)
|
|
@@ -14,8 +16,9 @@ import { glide, reducedMotion, setRefs, stopMoves, useDisclosure } from '../stat
|
|
|
14
16
|
*/
|
|
15
17
|
export function Row({ lg, done, as, href, more, open, defaultOpen, onOpenChange, className, children, ...rest }) {
|
|
16
18
|
const disclosure = useDisclosure(open, defaultOpen, onOpenChange);
|
|
19
|
+
const kids = (useContext(RowEndRoomCtx) && withEndRoom(children, Words)) || children; // in a LinkBlock: the title's later lines run under the ends
|
|
17
20
|
const el = more !== undefined ? 'summary' : as ?? (href ? 'a' : 'div');
|
|
18
|
-
const row = createElement(el, { href, className: cx('row', lg && 'row--lg', done && 'row--done', className), 'aria-disabled': done || undefined, ...(more === undefined ? rest : {}) },
|
|
21
|
+
const row = createElement(el, { href, className: cx('row', lg && 'row--lg', done && 'row--done', className), 'aria-disabled': done || undefined, ...(more === undefined ? rest : {}) }, kids, done && _jsx("span", { className: "row__done", children: _jsx(Icon, { name: "check", size: "sm" }) }));
|
|
19
22
|
if (more === undefined)
|
|
20
23
|
return row;
|
|
21
24
|
return (_jsxs("details", { className: "row-expand", ...rest, ...disclosure, children: [row, _jsx("div", { className: "row-expand__more", children: more })] }));
|
package/dist/media/Postcard.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface PostcardProps extends ComponentProps<'div'> {
|
|
|
10
10
|
line?: ReactNode;
|
|
11
11
|
/** the words on the back */
|
|
12
12
|
caption?: ReactNode;
|
|
13
|
-
/** a voice note instead of words: the control to hear it, at the middle of the back — the APP plays it (
|
|
13
|
+
/** a voice note instead of words: the control to hear it, at the middle of the back — the APP plays it (a round `Btn` with its `onClick`) */
|
|
14
14
|
voice?: ReactNode;
|
|
15
15
|
/** CONTROLLED: the back is showing. The app owns it — pair it with `onFlip`. */
|
|
16
16
|
flipped?: boolean;
|
package/dist/media/Postcard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useControlled } from '../state.js';
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
|
-
import {
|
|
4
|
+
import { Btn } from '../actions/Btn.js';
|
|
5
5
|
/**
|
|
6
6
|
* Postcard — a member's introduction, the shape of a cover card: the photo fills it (or the wireframe box), the band at the
|
|
7
7
|
* bottom holds the name, its line and the heart, and turns WITH the face; a tap on the photo turns it over (the shared flip mechanic, `.flip`, at `--motion-flip`) to the back: the name a fifth down the paper, its line and the caption after it — or, for a voice note, `voice` (the play control) at the middle; the app plays it.
|
|
@@ -12,5 +12,5 @@ export function Postcard({ photo, alt = '', name, line, caption, voice, flipped,
|
|
|
12
12
|
const [back, flip] = useControlled(flipped, defaultFlipped, onFlip);
|
|
13
13
|
const turn = () => flip(!back);
|
|
14
14
|
const words = (_jsxs("div", { className: "postcard__words", children: [_jsx("span", { className: "t-h1", children: name }), line != null && _jsx("span", { className: "t-body", children: line })] }));
|
|
15
|
-
return (_jsxs("div", { className: cx('postcard flip', back && 'is-flipped', className), ...rest, children: [_jsxs("div", { className: "postcard__face flip__face flip__face--front postcard__front", children: [_jsx("button", { className: "postcard__turn", type: "button", "aria-label": frontLabel, onClick: turn, children: photo ? _jsx("img", { src: photo, alt: alt }) : alt ? _jsx("div", { className: "ph", role: "img", "aria-label": alt }) : _jsx("div", { className: "ph" }) }), _jsxs("div", { className: "postcard__band", children: [words, (liked !== undefined || onLike) && _jsx(
|
|
15
|
+
return (_jsxs("div", { className: cx('postcard flip', back && 'is-flipped', className), ...rest, children: [_jsxs("div", { className: "postcard__face flip__face flip__face--front postcard__front", children: [_jsx("button", { className: "postcard__turn", type: "button", "aria-label": frontLabel, onClick: turn, children: photo ? _jsx("img", { src: photo, alt: alt }) : alt ? _jsx("div", { className: "ph", role: "img", "aria-label": alt }) : _jsx("div", { className: "ph" }) }), _jsxs("div", { className: "postcard__band", children: [words, (liked !== undefined || onLike) && _jsx(Btn, { shape: "round", tone: "primary", icon: "heart", label: likeLabel, "aria-pressed": !!liked, onClick: () => onLike?.(!liked) })] })] }), _jsxs("div", { className: "postcard__face flip__face flip__face--back postcard__back", children: [_jsxs("button", { className: "postcard__turn", type: "button", "aria-label": backLabel, onClick: turn, children: [words, caption != null && _jsx("p", { className: "postcard__caption", children: caption })] }), voice != null && _jsx("div", { className: "postcard__voice", children: voice })] })] }));
|
|
16
16
|
}
|
package/dist/media/Tile.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
2
|
import { type IconName } from '../type/Icon.js';
|
|
3
3
|
export interface TileGridProps extends ComponentProps<'div'> {
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
/** four small square tiles across a phone: the icon over a short label, both centred — a sheet's row of actions (copy · share · draw · save). Not with `cols3` */
|
|
7
|
-
cols4?: boolean;
|
|
4
|
+
/** a fixed count across, at every phone width: `2` — four picks stand 2×2 (a `wide` tile still takes a whole row); `3` — attachments, upload kinds; `4` — small square tiles, the icon over a short label, both centred (a sheet's row of actions: copy · share · draw · save). None: as many as fit at `--tile-min` */
|
|
5
|
+
cols?: 2 | 3 | 4;
|
|
8
6
|
/** the grid takes the card's side padding back and runs to its edges (`.bleed`, card.css) */
|
|
9
7
|
bleed?: boolean;
|
|
10
8
|
}
|
|
11
9
|
/** TileGrid — big square Tiles in a responsive grid. */
|
|
12
|
-
export declare function TileGrid({
|
|
10
|
+
export declare function TileGrid({ cols, bleed, className, ...rest }: TileGridProps): import("react").JSX.Element;
|
|
13
11
|
export interface TileProps extends Omit<ComponentProps<'div'>, 'onChange'> {
|
|
14
12
|
/** the icon at the top */
|
|
15
13
|
icon?: IconName;
|
|
@@ -44,10 +42,10 @@ export interface TileProps extends Omit<ComponentProps<'div'>, 'onChange'> {
|
|
|
44
42
|
}
|
|
45
43
|
/** Tile — a big square: icon top, label bottom (`inline`: icon and label on one line, the sub under it); `pick` toggles, `upload` is the dashed slot. A `pick` or `upload` tile is filled in: On a sheet, never in a Card: the sheet is the paper the member fills in (Lh 2026-10-18). A number with its icon and label in a cell is a `KvCell` (Lh 2026-10-20). */
|
|
46
44
|
export declare function Tile({ icon, label, sub, pick, type, name, checked, defaultChecked, onChange, on, upload, wide, inline, tone, as, className, children, ...rest }: TileProps): import("react").DetailedReactHTMLElement<{
|
|
47
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
48
45
|
slot?: string | undefined | undefined;
|
|
49
46
|
style?: import("react").CSSProperties | undefined;
|
|
50
47
|
title?: string | undefined | undefined;
|
|
48
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
51
49
|
dir?: string | undefined | undefined;
|
|
52
50
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
53
51
|
color?: string | undefined | undefined;
|
package/dist/media/Tile.js
CHANGED
|
@@ -3,8 +3,8 @@ import { createElement } from 'react';
|
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
4
|
import { Icon } from '../type/Icon.js';
|
|
5
5
|
/** TileGrid — big square Tiles in a responsive grid. */
|
|
6
|
-
export function TileGrid({
|
|
7
|
-
return _jsx("div", { className: cx('tile-grid',
|
|
6
|
+
export function TileGrid({ cols, bleed, className, ...rest }) {
|
|
7
|
+
return _jsx("div", { className: cx('tile-grid', cols && `tile-grid--${cols}`, bleed && 'bleed', className), ...rest });
|
|
8
8
|
}
|
|
9
9
|
/** Tile — a big square: icon top, label bottom (`inline`: icon and label on one line, the sub under it); `pick` toggles, `upload` is the dashed slot. A `pick` or `upload` tile is filled in: On a sheet, never in a Card: the sheet is the paper the member fills in (Lh 2026-10-18). A number with its icon and label in a cell is a `KvCell` (Lh 2026-10-20). */
|
|
10
10
|
export function Tile({ icon, label, sub, pick, type = 'checkbox', name, checked, defaultChecked, onChange, on, upload, wide, inline, tone, as, className, children, ...rest }) {
|
package/dist/parts/End.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export interface EndProps extends ComponentProps<'span'> {
|
|
|
6
6
|
caption?: ReactNode;
|
|
7
7
|
}
|
|
8
8
|
/** End — the value at the end of a line over its caption, right-aligned (+1.0 h over Tue); or its children.
|
|
9
|
-
* A control at the end (
|
|
9
|
+
* A control at the end (a round Btn, a Chip, a Check) takes no End: it goes straight in the line after the Words. */
|
|
10
10
|
export declare function End({ value, caption, className, children, ...rest }: EndProps): import("react").JSX.Element;
|
package/dist/parts/End.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from '../cx.js';
|
|
3
3
|
/** End — the value at the end of a line over its caption, right-aligned (+1.0 h over Tue); or its children.
|
|
4
|
-
* A control at the end (
|
|
4
|
+
* A control at the end (a round Btn, a Chip, a Check) takes no End: it goes straight in the line after the Words. */
|
|
5
5
|
export function End({ value, caption, className, children, ...rest }) {
|
|
6
6
|
return (_jsxs("span", { className: cx('end', className), ...rest, children: [value != null && _jsx("span", { className: "t-title", children: value }), caption != null && _jsx("span", { className: "t-caption t-muted", children: caption }), children] }));
|
|
7
7
|
}
|
package/dist/parts/Foot.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface FootProps extends ComponentProps<'div'> {
|
|
|
3
3
|
/** a SMALL LINK under the buttons, centred on its own short row (a `Link sm` — "details for developers") — the same as an
|
|
4
4
|
* ActionBar's ctaLink (Lh 2026-09-23). It never takes a share of the buttons' line */
|
|
5
5
|
link?: ReactNode;
|
|
6
|
-
/** a foot of a few ROUND buttons (`
|
|
6
|
+
/** a foot of a few ROUND buttons (round `Btn`, a size `lg` / `xl` for the big ones): they keep their own size instead of sharing the line, and
|
|
7
7
|
* stand as ONE group in the middle of the foot, a fixed gap apart (wider than the Btns' — `--foot-gap` sets it). The Btn foot is
|
|
8
8
|
* unchanged: this is the other foot, for a few big round answers */
|
|
9
9
|
round?: boolean;
|
|
@@ -13,7 +13,7 @@ export interface FootProps extends ComponentProps<'div'> {
|
|
|
13
13
|
/** a foot SPLIT IN HALF: two small `Link sm`s (or two `Btn`s) that ARE the card's foot, each half its width, edge to edge and flush with the card's bottom edge (its
|
|
14
14
|
* corners round them), a thin rule between them and over them (none over a `paper="bands"` foot band, whose fill is its edge). No pill: no
|
|
15
15
|
* fill, no edge, no radius, the words centred; a `Link sm` keeps its small size and ink (`error` its red), fills its half (the whole half is
|
|
16
|
-
* the tap target) and never wraps; a `Btn warn` keeps its warning ink. Knob `--foot-split-rule-ink`.
|
|
16
|
+
* the tap target) and never wraps; a `Btn tone="warn"` keeps its warning ink. Knob `--foot-split-rule-ink`.
|
|
17
17
|
* The member's own item: `<Link sm><Icon name="pencil" size="xs" /> Edit</Link>` left, `<Link sm error><Icon name="x" size="xs" />
|
|
18
18
|
* Cancel request</Link>` right (Lh 2026-10-25). The halves are a strip at a status row's height with small words
|
|
19
19
|
* (knob `--foot-split-font-size`, the Btns'); status `Rows` may follow the two halves in the same foot and stand under them, a rule between */
|
|
@@ -26,7 +26,7 @@ export interface FootProps extends ComponentProps<'div'> {
|
|
|
26
26
|
}
|
|
27
27
|
/** Foot — the last row of a card, a sheet or a stack sheet: what the member can do next, its buttons on one line. One takes the width, up to
|
|
28
28
|
* four share it evenly. Btns only in the row; a small link goes in `link`, under it. A `Btn form` keeps its own size here: as wide as its words,
|
|
29
|
-
* centred — for a foot whose one button should not fill the card. With `round` it is the foot of a few round `
|
|
29
|
+
* centred — for a foot whose one button should not fill the card. With `round` it is the foot of a few round `Btn`s (`size="xl"`, one
|
|
30
30
|
* `primary` with a word, the others with icons): one centred group, a fixed gap between them. With `split` it is two small `Link`s (or `Btn`s) that are the
|
|
31
31
|
* card's foot, each half its width, edge to edge on its bottom edge, a rule between (the member's own item: Edit · Cancel). With `wrap` each Btn is as
|
|
32
32
|
* wide as its words and they wrap (`wrap end`: at the foot's end). In a `Sheet` it stands on the box's bottom edge
|
package/dist/parts/Foot.js
CHANGED
|
@@ -3,7 +3,7 @@ import { cx } from '../cx.js';
|
|
|
3
3
|
import { joinDots } from '../actions/joined.js';
|
|
4
4
|
/** Foot — the last row of a card, a sheet or a stack sheet: what the member can do next, its buttons on one line. One takes the width, up to
|
|
5
5
|
* four share it evenly. Btns only in the row; a small link goes in `link`, under it. A `Btn form` keeps its own size here: as wide as its words,
|
|
6
|
-
* centred — for a foot whose one button should not fill the card. With `round` it is the foot of a few round `
|
|
6
|
+
* centred — for a foot whose one button should not fill the card. With `round` it is the foot of a few round `Btn`s (`size="xl"`, one
|
|
7
7
|
* `primary` with a word, the others with icons): one centred group, a fixed gap between them. With `split` it is two small `Link`s (or `Btn`s) that are the
|
|
8
8
|
* card's foot, each half its width, edge to edge on its bottom edge, a rule between (the member's own item: Edit · Cancel). With `wrap` each Btn is as
|
|
9
9
|
* wide as its words and they wrap (`wrap end`: at the foot's end). In a `Sheet` it stands on the box's bottom edge
|
package/dist/parts/Head.d.ts
CHANGED
|
@@ -9,8 +9,10 @@ export interface HeadProps extends ComponentProps<'div'> {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Head — the first row of a card, a sheet or a stack sheet: what this is, and the one thing beside it. Its children are, in order, an optional
|
|
12
|
-
* lead (a `Lead`, a `StackBack`, a `JourneyBadge`), the `Words` (the title takes the room, its meta under it), chips, and an end (
|
|
12
|
+
* lead (a `Lead`, a `StackBack`, a `JourneyBadge`), the `Words` (the title takes the room, its meta under it), chips, and an end (a round `Btn`, a `Chip`, an `End`).
|
|
13
13
|
* A `Lead`, an `Avatar` or an `AvatarStack` first, the `Words` next: the lead at the left, the title over its meta as one block beside it, the end at the right.
|
|
14
|
+
* Whatever follows the `Words` (an `End`, a `Btn size="sm"`, round `Btn`s) stands at the top right, together, its centre on the title's first line's
|
|
15
|
+
* x-height middle; the title and the meta flow as one block round it (the meta right under the title) and run under it at full width.
|
|
14
16
|
* Never put buttons here that finish the card: they go in the foot. A `Card` finds its `Head` by type, so a consumer's own component that wraps a `Head` is not found.
|
|
15
17
|
*/
|
|
16
18
|
export declare function Head({ top, centre, long, className, children, ...rest }: HeadProps): import("react").JSX.Element;
|
package/dist/parts/Head.js
CHANGED
|
@@ -4,6 +4,8 @@ import { cx } from '../cx.js';
|
|
|
4
4
|
import { Text } from '../type/Text.js';
|
|
5
5
|
import { StackHeadCtx } from '../sheets/stackCard.js';
|
|
6
6
|
import { HeadCtx, onTitleKey } from './headCtx.js';
|
|
7
|
+
import { withEndRoom } from './endRoom.js';
|
|
8
|
+
import { Words } from './Words.js';
|
|
7
9
|
/** a title written by hand (a `Text` h1/h2/display, a bare h1-h3) is the stack's keyboard way in as a `Words` title is. The head renders the tab stop and, when
|
|
8
10
|
* the sheet measured it long, `.is-long`. Nothing sets either on the node afterwards */
|
|
9
11
|
function markTitle(node, tab, long) {
|
|
@@ -25,11 +27,14 @@ function markTitle(node, tab, long) {
|
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Head — the first row of a card, a sheet or a stack sheet: what this is, and the one thing beside it. Its children are, in order, an optional
|
|
28
|
-
* lead (a `Lead`, a `StackBack`, a `JourneyBadge`), the `Words` (the title takes the room, its meta under it), chips, and an end (
|
|
30
|
+
* lead (a `Lead`, a `StackBack`, a `JourneyBadge`), the `Words` (the title takes the room, its meta under it), chips, and an end (a round `Btn`, a `Chip`, an `End`).
|
|
29
31
|
* A `Lead`, an `Avatar` or an `AvatarStack` first, the `Words` next: the lead at the left, the title over its meta as one block beside it, the end at the right.
|
|
32
|
+
* Whatever follows the `Words` (an `End`, a `Btn size="sm"`, round `Btn`s) stands at the top right, together, its centre on the title's first line's
|
|
33
|
+
* x-height middle; the title and the meta flow as one block round it (the meta right under the title) and run under it at full width.
|
|
30
34
|
* Never put buttons here that finish the card: they go in the foot. A `Card` finds its `Head` by type, so a consumer's own component that wraps a `Head` is not found.
|
|
31
35
|
*/
|
|
32
36
|
export function Head({ top, centre, long, className, children, ...rest }) {
|
|
33
37
|
const tab = useContext(StackHeadCtx);
|
|
34
|
-
|
|
38
|
+
const kids = withEndRoom(children, Words) ?? children;
|
|
39
|
+
return (_jsx("div", { className: cx('head', top && 'head--top', centre && 'head--centre', className), ...rest, children: _jsx(HeadCtx.Provider, { value: { tab, long: !!long }, children: tab == null && !long ? kids : Children.map(kids, (c) => markTitle(c, tab, !!long)) }) }));
|
|
35
40
|
}
|
package/dist/parts/Words.d.ts
CHANGED
|
@@ -12,5 +12,7 @@ export interface WordsProps extends Omit<ComponentProps<'span'>, 'title'> {
|
|
|
12
12
|
}
|
|
13
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;
|
|
14
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
|
|
15
|
-
* stand in the head, and a `className`, an `id` or any other attribute goes on the title.
|
|
15
|
+
* stand in the head, and a `className`, an `id` or any other attribute goes on the title. After a lead, with ends after it, in a `Head` or a
|
|
16
|
+
* `LinkBlock`'s `Row` (a led line): the title and the meta are ONE flowing block round the ends' room (their unseen copy, at its top right),
|
|
17
|
+
* so both wrap round the ends and run under them at full width; the title's first line has its x-height middle on the ends' centre. */
|
|
16
18
|
export declare function Words({ title, meta, over, level, className, children, ...rest }: WordsProps): import("react").JSX.Element;
|
package/dist/parts/Words.js
CHANGED
|
@@ -2,11 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
4
|
import { HeadCtx, onTitleKey } from './headCtx.js';
|
|
5
|
+
import { EndRoomCtx } from './endRoom.js';
|
|
5
6
|
/** 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
7
|
* 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
|
-
* stand in the head, and a `className`, an `id` or any other attribute goes on the title.
|
|
8
|
+
* stand in the head, and a `className`, an `id` or any other attribute goes on the title. After a lead, with ends after it, in a `Head` or a
|
|
9
|
+
* `LinkBlock`'s `Row` (a led line): the title and the meta are ONE flowing block round the ends' room (their unseen copy, at its top right),
|
|
10
|
+
* so both wrap round the ends and run under them at full width; the title's first line has its x-height middle on the ends' centre. */
|
|
8
11
|
export function Words({ title, meta, over, level, className, children, ...rest }) {
|
|
9
12
|
const head = useContext(HeadCtx);
|
|
13
|
+
const ends = useContext(EndRoomCtx);
|
|
14
|
+
// the room the line's ends take at the top right of its words: their unseen, inert copies (endRoom.ts), read by nobody
|
|
15
|
+
const room = ends != null && _jsx("span", { className: "words__room", "aria-hidden": true, inert: true, children: _jsx(EndRoomCtx.Provider, { value: null, children: ends }) });
|
|
10
16
|
if (head) {
|
|
11
17
|
const as = level ?? 'h2';
|
|
12
18
|
const Title = as === 'h1' ? 'h1' : 'h2';
|
|
@@ -14,8 +20,12 @@ export function Words({ title, meta, over, level, className, children, ...rest }
|
|
|
14
20
|
const attrs = head.tab != null ? { tabIndex: head.tab, onKeyDown: (e) => { onKeyDown?.(e); if (!e.defaultPrevented)
|
|
15
21
|
onTitleKey(e); } } : { onKeyDown };
|
|
16
22
|
const titled = title != null && _jsx(Title, { className: cx('words__title', `t-${as}`, head.long && 'is-long', className), ...own, ...attrs, children: title });
|
|
17
|
-
|
|
23
|
+
const metaLine = meta != null && _jsx("span", { className: "words__meta t-caption t-muted", children: meta });
|
|
24
|
+
// a led line: the title and the meta flow as one block round the room (a line holds no `over` and no children: endRoom.ts)
|
|
25
|
+
if (room)
|
|
26
|
+
return _jsxs("div", { className: "words__flow", children: [room, titled, metaLine] });
|
|
27
|
+
return (_jsxs(_Fragment, { children: [over != null ? _jsxs("div", { className: "words__over-title", children: [_jsx("span", { className: "words__over t-caption", children: over }), titled] }) : titled, metaLine, children] }));
|
|
18
28
|
}
|
|
19
29
|
const Title = level === 'h1' ? 'h1' : level ? 'h2' : 'span';
|
|
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] }));
|
|
30
|
+
return (_jsxs("span", { className: cx('words', className), ...rest, children: [room, 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] }));
|
|
21
31
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ElementType, type ReactNode } from 'react';
|
|
2
|
+
/** the ends a led line's `Words` keeps room for at the top right of its words: unseen copies of them, floated so the title and the meta wrap
|
|
3
|
+
* round them and run under the real ends at full width (parts.css "the ends' room"). `null`: no room */
|
|
4
|
+
export declare const EndRoomCtx: import("react").Context<ReactNode>;
|
|
5
|
+
/** set by a holder (a `LinkBlock`) whose `Row`s keep that room; a list's rows keep none */
|
|
6
|
+
export declare const RowEndRoomCtx: import("react").Context<boolean>;
|
|
7
|
+
/** a LED line's children, or `null` when the line is not one: a `Lead`, an `Avatar` or an `AvatarStack` first, the `Words` next (a title, a meta
|
|
8
|
+
* or none; no `over`, no children), and one element or more after it, its ends. The `Words` is given the ends' room (their copies), and the
|
|
9
|
+
* real ends stand together in ONE box after it, `.line-ends`, in the order given (parts.css "a LED LINE"): the box sets their centre on the
|
|
10
|
+
* title's x-height middle, whatever they are */
|
|
11
|
+
export declare function withEndRoom(children: ReactNode, words: ElementType): ReactNode[] | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Children, cloneElement, createContext, createElement, isValidElement } from 'react';
|
|
2
|
+
import { Lead } from './Lead.js';
|
|
3
|
+
import { Avatar, AvatarStack } from '../people/Avatar.js';
|
|
4
|
+
/** what may lead a line that keeps the room (the CSS's .lead, .avatar, .avatar-stack) */
|
|
5
|
+
const LEADS = [Lead, Avatar, AvatarStack];
|
|
6
|
+
/** the ends a led line's `Words` keeps room for at the top right of its words: unseen copies of them, floated so the title and the meta wrap
|
|
7
|
+
* round them and run under the real ends at full width (parts.css "the ends' room"). `null`: no room */
|
|
8
|
+
export const EndRoomCtx = createContext(null);
|
|
9
|
+
/** set by a holder (a `LinkBlock`) whose `Row`s keep that room; a list's rows keep none */
|
|
10
|
+
export const RowEndRoomCtx = createContext(false);
|
|
11
|
+
/** an end's copy, sized as the end is and doing nothing: no id, no name, no ref, no handler that could fire without a touch, not sending.
|
|
12
|
+
* `onChange` stays so a controlled input's copy is still controlled (the copy is inert: it never changes) */
|
|
13
|
+
function copyOf(end) {
|
|
14
|
+
const off = { id: undefined, name: undefined, ref: null, sending: undefined, autoFocus: undefined };
|
|
15
|
+
for (const k of Object.keys(end.props))
|
|
16
|
+
if (/^on[A-Z]/.test(k) && k !== 'onChange')
|
|
17
|
+
off[k] = undefined;
|
|
18
|
+
return cloneElement(end, off);
|
|
19
|
+
}
|
|
20
|
+
/** a LED line's children, or `null` when the line is not one: a `Lead`, an `Avatar` or an `AvatarStack` first, the `Words` next (a title, a meta
|
|
21
|
+
* or none; no `over`, no children), and one element or more after it, its ends. The `Words` is given the ends' room (their copies), and the
|
|
22
|
+
* real ends stand together in ONE box after it, `.line-ends`, in the order given (parts.css "a LED LINE"): the box sets their centre on the
|
|
23
|
+
* title's x-height middle, whatever they are */
|
|
24
|
+
export function withEndRoom(children, words) {
|
|
25
|
+
const list = Children.toArray(children);
|
|
26
|
+
const at = list.findIndex((c) => isValidElement(c) && c.type === words);
|
|
27
|
+
if (at !== 1 || !isValidElement(list[0]) || !LEADS.includes(list[0].type))
|
|
28
|
+
return null;
|
|
29
|
+
const w = list[at];
|
|
30
|
+
if (w.props.title == null || w.props.over != null || w.props.children != null)
|
|
31
|
+
return null;
|
|
32
|
+
const ends = list.slice(at + 1);
|
|
33
|
+
if (ends.length < 1 || !ends.every(isValidElement))
|
|
34
|
+
return null;
|
|
35
|
+
return [
|
|
36
|
+
list[0],
|
|
37
|
+
createElement(EndRoomCtx.Provider, { key: w.key ?? 'words', value: ends.map(copyOf) }, w),
|
|
38
|
+
createElement('span', { key: 'line-ends', className: 'line-ends' }, ...ends),
|
|
39
|
+
];
|
|
40
|
+
}
|