{"name":"filter-table","title":"Filter Table","description":"","kind":"block","category":"data","status":"beta","props":{"columns":{"type":"array","items":{"key":"string","label":"string","type":"title|text|date|number|status|tag (default text; status: a StatusPill, for a state; tag: a Tag, for a label people assign)","width":"number? (a share of the width, fr; default by type: title 1.3, status and tag 0.95, text 0.9, number 0.8, date 0.6)"},"description":"The columns in order. Without them: task (title), date, status, owner (text), named by labels.columns. The shares reach the table as --fndn-filter-cols (set through filter-table.logic.ts)."},"rows":{"type":"array","items":{"[column key]":"string | number"},"description":"One object per row, values by column key."},"filters":{"type":"array","items":{"key":"string (\"all\" matches every row)","label":"string","tone":"blue|green|orange|red|purple|cyan|yellow|pink?","count":"number? (derived from the rows otherwise)"},"description":"The chips. A row matches a chip when its filterKey field equals the chip's key. Without them: All, To do (orange), In Progress (blue), Completed (green), named by labels.statuses, for the values todo, progress, done."},"filterKey":{"type":"string","default":"status","description":"The row field the chips match."},"filter":{"type":"string","default":"all","model":true,"description":"The selected chip"},"labels":{"type":"object","description":"{ filters, region, empty, none, columns: { task, date, status, owner } (built-in columns), statuses: { todo, progress, done } (built-in chips) }"}},"playground":{"name":"Playground","props":{"rows":[{"task":"Reminder SMS sent twice for the same booking","date":"Nov 16","status":"todo","owner":"Brightline Dental"},{"task":"Calendar sync stopped after Google re-auth","date":"Nov 15","status":"progress","owner":"Kestrel Logistics"},{"task":"Can't export invoices as CSV","date":"Nov 14","status":"todo","owner":"Juniper Health"},{"task":"Add a second location to our plan","date":"Nov 12","status":"progress","owner":"Saint Aldric Pediatric Dental Group"},{"task":"Booking page shows the wrong time zone","date":"Nov 10","status":"done","owner":"Orbit Studio"}],"labels":{"filters":"Filter tickets by status","region":"Support tickets","empty":"No tickets with this status","none":"No tickets yet","columns":{"task":"Ticket","owner":"Customer"},"statuses":{"todo":"Open","progress":"Pending","done":"Solved"}}}},"exampleFiles":[{"file":"default","title":"Support tickets by status"},{"file":"deploys-by-environment","title":"Deploys by environment (your own columns)"},{"file":"open-queue","title":"Triage starts on open tickets"},{"file":"nothing-solved","title":"Nothing solved yet this week"},{"file":"no-tickets","title":"A queue with no tickets"}],"worstCase":[{"name":"Long names, unbreakable slug, non-Latin and right-to-left","props":{"rows":[{"task":"Reconcile Alphonso Holdings and Kashmiri Saffron invoices with refunds, credits and late fees","date":"Dec 03","status":"todo","owner":"northwind-industries-holdings-wholesale-cloud-services-division"},{"task":"A","date":"Jan 01","status":"done","owner":"B"},{"task":"夏季限定プランの需要予測を更新する","date":"Jul 19","status":"progress","owner":"株式会社クモ・キャピタル"},{"task":"مراجعة تكاليف الخوادم لهذا الأسبوع","date":"Mar 08","status":"todo","owner":"حلول الشروق"}]}},{"name":"Sixty rows","props":{"rows":[{"task":"Export batch 1","date":"Jan 01","status":"todo","owner":"Kumo Capital"},{"task":"Export batch 2","date":"Feb 08","status":"progress","owner":"Maple Orbit"},{"task":"Export batch 3","date":"Mar 15","status":"done","owner":"Aurora Health"},{"task":"Export batch 4","date":"Apr 22","status":"todo","owner":"Mango Moon Studio"},{"task":"Export batch 5","date":"May 01","status":"progress","owner":"Kumo Capital"},{"task":"Export batch 6","date":"Jun 08","status":"done","owner":"Maple Orbit"},{"task":"Export batch 7","date":"Jul 15","status":"todo","owner":"Aurora Health"},{"task":"Export batch 8","date":"Aug 22","status":"progress","owner":"Mango Moon Studio"},{"task":"Export batch 9","date":"Sep 01","status":"done","owner":"Kumo Capital"},{"task":"Export batch 10","date":"Oct 08","status":"todo","owner":"Maple Orbit"},{"task":"Export batch 11","date":"Nov 15","status":"progress","owner":"Aurora Health"},{"task":"Export batch 12","date":"Dec 22","status":"done","owner":"Mango Moon Studio"},{"task":"Export batch 13","date":"Jan 01","status":"todo","owner":"Kumo Capital"},{"task":"Export batch 14","date":"Feb 08","status":"progress","owner":"Maple Orbit"},{"task":"Export batch 15","date":"Mar 15","status":"done","owner":"Aurora Health"},{"task":"Export batch 16","date":"Apr 22","status":"todo","owner":"Mango Moon Studio"},{"task":"Export batch 17","date":"May 01","status":"progress","owner":"Kumo Capital"},{"task":"Export batch 18","date":"Jun 08","status":"done","owner":"Maple Orbit"},{"task":"Export batch 19","date":"Jul 15","status":"todo","owner":"Aurora Health"},{"task":"Export batch 20","date":"Aug 22","status":"progress","owner":"Mango Moon Studio"},{"task":"Export batch 21","date":"Sep 01","status":"done","owner":"Kumo Capital"},{"task":"Export batch 22","date":"Oct 08","status":"todo","owner":"Maple Orbit"},{"task":"Export batch 23","date":"Nov 15","status":"progress","owner":"Aurora Health"},{"task":"Export batch 24","date":"Dec 22","status":"done","owner":"Mango Moon Studio"},{"task":"Export batch 25","date":"Jan 01","status":"todo","owner":"Kumo Capital"},{"task":"Export batch 26","date":"Feb 08","status":"progress","owner":"Maple Orbit"},{"task":"Export batch 27","date":"Mar 15","status":"done","owner":"Aurora Health"},{"task":"Export batch 28","date":"Apr 22","status":"todo","owner":"Mango Moon Studio"},{"task":"Export batch 29","date":"May 01","status":"progress","owner":"Kumo Capital"},{"task":"Export batch 30","date":"Jun 08","status":"done","owner":"Maple Orbit"},{"task":"Export batch 31","date":"Jul 15","status":"todo","owner":"Aurora Health"},{"task":"Export batch 32","date":"Aug 22","status":"progress","owner":"Mango Moon Studio"},{"task":"Export batch 33","date":"Sep 01","status":"done","owner":"Kumo Capital"},{"task":"Export batch 34","date":"Oct 08","status":"todo","owner":"Maple Orbit"},{"task":"Export batch 35","date":"Nov 15","status":"progress","owner":"Aurora Health"},{"task":"Export batch 36","date":"Dec 22","status":"done","owner":"Mango Moon Studio"},{"task":"Export batch 37","date":"Jan 01","status":"todo","owner":"Kumo Capital"},{"task":"Export batch 38","date":"Feb 08","status":"progress","owner":"Maple Orbit"},{"task":"Export batch 39","date":"Mar 15","status":"done","owner":"Aurora Health"},{"task":"Export batch 40","date":"Apr 22","status":"todo","owner":"Mango Moon Studio"},{"task":"Export batch 41","date":"May 01","status":"progress","owner":"Kumo Capital"},{"task":"Export batch 42","date":"Jun 08","status":"done","owner":"Maple Orbit"},{"task":"Export batch 43","date":"Jul 15","status":"todo","owner":"Aurora Health"},{"task":"Export batch 44","date":"Aug 22","status":"progress","owner":"Mango Moon Studio"},{"task":"Export batch 45","date":"Sep 01","status":"done","owner":"Kumo Capital"},{"task":"Export batch 46","date":"Oct 08","status":"todo","owner":"Maple Orbit"},{"task":"Export batch 47","date":"Nov 15","status":"progress","owner":"Aurora Health"},{"task":"Export batch 48","date":"Dec 22","status":"done","owner":"Mango Moon Studio"},{"task":"Export batch 49","date":"Jan 01","status":"todo","owner":"Kumo Capital"},{"task":"Export batch 50","date":"Feb 08","status":"progress","owner":"Maple Orbit"},{"task":"Export batch 51","date":"Mar 15","status":"done","owner":"Aurora Health"},{"task":"Export batch 52","date":"Apr 22","status":"todo","owner":"Mango Moon Studio"},{"task":"Export batch 53","date":"May 01","status":"progress","owner":"Kumo Capital"},{"task":"Export batch 54","date":"Jun 08","status":"done","owner":"Maple Orbit"},{"task":"Export batch 55","date":"Jul 15","status":"todo","owner":"Aurora Health"},{"task":"Export batch 56","date":"Aug 22","status":"progress","owner":"Mango Moon Studio"},{"task":"Export batch 57","date":"Sep 01","status":"done","owner":"Kumo Capital"},{"task":"Export batch 58","date":"Oct 08","status":"todo","owner":"Maple Orbit"},{"task":"Export batch 59","date":"Nov 15","status":"progress","owner":"Aurora Health"},{"task":"Export batch 60","date":"Dec 22","status":"done","owner":"Mango Moon Studio"}]}},{"name":"One row","props":{"rows":[{"task":"Renew annual contract","date":"Dec 03","status":"todo","owner":"Mango Moon Studio"}]}},{"name":"Zero rows","props":{"rows":[]}},{"name":"Translated statuses, a hue that is not a pill tone, an unknown value","props":{"labels":{"filters":"Tickets nach Status filtern","region":"Support-Tickets","empty":"Keine Tickets mit diesem Status","none":"Noch keine Tickets","columns":{"task":"Ticket","date":"Datum","status":"Status","owner":"Kunde"}},"filters":[{"key":"all","label":"Alle"},{"key":"todo","label":"Offen","tone":"orange"},{"key":"waiting","label":"Wartet auf Rückmeldung des Kunden","tone":"purple"},{"key":"done","label":"Erledigt","tone":"green"}],"rows":[{"task":"Rechnungsexport als CSV schlägt fehl","date":"Nov 16","status":"waiting","owner":"Brightline Dental"},{"task":"Zweiter Standort im Tarif","date":"Nov 12","status":"todo","owner":"Juniper Health"},{"task":"Zeitzone auf der Buchungsseite","date":"Nov 10","status":"archived_by_migration_2024","owner":"Orbit Studio"},{"task":"SMS-Erinnerung doppelt versendet","date":"Nov 08","status":"done","owner":"Kestrel Logistics"}]}}],"anatomy":[{"part":"root","element":"div","description":"max-width 420"},{"part":"filters","element":"div","description":"The real SegmentedControl, variant chips, marked data-filter-table=\"filters\": one radio group, a sliding thumb, each option label holds its filter's dot (its tone) and a count"},{"part":"card","element":"div","description":"role=region, focusable; scrolls sideways when the table is wider than the card; edge veils (::before / ::after, sticky) fade the side the table continues past, each shown while there is more on its side (data-overflow-start, data-overflow-end, kept in step with the scroll position by lib/veil.ts)"},{"part":"table","element":"div","description":"role=table; at least --fndn-filter-min wide (105px a column, 420px at least); the head and every row lay their cells on --fndn-filter-cols (each column's share of the width)"},{"part":"head","element":"div","description":"role=row"},{"part":"th","element":"span","repeat":true,"description":"role=columnheader; a number column's header at the end"},{"part":"row","element":"div","repeat":true,"description":"Reveal wrapper; shown (the row matches the filter) is a recipe variant; kbd-instant (the shared keyboard-instant flag)"},{"part":"cells","element":"div","description":"role=row"},{"part":"cell","element":"span","repeat":true,"description":"role=cell; its column's type (title|text|date|number|status|tag) is a recipe variant. title: 500 ink; title and text are cut at the end with the full value in title; date and number stay whole (tabular; number at the end); a status cell is at least 40px tall, the height a tag row has, so rows do not change height with the column type"},{"part":"status","element":"span","optional":true,"description":"A status column's cell content (to do, failed, live): the real StatusPill size sm, marked data-filter-table=\"status\", with the label of the filter its value matches; that filter's tone is the pill's tone when it is green, orange, red or blue, and a neutral pill's dotTone for purple, cyan, yellow and pink (a neutral pill and the raw value when no filter matches)"},{"part":"tag","element":"span","optional":true,"description":"A tag column's cell content, for labels people assign (an environment, a category): the real Tag, marked data-filter-table=\"tag\", in the label and tone of the filter its value matches (neutral and the raw value when none does)"},{"part":"empty","element":"div","description":"The real EmptyState, marked data-filter-table=\"empty\": a centred row shown only while no row matches, or a block when there are no rows"}],"events":{"change":"(filter)"},"states":["hover","press","focus-visible","checked","disabled","row-hover","row-hidden","empty"],"tokens":["color.surface","color.ink","color.ink-2","color.line","color.hover","color.accent","shadow.card","radius.card","text.sm","easing.out-strong","duration.fast","duration.base","duration.reveal"],"a11y":{"role":"radiogroup + table","keyboard":["Tab reaches the chip group once (the selected chip), then the table region","ArrowRight / ArrowDown and ArrowLeft / ArrowUp move to the next / previous chip and select it","Home / End select the first / last chip","Space selects the focused chip","The table region is focusable; ArrowLeft / ArrowRight scroll it when it overflows"],"notes":["The chips are the segmented control's radio group, labelled by labels.filters; each radio is named by its chip text and count.","The table is role=table with row / columnheader / cell; rows that do not match are visibility: hidden, so they leave the accessibility tree.","Filtering from the keyboard is instant (the rows carry kbd-instant)."]},"motion":["chips: the segmented control's (variant chips): one thumb slides between chips at duration.move easing.move, colour on hover, press scale; instant from the keyboard","row leave / return: grid-template-rows over duration.reveal easing.out-strong with opacity over duration.base; a leaving row gives its space back while it fades, so the rows below close the gap in one motion; no stagger","keyboard selection: instant (kbd-instant)","row hover: instant both ways (the tables' one hover)","edge veils: when the table is cut by the card, the side it continues past fades into the surface; each veil shows at once while there is more on its side (data-overflow-start, data-overflow-end, set from the scroll position by lib/veil.ts, the same in every browser; no animation, never timed); nothing when the table fits, also after a scrolled card grows to fit"]}