UNPKG

@dnanpm/styleguide

Version:

DNA Styleguide repository provides the set of components and theme object used in various DNA projects.

64 lines (63 loc) 2.23 kB
import type { MouseEvent, ReactNode } from 'react'; import React from 'react'; type ChipType = 'default' | 'info' | 'success' | 'warning' | 'error'; type ChipVariant = 'outlined' | 'filled'; interface Props { /** * Unique ID for the component */ id?: string; /** * Allows to change the color styling of component, depending on the passed type * * @param {ChipType} default Uses default color: `theme.color.line.L01` * @param {ChipType} info Changes color to default color (this type will be deprecated in the future) * @param {ChipType} success Uses `theme.color.notification.success` color for styling * @param {ChipType} warning Changes color to default color (this type will be deprecated in the future) * @param {ChipType} error Uses `theme.color.notification.error` color for styling * * @deprecated The 'info' and 'warning' types will be deprecated and removed in the next major release. * * @default 'default' */ type?: ChipType; /** * Allows to change the appearance styling of component, depending on passed variant * * @param {ChipVariant} outlined * @param {ChipVariant} filled * * @deprecated The styles are now encapsulated within the component. The 'variant' prop will be removed in the next major release. * * @default 'outlined' */ variant?: ChipVariant; /** * Content of the component */ children?: ReactNode; /** * On component click callback */ onClick?: (e: MouseEvent<HTMLElement>) => void; /** * Allows to pass a custom className */ className?: string; /** * Allows to pass testid string for testing purposes */ 'data-testid'?: string; /** * Allows to pass an accessible label for the component. */ ariaLabel?: string; /** * Provides additional information about the Chip not included in the aria-label. * This attribute should reference the ID of a related text element for context. */ ariaDescribedBy?: string; } declare const Chip: ({ type, variant, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element; /** @component */ export default Chip;