Skip to Content
BBRICKSv0.7.4
PR PortalGifts

GiftStatusPills

A shipment's status pill, and "Problem reported" beside it while the brand disputes the count (the mock's gPill(st) + p-bad pill): "Confirmed with difference" + "Problem reported". Words and tones come from the provider's statusTables.pr. Used by the Gift stock list, the shipment page and anywhere a shipment is listed.

import { GiftStatusPills } from '@ergasti/bricks';

Examples

A shipment's status, and "Problem reported" beside it while the brand disputes PR's count

Code
import { GiftStatusPills } from '@ergasti/bricks';

function Pills() {
  return (
    <div style={{ display: 'grid', gap: 10, justifyItems: 'start' }}>
      <GiftStatusPills state="expected" />
      <GiftStatusPills state="arrived" />
      <GiftStatusPills state="confirmed_diff" problem />
      <GiftStatusPills state="confirmed" />
    </div>
  );
}

The Gift stock list: status chips over giftShipmentColumns (reference, brand, for, units claimed and confirmed, status)

giftShipmentMatches filters by a chip; "Problem reported" matches any state with an open report.

Code
import { useState } from 'react';
import { DataTable, GiftStatusFilter, giftShipmentColumns, giftShipmentMatches, type GiftShipmentFilter, type GiftShipmentRow } from '@ergasti/bricks';

const glow = { id: 'glow', name: 'Glow Lab', color: '#C7325C' };

const rows: GiftShipmentRow[] = [
  { id: 'GS-0017', sent: '17 Nov', brand: glow, for: 'December glow', claimed: 40, state: 'expected' },
  { id: 'GS-0013', sent: '15 Nov', brand: { id: 'kemet', name: 'Kemet Home', color: '#3D5A10' }, for: 'Weekend sprint', claimed: 40, state: 'arrived' },
  { id: 'GS-0014', sent: '9 Nov', brand: glow, for: 'Lip oil bundle push', claimed: 60, confirmed: 54, state: 'confirmed_diff', problem: true },
  { id: 'GS-0009', sent: '28 Oct', brand: glow, for: 'Winter glow launch', claimed: 115, confirmed: 115, state: 'confirmed' },
];

function GiftStockList() {
  const [chip, setChip] = useState<GiftShipmentFilter | 'all'>('all');
  return (
    <div style={{ display: 'grid', gap: 14 }}>
      <GiftStatusFilter value={chip} onChange={setChip} />
      <DataTable label="Gift shipments" columns={giftShipmentColumns('en')} rows={rows.filter((r) => giftShipmentMatches(chip, r))} rowKey={(r) => r.id} onRowClick={() => {}} />
    </div>
  );
}

Props

Prop

Type

Design guidance

How the BRICKS design system uses GiftStatusPills. Written in docs/content/components/GiftStatusPills.md; the props above are read from the code, which wins where the two disagree.

A gift shipment's status pill, plus a red "Problem reported" pill while the brand disputes the count; use it wherever a shipment is listed or headed. GiftStatusFilter, the Gift stock list's status chips, is documented here too.

GiftStatusPills is the PR mock v3's gPill(st) with its p-bad companion. A shipment moves from Expected (the brand says it sent gifts) to Arrived (they reached the warehouse) to Confirmed (every unit matched) or Confirmed with difference; a dropped claim is Cancelled. A brand disputing PR's count is not a state but a separate flag, shown as a second pill so both facts stay visible. Words and tones come from the provider's statusTables.pr.

Anatomy

  1. Wrapper: <span class="kit-pr-gpills">, inline-flex, wraps, 6px gap.
  2. State pill: PrStatusPill with gift_<state>.
  3. Problem pill (with problem): PrStatusPill status="gift_problem", red.

GiftStatusFilter: the kit FilterChips radiogroup "Shipment status": All, Expected, Arrived, Problem reported, Confirmed with difference, Confirmed (optional counts).

Variants

statePillTone
expectedExpectedsky
arrivedArrivedlilac
confirmedConfirmedok (green)
confirmed_diffConfirmed with differencewarn (butter)
cancelledCancelledmute
problem (flag)+ Problem reportedbad (red)

States

StateTrigger
One pillproblem false
Two pillsproblem true
Narrow cellpills wrap onto two lines
Filter chip selectedGiftStatusFilter value

Types

GiftShipmentState (state): 'expected' | 'arrived' | 'confirmed' | 'confirmed_diff' | 'cancelled'.

GiftStatusFilter

PropTypeDefaultRequiredDescription
valueGiftShipmentFilter | 'all'yesThe chosen chip.
onChange(value) => voidyesChoose a chip.
countsPartial<Record<GiftShipmentFilter | 'all', number>>{}noA number per chip; missing shows none.
filtersReadonlyArray<GiftShipmentFilter>GIFT_SHIPMENT_FILTERSnoChips after All, in order.
languageLangprovider'snoWords.
labelsPartial<PrGiftStatusFilterCopy>nonenolabel, all.

