import { ChevronEnd } from '@transferwise/icons'; import type { ButtonProps } from '../../Button/Button.types'; import { useListItemControl } from '../useListItemControl'; import { PrimitiveButton } from '../../Primitives'; import { useContext } from 'react'; import { ListItemContext } from '../ListItemContext'; export type ListItemNavigationProps = Pick & { /** * When `true`, the chevron indicator is hidden. Use when surrounding context makes the * interactive affordance clear without a directional cue (e.g. a widget row with trailing * value content).
* **NB:** This feature should be used with great care as it can result in the item looking * as non-interactive, significantly degrading accessibility, UX, and conversion, * especially if used on busy screens with multiple Lists. */ hideIndicator?: boolean; [key: `data-${string}`]: string | number | boolean | undefined; }; /** * This component allows for rendering a control functionally synonymous with HTML `anchor` or a * `button`, giving users a rich way to choose between options and navigate to another screen or * step in a flow. It offers only a subset of features of the HTML element in line with the * ListItem's constraints.
*
* Please refer to the [Design documentation](https://docs.wise.design/components/list-item---navigation) for details. */ export const Navigation = function Navigation({ href, hideIndicator, target, onClick, ...dataAttributes }: ListItemNavigationProps) { const { baseItemProps } = useListItemControl('navigation', { href, hideIndicator, target, onClick, }); const { ids, describedByIds } = useContext(ListItemContext); const icon = hideIndicator ? null : ( ); return href ? ( <>{icon} ) : ( | undefined} > {icon} ); }; Navigation.displayName = 'ListItem.Navigation';