{"version":3,"file":"PopoverListItem.mjs","sources":["../../../src/components/PopoverListItem/PopoverListItem.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React, { type ReactNode } from 'react';\n\nimport type { IconOrContent } from '../../util/utility-types';\n\nimport { hasSlotContent, IconSlot } from '../Icon';\nimport Text from '../Text';\nimport styles from './PopoverListItem.module.css';\n\nexport type PopoverListItemProps = {\n  // Component API\n  /**\n   * Child node(s) that can be nested inside component\n   */\n  children?: ReactNode;\n  /**\n   * CSS class names that can be appended to the component.\n   */\n  className?: string;\n  __type?: 'selectitem' | 'listitem' | 'label' | 'separator' | 'caption';\n  // Design API\n  /**\n   * Handling behavior for whether the marked menu item is destructive or not (deletes, removes, etc.)\n   */\n  isDestructiveAction?: boolean;\n  /**\n   * Whether the component is in focus (programmatically or otherwise)\n   */\n  isFocused?: boolean;\n  /**\n   * Whether the list item is treated as disabled\n   */\n  isDisabled?: boolean;\n  /**\n   * Content to appear at the start of the list item. Takes an EDS icon name, or any content\n   * to render in its place at 24px.\n   */\n  leadingContent?: IconOrContent;\n  /**\n   * Text below the main menu item call-to-action, briefly describing the menu item's function\n   */\n  subLabel?: ReactNode;\n  /**\n   * Content (icon, text, other component) to appear at the end of the list item. Recommended maximum size of 24 pixels.\n   */\n  trailingContent?: ReactNode;\n};\n\n/**\n * ## Usage\n *\n * Styles and containers for individual elements in internal Popover-like components (e.g., `Menu`,\n * `Select`). This should not be used directly by consumers.\n *\n * Each item lays out four optional slots: `leadingContent` at the start, the `children` label,\n * `subLabel` beneath the label, and `trailingContent` at the end.\n *\n * `Menu`, `Select`, and `Combobox` compose this for you and drive the `isFocused`, `isDisabled`,\n * and `isDestructiveAction` states from their own render props. Because HeadlessUI implements\n * listbox options as a render prop, the same item works for both listbox and menu shapes. Reach\n * for those components rather than this one.\n */\nexport const PopoverListItem = React.forwardRef<\n  HTMLDivElement,\n  PopoverListItemProps\n>(\n  (\n    {\n      className,\n      isDestructiveAction = false,\n      isDisabled = false,\n      isFocused = false,\n      children,\n      leadingContent,\n      subLabel,\n      trailingContent,\n      __type,\n      ...other\n    },\n    ref,\n  ) => {\n    const componentClassName = clsx(\n      styles['popover-list-item'],\n      isDisabled && styles['popover-list-item--disabled'],\n      isDestructiveAction && styles['popover-list-item--destructive-action'],\n      isFocused && styles['popover-list-item--focused'],\n      __type && styles[`popover-list-item--type-${__type}`],\n      className,\n    );\n\n    const ariaIsDisabled = isDisabled\n      ? {\n          'aria-disabled': true,\n        }\n      : {};\n\n    return (\n      <div\n        className={componentClassName}\n        {...other}\n        {...ariaIsDisabled}\n        ref={ref}\n      >\n        {hasSlotContent(leadingContent) ? (\n          <div className={styles['popover-list-item__leading-content']}>\n            <IconSlot\n              content={leadingContent}\n              purpose=\"decorative\"\n              size=\"24px\"\n            />\n          </div>\n        ) : (\n          <div className={styles['popover-list-item__no-icon']}></div>\n        )}\n        <div\n          className={clsx(\n            styles['popover-list-item__menu-labels'],\n            subLabel && styles['popover-list-item--has-sub-label'],\n          )}\n        >\n          {__type === 'label' ? (\n            <Text\n              as=\"div\"\n              className={styles['popover-list-item__label']}\n              preset=\"overline-sm\"\n            >\n              {children}\n            </Text>\n          ) : (\n            <>\n              <Text\n                as=\"div\"\n                preset={__type === 'caption' ? 'body-xs' : 'body-md'}\n              >\n                {children}\n              </Text>\n              {subLabel && (\n                <Text\n                  as=\"div\"\n                  className={styles['popover-list-item__sub-label']}\n                  preset=\"body-sm\"\n                >\n                  {subLabel}\n                </Text>\n              )}\n            </>\n          )}\n        </div>\n        {trailingContent && (\n          <div className={styles['popover-list-item__trailing-content']}>\n            {typeof trailingContent === 'string' ? (\n              <Text as=\"span\" preset=\"body-xs\">\n                {trailingContent}\n              </Text>\n            ) : (\n              trailingContent\n            )}\n          </div>\n        )}\n      </div>\n    );\n  },\n);\n\nPopoverListItem.displayName = 'PopoverListItem';\n"],"names":["React"],"mappings":";;;;;;;;AAgDA;;;;;;;;;;;;;AAaG;AACI,MAAM,eAAe,GAAGA,cAAK,CAAC,UAA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