'use strict';

var clsx = require('clsx');
var React = require('react');
var IconButton$1 = require('../../iconButton/IconButton.js');
var useListItemControl = require('../useListItemControl.js');
var ListItemContext = require('../ListItemContext.js');
var jsxRuntime = require('react/jsx-runtime');

const IconButton = function ({
  priority = 'minimal',
  'aria-label': ariaLabel,
  ...props
}) {
  const {
    partiallyInteractive,
    ...restProps
  } = props;
  const {
    ids,
    props: itemProps
  } = React.useContext(ListItemContext.ListItemContext);
  const {
    baseItemProps
  } = useListItemControl.useListItemControl('icon-button', {
    partiallyInteractive,
    ...restProps
  });
  const getAriaProps = () => {
    const labelIds = [itemProps.inverted ? ids.subtitle : ids.title, itemProps.inverted ? ids.title : ids.subtitle, itemProps.inverted ? ids.valueSubtitle : ids.valueTitle, itemProps.inverted ? ids.valueTitle : ids.valueSubtitle].join(' ');
    const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');
    if (ariaLabel) {
      return {
        'aria-label': ariaLabel,
        'aria-describedby': labelIds.concat(descriptorIds)
      };
    }
    return {
      'aria-labelledby': labelIds,
      'aria-describedby': descriptorIds
    };
  };
  return /*#__PURE__*/jsxRuntime.jsx(IconButton$1.default, {
    ...restProps,
    ...getAriaProps(),
    className: clsx.clsx('wds-list-item-control', !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element'),
    id: ids.control,
    size: 40,
    priority: priority,
    disabled: baseItemProps.disabled
  });
};
IconButton.displayName = 'ListItem.IconButton';

exports.IconButton = IconButton;
//# sourceMappingURL=ListItemIconButton.js.map
