wealth/packages/island/src/atoms/chip/variants.ts

36 lines
1.4 KiB
TypeScript

import { cva } from 'class-variance-authority';
/**
* A pill you press to pick one of many, such as a market; a set sits in a wrapping row (DS Chips).
* Off, it is white with a `border-default` outline; on, filled brand. 15/600, 14 at `sm`.
*/
export const chipVariants = cva(
'rounded-full border px-4 font-semibold whitespace-nowrap transition-colors duration-120 ease-standard focus-visible:focus-ring actionable:cursor-pointer disabled:frozen',
{
variants: {
selected: {
true: 'border-action-primary bg-action-primary text-text-on-action actionable:hover:bg-action-primary-hover',
false:
'border-border-default bg-surface text-text-primary actionable:hover:border-text-secondary actionable:hover:bg-surface-hover',
},
size: {
sm: 'min-h-control-sm px-3.5 text-body-sm leading-6',
md: 'min-h-control-md text-body-compact leading-6',
},
},
defaultVariants: { selected: false, size: 'md' },
},
);
/** A set of chips: wrapping rows, or one row that scrolls sideways (DS `scroll`). */
export const chipRowVariants = cva('', {
variants: {
scroll: {
// The 4px padding keeps each chip's focus ring inside the scroller's clip.
true: '-m-1 overflow-x-auto p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',
false: '',
},
},
defaultVariants: { scroll: false },
});