GiftShipmentCard
The PR mock v3's shipment card (P.gship's left card): "What Glow Lab says it sent vs what arrived" with the state pill, the product table and what PR does next, by state:
expected/arrived: the check table. "Arrived in full?" ticks a row ("All 40 OK"): its Good units become the claim, Damaged 0, both lock and the row is tinted; unticking clears Good and puts focus there. "Tick all as received in full", the explanation, "Boxes received" (expected only, with "Glow Lab said 2") and "Confirm received quantities", which checks every field (an inline alert names the problem, the bad fields are marked) beforeonConfirm. -confirmed/confirmed_diff: Good, Damaged and Missing ("+2 extra" when more arrived), then the matched line or the butter "You confirmed 54 of the 60 units…" banner. -problem: the brand's report in a red banner with "Keep the count" / "Recount" (any state).
import { GiftShipmentCard } from '@ergasti/bricks';Examples
Count a shipment that is expected: tick a product that arrived in full ("All 40 OK") or enter the good and damaged units, then the boxes received
onConfirm gets whole numbers only.
Code
import { useState } from 'react';
import { GiftShipmentCard, type GiftCount } from '@ergasti/bricks';
function CountWhatArrived() {
const [last, setLast] = useState<GiftCount | null>(null);
return (
<div style={{ display: 'grid', gap: 10 }}>
<GiftShipmentCard brand="Glow Lab" state="expected" lines={[{ id: 'powder', product: 'Face powder', claimed: 40 }]} claimedBoxes={2} onConfirm={setLast} />
<small>{last ? `Confirmed: ${last.lines[0].good} good, ${last.lines[0].damaged} damaged, ${last.boxes} boxes` : 'Not confirmed yet'}</small>
</div>
);
}After the count: Missing per product, the difference banner, and the brand's problem report with "Keep the count" / "Recount"
Code
import { useState } from 'react';
import { GiftShipmentCard } from '@ergasti/bricks';
function ProblemReported() {
const [open, setOpen] = useState(true);
return (
<GiftShipmentCard
brand="Glow Lab" state="confirmed_diff"
lines={[{ product: 'Eyeshadow palette', claimed: 30, good: 28, damaged: 2 }, { product: 'Hand soap', claimed: 30, good: 26, damaged: 0 }]}
problem={open ? { date: '12 Nov', text: 'We packed 30 hand soaps in box 2. Please recount.' } : null} problemKept={!open}
onKeepCount={() => setOpen(false)} onRecount={() => setOpen(false)}
/>
);
}The shipment page's side column: when it was sent, arrived and confirmed, and the brand's confirmed gift stock
Code
import { BrandGiftStockCard, GiftShipmentTimeline } from '@ergasti/bricks';
function SideColumn() {
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 420 }}>
<GiftShipmentTimeline sent="9 Nov · 3 boxes · Own driver" arrived="10 Nov · 3 of 3 boxes" confirmed="11 Nov" />
<BrandGiftStockCard brand="Glow Lab" left={42} total={100} />
</div>
);
}Counting while the shipment refetches
Pass shipmentId: what PR has typed is kept by product (the line's id, else its name), so a refetch that reorders the lines, adds one or moves the shipment from Expected to Arrived keeps each count with its product. Only another shipment id starts a new count. Type a count, then press Refetch.
Code
import { useState } from 'react';
import { Button, GiftShipmentCard, type GiftShipmentLine } from '@ergasti/bricks';
function RefetchKeepsTheCount() {
const first: GiftShipmentLine[] = [{ id: 'eye', product: 'Eyeshadow palette', claimed: 20 }, { id: 'lip', product: 'Red lipstick', claimed: 10 }];
const [lines, setLines] = useState(first);
return (
<div style={{ display: 'grid', gap: 10 }}>
<div><Button size="sm" onClick={() => setLines((l) => [{ id: 'oil', product: 'Lip oil', claimed: 5 }, ...[...l].reverse().filter((x) => x.id !== 'oil')])}>Refetch</Button></div>
<GiftShipmentCard shipmentId="GS-0016" brand="Glow Lab" state="arrived" lines={lines} onConfirm={() => {}} />
</div>
);
}Loading and failed loads
The claim page's cards take loading (skeleton lines under their heading) and a load error with Try again: loadError / onRetry on all four (error on GiftShipmentCard and WarehouseDetailsCard is a failed save).
Code (not run)
import { BrandGiftStockCard, GiftShipmentCard, GiftShipmentTimeline, WarehouseDetailsCard } from '@ergasti/bricks';
function LoadStates() {
return (
<div style={{ display: 'grid', gap: 16 }}>
<GiftShipmentCard brand="Glow Lab" state="expected" lines={[]} loading />
<div style={{ display: 'grid', gap: 16, maxWidth: 420 }}>
<GiftShipmentTimeline sent="" loading />
<BrandGiftStockCard brand="Glow Lab" left={0} loadError onRetry={() => {}} />
</div>
<WarehouseDetailsCard value={{ address: '', hours: '', phone: '' }} onSave={() => {}} loadError onRetry={() => {}} />
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prGiftShipment, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
says | What {brand} says it sent | اللي {brand} بتقول إنها بعتته |
saysVs | What {brand} says it sent vs what arrived | اللي {brand} بتقول إنها بعتته واللي وصل فعلاً |
product | Product | المنتج |
claimed | Brand says sent | البراند بتقول بعتت |
inFull | Arrived in full? | وصل كامل؟ |
good | Good | سليم |
damaged | Damaged | تالف |
missing | Missing | ناقص |
allOk | All {n} OK | الـ {n} كلهم تمام |
goodOf | Good units of {product} | الوحدات السليمة من {product} |
damagedOf | Damaged units of {product} | الوحدات التالفة من {product} |
extra | +{n} extra | +{n} زيادة |
missingN | {n} missing | {n} ناقصين |
check | Check what arrived · {n} products | راجع اللي وصل · {n} منتجات |
tickAll | Tick all as received in full | علّم الكل إنه وصل كامل |
explain | Tick each product that arrived in full and undamaged. If a count is off, leave it unticked and enter the good and damaged units you actually received. Units that can't be gifted go under Damaged. Only good units go into {brand}'s gift stock. | علّم على كل منتج وصل كامل ومن غير تلف. لو العدد مش مظبوط، سيبه من غير علامة واكتب الوحدات السليمة والتالفة اللي استلمتها فعلاً. الوحدات اللي ما تنفعش هدية تتكتب في التالف. الوحدات السليمة بس هي اللي بتدخل مخزون هدايا {brand}. |
boxes | Boxes received | الكراتين اللي وصلت |
said | {brand} said {n} | {brand} قالت {n} |
confirm | Confirm received quantities | أكّد الكميات اللي وصلت |
boxesErr | Boxes received must be a whole number from 1 to 99 | عدد الكراتين لازم يكون رقم صحيح من 1 لـ 99 |
unitsErr | Enter the good and damaged units for every product (0 to 999) | اكتب الوحدات السليمة والتالفة لكل منتج (من 0 لـ 999) |
unitsErrUpTo | Enter the good and damaged units for every product (0 to {max}) | اكتب الوحدات السليمة والتالفة لكل منتج (من 0 لـ {max}) |
problem | {brand} reported a problem | {brand} بلّغت عن مشكلة |
keep | Keep the count | خلّي العدد زي ما هو |
recount | Recount | عِدّ تاني |
kept | {brand}'s problem report was closed: the count stands. | بلاغ {brand} اتقفل: العدد زي ما هو. |
diff | You confirmed {good} of the {claimed} units {brand} claimed. Only {good} are in stock. {brand} sees the difference and can report a problem. | أكّدت {good} من الـ {claimed} وحدة اللي {brand} قالت عليهم. {good} بس اللي في المخزون. {brand} بتشوف الفرق وتقدر تبلّغ عن مشكلة. |
matched | All {good} units matched the claim and are in {brand}'s gift stock. | الـ {good} وحدة كلهم طابقوا اللي اتقال وبقوا في مخزون هدايا {brand}. |
loading | Loading the shipment… | بنحمّل الشحنة… |
loadError | Couldn’t load this shipment. Try again. | مقدرناش نحمّل الشحنة دي. جرّب تاني. |
retry | Try again | جرّب تاني |
Design guidance
How the BRICKS design system uses GiftShipmentCard. Written in docs/content/components/GiftShipmentCard.md; the props above are read from the code, which wins where the two disagree.
The shipment page's main card: what a brand says it sent against what arrived, the count PR enters, and what happens next by state; use it on the PR Portal's Shipment page.
GiftShipmentCard is the PR mock v3's P.gship left card ("What Glow Lab says it sent vs what arrived"). A brand claims it shipped gifts; nothing is gift stock until PR counts what arrived and confirms it, and only good units go into the brand's stock. While the shipment is Expected or Arrived the card is a check table: tick "All 40 OK" or type good and damaged units, enter boxes received (Expected only) and confirm. Once counted it shows Good, Damaged and Missing with the matched line or a difference banner. A brand's problem report shows above any state with "Keep the count" and "Recount". It fetches nothing; actions come back through callbacks.
Anatomy
- Card head: the title ("What Glow Lab says it sent" or "… vs what arrived") and the state's
PrStatusPill. - Table (bordered, radius 18): Product (row header,
<bdi>), Brand says sent; while counting: Arrived in full? (checkbox "All 40 OK"), Good and Damaged inputs (72 × 42, numeric); once counted: Good (bold), Damaged, Missing (red count, or "+2 extra"). - Problem report (with
problem): redBanner"Glow Lab reported a problem (12 Nov): "…"", then Keep the count / Recount (ink). - Kept line (
problemKept): "Glow Lab's problem report was closed: the count stands." - Check block (counting): "Check what arrived · 2 products" with "Tick all as received in full"; the explanation (+
note); "Boxes received" field (Expected) with the hint "Glow Lab said 2"; inline errors; "Confirm received quantities" (ink). - Result (counted):
confirmed: "All 80 units matched the claim and are in Glow Lab's gift stock.";confirmed_diff: butter banner "You confirmed 54 of the 60 units Glow Lab claimed…".
Under 600px each product becomes a small card with its column labels.
Variants
state | What it shows |
|---|---|
expected | Check table, explanation, Boxes received, Confirm |
arrived | Check table, explanation, Confirm (no boxes) |
confirmed | Counted table, matched line |
confirmed_diff | Counted table, difference banner |
cancelled | Claimed units only |
+ problem | Red report banner and Keep / Recount, over any state |
+ problemKept | Muted "count stands" line |
States
| State | Trigger |
|---|---|
| Row ticked | checkbox on: Good = claimed, Damaged = 0, both read-only, row lime-tinted |
| Row unticked | Good cleared and focused |
| Invalid count | Confirm with a non-whole or out-of-range value (0-999): fields marked aria-invalid, alert "Enter the good and damaged units for every product (0 to 999)" |
| Invalid boxes | not 1-99: field error |
| Busy | busy: Keep, Recount and Confirm disabled |
| Save error | error: alert above Confirm |
| New shipment | state or line ids/claims change: the count resets |
| Arabic digits | typed Arabic-Indic digits are accepted |
Types
GiftShipmentState (state): 'expected' | 'arrived' | 'confirmed' | 'confirmed_diff' | 'cancelled'. GiftShipmentLine (lines): { id?, product, claimed, good?, damaged? }. GiftProblem (problem): { date, text }: the open report. GiftCount (onConfirm, valid counts only): { lines: [{ id, good, damaged }], boxes? }.
Usage
import { GiftShipmentCard } from '@ergasti/bricks';
<GiftShipmentCard
brand="Glow Lab"
state="expected"
lines={[{ id: 'powder', product: 'Face powder', claimed: 40 }]}
claimedBoxes={2}
onConfirm={(count) => confirmShipment('GS-0017', count)}
busy={saving}
error={saveError}
/>// Shipment page: the card beside the timeline and the brand's gift stock
<PageHeader title="GS-0014 · Glow Lab" subtitle="Sent 10 Nov · 3 boxes" />
<div style={{ display: 'grid', gridTemplateColumns: 'minmax(0, 2fr) minmax(0, 1fr)', gap: 16, alignItems: 'start' }}>
<GiftShipmentCard
brand="Glow Lab"
state="confirmed_diff"
lines={[
{ product: 'Eyeshadow palette', claimed: 30, good: 28, damaged: 2 },
{ product: 'Hand soap', claimed: 30, good: 26, damaged: 0 },
]}
problem={{ date: '12 Nov', text: 'We packed 30 hand soaps in box 2. Please recount.' }}
onKeepCount={keepCount}
onRecount={recount}
/>
<div style={{ display: 'grid', gap: 16 }}>
<GiftShipmentTimeline sent="10 Nov · 3 boxes · Courier" />
<BrandGiftStockCard brand="Glow Lab" left={42} total={100} />
</div>
</div>Count a shipment that is expected: tick a product that arrived in full ("All 40 OK") or enter the good and damaged units, then the boxes received. onConfirm gets whole numbers only. (docs example CountWhatArrived)
import { useState } from 'react';
import { BrandGiftStockCard, GiftShipmentCard, GiftShipmentTimeline, type GiftCount } from '@ergasti/bricks';
export function CountWhatArrived() {
const [last, setLast] = useState<GiftCount | null>(null);
return (
<div style={{ display: 'grid', gap: 10 }}>
<GiftShipmentCard brand="Glow Lab" state="expected" lines={[{ id: 'powder', product: 'Face powder', claimed: 40 }]} claimedBoxes={2} onConfirm={setLast} />
<small>{last ? `Confirmed: ${last.lines[0].good} good, ${last.lines[0].damaged} damaged, ${last.boxes} boxes` : 'Not confirmed yet'}</small>
</div>
);
}Where it appears
- PR Portal › Gift stock › a shipment's page (
P.gship) › left card, in every state (GS-0017 expected, GS-0016 arrived, GS-0014 confirmed with difference and problem, GS-0009 confirmed). - Opened from PR Portal › Gift stock › shipments table row.
- Dashboard screen: PrGifts (the list); the shipment page is a gallery screen.
Guidelines
Do
- Re-send the shipment after
onConfirmsucceeds so the card moves to the counted state. - Keep "Damaged" for units that arrived but can't be gifted; missing is computed.
- Put an open decision or a rules link in
note, not in your own paragraph.
Don't
- Don't count claimed units as stock anywhere else in the UI.
- Don't hide the problem banner once the count is confirmed: the brand's report stays until PR answers.
- Don't mix it with the deprecated
GiftClaimCheckon the same page.
RTL and Arabic
Table and banners mirror; number inputs stay dir="ltr". Table heads drop upper-casing in Arabic. Arabic words: "وصل كامل؟", "سليم", "تالف", "ناقص", "الـ 40 كلهم تمام", "أكّد الكميات اللي وصلت"; Arabic-Indic digits typed into the fields are accepted.
Tokens
--line, --card, --tbl-head, --ink, --ink-3, --lime-50, --ok, --rasp, --bad, --field-radius, --focus-ring, --focus-ring-field, --radius-xs, --min-touch-target.
Accessibility
- A real
<table>withscopeheaders; each input is named ("Good units of Face powder"), the checkbox carries the product in hidden text. - A Missing count is a bold number,
aria-hidden, with visually hidden "6 missing" text, so it is read with its meaning. - Invalid inputs are
aria-invalidand point to the alert (aria-describedby); errors arerole="alert". - Unticking moves focus to Good so PR can type at once.
- Checkbox labels get a focus ring and, on touch, 44px targets.
Found in the source
- Roles in the markup:
alert. - ARIA attributes set:
aria-label,aria-invalid,aria-describedby,aria-hidden. - It moves focus in code.
- Its tests cover: “a tick fills Good with the claim, locks both and tints the row; unticking clears Good and focuses it”; “an untouched ”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
GiftStatusPills: the state (and problem) as pills in lists.GiftShipmentTimeline,BrandGiftStockCard: the side cards of the same page.GiftClaimCheck: deprecated since 0.7.0 in favour of this card (shipmentIdkeeps counts by product, as it did).RecordGiftsDialog: PR records a shipment for a brand.
See also: Banner · Button · Card · FormField · useLanguage · PrStatusPill · WarehouseDetailsCard · GiftAttentionList · GiftShipmentCounts
Source
src/pr/gifts/GiftShipmentCard.tsx (line 181) on GitHub.