"use client"; import * as React from "react"; import { LAUNCHER_NAMES, LauncherGlyph, type LauncherName, } from "./launcher-glyph"; import { RadioGroup, RadioGroupItem } from "./radio-group"; import { cn } from "../lib/cn"; export interface LauncherPickerProps { /** Above the tiles, and the group's name: "Icona". */ label: string; value: LauncherName; onChange?: (value: LauncherName) => void; /** The button's colour and the glyph's, as CSS colours. */ color?: string; glyph?: string; /** What each icon is called: "Universale", "Sedia a rotelle", "Vista". */ names: Record; /** The choice is shown and read out, and cannot be changed. */ disabled?: boolean; className?: string; } // The design system's LauncherPicker: which icon the widget's button shows on // the customer's site. Each option is a radio tile with the real launcher // artwork, drawn in the button's own colours, above its name. The three sit // side by side down to a 330px column, then wrap. // // One radio group: one tab stop, the arrow keys move between the icons. All // four of them: the tiles wrap onto two rows on a phone, so the group has no // single direction to restrict the keys to. function LauncherPicker({ label, value, onChange, color, glyph, names, disabled = false, className, }: LauncherPickerProps) { const id = React.useId(); return (
{label} onChange?.(next as LauncherName)} disabled={disabled} className="grid-cols-[repeat(auto-fit,minmax(min(6.5rem,100%),1fr))]" > {LAUNCHER_NAMES.map((name) => ( ))}
); } export { LauncherPicker };