codeburn/app/renderer/components/ProviderPop.tsx
iamtoruk 015a1a069a polish(app): shared empty states, type ladder, AA contrast, honest affordances, a11y semantics
D1 one shared EmptyNote (7 copies removed); CliErrorPanel on canonical
   tokens; dead code deleted (CapsuleChart, stale SERIES_HEX palette,
   Stat tone API, unused rail/doc-chrome CSS)
D2 type ladder tokens (--fs-*/--fw-*); panel titles unified 13/600/ink;
   high-visibility sizes/weights snapped to rungs
D3 contrast: --mut2 5.00:1 light / 5.74:1 dark (was 2.37/3.11); new
   --accent-text 5.07:1 + persistent underline on text links; last
   prose em-dash removed
D4 'See all' and 'Most expensive sessions' navigate to Sessions; 'add
   alias' jumps to Settings/Aliases; chevrons only on clickable rows;
   inline confirm replaces window.confirm; default-period setting
   honored at boot; Sankey caption no longer promises a click; Optimize
   'improving' trend badges; cursor + Space-key fixes
D5 aria-current on nav, SegTabs as real tablist, aria-pressed toggles,
   ProviderPop rebuilt on Dropdown (one tab stop, arrow keys, focus ring)

191/191, typecheck + build green. Contrast ratios independently
recomputed. Net -93 lines.
2026-07-16 02:27:41 -07:00

32 lines
874 B
TypeScript

import { Dropdown } from './Dropdown'
import { ProviderLogo } from './ProviderLogo'
export type ProviderOption = { value: string; label: string }
/**
* Provider selector built on the Dropdown listbox (roving tabindex, arrow-key
* navigation, one tab stop, focus-visible ring via `.dropdown-trigger`), with a
* provider logo rendered in the trigger and each option. `label` is retained for
* API compatibility; the Dropdown derives the display label from `options`.
*/
export function ProviderPop({
value,
options,
onSelect,
}: {
value: string
label: string
options: ProviderOption[]
onSelect: (value: string) => void
}) {
return (
<Dropdown
id="provider-select"
ariaLabel="Providers"
value={value}
options={options}
onChange={onSelect}
renderIcon={provider => <ProviderLogo provider={provider} />}
/>
)
}