Skip to content

@sakaniui/react 0.19.0

Choose a tag to compare

@samzydd samzydd released this 17 Nov 14:59
· 27 commits to main since this release

Added

  • RegionMap, RegionMapLegend and RegionMapBlock. A choropleth for "how does this vary by place": regions shaded by a value, a hover card with the rank, and click-to-zoom into one region (the view eases to it; Escape or a second click goes back out; reduced motion jumps). Plain SVG, no map library, no new dependency. The shapes are data (regions + viewBox), so it is not tied to one country: outlines ship per country, each importable on its own so an app only carries the ones it uses: @sakaniui/react/regions/us (the 50 states and DC), /uk (the 12 statistical regions), /es (the 17 autonomous communities and Ceuta and Melilla, with the Canary Islands as an inset), /de (the 16 Länder), /ca (13 provinces and territories) and /au (6 states and 2 territories), 6 to 45 KB each, from Natural Earth and US Census boundaries (public domain), and any SVG paths work. scale takes breaks (4 breaks make 5 bins) and diverging for growth-style data (orange below zero, blue above). Keyboard: one tab stop, arrows move between regions, Enter or Space selects. RegionMapBlock is the full "Revenue by state" card (Blocks / Application / Region Map): a metric switch, a find-a-state search, the headline figure, the map and legend, and a ranked list (highest or lowest, or all) that becomes, once a region is zoomed, its first two metrics as compact cards (name and rank on top, the figure, then a green, red or grey pill: "+16.6 pts", "39% below", "On average"), the rest of the metrics as one line of help text under them ("Penetration 10.3%, 25th of 51, in line with the average") and the regions next to it in the ranking. The map, legend and list are linked: pointing at a region outlines it everywhere and marks its band on the legend; pointing at a legend band (or clicking it to hold it) fades every region outside it. RegionMap gains onHoverChange, hovered and dimExcept; RegionMapLegend gains activeBin, lockedBin, markBin, onBinHover, onBinClick and noData. The list plays a load animation: each bar grows from the left while its figure counts up from zero, row by row (on first load, when the metric changes, and when you come back from a zoom). animate={false} turns it off, and reduced motion skips it. The map colours are seven new tokens, --color-map-bin-0 to --color-map-bin-4 (the chart blue stepping from 25% to 100% over --color-bg-muted) and --color-map-neg-0, --color-map-neg-1 (the chart orange, for values below zero), declared in light and dark and mirrored in Figma as Semantic map/*. Nothing existing changes.

Fixed

  • Combobox shows a pointer cursor, not a text cursor. The field is a button that opens a list, but a stray cursor: text made it look like a box you could type into. It now shows the pointer, and the value is no longer selectable text. No prop or layout changes.