@usableapp/cardds 0.7.144 → 0.7.145
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 +9 -0
- package/css/sheet.css +1 -1
- package/dist/cardds.css +1 -1
- package/dist/catalog.json +1 -1
- package/dist/sheets/Sheet.d.ts +3 -1
- package/dist/sheets/Sheet.js +2 -2
- package/docs/reference.md +2 -0
- package/package.json +1 -1
package/dist/sheets/Sheet.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface SheetProps extends Omit<ComponentProps<'article'>, 'onChange'>
|
|
|
17
17
|
* AFTER it landed (`--motion-sheet-rest`) — its own timeout, every time. To leave the screen: set `away`, and take the
|
|
18
18
|
* sheet out of the tree here — `onSettled={(s) => s === 'away' && setMounted(false)}` — so it slides out instead of vanishing */
|
|
19
19
|
onSettled?: (state: SheetState) => void;
|
|
20
|
+
/** how much of the sheet shows at `half`, in tenths of its height: `half={6}` shows 60%. 1–9; default 5 (half). Every other state and the state's name stay as they are */
|
|
21
|
+
half?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
20
22
|
/** the states a drag snaps to and a reveal may climb through — "peek half full", or an array (default all four) */
|
|
21
23
|
states?: string | readonly Resting[];
|
|
22
24
|
/** the grab handle; `false` for a sheet with no handle. cardds names it in the page's language (`<html lang>`) — a string is for different words only */
|
|
@@ -52,4 +54,4 @@ export interface SheetProps extends Omit<ComponentProps<'article'>, 'onChange'>
|
|
|
52
54
|
* first's `onSettled`) — the app adds no timer.
|
|
53
55
|
* The CURSOR is cardds's too: once it has come up it waits in the field marked `data-autofocus`, else the first field, else the heading — write no `autoFocus` or `.focus()` for it.
|
|
54
56
|
*/
|
|
55
|
-
export declare function Sheet({ state, defaultState, onStateChange, onSettled, states, handle, mark, refreshing, tone, paper, className, children, onFocus, ...rest }: SheetProps): import("react").JSX.Element;
|
|
57
|
+
export declare function Sheet({ state, defaultState, onStateChange, onSettled, half, states, handle, mark, refreshing, tone, paper, className, style, children, onFocus, ...rest }: SheetProps): import("react").JSX.Element;
|
package/dist/sheets/Sheet.js
CHANGED
|
@@ -38,7 +38,7 @@ function markLong(node, long) {
|
|
|
38
38
|
* first's `onSettled`) — the app adds no timer.
|
|
39
39
|
* The CURSOR is cardds's too: once it has come up it waits in the field marked `data-autofocus`, else the first field, else the heading — write no `autoFocus` or `.focus()` for it.
|
|
40
40
|
*/
|
|
41
|
-
export function Sheet({ state, defaultState = 'half', onStateChange, onSettled, states, handle = true, mark = 'line', refreshing, tone, paper, className, children, onFocus, ...rest }) {
|
|
41
|
+
export function Sheet({ state, defaultState = 'half', onStateChange, onSettled, half, states, handle = true, mark = 'line', refreshing, tone, paper, className, style, children, onFocus, ...rest }) {
|
|
42
42
|
const [current, request] = useControlled(state, defaultState, onStateChange);
|
|
43
43
|
const ref = useRef(null);
|
|
44
44
|
const handleRef = useRef(null);
|
|
@@ -130,5 +130,5 @@ export function Sheet({ state, defaultState = 'half', onStateChange, onSettled,
|
|
|
130
130
|
return; // the click that follows a drag is not a tap
|
|
131
131
|
request(current === 'peek' ? (allowed().includes(home.current) ? home.current : allowed().find((s) => s !== 'peek') ?? 'half') : 'peek', 'tap');
|
|
132
132
|
};
|
|
133
|
-
return (_jsxs("article", { ref: ref, className: cx('card sheet', tone && tone !== 1 && `card--${tone}`, paper && 'sheet--paper', `sheet--${shown}`, refreshing && 'is-loading', className), "aria-busy": refreshing || undefined, inert: current === 'away' || held || undefined, onFocus: focus, ...rest, children: [handle !== false && (_jsx("button", { ref: handleRef, className: cx('sheet__handle', mark === 'dots' && 'sheet__handle--dots'), type: "button", "aria-label": typeof handle === 'string' ? handle : word('resize'), onClick: tap, onPointerDown: down, onPointerMove: move, onPointerUp: up, onPointerCancel: up })), Children.map(children, (node) => markLong(node, titleLong))] }));
|
|
133
|
+
return (_jsxs("article", { ref: ref, className: cx('card sheet', tone && tone !== 1 && `card--${tone}`, paper && 'sheet--paper', `sheet--${shown}`, refreshing && 'is-loading', className), "aria-busy": refreshing || undefined, inert: current === 'away' || held || undefined, onFocus: focus, style: half ? { ...style, '--sheet-half': (10 - half) / 10 } : style, ...rest, children: [handle !== false && (_jsx("button", { ref: handleRef, className: cx('sheet__handle', mark === 'dots' && 'sheet__handle--dots'), type: "button", "aria-label": typeof handle === 'string' ? handle : word('resize'), onClick: tap, onPointerDown: down, onPointerMove: move, onPointerUp: up, onPointerCancel: up })), Children.map(children, (node) => markLong(node, titleLong))] }));
|
|
134
134
|
}
|
package/docs/reference.md
CHANGED
|
@@ -445,6 +445,8 @@ whose markup has rules, because the sheet's box is the step itself:
|
|
|
445
445
|
onStateChange={setS}>` (controlled) or `<Sheet defaultState="half">` (it keeps its own). The sheet's own behaviour —
|
|
446
446
|
the handle's tap and drag, the focus raise, the climb when the keyboard moves the cut — lives in the component and
|
|
447
447
|
only ever ASKS through `onStateChange(state, reason)`; nothing outside the sheet is touched.
|
|
448
|
+
How much shows at `half` is the sheet's own prop: `half` = tenths of its height, 1–9 (default 5); `<Sheet half={6}>`
|
|
449
|
+
shows 60% at half. Translate, scroll-padding and drag-snap all read it; the state is still called `half`.
|
|
448
450
|
A sheet always ARRIVES and LEAVES by sliding: mounted already up, it starts `away` for one frame and slides in. To
|
|
449
451
|
take it off the screen set `state="away"` and unmount it in `onSettled` (`s === 'away'`) — unmounting it while it is up
|
|
450
452
|
only makes it vanish (dev warning). Story: `Sheet · MountedOnDemand`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usableapp/cardds",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.145",
|
|
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).",
|