@nice2dev/ui-erp 1.0.12 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1474,13 +1474,30 @@ const NiceInvoiceView = forwardRef(
1474
1474
  }
1475
1475
  );
1476
1476
  function colorFor(occ, colors) {
1477
- if (occ <= 0.01) return colors.low;
1478
- if (occ < 0.5) return colors.low;
1479
- if (occ < 0.85) return colors.mid;
1477
+ if (occ <= 0.01) {
1478
+ return colors.low;
1479
+ }
1480
+ if (occ < 0.5) {
1481
+ return colors.low;
1482
+ }
1483
+ if (occ < 0.85) {
1484
+ return colors.mid;
1485
+ }
1480
1486
  return colors.high;
1481
1487
  }
1482
1488
  const NiceWarehouseView = forwardRef(
1483
- function NiceWarehouseView2({ warehouseName, cells, colors = { low: "#dcfce7", mid: "#fde68a", high: "#fecaca" }, onCellClick, showLegend = true, cellSize = 48, aisleEvery = 4, className, style, id }, ref) {
1489
+ function NiceWarehouseView2({
1490
+ warehouseName,
1491
+ cells,
1492
+ colors = { low: "#dcfce7", mid: "#fde68a", high: "#fecaca" },
1493
+ onCellClick,
1494
+ showLegend = true,
1495
+ cellSize = 48,
1496
+ aisleEvery = 4,
1497
+ className,
1498
+ style,
1499
+ id
1500
+ }, ref) {
1484
1501
  const [hovered, setHovered] = useState(null);
1485
1502
  const grid = useMemo(() => {
1486
1503
  const rows = /* @__PURE__ */ new Map();
@@ -1573,17 +1590,36 @@ const STATUS_TINT = {
1573
1590
  function fmtMoney(amount, currency, locale) {
1574
1591
  const code = typeof currency === "string" ? currency : currency.code;
1575
1592
  const decimals = typeof currency === "string" ? 2 : currency.decimalPlaces ?? 2;
1576
- return new Intl.NumberFormat(locale, { style: "currency", currency: code }).format(amount / Math.pow(10, decimals));
1593
+ return new Intl.NumberFormat(locale, { style: "currency", currency: code }).format(
1594
+ amount / Math.pow(10, decimals)
1595
+ );
1577
1596
  }
1578
1597
  function fmtDate(d, locale) {
1579
- if (!d) return "—";
1598
+ if (!d) {
1599
+ return "—";
1600
+ }
1580
1601
  const dt = d instanceof Date ? d : new Date(d);
1581
1602
  return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(dt);
1582
1603
  }
1583
1604
  const NicePurchaseOrder = forwardRef(
1584
- function NicePurchaseOrder2({ orders, selectable = true, initialSelectedId, locale, labels, readOnly, onOrderApprove, onReceiveItems, onOrderUpdate, className, style, id }, ref) {
1605
+ function NicePurchaseOrder2({
1606
+ orders,
1607
+ selectable = true,
1608
+ initialSelectedId,
1609
+ locale,
1610
+ labels,
1611
+ readOnly,
1612
+ onOrderApprove,
1613
+ onReceiveItems,
1614
+ onOrderUpdate,
1615
+ className,
1616
+ style,
1617
+ id
1618
+ }, ref) {
1585
1619
  var _a;
1586
- const [selectedId, setSelectedId] = useState(initialSelectedId ?? ((_a = orders[0]) == null ? void 0 : _a.id));
1620
+ const [selectedId, setSelectedId] = useState(
1621
+ initialSelectedId ?? ((_a = orders[0]) == null ? void 0 : _a.id)
1622
+ );
1587
1623
  const L = {
1588
1624
  orderNumber: "PO #",
1589
1625
  supplier: "Supplier",
@@ -1637,57 +1673,77 @@ const NicePurchaseOrder = forwardRef(
1637
1673
  o.id
1638
1674
  )) })
1639
1675
  ] }),
1640
- selectable && selected && /* @__PURE__ */ jsxs("section", { className: "nice-purchase-order__detail", "aria-label": `${L.orderNumber} ${selected.orderNumber}`, children: [
1641
- /* @__PURE__ */ jsxs("header", { children: [
1642
- /* @__PURE__ */ jsxs("h3", { children: [
1643
- selected.orderNumber,
1644
- " ",
1645
- selected.supplier.name
1646
- ] }),
1647
- !readOnly && /* @__PURE__ */ jsxs("div", { className: "nice-purchase-order__actions", children: [
1648
- selected.status === "pending-approval" && onOrderApprove && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onOrderApprove(selected.id), children: L.approve }),
1649
- (selected.status === "ordered" || selected.status === "partially-received") && onReceiveItems && /* @__PURE__ */ jsx(
1650
- "button",
1651
- {
1652
- type: "button",
1653
- onClick: () => onReceiveItems(selected.id, selected.items.map((it) => ({ itemId: it.itemId, quantity: it.quantity - (it.receivedQuantity ?? 0) }))),
1654
- children: L.receive
1655
- }
1656
- ),
1657
- onOrderUpdate && selected.status === "draft" && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onOrderUpdate({ ...selected, status: "pending-approval" }), children: "Submit" })
1658
- ] })
1659
- ] }),
1660
- /* @__PURE__ */ jsxs("table", { className: "nice-purchase-order__items", children: [
1661
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
1662
- /* @__PURE__ */ jsx("th", { children: L.sku }),
1663
- /* @__PURE__ */ jsx("th", { children: L.name }),
1664
- /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.qty }),
1665
- /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.received }),
1666
- /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.unitPrice }),
1667
- /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.lineTotal })
1668
- ] }) }),
1669
- /* @__PURE__ */ jsx("tbody", { children: selected.items.map((it) => /* @__PURE__ */ jsxs("tr", { children: [
1670
- /* @__PURE__ */ jsx("td", { children: it.sku }),
1671
- /* @__PURE__ */ jsx("td", { children: it.itemName }),
1672
- /* @__PURE__ */ jsx("td", { className: "nice-num", children: it.quantity }),
1673
- /* @__PURE__ */ jsx("td", { className: "nice-num", children: it.receivedQuantity ?? 0 }),
1674
- /* @__PURE__ */ jsx("td", { className: "nice-num", children: fmtMoney(it.unitPrice.amount, it.unitPrice.currency, locale) }),
1675
- /* @__PURE__ */ jsx("td", { className: "nice-num", children: fmtMoney(it.lineTotal.amount, it.lineTotal.currency, locale) })
1676
- ] }, it.itemId)) }),
1677
- /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { children: [
1678
- /* @__PURE__ */ jsx("td", { colSpan: 5, className: "nice-num", children: L.total }),
1679
- /* @__PURE__ */ jsx("td", { className: "nice-num", children: /* @__PURE__ */ jsx("strong", { children: fmtMoney(selected.total.amount, selected.total.currency, locale) }) })
1680
- ] }) })
1681
- ] }),
1682
- selected.notes && /* @__PURE__ */ jsxs("p", { className: "nice-purchase-order__notes", children: [
1683
- /* @__PURE__ */ jsxs("strong", { children: [
1684
- L.notes,
1685
- ":"
1686
- ] }),
1687
- " ",
1688
- selected.notes
1689
- ] })
1690
- ] })
1676
+ selectable && selected && /* @__PURE__ */ jsxs(
1677
+ "section",
1678
+ {
1679
+ className: "nice-purchase-order__detail",
1680
+ "aria-label": `${L.orderNumber} ${selected.orderNumber}`,
1681
+ children: [
1682
+ /* @__PURE__ */ jsxs("header", { children: [
1683
+ /* @__PURE__ */ jsxs("h3", { children: [
1684
+ selected.orderNumber,
1685
+ " ",
1686
+ selected.supplier.name
1687
+ ] }),
1688
+ !readOnly && /* @__PURE__ */ jsxs("div", { className: "nice-purchase-order__actions", children: [
1689
+ selected.status === "pending-approval" && onOrderApprove && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onOrderApprove(selected.id), children: L.approve }),
1690
+ (selected.status === "ordered" || selected.status === "partially-received") && onReceiveItems && /* @__PURE__ */ jsx(
1691
+ "button",
1692
+ {
1693
+ type: "button",
1694
+ onClick: () => onReceiveItems(
1695
+ selected.id,
1696
+ selected.items.map((it) => ({
1697
+ itemId: it.itemId,
1698
+ quantity: it.quantity - (it.receivedQuantity ?? 0)
1699
+ }))
1700
+ ),
1701
+ children: L.receive
1702
+ }
1703
+ ),
1704
+ onOrderUpdate && selected.status === "draft" && /* @__PURE__ */ jsx(
1705
+ "button",
1706
+ {
1707
+ type: "button",
1708
+ onClick: () => onOrderUpdate({ ...selected, status: "pending-approval" }),
1709
+ children: "Submit"
1710
+ }
1711
+ )
1712
+ ] })
1713
+ ] }),
1714
+ /* @__PURE__ */ jsxs("table", { className: "nice-purchase-order__items", children: [
1715
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
1716
+ /* @__PURE__ */ jsx("th", { children: L.sku }),
1717
+ /* @__PURE__ */ jsx("th", { children: L.name }),
1718
+ /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.qty }),
1719
+ /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.received }),
1720
+ /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.unitPrice }),
1721
+ /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.lineTotal })
1722
+ ] }) }),
1723
+ /* @__PURE__ */ jsx("tbody", { children: selected.items.map((it) => /* @__PURE__ */ jsxs("tr", { children: [
1724
+ /* @__PURE__ */ jsx("td", { children: it.sku }),
1725
+ /* @__PURE__ */ jsx("td", { children: it.itemName }),
1726
+ /* @__PURE__ */ jsx("td", { className: "nice-num", children: it.quantity }),
1727
+ /* @__PURE__ */ jsx("td", { className: "nice-num", children: it.receivedQuantity ?? 0 }),
1728
+ /* @__PURE__ */ jsx("td", { className: "nice-num", children: fmtMoney(it.unitPrice.amount, it.unitPrice.currency, locale) }),
1729
+ /* @__PURE__ */ jsx("td", { className: "nice-num", children: fmtMoney(it.lineTotal.amount, it.lineTotal.currency, locale) })
1730
+ ] }, it.itemId)) }),
1731
+ /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { children: [
1732
+ /* @__PURE__ */ jsx("td", { colSpan: 5, className: "nice-num", children: L.total }),
1733
+ /* @__PURE__ */ jsx("td", { className: "nice-num", children: /* @__PURE__ */ jsx("strong", { children: fmtMoney(selected.total.amount, selected.total.currency, locale) }) })
1734
+ ] }) })
1735
+ ] }),
1736
+ selected.notes && /* @__PURE__ */ jsxs("p", { className: "nice-purchase-order__notes", children: [
1737
+ /* @__PURE__ */ jsxs("strong", { children: [
1738
+ L.notes,
1739
+ ":"
1740
+ ] }),
1741
+ " ",
1742
+ selected.notes
1743
+ ] })
1744
+ ]
1745
+ }
1746
+ )
1691
1747
  ] });
