Commerce foundations
What @sdxc/ui/commerce is for, the forms-first rules its parts share, and every variable it reads.
The pieces of ordering something to be delivered: a menu item and the dialog that asks for its options, priced option groups, cart lines with a quantity stepper, and an order's live status.
Every piece is a form or a link first, so a cart fills and an order places with script off; the islands only reprice and track live.
import "@sdxc/ui/theme.css";
import { … } from "@sdxc/ui/commerce";When to reach for it
- A food delivery, grocery or takeaway menu whose items ask for picks with prices.
- A cart whose counts change with one tap, and still post without script.
- An order, delivery or job whose progress streams from the server while the visitor watches.
Shared ideas
- Forms firstSteppers, picks and Place order are plain posts; the server prices and checks them.
- Prices in minor unitsEvery choice carries
data-pricein cents;OptionsLivesums them with the form'sdata-base. - Native dialogsA menu card opens its
<dialog>withcommandfor; it is a bottom sheet on a phone. - Limits on the formA required group is radios; extras are checkboxes that stop at
maxonce script loads. - Progress as text
OrderLivereads<step> <progress> <minutes>lines from anytext/plainstream. - Maps by attributeThe tracker moves any
[data-map-marker]on the page, so it pairs with a map without importing one.
CSS variables
Every custom property the namespace reads or declares, with its default and what it controls.
Reads the neutral role for text, hairlines and surfaces, and brand for the add button, ticked picks and the steps already done. The roles are documented on Theming.
Shared
The commerce pieces read the theme's own tokens; none is declared for them alone.
| Variable | Default | What it controls |
|---|---|---|
--ui-radius-lg | 1rem | The corner of a menu item card. |
--ui-color-brand-600 | the brand scale | Ticked picks, the done steps' dots and rail, and the current step's ring. |
--ui-map-progress | set by OrderLive | Written on each [data-map-marker] as the order moves, from 0 to 1. |