{"version":3,"file":"ListItemNavigation.mjs","sources":["../../../src/ListItem/Navigation/ListItemNavigation.tsx"],"sourcesContent":["import { ChevronEnd } from '@transferwise/icons';\nimport type { ButtonProps } from '../../Button/Button.types';\nimport { useListItemControl } from '../useListItemControl';\nimport { PrimitiveButton } from '../../Primitives';\nimport { useContext } from 'react';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemNavigationProps = Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n  /**\n   * When `true`, the chevron indicator is hidden. Use when surrounding context makes the\n   * interactive affordance clear without a directional cue (e.g. a widget row with trailing\n   * value content).<br />\n   * **NB:** This feature should be used with great care as it can result in the item looking\n   * as non-interactive, significantly degrading accessibility, UX, and conversion,\n   * especially if used on busy screens with multiple Lists.\n   */\n  hideIndicator?: boolean;\n  [key: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/**\n * This component allows for rendering a control functionally synonymous with HTML `anchor` or a\n * `button`, giving users a rich way to choose between options and navigate to another screen or\n * step in a flow. It offers only a subset of features of the HTML element in line with the\n * ListItem's constraints.<br />\n * <br />\n * Please refer to the [Design documentation](https://docs.wise.design/components/list-item---navigation) for details.\n */\nexport const Navigation = function Navigation({\n  href,\n  hideIndicator,\n  target,\n  onClick,\n  ...dataAttributes\n}: ListItemNavigationProps) {\n  const { baseItemProps } = useListItemControl('navigation', {\n    href,\n    hideIndicator,\n    target,\n    onClick,\n  });\n  const { ids, describedByIds } = useContext(ListItemContext);\n  const icon = hideIndicator ? null : (\n    <ChevronEnd size={16} data-testid=\"NavigationIndicator\" {...dataAttributes} />\n  );\n\n  return href ? (\n    <>{icon}</>\n  ) : (\n    <PrimitiveButton\n      {...dataAttributes}\n      disabled={baseItemProps.disabled}\n      aria-describedby={describedByIds}\n      id={ids.control}\n      className=\"btn-unstyled wds-list-item-control\"\n      onClick={onClick as React.MouseEventHandler<HTMLButtonElement> | undefined}\n    >\n      {icon}\n    </PrimitiveButton>\n  );\n};\n\nNavigation.displayName = 'ListItem.Navigation';\n"],"names":["Navigation","href","hideIndicator","target","onClick","dataAttributes","baseItemProps","useListItemControl","ids","describedByIds","useContext","ListItemContext","icon","_jsx","ChevronEnd","size","_Fragment","children","PrimitiveButton","disabled","id","control","className","displayName"],"mappings":";;;;;;;;AA4BO,MAAMA,UAAU,GAAG,SAASA,UAAUA,CAAC;EAC5CC,IAAI;EACJC,aAAa;EACbC,MAAM;EACNC,OAAO;EACP,GAAGC;AAAc,CACO,EAAA;EACxB,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,kBAAkB,CAAC,YAAY,EAAE;IACzDN,IAAI;IACJC,aAAa;IACbC,MAAM;AACNC,IAAAA;AACD,GAAA,CAAC;EACF,MAAM;IAAEI,GAAG;AAAEC,IAAAA;AAAc,GAAE,GAAGC,UAAU,CAACC,eAAe,CAAC;EAC3D,MAAMC,IAAI,GAAGV,aAAa,GAAG,IAAI,gBAC/BW,GAAA,CAACC,UAAU,EAAA;AAACC,IAAAA,IAAI,EAAE,EAAG;AAAC,IAAA,aAAA,EAAY,qBAAqB;IAAA,GAAKV;AAAc,GAAC,CAC5E;AAED,EAAA,OAAOJ,IAAI,gBACTY,GAAA,CAAAG,QAAA,EAAA;AAAAC,IAAAA,QAAA,EAAGL;AAAI,GAAC,CAAG,gBAEXC,GAAA,CAACK,eAAe,EAAA;AAAA,IAAA,GACVb,cAAc;IAClBc,QAAQ,EAAEb,aAAa,CAACa,QAAS;AACjC,IAAA,kBAAA,EAAkBV,cAAe;IACjCW,EAAE,EAAEZ,GAAG,CAACa,OAAQ;AAChBC,IAAAA,SAAS,EAAC,oCAAoC;AAC9ClB,IAAAA,OAAO,EAAEA,OAAkE;AAAAa,IAAAA,QAAA,EAE1EL;AAAI,GACU,CAClB;AACH;AAEAZ,UAAU,CAACuB,WAAW,GAAG,qBAAqB;;"}