import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { Icon, Dropdown, Box, FieldContainer, Checkbox } from "@contember/ui";
import { useMemo, Fragment as Fragment$1 } from "react";
function DataGridColumnHiding({
  desiredState,
  formatMessage,
  setIsColumnHidden
}) {
  const buttonProps = useMemo(() => ({
    intent: "default",
    distinction: "seamless",
    children: /* @__PURE__ */ jsxDEV(Fragment, { children: [
      /* @__PURE__ */ jsxDEV(Icon, { blueprintIcon: "list-columns", alignWithLowercase: true, style: { marginRight: "0.4em" } }, void 0, false, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx",
        lineNumber: 24,
        columnNumber: 5
      }, this),
      formatMessage("dataGrid.columnHiding.showMenuButton.text")
    ] }, void 0, true, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx",
      lineNumber: 23,
      columnNumber: 4
    }, this)
  }), [formatMessage]);
  return /* @__PURE__ */ jsxDEV(
    Dropdown,
    {
      alignment: "end",
      buttonProps,
      children: /* @__PURE__ */ jsxDEV(Box, { heading: formatMessage("dataGrid.columnHiding.heading"), children: /* @__PURE__ */ jsxDEV("div", { style: { display: "flex", flexDirection: "column", gap: "0.25em" }, children: Array.from(desiredState.columns, ([key, column]) => {
        if (column.canBeHidden === false) {
          return /* @__PURE__ */ jsxDEV(Fragment$1, {}, key, false, {
            fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx",
            lineNumber: 39,
            columnNumber: 15
          }, this);
        }
        return /* @__PURE__ */ jsxDEV(
          FieldContainer,
          {
            label: column.header,
            labelPosition: "labelInlineRight",
            children: /* @__PURE__ */ jsxDEV(
              Checkbox,
              {
                notNull: true,
                value: !desiredState.hiddenColumns[key],
                onChange: (isChecked) => setIsColumnHidden(key, !isChecked)
              },
              void 0,
              false,
              {
                fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx",
                lineNumber: 47,
                columnNumber: 9
              },
              this
            )
          },
          key,
          false,
          {
            fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx",
            lineNumber: 42,
            columnNumber: 8
          },
          this
        );
      }) }, void 0, false, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx",
        lineNumber: 36,
        columnNumber: 5
      }, this) }, void 0, false, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx",
        lineNumber: 35,
        columnNumber: 4
      }, this)
    },
    void 0,
    false,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx",
      lineNumber: 31,
      columnNumber: 3
    },
    this
  );
}
export {
  DataGridColumnHiding
};
//# sourceMappingURL=DataGridColumnHiding.js.map
