Skip to content

@sakaniui/react 0.18.0

Choose a tag to compare

@samzydd samzydd released this 15 Nov 11:54
· 53 commits to main since this release

Map Globe: markers that carry data, a globe that follows

All additions are optional; a globe that uses none of them draws and behaves as before.

  • MapGlobeMarker.size ("sm" | "md" | "lg", default "sm"): the dot, its ring and its halo scale 1x, 1.6x and 2.3x, so a marker can show a value (Figma Map Globe Marker, Size).
  • MapGlobeMarker.rank: a numbered chip beside the marker that matches the rank in a list next to the globe (Rank=Number).
  • MapGlobeMarker.status="watch": a dashed amber ring (--color-warning-solid), so a warning is never carried by colour alone (Status=Watch).
  • center is reactive. When it changes after mount the globe turns to face the new place, the short way round, over about 0.9s, then pauses its spin for a moment; dragging cancels it. Under reduced motion it jumps.
  • zoom (default 1, 0.7 to 2.2): scales the sphere, easing between values.
  • renderMarkerCard(index, marker): your own card, kept on the hovered marker (or the selected one) as the globe turns, above it or below when there is no room, and hidden while the marker is on the far side. It never takes the pointer. Replaces the small text label.
  • Arrow keys move between the markers' keyboard buttons.
  • New type export MapGlobeMarkerSize.
  • cardPlacement ("above" | "side", default "above"): renderMarkerCard can sit beside the marker, on the side with room, instead of above it.
  • MapControlButton takes pressed (a toggle that is on: a bg/muted fill and aria-pressed) and title. Figma's Map Control Button set has a matching Pressed state.
  • markerScale: how big the markers are drawn (dots, rings, halos and rank chips together). It follows the globe's size by default; pass 1 to keep the design size on a small globe, so the rank numbers stay readable on a phone.
  • A marker pinned with hovered now shows its renderMarkerCard too. Markers stay solid until the very edge of the disc instead of fading a little early, and the rank chip is Geist Regular 10px as in Figma.

New component: Flag

A country flag from the Figma "Flags" set: <Flag country="JP" />, by ISO 3166-1 alpha-2 code, a 16 x 16 box (Figma uses 16 beside text and 32 beside a heading; pass size). Decorative unless you pass label: put the country's name in text beside it. The flags the library uses are imported (GB, SG, JP, IN, AU); a country whose artwork is not imported yet draws a neutral placeholder of the same shape, so a row of flags never shifts. Each further flag is added by dropping its exported SVG markup into src/components/Flag/flags.ts.

New block: Live Map (LiveMapBlock)

A live payments map from the Figma "Live Map" set (Device x State). A dotted globe whose dots are sized by the metric and ranked, a ranked list of cities that turns into a city's detail when you pick one, region filters, a Revenue / Payments / Approval rate switch, a hover card (with the city's Flag), a legend, zoom buttons, and a playback row (Replay today, Pause, the volume by hour, a UTC clock). A rotate button in the map controls stops and restarts the globe's slow spin. Under 720px of its own width it is the phone layout, with the list as a bottom sheet. States: default, loading (skeletons), empty (no payments yet today). It is a composition example: the data is plain props (cities, regions, hourly, totals, insight) with the Figma block's figures as the default, and it is built from Map Globe, Flag, Segmented control, Filter chip, Tabs, Badge, Button, Icon button and Location dot. Each city's country is its two-letter code, which shows as its flag in the list, the hover card, the city detail and the phone rows.

import { LiveMapBlock } from '@sakaniui/react/blocks';
<LiveMapBlock cities={cities} onViewCity={(city) => router.push(`/payments?city=${city.id}`)} />

Fixed

  • Button is the same height with an icon as without one. A 16px (or 18px) icon was taller than the label's 14px line, so every sm button with an icon was 34px tall (Figma: 32) and md 38px (Figma: 36). The icon now overflows its box evenly and the button keeps its size.
  • FilterChip is 26px tall, as in Figma (4px + an 18px line + 4px, with the 1px stroke inside). It was 28px, and 2 to 4px wider.
  • The active SidebarItem has no hover state. It is where you are, not something to point at, so the pointer no longer changes it. The "Active - Indicator" item keeps shadow/xs under the pointer (it used to strengthen to shadow/sm), the "Active - Default" item keeps its bg/subtle tint (it used to lighten toward bg/canvas, expanded only), and the Sidebar's gliding hover highlight skips the active item (data-hover-item="off", also on the active SidebarSubItem). Every other item still reacts as before. The Figma Sidebar Item set no longer has the three "Active Hover" variants either. Nothing to change in your code; blocks that use SidebarItem (the CRM dashboard, the chat and AI chat blocks) follow automatically.