import { memo, useCallback, createElement, Fragment } from "react";
import { LayoutPageStickyContainer, Stack, ButtonList, Button, Icon, Divider } from "@contember/ui";
import { DataGridColumnHiding } from "../DataGridColumnHiding.js";
import { dataGridDictionary } from "../dataGridDictionary.js";
import { DataGridFullFilters } from "../DataGridFullFilters.js";
import { useMessageFormatter } from "../../../../../../i18n/useMessageFormatter.js";
const DataGridContainerHeader = memo(({
  accessor,
  allowAggregateFilterControls,
  allowColumnVisibilityControls,
  desiredState,
  hasTile,
  pagingSummary,
  setFilter,
  setIsColumnHidden,
  setLayout
}) => {
  const { layout } = desiredState;
  const formatMessage = useMessageFormatter(dataGridDictionary);
  const setDefaultView = useCallback(() => setLayout("default"), [setLayout]);
  const setTileView = useCallback(() => setLayout("tiles"), [setLayout]);
  return /* @__PURE__ */ createElement(LayoutPageStickyContainer, {
    left: "var(--cui-layout-page-padding-left)",
    right: "var(--cui-layout-page-padding-right)"
  }, /* @__PURE__ */ createElement(Stack, {
    wrap: true,
    align: "center",
    direction: "horizontal",
    justify: "space-between"
  }, /* @__PURE__ */ createElement(Stack, {
    gap: "small",
    direction: "horizontal"
  }, hasTile && /* @__PURE__ */ createElement(Fragment, null, /* @__PURE__ */ createElement(ButtonList, null, /* @__PURE__ */ createElement(Button, {
    onClick: setTileView,
    size: "small",
    distinction: "seamless",
    intent: layout === "tiles" ? "primary" : "default"
  }, /* @__PURE__ */ createElement(Icon, {
    blueprintIcon: "grid-view"
  })), /* @__PURE__ */ createElement(Button, {
    onClick: setDefaultView,
    size: "small",
    distinction: "seamless",
    intent: layout === "default" ? "primary" : "default"
  }, /* @__PURE__ */ createElement(Icon, {
    blueprintIcon: "list"
  }))), /* @__PURE__ */ createElement(Divider, null)), layout !== "tiles" && allowColumnVisibilityControls !== false && /* @__PURE__ */ createElement(DataGridColumnHiding, {
    desiredState,
    formatMessage,
    setIsColumnHidden
  }), allowAggregateFilterControls !== false && /* @__PURE__ */ createElement(DataGridFullFilters, {
    desiredState,
    environment: accessor.environment,
    formatMessage,
    setFilter
  })), /* @__PURE__ */ createElement("div", null, pagingSummary)));
});
DataGridContainerHeader.displayName = "DataGridContainerHeader";
export { DataGridContainerHeader };
//# sourceMappingURL=DataGridContainerHeader.js.map