Helpers: giftStatusKey(state) ('gift_' + state), isGiftCounting(state) (expected or arrived), giftShipmentMatches(filter, row), GIFT_SHIPMENT_FILTERS.

Usage

import { GiftStatusPills } from '@ergasti/bricks';

<GiftStatusPills state="confirmed_diff" problem />
// Gift stock: the toolbar's chips filter the shipments table, whose Status column uses GiftStatusPills
export function GiftStock({ shipments, openShipment }: { shipments: GiftShipmentRow[]; openShipment: (id: string) => void }) {
const [chip, setChip] = useState<GiftShipmentFilter | 'all'>('all');
const [q, setQ] = useState('');
const [scope, setScope] = useState('mine');
const rows = shipments.filter((s) => giftShipmentMatches(chip, s));
return (
<>
<ListToolbar
  search={{ value: q, onChange: setQ, placeholder: 'Search shipments' }}
  filters={<GiftStatusFilter value={chip} onChange={setChip} />}
  extra={<Segmented label="Scope" value={scope} onChange={setScope} options={[['mine', 'My brands'], ['all', 'All brands']]} />}
/>
<DataTable label="Shipments" rows={rows} rowKey={(s) => s.id} columns={giftShipmentColumns('en')} onRowClick={(s) => openShipment(s.id)} />
</>
);
}
// The shipment page header: reference, brand, both pills
<PageHeader title="GS-0017 · Glow Lab" actions={<GiftStatusPills state="arrived" problem={shipment.problem} />} />

The Gift stock list: status chips over giftShipmentColumns (reference, brand, for, units claimed and confirmed, status). giftShipmentMatches filters by a chip; "Problem reported" matches any state with an open report. (docs example GiftStockList)

import { useState } from 'react';
import { DataTable, GiftStatusFilter, GiftStatusPills, giftShipmentColumns, giftShipmentMatches, type GiftShipmentFilter, type GiftShipmentRow } from '@ergasti/bricks';

const rows: GiftShipmentRow[] = [
  { id: 'GS-0017', sent: '17 Nov', brand: glow, for: 'December glow', claimed: 40, state: 'expected' },
  { id: 'GS-0013', sent: '15 Nov', brand: { id: 'kemet', name: 'Kemet Home', color: '#3D5A10' }, for: 'Weekend sprint', claimed: 40, state: 'arrived' },
  { id: 'GS-0014', sent: '9 Nov', brand: glow, for: 'Lip oil bundle push', claimed: 60, confirmed: 54, state: 'confirmed_diff', problem: true },
  { id: 'GS-0009', sent: '28 Oct', brand: glow, for: 'Winter glow launch', claimed: 115, confirmed: 115, state: 'confirmed' },
];

export function GiftStockList() {
  const [chip, setChip] = useState<GiftShipmentFilter | 'all'>('all');
  return (
    <div style={{ display: 'grid', gap: 14 }}>
      <GiftStatusFilter value={chip} onChange={setChip} />
      <DataTable label="Gift shipments" columns={giftShipmentColumns('en')} rows={rows.filter((r) => giftShipmentMatches(chip, r))} rowKey={(r) => r.id} onRowClick={() => {}} />
    </div>
  );
}

Where it appears

  • PR Portal › Gift stock › shipments table, Status column (one or two pills per row) and the status chips.
  • PR Portal › Gift stock › a shipment's page › page header and card.
  • Dashboard screen: PrGifts.

Guidelines

Do

  • Keep the problem flag separate from the state; clear it when PR answers the report.
  • Use giftShipmentMatches so the "Problem reported" chip matches rows in any state.

Don't

  • Don't invent a problem state.
  • Don't show more than these two pills in a cell.

RTL and Arabic

Pills flow from the right. Arabic words come from statusTables.pr (gift_*); filter label "حالة الشحنة", "الكل".

Tokens

--sky, --sky-ink, --lilac, --lilac-ink, --ok-bg, --ok, --butter, --butter-ink, --rasp-50, --bad, --soft, --ink-2.

Accessibility

Plain text pills, read in order ("Confirmed with difference, Problem reported"). The filter is a radiogroup: one tab stop, arrow keys move and choose. Pass all or one of filters as value (with any other value the first chip is the tab stop and none shows as selected). In giftShipmentColumns, an uncounted "Units confirmed" cell is an aria-hidden dash with visually hidden "Not counted yet" text.

Found in the source

  • Its tests cover: “the mock’s chips in order, a radiogroup moved with the arrows”.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: useBricks · useLanguage · GiftStockList · DataTable · BrandGiftStockCard · GiftAttentionList · GiftClaimCheck

Source

src/pr/gifts/GiftStatus.tsx (line 34) on GitHub.

On this page