import { jsxs, Fragment, jsx } from "react/jsx-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__ */ jsxs(Fragment, { children: [
      /* @__PURE__ */ jsx(Icon, { blueprintIcon: "list-columns", alignWithLowercase: true, style: { marginRight: "0.4em" } }),
      formatMessage("dataGrid.columnHiding.showMenuButton.text")
    ] })
  }), [formatMessage]);
  return /* @__PURE__ */ jsx(
    Dropdown,
    {
      alignment: "end",
      buttonProps,
      children: /* @__PURE__ */ jsx(Box, { heading: formatMessage("dataGrid.columnHiding.heading"), children: /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.25em" }, children: Array.from(desiredState.columns, ([key, column]) => {
        if (column.canBeHidden === false) {
          return /* @__PURE__ */ jsx(Fragment$1, {}, key);
        }
        return /* @__PURE__ */ jsx(
          FieldContainer,
          {
            label: column.header,
            labelPosition: "labelInlineRight",
            children: /* @__PURE__ */ jsx(
              Checkbox,
              {
                notNull: true,
                value: !desiredState.hiddenColumns[key],
                onChange: (isChecked) => setIsColumnHidden(key, !isChecked)
              }
            )
          },
          key
        );
      }) }) })
    }
  );
}
export {
  DataGridColumnHiding
};
//# sourceMappingURL=DataGridColumnHiding.js.map
