{"version":3,"file":"ListItemButton.mjs","sources":["../../../src/listItem/Button/ListItemButton.tsx"],"sourcesContent":["import { useContext, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport ButtonComp, { type ButtonAddonIcon, type NewButtonProps } from '../../button';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemButtonProps = Omit<\n  NewButtonProps,\n  'v2' | 'size' | 'disabled' | 'block' | 'addonStart'\n> & {\n  /**\n   * Toggles the [interactivity strategy](https://storybook.wise.design/?path=/docs/content-listitem--docs#interactivity) for the whole ListItem.\n   */\n  partiallyInteractive?: boolean;\n  addonStart?: ButtonAddonIcon;\n  /** @default 'secondary-neutral' */\n  priority?: NewButtonProps['priority'];\n};\n\n/**\n * This component allows for rendering a Button control. It's a thin wrapper around the\n * [Button component](https://storybook.wise.design/?path=/docs/content-button--docs), but offers only\n * a subset of its features in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://wise.design/components/list-item---button) for details.\n */\nexport const Button = forwardRef<HTMLButtonElement, ListItemButtonProps>(\n  (\n    { priority = 'secondary-neutral', partiallyInteractive, ...props }: ListItemButtonProps,\n    ref,\n  ) => {\n    const { baseItemProps } = useListItemControl('button', { partiallyInteractive, ...props });\n    const { ids, describedByIds } = useContext(ListItemContext);\n\n    const commonProps = {\n      ...props,\n      className: clsx(\n        'wds-list-item-control',\n        !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n      ),\n      id: ids.control,\n      priority,\n      v2: true,\n      size: 'sm',\n      disabled: baseItemProps.disabled,\n    };\n\n    const buttonContentId = props.href || partiallyInteractive ? '' : `${ids.control}_content`;\n\n    return (\n      <ButtonComp\n        ref={ref}\n        aria-describedby={`${buttonContentId} ${describedByIds}`}\n        {...(commonProps as NewButtonProps)}\n      />\n    );\n  },\n);\n\nButton.displayName = 'ListItem.Button';\n"],"names":["Button","forwardRef","priority","partiallyInteractive","props","ref","baseItemProps","useListItemControl","ids","describedByIds","useContext","ListItemContext","commonProps","className","clsx","href","id","control","v2","size","disabled","buttonContentId","_jsx","ButtonComp","displayName"],"mappings":";;;;;;;AA0BO,MAAMA,MAAM,gBAAGC,UAAU,CAC9B,CACE;AAAEC,EAAAA,QAAQ,GAAG,mBAAmB;EAAEC,oBAAoB;EAAE,GAAGC;CAA4B,EACvFC,GAAG,KACD;EACF,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,kBAAkB,CAAC,QAAQ,EAAE;IAAEJ,oBAAoB;IAAE,GAAGC;AAAK,GAAE,CAAC;EAC1F,MAAM;IAAEI,GAAG;AAAEC,IAAAA;AAAc,GAAE,GAAGC,UAAU,CAACC,eAAe,CAAC;AAE3D,EAAA,MAAMC,WAAW,GAAG;AAClB,IAAA,GAAGR,KAAK;AACRS,IAAAA,SAAS,EAAEC,IAAI,CACb,uBAAuB,EACvB,CAACX,oBAAoB,IAAIC,KAAK,CAACW,IAAI,IAAI,sCAAsC,CAC9E;IACDC,EAAE,EAAER,GAAG,CAACS,OAAO;IACff,QAAQ;AACRgB,IAAAA,EAAE,EAAE,IAAI;AACRC,IAAAA,IAAI,EAAE,IAAI;IACVC,QAAQ,EAAEd,aAAa,CAACc;GACzB;AAED,EAAA,MAAMC,eAAe,GAAGjB,KAAK,CAACW,IAAI,IAAIZ,oBAAoB,GAAG,EAAE,GAAG,CAAA,EAAGK,GAAG,CAACS,OAAO,CAAA,QAAA,CAAU;EAE1F,oBACEK,GAAA,CAACC,QAAU,EAAA;AACTlB,IAAAA,GAAG,EAAEA,GAAI;AACT,IAAA,kBAAA,EAAkB,CAAA,EAAGgB,eAAe,CAAA,CAAA,EAAIZ,cAAc,CAAA,CAAG;IAAA,GACpDG;AAA8B,GAAC,CACpC;AAEN,CAAC;AAGHZ,MAAM,CAACwB,WAAW,GAAG,iBAAiB;;;;"}