import { useMemo, createElement, Fragment } from "react";
import { Icon, Dropdown, Box, FieldContainer, Checkbox } from "@contember/ui";
function DataGridColumnHiding({
  desiredState,
  formatMessage,
  setIsColumnHidden
}) {
  const buttonProps = useMemo(() => ({
    intent: "default",
    distinction: "seamless",
    children: /* @__PURE__ */ createElement(Fragment, null, /* @__PURE__ */ createElement(Icon, {
      blueprintIcon: "list-columns",
      alignWithLowercase: true,
      style: { marginRight: "0.4em" }
    }), formatMessage("dataGrid.columnHiding.showMenuButton.text"))
  }), [formatMessage]);
  return /* @__PURE__ */ createElement(Dropdown, {
    alignment: "end",
    buttonProps
  }, /* @__PURE__ */ createElement(Box, {
    heading: formatMessage("dataGrid.columnHiding.heading")
  }, /* @__PURE__ */ createElement("div", {
    style: { display: "flex", flexDirection: "column", gap: "0.25em" }
  }, Array.from(desiredState.columns, ([key, column]) => {
    if (column.canBeHidden === false) {
      return /* @__PURE__ */ createElement(Fragment, {
        key
      });
    }
    return /* @__PURE__ */ createElement(FieldContainer, {
      key,
      label: column.header,
      labelPosition: "labelInlineRight"
    }, /* @__PURE__ */ createElement(Checkbox, {
      notNull: true,
      value: !desiredState.hiddenColumns[key],
      onChange: (isChecked) => setIsColumnHidden(key, !isChecked)
    }));
  }))));
}
export { DataGridColumnHiding };
//# sourceMappingURL=DataGridColumnHiding.js.map
