{"version":3,"file":"ListItemIconButton.mjs","sources":["../../../src/listItem/IconButton/ListItemIconButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useContext, type ReactNode } from 'react';\nimport IconButtonComp, { type IconButtonProps } from '../../iconButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemIconButtonProps = Pick<\n  IconButtonProps,\n  'type' | 'onClick' | 'href' | 'target' | 'aria-label'\n> & {\n  children: ReactNode;\n  partiallyInteractive?: boolean;\n  /** @default 'minimal' */\n  priority?: IconButtonProps['priority'];\n};\n\n/**\n * This component allows for rendering a IconButton control. It's a thin wrapper around the\n * [IconButton component](https://storybook.wise.design/?path=/docs/actions-iconbutton--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---icon-button) for details.\n */\nexport const IconButton = function ({\n  priority = 'minimal',\n  'aria-label': ariaLabel,\n  ...props\n}: ListItemIconButtonProps) {\n  const { partiallyInteractive, ...restProps } = props;\n\n  const { ids, props: itemProps } = useContext(ListItemContext);\n  const { baseItemProps } = useListItemControl('icon-button', {\n    partiallyInteractive,\n    ...restProps,\n  });\n\n  const getAriaProps = () => {\n    const labelIds = [\n      itemProps.inverted ? ids.subtitle : ids.title,\n      itemProps.inverted ? ids.title : ids.subtitle,\n      itemProps.inverted ? ids.valueSubtitle : ids.valueTitle,\n      itemProps.inverted ? ids.valueTitle : ids.valueSubtitle,\n    ].join(' ');\n    const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');\n\n    if (ariaLabel) {\n      return {\n        'aria-label': ariaLabel,\n        'aria-describedby': labelIds.concat(descriptorIds),\n      };\n    }\n\n    return {\n      'aria-labelledby': labelIds,\n      'aria-describedby': descriptorIds,\n    };\n  };\n\n  return (\n    <IconButtonComp\n      {...restProps}\n      {...getAriaProps()}\n      className={clsx(\n        'wds-list-item-control',\n        !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n      )}\n      id={ids.control}\n      size={40}\n      priority={priority}\n      disabled={baseItemProps.disabled}\n    />\n  );\n};\n\nIconButton.displayName = 'ListItem.IconButton';\n"],"names":["IconButton","priority","ariaLabel","props","partiallyInteractive","restProps","ids","itemProps","useContext","ListItemContext","baseItemProps","useListItemControl","getAriaProps","labelIds","inverted","subtitle","title","valueSubtitle","valueTitle","join","descriptorIds","additionalInfo","prompt","concat","_jsx","IconButtonComp","className","clsx","href","id","control","size","disabled","displayName"],"mappings":";;;;;;;AAuBO,MAAMA,UAAU,GAAG,UAAU;AAClCC,EAAAA,QAAQ,GAAG,SAAS;AACpB,EAAA,YAAY,EAAEC,SAAS;EACvB,GAAGC;AAAK,CACgB,EAAA;EACxB,MAAM;IAAEC,oBAAoB;IAAE,GAAGC;AAAS,GAAE,GAAGF,KAAK;EAEpD,MAAM;IAAEG,GAAG;AAAEH,IAAAA,KAAK,EAAEI;AAAS,GAAE,GAAGC,UAAU,CAACC,eAAe,CAAC;EAC7D,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,kBAAkB,CAAC,aAAa,EAAE;IAC1DP,oBAAoB;IACpB,GAAGC;AACJ,GAAA,CAAC;EAEF,MAAMO,YAAY,GAAGA,MAAK;IACxB,MAAMC,QAAQ,GAAG,CACfN,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACS,QAAQ,GAAGT,GAAG,CAACU,KAAK,EAC7CT,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACU,KAAK,GAAGV,GAAG,CAACS,QAAQ,EAC7CR,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACW,aAAa,GAAGX,GAAG,CAACY,UAAU,EACvDX,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACY,UAAU,GAAGZ,GAAG,CAACW,aAAa,CACxD,CAACE,IAAI,CAAC,GAAG,CAAC;AACX,IAAA,MAAMC,aAAa,GAAG,CAACd,GAAG,CAACe,cAAc,EAAEf,GAAG,CAACgB,MAAM,CAAC,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