1692
1748
  }
1693
1749
  );
@@ -1797,19 +1853,26 @@ function useMockErpApi(options = {}) {
1797
1853
  setLoading(false);
1798
1854
  }, [latencyMs, errorRate]);
1799
1855
  useEffect(() => {
1800
- if (settledRef.current) return;
1856
+ if (settledRef.current) {
1857
+ return;
1858
+ }
1801
1859
  settledRef.current = true;
1802
1860
  void refresh();
1803
1861
  }, [refresh]);
1804
1862
  const writeWith = useCallback(
1805
1863
  async (key, item) => {
1806
1864
  await wait(latencyMs);
1807
- if (Math.random() < errorRate) throw new Error("Mock ERP API: write failed");
1865
+ if (Math.random() < errorRate) {
1866
+ throw new Error("Mock ERP API: write failed");
1867
+ }
1808
1868
  setData((d) => {
1809
1869
  const arr = [...d[key]];
1810
1870
  const idx = arr.findIndex((i) => i.id === item.id);
1811
- if (idx >= 0) arr[idx] = item;
1812
- else arr.push(item);
1871
+ if (idx >= 0) {
1872
+ arr[idx] = item;
1873
+ } else {
1874
+ arr.push(item);
1875
+ }
1813
1876
  return { ...d, [key]: arr };
1814
1877
  });
1815
1878
  },
@@ -1834,60 +1897,111 @@ function useMockErpApi(options = {}) {
1834
1897
  [loading, error, data, refresh, writeWith]
1835
1898
  );
1836
1899
  }
