import { Badge } from '@/components/badge';
import type { BadgeProps } from '@/components/badge';
import { CheckIcon, XIcon } from '@/icons';
import { PALETTES } from './axis-values';
import type { Entry } from './types';
/**
* Badge's own axes, exported so `pages/badges.tsx` and `pages/badges-figma.tsx`
* read one list rather than a second hand-copy — the rule `registry/alert.tsx`
* and `registry/avatar.tsx` already follow.
*
* The split matters: {@link BADGE_VARIANTS} compose with `colorPalette` because
* they paint from the `--ctl-*` roles, while {@link BADGE_SHORTHANDS} pin their
* colour from the semantic roles and ignore `colorPalette` entirely. A grid that
* crossed the two would have five columns doing nothing.
*/
export const BADGE_VARIANTS = ['solid', 'subtle', 'surface', 'outline', 'ghost'] as const;
export const BADGE_SHORTHANDS = [
'default',
'secondary',
'destructive',
'success',
'warning',
] as const;
export const BADGE_SIZES = ['xs', 'sm', 'md', 'lg'] as const;
export const badge: Entry = {
slug: 'badge',
name: 'Badge',
group: 'Data display',
description:
'A small status label. Same two-axis model as Button — five treatments against seven palettes — plus five one-word shorthands that pin their own colour.',
imports: { subpath: 'badge', names: ['Badge'] },
figma: {
set: 'Badge',
axisMap: { color: 'colorPalette' },
/*
* CBAR names Badge's colours by what they mean rather than by ramp, so the
* four it draws are the four listed here; the rest of the kit's palettes
* have no counterpart on that canvas.
*
* `default` pairs with `secondary`, not `primary`. The pairing is read off
* the fills rather than off the axis name — the same correction
* `pages/alerts-figma.tsx` records for its own band table. Measured through
* the bridge, `color=default` is `#4BC7B5` solid / `#CFF3EC` surface /
* `#A6E8DA` border, which is `secondary-500 / -100 / -200` exactly. Calling
* it `primary` matched a role name against a navy ramp and reported the
* turquoise column as a gap.
*/
valueMap: { color: { green: 'success', red: 'removed', secondary: 'default' } },
},
axes: {
variant: BADGE_VARIANTS,
colorPalette: PALETTES,
size: BADGE_SIZES,
},
defaults: { variant: 'subtle', colorPalette: 'primary', size: 'md' },
render: (props) =>