import type { ReactNode, SVGProps } from 'react'; import type { IconPosition, Styles } from '@cleartrip/ct-design-types'; import type { TypographyStyleConfigProps, TypographyVariantType } from '@cleartrip/ct-design-typography'; import { ChipVariant, ChipSizeType } from './constants'; export type ChipVariantType = `${ChipVariant}`; export type ChipSize = `${ChipSizeType}`; export type ChipBorderWidth = 'none' | 'sm' | 'md' | 'lg'; /** * Style configuration for the Chip's composable slots. */ export interface IChipStyleConfig { /** Styles for the absolute-positioning relative container wrapping the chip. */ relativeContainer?: Styles[]; /** Styles for the root chip container. */ root?: Styles[]; /** Styles for the inner flex row container holding icon + label. */ chipContainer?: Styles[]; /** Styles for the prefix icon container (yagami-style API). */ prefixIconContainer?: Styles[]; /** Styles for the suffix icon container (yagami-style API). */ suffixIconContainer?: Styles[]; /** Styles for the top icon container. */ topIconContainer?: Styles[]; /** Styles for the label text wrapper. */ labelContainer?: Styles[]; /** Styles for the label Typography. */ labelTypography?: TypographyStyleConfigProps; /** Styles for the cross (dismiss) icon wrapper. */ crossContainer?: Styles[]; /** Styles for the absolute counter container. */ counterContainer?: Styles[]; /** Styles for the counter bubble. */ counter?: Styles[]; /** Styles for the counter Typography. */ counterTypography?: TypographyStyleConfigProps; } export interface IChipProps { /** Unique identifier for the chip. */ id?: string; /** Props spread onto the cross icon SVG. */ crossIconProps?: SVGProps; /** The label content of the chip. */ label?: ReactNode | string; /** Typography variant for string labels. Defaults to 'B2'. */ labelVariant?: TypographyVariantType; /** If true, shows the `Icon` at the specified `iconPosition`. */ showIcon?: boolean; /** Position of the icon within the chip. */ iconPosition?: `${IconPosition}`; /** The ReactNode representing the icon within the chip. */ Icon?: ReactNode; /** Icon rendered before the label (takes precedence over `Icon` + iconPosition='left'). */ prefixIcon?: ReactNode; /** Icon rendered after the label (takes precedence over `Icon` + iconPosition='right'). */ suffixIcon?: ReactNode; /** Icon rendered above the label (takes precedence over `Icon` + iconPosition='top'). */ topIcon?: ReactNode; /** If true, shows a counter within the chip. */ showCounter?: boolean; /** The count value displayed in the counter. */ count?: number; /** If true, the chip can be dismissed. */ isDismissible?: boolean; /** If true, the chip is selected. */ isSelected?: boolean; /** If true, the chip is disabled. */ isDisabled?: boolean; /** Alias for `isDisabled` — kept for yagami parity. */ disabled?: boolean; /** Callback function triggered on chip click. */ onClick?: () => void; /** Callback function triggered on chip dismissal. */ onDismiss?: () => void; /** The border width of the chip. */ borderWidth?: ChipBorderWidth; /** Visual variant for the chip. */ variant?: ChipVariantType; /** Size preset (sm | md). */ size?: ChipSize; /** Style configuration for different parts of the chip. */ styleConfig?: IChipStyleConfig; /** Show shimmer animation (web only). */ showShimmerAnimation?: boolean; } /** * @deprecated Use `IChipProps`. Kept as an alias for legacy consumers that * imported `ChipProps` from `@cleartrip/ct-design-chip`. The `styleConfig` * slots have been migrated from `{ css, className }` objects to `Styles[]` * arrays; legacy call sites will need to migrate. */ export type ChipProps = IChipProps;