@usableapp/cardds 0.7.151 → 0.7.152
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 +16 -0
- package/css/actions.css +5 -0
- package/css/card.css +24 -0
- package/css/media.css +4 -0
- package/css/sticky.css +12 -0
- package/dist/actions/Chip.d.ts +31 -0
- package/dist/actions/Chip.js +11 -1
- package/dist/cardds.css +45 -0
- package/dist/cards/Card.d.ts +3 -1
- package/dist/cards/Card.js +2 -2
- package/dist/cards/CardParts.d.ts +17 -1
- package/dist/cards/CardParts.js +11 -1
- package/dist/catalog.json +1 -1
- package/dist/media/Tile.d.ts +3 -1
- package/dist/media/Tile.js +2 -2
- package/dist/sticky/Sticky.d.ts +3 -1
- package/dist/sticky/Sticky.js +3 -2
- package/dist/sticky/StickyPick.d.ts +6 -4
- package/dist/sticky/StickyPick.js +5 -3
- package/docs/reference.md +20 -3
- package/package.json +1 -1
package/dist/media/Tile.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ import { type IconName } from '../type/Icon.js';
|
|
|
3
3
|
export interface TileGridProps extends ComponentProps<'div'> {
|
|
4
4
|
/** three across on a phone (attachments, upload kinds) */
|
|
5
5
|
cols3?: boolean;
|
|
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;
|
|
6
8
|
/** the grid takes the card's side padding back and runs to its edges (`.bleed`, card.css) */
|
|
7
9
|
bleed?: boolean;
|
|
8
10
|
}
|
|
9
11
|
/** TileGrid — big square Tiles in a responsive grid. */
|
|
10
|
-
export declare function TileGrid({ cols3, bleed, className, ...rest }: TileGridProps): import("react").JSX.Element;
|
|
12
|
+
export declare function TileGrid({ cols3, cols4, bleed, className, ...rest }: TileGridProps): import("react").JSX.Element;
|
|
11
13
|
export interface TileProps extends Omit<ComponentProps<'div'>, 'onChange'> {
|
|
12
14
|
/** the icon at the top */
|
|
13
15
|
icon?: IconName;
|
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({ cols3, bleed, className, ...rest }) {
|
|
7
|
-
return _jsx("div", { className: cx('tile-grid', cols3 && 'tile-grid--3', bleed && 'bleed', className), ...rest });
|
|
6
|
+
export function TileGrid({ cols3, cols4, bleed, className, ...rest }) {
|
|
7
|
+
return _jsx("div", { className: cx('tile-grid', cols3 && 'tile-grid--3', cols4 && 'tile-grid--4', 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/sticky/Sticky.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export interface StickyProps extends Omit<ComponentProps<'div'>, 'onClick'> {
|
|
|
7
7
|
tone?: StickyTone;
|
|
8
8
|
/** the note has been READ: no folded corner. A folded corner (the default) says the note is new — not read yet */
|
|
9
9
|
flat?: boolean;
|
|
10
|
+
/** a die-cut sticker note: a band of white paper all round it (`--sticky-cut-size`), rounded corners, a soft lifted shadow, no fold — so it says nothing of read or unread. Straight like every note (`tilt` still turns it) */
|
|
11
|
+
cut?: boolean;
|
|
10
12
|
/** what a folded note says to a screen reader after its words (default: cardds's own word, "Unread" / "ยังไม่ได้อ่าน" by the page's language) */
|
|
11
13
|
unreadLabel?: string;
|
|
12
14
|
/** a row at the top of the note — a date, a small picture, a label */
|
|
@@ -30,4 +32,4 @@ export interface StickyProps extends Omit<ComponentProps<'div'>, 'onClick'> {
|
|
|
30
32
|
* THE FOLD SAYS UNREAD: the bottom-right corner folded over = not read yet; `flat` = read. A folded note says so to a screen reader too (`unreadLabel`).
|
|
31
33
|
* The outer box holds the tone and the shadow; the paper inside is the part that is cut (a clip would cut the shadow too).
|
|
32
34
|
*/
|
|
33
|
-
export declare function Sticky({ tone, flat, unreadLabel, head, date, tilt, foot, corner, stuck, onClick, className, children, ref, ...rest }: StickyProps): import("react").JSX.Element;
|
|
35
|
+
export declare function Sticky({ tone, flat, cut, unreadLabel, head, date, tilt, foot, corner, stuck, onClick, className, children, ref, ...rest }: StickyProps): import("react").JSX.Element;
|
package/dist/sticky/Sticky.js
CHANGED
|
@@ -14,7 +14,7 @@ import { fitSticky } from './fit.js';
|
|
|
14
14
|
* THE FOLD SAYS UNREAD: the bottom-right corner folded over = not read yet; `flat` = read. A folded note says so to a screen reader too (`unreadLabel`).
|
|
15
15
|
* The outer box holds the tone and the shadow; the paper inside is the part that is cut (a clip would cut the shadow too).
|
|
16
16
|
*/
|
|
17
|
-
export function Sticky({ tone = 'custard', flat, unreadLabel, head, date, tilt, foot, corner, stuck, onClick, className, children, ref, ...rest }) {
|
|
17
|
+
export function Sticky({ tone = 'custard', flat, cut, unreadLabel, head, date, tilt, foot, corner, stuck, onClick, className, children, ref, ...rest }) {
|
|
18
18
|
const own = useRef(null);
|
|
19
19
|
const [small, setSmall] = useState(false);
|
|
20
20
|
const room = useRef(null);
|
|
@@ -34,7 +34,8 @@ export function Sticky({ tone = 'custard', flat, unreadLabel, head, date, tilt,
|
|
|
34
34
|
return holdRoomWhile(room, [paper.querySelector('.sticky__body')], measure, paper, fieldOf, () => fitSticky(note) === 'over', measure);
|
|
35
35
|
}, []);
|
|
36
36
|
const notched = corner != null;
|
|
37
|
+
const folded = !flat && !notched && !cut;
|
|
37
38
|
const { tap, Box, boxProps } = pressable(notched ? undefined : onClick, 'div', rest);
|
|
38
39
|
const Part = tap ? 'span' : 'div';
|
|
39
|
-
return (_jsxs(Box, { ref: setRefs(own, ref), className: cx('sticky', `sticky--${tone}`, small && 'sticky--small', flat && 'sticky--flat', notched && 'sticky--corner', tilt && `sticky--tilt-${tilt}`, tap && 'sticky--tap', className), ...boxProps, children: [_jsxs(Part, { className: "sticky__paper", children: [(head != null || date != null) && _jsxs(Part, { className: "sticky__head", children: [head, date] }), _jsx(Part, { className: "sticky__body", children: children }), foot != null && _jsx(Part, { className: "sticky__foot", children: foot }),
|
|
40
|
+
return (_jsxs(Box, { ref: setRefs(own, ref), className: cx('sticky', `sticky--${tone}`, small && 'sticky--small', (flat || cut) && 'sticky--flat', cut && 'sticky--cut', notched && 'sticky--corner', tilt && `sticky--tilt-${tilt}`, tap && 'sticky--tap', className), ...boxProps, children: [_jsxs(Part, { className: "sticky__paper", children: [(head != null || date != null) && _jsxs(Part, { className: "sticky__head", children: [head, date] }), _jsx(Part, { className: "sticky__body", children: children }), foot != null && _jsx(Part, { className: "sticky__foot", children: foot }), folded && _jsx("span", { className: "sticky__fold", "aria-hidden": "true" }), folded && _jsx("span", { className: "sticky__state t-sr", children: unreadLabel ?? word('unread') })] }), stuck != null && _jsx(Part, { className: "sticky__stuck", children: stuck }), notched && _jsx("div", { className: "sticky__corner", children: corner })] }));
|
|
40
41
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
2
|
import type { StickyTone } from './tones.js';
|
|
3
3
|
export interface StickyPickProps extends Omit<ComponentProps<'div'>, 'onChange'> {
|
|
4
|
-
/** CONTROLLED: the chosen tone — with `onChange
|
|
5
|
-
value
|
|
4
|
+
/** CONTROLLED: the chosen tone — with `onChange`. The app owns it */
|
|
5
|
+
value?: StickyTone;
|
|
6
|
+
/** UNCONTROLLED: the tone chosen on arrival (default: the first of `tones`); the chooser then keeps its own */
|
|
7
|
+
defaultValue?: StickyTone;
|
|
6
8
|
/** the tone the member tapped */
|
|
7
9
|
onChange?: (tone: StickyTone) => void;
|
|
8
10
|
/** the tones on offer, in order (default: all of STICKY_TONES) */
|
|
@@ -10,5 +12,5 @@ export interface StickyPickProps extends Omit<ComponentProps<'div'>, 'onChange'>
|
|
|
10
12
|
/** the group's accessible name */
|
|
11
13
|
label: string;
|
|
12
14
|
}
|
|
13
|
-
/** StickyPick — the tone chooser: a row of round swatches at tap size, the chosen one ringed. Native radios: the arrows move the choice. */
|
|
14
|
-
export declare function StickyPick({ value, onChange, tones, label, className, ...rest }: StickyPickProps): import("react").JSX.Element;
|
|
15
|
+
/** StickyPick — the tone chooser: a row of round swatches at tap size, the chosen one ringed. Native radios: the arrows move the choice. Controlled like an input (`value` + `onChange`, or `defaultValue`). */
|
|
16
|
+
export declare function StickyPick({ value, defaultValue, onChange, tones, label, className, ...rest }: StickyPickProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from 'react';
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
|
+
import { useControlled } from '../state.js';
|
|
4
5
|
import { STICKY_TONES } from './tones.js';
|
|
5
|
-
/** StickyPick — the tone chooser: a row of round swatches at tap size, the chosen one ringed. Native radios: the arrows move the choice. */
|
|
6
|
-
export function StickyPick({ value, onChange, tones = STICKY_TONES, label, className, ...rest }) {
|
|
6
|
+
/** StickyPick — the tone chooser: a row of round swatches at tap size, the chosen one ringed. Native radios: the arrows move the choice. Controlled like an input (`value` + `onChange`, or `defaultValue`). */
|
|
7
|
+
export function StickyPick({ value, defaultValue, onChange, tones = STICKY_TONES, label, className, ...rest }) {
|
|
7
8
|
const name = useId();
|
|
8
|
-
|
|
9
|
+
const [shown, request] = useControlled(value, defaultValue ?? tones[0], onChange);
|
|
10
|
+
return (_jsx("div", { className: cx('sticky-pick', className), role: "radiogroup", "aria-label": label, ...rest, children: tones.map((tone) => (_jsx("label", { className: cx('sticky-pick__swatch', `sticky--${tone}`), children: _jsx("input", { type: "radio", name: name, value: tone, "aria-label": tone, checked: tone === shown, onChange: () => request(tone) }) }, tone))) }));
|
|
9
11
|
}
|
package/docs/reference.md
CHANGED
|
@@ -248,6 +248,19 @@ one) lands on the card they left from, and the app holds no ref or id to it and
|
|
|
248
248
|
later, the prop does nothing. A screen's bottom bar is measured after the card mounts, so the card looks again one frame
|
|
249
249
|
later and stands clear of it. `Card` forwards `ref` to its root for anything else the app wants of it. Story `Card · StartsInView`.
|
|
250
250
|
|
|
251
|
+
### Cards side by side, and the pickers of a note
|
|
252
|
+
|
|
253
|
+
- **`CardGrid`** stands cards two across, each its own boundary (Lh 2026-10-27, from a shared-list sample); a `Card wide`
|
|
254
|
+
takes the grid's whole row (a card of `Rows`, voice notes). The two cards of a row stand as tall as each other. On the
|
|
255
|
+
base or in a sheet's body, never in a card.
|
|
256
|
+
- **`CardArt`** is a card's last row: a cut-out picture (`art`) in the bottom-right corner, out to the card's edge, a
|
|
257
|
+
`count` on it as a `Badge`, and a small control at the row's start (the children). The card's words stay at its top.
|
|
258
|
+
Knob `--card-art-size` (the picture's width, 3:4). A note among items is a toned `Card` with the same row.
|
|
259
|
+
- **`ChipChoice`** is ONE choice made of `ChipPick`s, controlled as a whole: `value` + `onValueChange` (a list of the
|
|
260
|
+
picked values; one at most without `many`), or `defaultValue`. An option's `lead` (a small `Avatar`, an `Icon`) leads
|
|
261
|
+
its words, unheard. `add` stands a "+" first. A one-line strip to the holder's edges by default, `wrap` wraps. On a sheet.
|
|
262
|
+
- **`TileGrid cols4`** — four small square tiles across: the icon over a short label, a sheet's row of actions.
|
|
263
|
+
|
|
251
264
|
## Sheet stack markup
|
|
252
265
|
|
|
253
266
|
The sheet stack (`.sheet-stack`, `stack.css` — the menu, see *Anatomy*) is the
|
|
@@ -681,7 +694,7 @@ between at 40% down the screen (see *Anatomy*, "Where the centre is"):
|
|
|
681
694
|
control the member fills in or picks stands on a sheet: a `Sheet`'s
|
|
682
695
|
`Body`, a `SheetStep`, or a stack sheet. That is `Field`, `Composer`
|
|
683
696
|
and `ComposerArea`, `Pin`, `Dropdown`, `Slider`, `Toggle`, `Check`,
|
|
684
|
-
`ChipPick`, `Calendar`, `CalendarWeeks`, `HourGrid`, `DayStrip` and `Day`, `Picker`, `Mood`,
|
|
697
|
+
`ChipPick` and `ChipChoice`, `StickyPick`, `Calendar`, `CalendarWeeks`, `HourGrid`, `DayStrip` and `Day`, `Picker`, `Mood`,
|
|
685
698
|
`AvatarPick`, `FileBtn`, `AddRow`, `MapPick`, a `Tile pick` and a
|
|
686
699
|
`Tile upload`. A card is for reading and pressing buttons; never put
|
|
687
700
|
a form in a card. Two exceptions (Lh 2026-10-26): a `Pin` and a `Field`
|
|
@@ -807,6 +820,10 @@ A sticky note is a square of paper with a few words on it. The family is in `src
|
|
|
807
820
|
under the words. `onClick` makes the whole note a button. `stuck` holds what is stuck on the paper (`StampOn`).
|
|
808
821
|
`tilt` turns the one note a start screen hands over. A `Chip sm` in the `foot` is a name label on the paper: it
|
|
809
822
|
stands at the start, what follows it (a time) at the end, on one line.
|
|
823
|
+
- **`Sticky cut`** — the die-cut sticker note (Lh 2026-10-27): a band of plain paper all round it (`--sticky-cut-size`,
|
|
824
|
+
`--sticky-cut-bg`, default the stamp paper), round corners (`--sticky-radius`), a soft lifted shadow, no fold — a
|
|
825
|
+
sticker says nothing of read or unread. Straight like every note: the sample it came from was turned, the turn was
|
|
826
|
+
not taken (`tilt` still turns it). The note being written on a "make a note" screen wears it (`StickyScreens/MakeNote`).
|
|
810
827
|
- **`StickyBoard`** — notes stuck on a page. Rows wrap by the width: two on a phone, three from 504 of room, a screen about 540 wide.
|
|
811
828
|
The notes stand edge to edge and each is turned by one of four angles in turn (`--sticky-board-turn-1` to `-4`), so
|
|
812
829
|
no two notes that touch lean alike. Later is on top, always: the right note over the left, the lower over the
|
|
@@ -841,8 +858,8 @@ A sticky note is a square of paper with a few words on it. The family is in `src
|
|
|
841
858
|
`label` is its name (required with `onClick`): one Tab stop, a ring round the pile. Where the press goes is the
|
|
842
859
|
app's. A `StampOn` on the top note keeps its own touch; the stamps on the notes under it are inert. A pile's notes
|
|
843
860
|
all wear their stamp at one size.
|
|
844
|
-
- **`StickyField`** is the bare textarea on a note. **`StickyPick`** is the paper chooser: `value` + `onChange`,
|
|
845
|
-
`tones` for the ones on offer.
|
|
861
|
+
- **`StickyField`** is the bare textarea on a note. **`StickyPick`** is the paper chooser: `value` + `onChange`, or
|
|
862
|
+
`defaultValue` (it then keeps its own), `tones` for the ones on offer.
|
|
846
863
|
|
|
847
864
|
Whose colour a note wears is the app's rule. The gallery's `StickyScreens` shows one: a neighbour's note wears the
|
|
848
865
|
ground of that neighbour's stamp, and my note wears the paper I picked while writing, from a writing set plus the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usableapp/cardds",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.152",
|
|
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).",
|