/** * Chip - a selectable filter chip. * * filter (default) - rectangular, accent border + accentSoft fill when active. * The filter chip of the kit. * tab - pill that reads as a tab row: the active one is filled * solid with the accent, idle ones sit on the card colour. * This is the shape the gallery app uses for its category * row, and it is what a swipeable tab strip should look * like across the apps. `count` appends a dimmed number. * * Takes a ref so a scrolling chip row can pull the active chip into view * (scrollIntoView) after the tab is switched by a swipe, not by a tap. * flexShrink/nowrap keep chips at their own width inside such a row. */ import { forwardRef } from "react"; import { FS, FW, R } from "@rukin/tokens"; import { useTheme } from "./theme"; export type ChipVariant = "filter" | "tab"; export type ChipProps = { label: string; active?: boolean; onClick?: () => void; variant?: ChipVariant; /** Dimmed counter after the label (tab variant reads best with it). */ count?: number; }; export const Chip = forwardRef(function Chip( { label, active = false, onClick, variant = "filter", count }, ref, ) { const { C } = useTheme(); const tab = variant === "tab"; return ( ); });