* feat(ui): shift-click range selection on list row checkboxes
Click one checkbox, shift-click another, and every row between them
takes the clicked row's new state, the way mail clients work. Turns a
20-row bulk selection into two clicks.
New useRangeSelect hook (lib/hooks/use-range-select.ts) keeps the anchor
and applies the range over the rows as currently rendered, so it follows
filtering, sorting and paging rather than the underlying data order. A
shift-click with no valid anchor (first click, or the anchor filtered
away) degrades to a plain toggle. Select-all and clear reset the anchor.
Wired into the 8 selection surfaces: transaction inbox and skattekonto
inbox (separate ranges, since the two row types book through different
endpoints), journal entry list, invoices, supplier invoices, orders,
pending operations, invoice inbox workspace.
Radix' onCheckedChange carries no mouse event, so each row records
shiftKey from the click that precedes it; the checkbox cells get
select-none so shift-clicking does not smear a text selection.
The pure range rule is unit tested (10 cases: both directions, range
unselect, anchor invalidation, rendered-order independence).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015n8vUx9Nukr8mHC7CVNF7y
* fix(ui): void the range anchor on an empty selection, keep placeholders out
Review findings from CodeRabbit and the skeptic pass, all in the new
range-selection feature:
- Clearing a selection left the anchor behind, so the next shift-click
extended from a row the user could no longer see selected (click a row,
press "Rensa markering", shift-click 30 rows down, get 30 rows). The
explicit resetAnchor() calls only covered the clear paths that were
wired by hand; several others (period change, filter change, post-bulk
success, "Avmarkera") were not. An empty selection now counts as having
no anchor, which covers every clear path including ones added later.
- The invoice inbox passed optimistic upload placeholders into visibleIds
even though they render no checkbox. Safe today only because
placeholders are always prepended; filtering them out makes the
invariant local instead of depending on insert order elsewhere.
- pending: "Godkänn alla" pre-selects a non-empty set, so it resets the
anchor explicitly.
Two existing tests used a fixture the UI cannot reach (an anchor with an
empty selection); they now start from the state a real anchor implies.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015n8vUx9Nukr8mHC7CVNF7y
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>