import { jsx as a } from "react/jsx-runtime";
import { Button as l, ButtonTypes as x, ButtonSizes as d } from "./index-Button.js";
import { ComponentContainer as f } from "./index-ComponentContainer.js";
import { IconNames as u } from "./index-IconNames.js";
import { FontWeights as h } from "./index-Text.js";
import { F as w } from "./index-FileSaver.min.js";
import "react";
import { utils as y, write as S } from "./index-xlsx.js";
import p from "./index-ExportXLS.module.scss.js";
const m = (t, o, e = ".xlsx", r = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8") => {
  const s = {
    Sheets: {
      data: y.json_to_sheet(t)
    },
    SheetNames: ["data"]
  }, i = S(s, {
    bookType: "xlsx",
    type: "array"
  }), c = new Blob([i], {
    type: r
  });
  w.saveAs(c, o + e);
}, L = (t = [], o = `export_${Date.now()}`) => ({
  exportHndlerFn: () => m(t, o)
}), v = (t) => {
  const {
    rows: o = [],
    fileName: e = `export_${Date.now()}`,
    buttonText: r = "Export XLS"
  } = t, n = (s) => m(o, e);
  return a(f, {
    className: p.container,
    children: a(l, {
      onClick: n,
      iconLeft: u.download,
      size: d.small,
      type: x.secondary,
      className: p.button,
      fontWeight: h.bold,
      children: r
    })
  });
};
export {
  v as ExportXLS,
  L as useExportXLS
};
