'use strict';
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '../../../fd-component-toolbox/dropdown-menu/DropdownMenu.js';
import { Icon, iconSizes, iconNames } from '../../../fd-component-toolbox/icon/Icon.js';
import { Button } from '../../../fd-component-toolbox/button/Button.js';
import { resourceListViewModes } from '../../../../fd-toolbox/enums/enums.js';
import { textButton } from './ResourceListDropdownMenu.funcs.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function ResourceListDropdownMenu({
  onViewModeChanged,
  viewMode
}) {
  return /* @__PURE__ */jsxs(DropdownMenu, {
    children: [/* @__PURE__ */jsx(DropdownMenuTrigger, {
      render: props => /* @__PURE__ */jsx(Button, {
        ...props,
        variant: "ghost",
        size: "icon",
        className: "size-7 shrink-0",
        tooltipText: "More Actions",
        tooltipSide: "top",
        tooltipClassName: "mb-1",
        children: /* @__PURE__ */jsx(Icon, {
          name: iconNames.dotsVerticalIcon,
          size: iconSizes.small
        })
      })
    }), /* @__PURE__ */jsxs(DropdownMenuContent, {
      align: "start",
      children: [viewMode === void 0 && /* @__PURE__ */jsxs(Fragment, {
        children: [/* @__PURE__ */jsx(DropdownMenuItem, {
          onClick: () => onViewModeChanged(resourceListViewModes.table),
          children: "Switch to table view"
        }), /* @__PURE__ */jsx(DropdownMenuItem, {
          onClick: () => onViewModeChanged(resourceListViewModes.cards),
          children: "Switch to card view"
        })]
      }), viewMode !== void 0 && /* @__PURE__ */jsx(DropdownMenuItem, {
        onClick: () => onViewModeChanged(viewMode === resourceListViewModes.table ? resourceListViewModes.cards : resourceListViewModes.table),
        children: viewMode === resourceListViewModes.table ? textButton.showCard : textButton.showTable
      })]
    })]
  });
}
__name(ResourceListDropdownMenu, "ResourceListDropdownMenu");

export { ResourceListDropdownMenu };
