SPB Git

Repository Public

SP-WALLET-DESIGN-SYSTEM.md 11.3 KB

# SP Wallet Design System (NEXT) — 2.0

One system for the web app, the macOS app and the iOS app. Same values, native components on each platform.

Source of truth: design/tokens.json. Generated by node scripts/gen-design-tokens.mjs:

Output Used by
apps/web/src/tokens.css — CSS variables (light, dark, system), type-role classes, life-cycle tones web
apps/web/src/tokens.gen.ts — life-cycle status vocabulary, series names web
design/generated/SPWalletTokens.swift — SPTokens (palette, series, aurora, type scale, spacing, radii, elevation, motion, status) copied into the SPWalletUI Swift target, used by macOS and iOS

node scripts/gen-design-tokens.mjs --check fails when an output is stale, and generation itself fails when a text pair drops under 4.5 : 1 (the contrast list of the token file, plus the balance-card text against the aurora's lightest possible point). A screen never writes a literal colour, size, radius or duration.

# 1. Principles

  1. The amount is the hero. One dominant figure per screen, in the display role; everything else is quiet.
  2. Honest before handsome. Every figure says what it is (estimate, as of when, partial). A review shows every signed field in full. Nothing the owner is about to approve is animated, truncated or folded away. A stale value looks stale.
  3. Depth by layering. Hairlines, soft elevation, translucent bars. One gradient only: the balance card's aurora.
  4. Colour never carries a meaning alone. Gains keep sign and arrow, states keep symbol and word, chart parts keep name and share.
  5. Native on each platform. Same tokens; navigation, controls, gestures, typography scaling and motion come from the platform (SwiftUI on Apple, the browser on the web). No web view in the native apps, no imitation of iOS on the web.
  6. Motion is short and optional. Transform and opacity only, ≤ 360 ms, none under Reduce Motion.

# 2. Tokens

Colour (light / dark): bg, surface, elev, line, ink, mute, accent, positive, negative, caution, primary / onPrimary, onNegative, plate, and the balance card's heroBase / heroInk / heroMute (identical in both themes). All text pairs ≥ 4.5 : 1; measured values are printed by the generator. Changes from v9: blue → accent (slightly deeper in light, 6.7 : 1), emerald → positive, danger → negative, warn → caution; in dark the primary button is ink-on-light instead of emerald (emerald is kept for meaning only); a sixth data series; the aurora is defined by tokens and shared with the native apps.

Type scale — eleven roles: display 44, title1 30, title2 22, headline 17, body 15, bodyStrong 15, callout 14, footnote 13, eyebrow 11.5 (caps), micro 11, mono 13. System fonts. Web sizes are emitted in rem (the reader's browser text size applies). On Apple each role maps to a Dynamic Type text style and scales with it; display amounts shrink to fit (minimumScaleFactor) rather than truncate. Amounts in columns use tabular figures; display amounts use proportional figures.

Spacing 4-pt grid (space.1 = 4 … space.16 = 64). Layout: gutter 20, card padding 20, row ≥ 60, asset row 68, target ≥ 44, content max 1120, reading max 672, sidebar 256. Radius: xs 8, sm 12, md 16, lg 22 (cards), xl 28 (balance card, sheets), full. Elevation: e1 card, e2 raised control, e3 sheet / balance card. Motion: 90 / 140 / 220 / 360 ms; easings standard, spring, exit; Apple spring response 0.36, damping 0.86.

# 3. Transfer status — one vocabulary

The API field lifecycle has fourteen values. Each has one tone, one symbol and one word on the three platforms (status in the token file):

lifecycle tone FR EN
draft mute Brouillon Draft
awaiting_confirmation accent À confirmer Awaiting confirmation
awaiting_signature accent Signature en cours Awaiting signature
signed accent Signée Signed
broadcasting accent Envoi au réseau Broadcasting
pending caution En attente Pending
confirming accent En confirmation Confirming (in a block, not final; shows confirmations)
confirmed positive Confirmée Confirmed — said only of a final transaction
failed negative Échouée Failed
replaced caution Remplacée Replaced
dropped caution Non incluse Dropped
expired mute Expirée Expired
rejected mute Refusée par vous Rejected
not_sent mute Signée, non envoyée Signed, not sent

dropped and replaced always show their explanation (errorCode text) and, while watched is true, the line "still watched". A client older than lifecycle reads state.

# 4. Components (same anatomy everywhere)

Component Anatomy and rules
Balance card aurora over heroBase, radius xl, e3. Eyebrow "Valeur estimée" · display amount · change chip (absolute + %, sign and arrow, period named) · freshness line ("à jour à 14:32" / "partiel : 2 réseaux indisponibles"). Hidden-balance mode replaces figures by "••••" everywhere at once. Never a performance word for an estimate.
Range selector segmented 1D 1W 1M 3M 1Y ALL (FR: 1J 1S 1M 3M 1A TOUT); arrow keys on web and macOS; selection announced.
Value chart line in accent with a soft area, no grid; scrub shows value and date; points flagged incomplete are not drawn (a gap is shown as a gap); accessible summary (first, last, min, max, change); haptic tick on iOS scrubbing. Flows (deposits / withdrawals) are marked on the axis so that a deposit does not read as a gain.
Allocation one horizontal bar in series colours + a legend list with name and share; toggle "par actif / par réseau". Not a donut.
Asset row logo with network badge · name + network · amount + fiat · 24 h change. Unverified token: caution "Non vérifié" pill, never a price. Hidden assets live under "Masqués".
Transaction row / detail direction symbol · counterparty (contact label when known, else shortened address, full on detail) · amount · status pill from §3. Detail: every field, hash with copy and explorer link, confirmations, fee paid ("frais payés") or fee estimate labelled as such, timeline of the life cycle with times.
Status pill symbol + word, tone tint at 10–14 % with tone text (≥ 4.5 : 1).
Stat tile eyebrow label · headline value · footnote context (network fee now, fees paid this month, inflow / outflow).
Notice / banner tone bar, symbol, sentence, optional action. Levels: info, caution, negative. Stale-data banner is caution and names the time.
Buttons primary (one per screen), secondary (elev fill), quiet (text), destructive. Height 48 touch / 32 pointer (macOS regular). Busy state keeps the label and adds a spinner; never changes width.
Sheet / dialog radius xl top, e3, scrim; focus trapped and restored; Escape closes unless an operation's outcome is unknown.
Fields 16 px text minimum on touch; inline validation message under the field; address fields are mono with paste, scan (iOS), contact picker.
Skeleton / empty / error skeleton shaped like the content; empty state says what will appear and offers the first action; error state names what failed and offers Retry — a spinner is never the final state.
Review (approval) generated from the canonical object: every signed field, ordered, labelled, full values. The passkey button states the action and the amount.
Outcome-unknown panel caution: "État inconnu — ne renvoyez pas." Retry-check, link to Activity. No reset, no cancel.

# 5. Screens

Dashboard. Balance card → range selector + value chart → quick actions (Envoyer, Recevoir, Échanger, Scanner on iOS) → alerts strip (only when something needs attention) → allocation → held assets (top 6, "tout voir") → recent activity (5) → tiles: network fees now, fees paid (period), inflow / outflow (period). Web desktop and macOS: two columns (value + assets | activity + tiles) inside contentMax; phone: one column.

Assets. Search (name, symbol, network, contract) · filters (held, favourites, network) · rows · "Masqués". Asset page: price chart, holding, per-network breakdown, contract with copy / explorer, movements of that asset (server-filtered).

Send. Asset and network → recipient (paste, scan, contacts; validation per network; warnings) → amount (fiat equivalent, Max, available) → review → passkey → tracker (life-cycle timeline, live by the event stream).

Receive. Network → QR on a white plate, address in full, copy, share (address or payment URI), network notices.

Activity. Timeline by day, filters (kind, asset, network, status, period), search, cursor pagination, export CSV.

Contacts. List, add, edit, delete, favourite; network-bound; changing an address requires confirming the old and new values and raises a security event.

Security Center. Signer and halt state · passkeys (list from the signer, add, revoke) · sessions (current marked, revoke one, revoke all) · last logins · security alerts · limits (read-only) · recovery status ("phrase notée : jamais / date") · backups.

Settings. Language, currency, appearance (system / light / dark), privacy (hide balances, widget / notification content), notifications, networks status, about (version + commit).

Search (⌘K on web and macOS, pull-down on iOS). Assets, contacts, transactions (hash, address, amount), settings.

# 6. Platform mapping

Web macOS iOS / iPadOS
Navigation sidebar ≥ 1024 px, tab bar below NavigationSplitView sidebar, multiple windows, toolbar search TabView (compact), sidebar (regular)
Type scaling rem Dynamic Type text styles Dynamic Type, tested to AX3 on core screens
Theme system / light / dark, stored in account settings system (override in settings) system (override in settings)
Pointer hover, focus ring, shortcuts hover, context menus, keyboard commands, menus touch, context menus, haptics, pull to refresh
Unlock WebAuthn Touch ID app lock + passkey Face ID app lock + passkey
Privacy hide balances lock covers every window; hide balances privacy cover in the app switcher (above sheets); widgets and notifications without amounts unless enabled
Haptics — — selection (range, scrub), success (confirmed), warning (dropped / replaced), error (failed)

# 7. Accessibility

Contrast ≥ 4.5 : 1 for text (checked at generation); targets ≥ 44 pt; visible focus; every chart has a text summary; every status has a word; reduced motion honoured; VoiceOver labels on every control and amount (amounts read with unit and currency, addresses read in groups); no information by colour or position alone; forms announce errors.

# 8. Migration from v9

Web: styles.css imports tokens.css; v9 variable names stay as aliases for one release (--blue → --accent, …) while screens move to the roles and type classes; literal pixel sizes are replaced by type roles and spacing tokens. iOS: Components/Theme.swift reads SPTokens; fixed-size fonts become scaled roles. macOS: the indigo gradient, system greys, donuts and letter discs are replaced by the shared tokens, the aurora card, the allocation bar and the real logos.

Files main
Menu

Theme