1837
- const NiceVatTable = forwardRef(
1838
- function NiceVatTable2({ country = "PL", rates, editable = false, onChange, onRemove, locale, labels, density = "comfortable", className, style, id }, ref) {
1839
- const [internal, setInternal] = useState(rates ?? NICE_VAT_PRESETS[country]);
1840
- const L = { code: "Code", rate: "Rate", label: "Label", description: "Description", add: "+ Add", remove: "Remove", ...labels };
1841
- const update = useCallback(
1842
- (next) => {
1843
- setInternal(next);
1844
- onChange == null ? void 0 : onChange(next);
1845
- },
1846
- [onChange]
1847
- );
1848
- const onCellEdit = (idx, key, raw) => {
1849
- const next = [...internal];
1850
- const r = { ...next[idx] };
1851
- if (key === "rate") {
1852
- const n = Number(raw.replace(",", "."));
1853
- if (!Number.isFinite(n)) return;
1854
- r.rate = n > 1 ? n / 100 : n;
1855
- } else if (key === "code" || key === "label" || key === "description") {
1856
- r[key] = raw;
1900
+ const NiceVatTable = forwardRef(function NiceVatTable2({
1901
+ country = "PL",
1902
+ rates,
1903
+ editable = false,
1904
+ onChange,
1905
+ onRemove,
1906
+ locale,
1907
+ labels,
1908
+ density = "comfortable",
1909
+ className,
1910
+ style,
1911
+ id
1912
+ }, ref) {
1913
+ const [internal, setInternal] = useState(rates ?? NICE_VAT_PRESETS[country]);
1914
+ const L = {
1915
+ code: "Code",
1916
+ rate: "Rate",
1917
+ label: "Label",
1918
+ description: "Description",
1919
+ add: "+ Add",
1920
+ remove: "Remove",
1921
+ ...labels
1922
+ };
1923
+ const update = useCallback(
1924
+ (next) => {
1925
+ setInternal(next);
1926
+ onChange == null ? void 0 : onChange(next);
1927
+ },
1928
+ [onChange]
1929
+ );
1930
+ const onCellEdit = (idx, key, raw) => {
1931
+ const next = [...internal];
1932
+ const r = { ...next[idx] };
1933
+ if (key === "rate") {
1934
+ const n = Number(raw.replace(",", "."));
1935
+ if (!Number.isFinite(n)) {
1936
+ return;
1857
1937
  }
1858
- next[idx] = r;
1859
- update(next);
1860
- };
1861
- const addRow = () => {
1862
- update([...internal, { code: `NEW-${internal.length + 1}`, rate: 0, label: "0%" }]);
1863
- };
1864
- const removeRow = (idx) => {
1865
- const code = internal[idx].code;
1866
- const next = internal.filter((_, i) => i !== idx);
1867
- update(next);
1868
- onRemove == null ? void 0 : onRemove(code);
1869
- };
1870
- return /* @__PURE__ */ jsxs("div", { ref, id, className: `nice-vat-table nice-vat-table--${density} ${className ?? ""}`, style, children: [
1871
- /* @__PURE__ */ jsxs("table", { children: [
1872
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
1873
- /* @__PURE__ */ jsx("th", { children: L.code }),
1874
- /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.rate }),
1875
- /* @__PURE__ */ jsx("th", { children: L.label }),
1876
- /* @__PURE__ */ jsx("th", { children: L.description }),
1877
- editable && /* @__PURE__ */ jsx("th", { "aria-label": L.remove })
1878
- ] }) }),
1879
- /* @__PURE__ */ jsx("tbody", { children: internal.map((r, idx) => /* @__PURE__ */ jsxs("tr", { children: [
1880
- /* @__PURE__ */ jsx("td", { children: editable ? /* @__PURE__ */ jsx("input", { value: r.code, onChange: (e) => onCellEdit(idx, "code", e.target.value) }) : r.code }),
1881
- /* @__PURE__ */ jsx("td", { className: "nice-num", children: editable ? /* @__PURE__ */ jsx("input", { type: "number", step: "0.01", min: 0, max: 1, value: r.rate, onChange: (e) => onCellEdit(idx, "rate", e.target.value) }) : `${(r.rate * 100).toLocaleString(locale, { maximumFractionDigits: 2 })}%` }),
1882
- /* @__PURE__ */ jsx("td", { children: editable ? /* @__PURE__ */ jsx("input", { value: r.label ?? "", onChange: (e) => onCellEdit(idx, "label", e.target.value) }) : r.label ?? "" }),
1883
- /* @__PURE__ */ jsx("td", { children: editable ? /* @__PURE__ */ jsx("input", { value: r.description ?? "", onChange: (e) => onCellEdit(idx, "description", e.target.value) }) : r.description ?? "" }),
1884
- editable && /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeRow(idx), "aria-label": L.remove, children: "×" }) })
1885
- ] }, r.code)) })
1886
- ] }),
1887
- editable && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-vat-table__add", onClick: addRow, children: L.add })
1888
- ] });
1889
- }
1890
- );
1938
+ r.rate = n > 1 ? n / 100 : n;
1939
+ } else if (key === "code" || key === "label" || key === "description") {
1940
+ r[key] = raw;
1941
+ }
1942
+ next[idx] = r;
1943
+ update(next);
1944
+ };
1945
+ const addRow = () => {
1946
+ update([...internal, { code: `NEW-${internal.length + 1}`, rate: 0, label: "0%" }]);
1947
+ };
1948
+ const removeRow = (idx) => {
1949
+ const code = internal[idx].code;
1950
+ const next = internal.filter((_, i) => i !== idx);
1951
+ update(next);
1952
+ onRemove == null ? void 0 : onRemove(code);
1953
+ };
1954
+ return /* @__PURE__ */ jsxs(
1955
+ "div",
1956
+ {
1957
+ ref,
1958
+ id,
1959
+ className: `nice-vat-table nice-vat-table--${density} ${className ?? ""}`,
1960
+ style,
1961
+ children: [
1962
+ /* @__PURE__ */ jsxs("table", { children: [
1963
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
1964
+ /* @__PURE__ */ jsx("th", { children: L.code }),
1965
+ /* @__PURE__ */ jsx("th", { className: "nice-num", children: L.rate }),
1966
+ /* @__PURE__ */ jsx("th", { children: L.label }),
1967
+ /* @__PURE__ */ jsx("th", { children: L.description }),
1968
+ editable && /* @__PURE__ */ jsx("th", { "aria-label": L.remove })
1969
+ ] }) }),
1970
+ /* @__PURE__ */ jsx("tbody", { children: internal.map((r, idx) => /* @__PURE__ */ jsxs("tr", { children: [
1971
+ /* @__PURE__ */ jsx("td", { children: editable ? /* @__PURE__ */ jsx("input", { value: r.code, onChange: (e) => onCellEdit(idx, "code", e.target.value) }) : r.code }),
1972
+ /* @__PURE__ */ jsx("td", { className: "nice-num", children: editable ? /* @__PURE__ */ jsx(
1973
+ "input",
1974
+ {
1975
+ type: "number",
1976
+ step: "0.01",
1977
+ min: 0,
1978
+ max: 1,
1979
+ value: r.rate,
1980
+ onChange: (e) => onCellEdit(idx, "rate", e.target.value)
1981
+ }
1982
+ ) : `${(r.rate * 100).toLocaleString(locale, { maximumFractionDigits: 2 })}%` }),
1983
+ /* @__PURE__ */ jsx("td", { children: editable ? /* @__PURE__ */ jsx(
1984
+ "input",
1985
+ {
1986
+ value: r.label ?? "",
1987
+ onChange: (e) => onCellEdit(idx, "label", e.target.value)
1988
+ }
1989
+ ) : r.label ?? "" }),
1990
+ /* @__PURE__ */ jsx("td", { children: editable ? /* @__PURE__ */ jsx(
1991
+ "input",
1992
+ {
1993
+ value: r.description ?? "",
1994
+ onChange: (e) => onCellEdit(idx, "description", e.target.value)
1995
+ }
1996
+ ) : r.description ?? "" }),
1997
+ editable && /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeRow(idx), "aria-label": L.remove, children: "×" }) })
1998
+ ] }, r.code)) })
1999
+ ] }),
2000
+ editable && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-vat-table__add", onClick: addRow, children: L.add })
2001
+ ]
2002
+ }
2003
+ );
2004
+ });
1891
2005
  function pad(n) {
1892
2006
  return n < 10 ? `0${n}` : String(n);
1893
2007
  }
