Skip to content
satin

Reviewable changes

Pro

The fields an agent wants to change, each accepted or rejected before any is applied.

Update the Quanta deal

Based on today's call

1/3
StageProposalNegotiation
TranscriptionWe’re ready to talk terms. Send the contract over.

Installation

Terminal
npm i @uisatin/ui @uisatin/pro
Import
import '@uisatin/ui/styles.css'
import '@uisatin/pro/styles.css'
import { ReviewableChanges, type ReviewableChangesValue } from '@uisatin/pro/agent-changes-review'

Part of Satin Pro, the licensed edition: @uisatin/pro on top of @uisatin/ui at the same version, its stylesheet after Free's. Satin Pro isn't on npm yet.

About 2.7 kB of JavaScript, minified and gzipped, on top of the @uisatin/uicomponents it uses (React aside).

First time with Satin? Set it up once, styles and fonts included, with the installation guide.

API Reference

The ReviewableChanges component (Satin Pro, @uisatin/pro/agent-changes-review) is a DecisionCard that takes the changes AgentSuggestionChanges takes and shows one per step: the same card, header, "‹ 1/3 ›" navigator, footer and step slide. The header is title (the suggestion: "Update the Quanta deal") and description; without a title, each change's field is the title. The body is the field's name, the old value struck through, an arrow and the new one, then, when the change has a source ({ icon, label, quote }), a preview of where it comes from (a logo, "Transcription" and the quoted line); quote the line that justifies that change, short and specific to it, not a summary. The footer is DecisionCard's: Skip and Accept, in Skip and Continue's places. Accept accepts the change, Skip leaves it unapplied ("rejected"); either slides in the next change still pending, and deciding the last one finishes the review. Go back with the navigator to decide a change again; a change you come back to says "Accepted" or "Skipped" under it; the last decision goes straight to applying, with no tick. value is { [id]: "pending" | "accepted" | "rejected" }, keyed by each change's id (or its place, "0", "1", …); a change left out is pending. defaultStep opens on another change. On finishing, onApply(accepted, value) gets the accepted changes only (it isn't called when none is); return a promise to hold the applying stage, and if it rejects, review starts again. Then the card fades out and rises 4px (--duration-base; at once under reduced motion) and onApplied(accepted, value) fires: remove it there, as you would after an onDismiss. If focus was inside, it goes to returnFocus() or, without one, to the page, and "2 changes applied" is read out from a live region on the body. label names a change for its buttons and the title when field isn't a string. For a new set of changes, give it a new key.

PropTypeDefault
changes
{ id?, field, label?, from?, to, source? }[]
—
title
string
—
description
string
—
value
ReviewableChangesValue
—
defaultValue
ReviewableChangesValue
{}
onValueChange
(value) => void
—
defaultStep
number
0
onApply
(accepted, value) => unknown
—
onApplied
(accepted, value) => void
—
returnFocus
() => HTMLElement | null | undefined
—
status
"review""applying"
—
className
string
—
ref
Ref<HTMLDivElement>
—
...props
ComponentProps<'div'>

Other attributes go to <div>

—

Accessibility

A DecisionCard: a role="group" labelled by the title, with the step count ("2/3") a polite live region and the step buttons named "Previous change" and "Next change" (previousFieldChange, nextFieldChange). Under a title, the change is its own role="group" named by its field. Skip and Accept are named after the change ("Skip Stage change", "Accept Stage change", skipFieldChange and acceptFieldChange in SatinLabels; their visible text "Skip" and "Accept" starts the names; a change whose field isn't a string needs a label). Both are new buttons on each step and focus stays on the one pressed, so the next change's name is read. A change you come back to says how it was decided in text ("Accepted", "Skipped"), never colour alone; a skipped value turns text/muted, a Badge grey, so its text keeps its contrast. A change's source is a q, so its quotation marks follow the page's language; the logo is decorative. The old value is a del, the arrow hidden. "Applying changes…" is read out from a polite status region; while applying, the button pressed is aria-busy (it keeps focus) and the other is disabled. Once applied, the card leaves: focus goes to returnFocus(), or to the page's body when the app gives none, the card turns inert, and "2 changes applied" is read out from a polite status region on the body, which outlives it. Under reduced motion the step just changes, with no slide or rolling count, and the card goes at once.

KeyAction
TabMoves through the step buttons, then Skip and Accept.
EnterorSpaceOn Accept or Skip: decides the change and moves to the next pending one; on the last, finishes the review. On a step button: shows the previous or next change.