@@ -1910,14 +2024,20 @@ function defaultBuildXml(opts) {
1910
2024
  lines.push(" <Podmiot1>");
1911
2025
  lines.push(` <NIP>${escapeXml(taxpayer.nip)}</NIP>`);
1912
2026
  lines.push(` <PelnaNazwa>${escapeXml(taxpayer.name)}</PelnaNazwa>`);
1913
- if (taxpayer.regon) lines.push(` <REGON>${escapeXml(taxpayer.regon)}</REGON>`);
2027
+ if (taxpayer.regon) {
2028
+ lines.push(` <REGON>${escapeXml(taxpayer.regon)}</REGON>`);
2029
+ }
1914
2030
  lines.push(" </Podmiot1>");
1915
2031
  for (const inv of invoices) {
1916
2032
  lines.push(" <Faktura>");
1917
2033
  lines.push(` <NumerFaktury>${escapeXml(inv.invoiceNumber)}</NumerFaktury>`);
1918
- lines.push(` <DataWystawienia>${isoDate(inv.issueDate instanceof Date ? inv.issueDate : new Date(inv.issueDate))}</DataWystawienia>`);
2034
+ lines.push(
2035
+ ` <DataWystawienia>${isoDate(inv.issueDate instanceof Date ? inv.issueDate : new Date(inv.issueDate))}</DataWystawienia>`
2036
+ );
1919
2037
  lines.push(` <NazwaNabywcy>${escapeXml(inv.buyer.name)}</NazwaNabywcy>`);
1920
- if (inv.buyer.vatId) lines.push(` <NIPNabywcy>${escapeXml(inv.buyer.vatId)}</NIPNabywcy>`);
2038
+ if (inv.buyer.vatId) {
2039
+ lines.push(` <NIPNabywcy>${escapeXml(inv.buyer.vatId)}</NIPNabywcy>`);
2040
+ }
1921
2041
  let net = 0;
1922
2042
  let vat = 0;
1923
2043
  for (const ln of inv.lines) {
@@ -1935,12 +2055,34 @@ function defaultBuildXml(opts) {
1935
2055
  return lines.join("\n");
1936
2056
  }
1937
2057
  const NiceJpkExporter = forwardRef(
1938
- function NiceJpkExporter2({ invoices, taxpayer, defaultFormat = "JPK_V7M", defaultPeriod, buildXml = defaultBuildXml, onExport, filenameFor, labels, className, style, id }, ref) {
2058
+ function NiceJpkExporter2({
2059
+ invoices,
2060
+ taxpayer,
2061
+ defaultFormat = "JPK_V7M",
2062
+ defaultPeriod,
2063
+ buildXml = defaultBuildXml,
2064
+ onExport,
2065
+ filenameFor,
2066
+ labels,
2067
+ className,
2068
+ style,
2069
+ id
2070
+ }, ref) {
1939
2071
  const today = /* @__PURE__ */ new Date();
1940
2072
  const [format, setFormat] = useState(defaultFormat);
1941
- const [from, setFrom] = useState(isoDate((defaultPeriod == null ? void 0 : defaultPeriod.from) ?? new Date(today.getFullYear(), today.getMonth(), 1)));
1942
- const [to, setTo] = useState(isoDate((defaultPeriod == null ? void 0 : defaultPeriod.to) ?? new Date(today.getFullYear(), today.getMonth() + 1, 0)));
1943
- const L = { format: "Format", from: "From", to: "To", export: "Export", ...labels };
2073
+ const [from, setFrom] = useState(
2074
+ isoDate((defaultPeriod == null ? void 0 : defaultPeriod.from) ?? new Date(today.getFullYear(), today.getMonth(), 1))
2075
+ );
2076
+ const [to, setTo] = useState(
2077
+ isoDate((defaultPeriod == null ? void 0 : defaultPeriod.to) ?? new Date(today.getFullYear(), today.getMonth() + 1, 0))
2078
+ );
2079
+ const L = {
2080
+ format: "Format",
2081
+ from: "From",
2082
+ to: "To",
2083
+ export: "Export",
2084
+ ...labels
2085
+ };
1944
2086
  const exportNow = useCallback(() => {
1945
2087
  const opts = {
1946
2088
  format,
@@ -1966,11 +2108,18 @@ const NiceJpkExporter = forwardRef(
1966
2108
  return /* @__PURE__ */ jsxs("div", { ref, id, className: `nice-jpk-exporter ${className ?? ""}`, style, children: [
1967
2109
  /* @__PURE__ */ jsxs("label", { children: [
1968
2110
  L.format,
1969
- /* @__PURE__ */ jsxs("select", { value: format, onChange: (e) => setFormat(e.target.value), children: [
1970
- /* @__PURE__ */ jsx("option", { value: "JPK_V7M", children: "JPK_V7M" }),
1971
- /* @__PURE__ */ jsx("option", { value: "JPK_V7K", children: "JPK_V7K" }),
1972
- /* @__PURE__ */ jsx("option", { value: "JPK_FA", children: "JPK_FA" })
1973
- ] })
2111
+ /* @__PURE__ */ jsxs(
2112
+ "select",
2113
+ {
2114
+ value: format,
2115
+ onChange: (e) => setFormat(e.target.value),
2116
+ children: [
2117
+ /* @__PURE__ */ jsx("option", { value: "JPK_V7M", children: "JPK_V7M" }),
2118
+ /* @__PURE__ */ jsx("option", { value: "JPK_V7K", children: "JPK_V7K" }),
2119
+ /* @__PURE__ */ jsx("option", { value: "JPK_FA", children: "JPK_FA" })
2120
+ ]
2121
+ }
2122
+ )
1974
2123
  ] }),
1975
2124
  /* @__PURE__ */ jsxs("label", { children: [
1976
2125
  L.from,