@nice2dev/ui-erp 1.0.16 → 1.0.18

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.cjs CHANGED
@@ -1286,14 +1286,28 @@ function lineVat(line) {
1286
1286
  function fmtMoney$1(amount, currency, locale) {
1287
1287
  const code = typeof currency === "string" ? currency : currency.code;
1288
1288
  const decimals = typeof currency === "string" ? 2 : currency.decimalPlaces ?? 2;
1289
- return new Intl.NumberFormat(locale, { style: "currency", currency: code }).format(amount / Math.pow(10, decimals));
1289
+ return new Intl.NumberFormat(locale, { style: "currency", currency: code }).format(
1290
+ amount / Math.pow(10, decimals)
1291
+ );
1290
1292
  }
1291
1293
  function fmtDate$1(d, locale) {
1292
1294
  const dt = d instanceof Date ? d : new Date(d);
1293
1295
  return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(dt);
1294
1296
  }
1295
1297
  const NiceInvoiceView = React.forwardRef(
1296
- function NiceInvoiceView2({ invoice, locale, currency, hideSections, labels, onAction, showActions = false, density = "comfortable", className, style, id }, ref) {
1298
+ function NiceInvoiceView2({
1299
+ invoice,
1300
+ locale,
1301
+ currency,
1302
+ hideSections,
1303
+ labels,
1304
+ onAction,
1305
+ showActions = false,
1306
+ density = "comfortable",
1307
+ className,
1308
+ style,
1309
+ id
1310
+ }, ref) {
1297
1311
  var _a;
1298
1312
  const cur = currency ?? invoice.currency ?? ((_a = invoice.lines[0]) == null ? void 0 : _a.unitPrice.currency) ?? "EUR";
1299
1313
  const L = {
@@ -1362,11 +1376,18 @@ const NiceInvoiceView = React.forwardRef(
1362
1376
  ] })
1363
1377
  ] })
1364
1378
  ] }),
1365
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-invoice-view__status", style: { color: STATUS_COLOR[invoice.status] }, children: [
1366
- /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, children: "●" }),
1367
- " ",
1368
- invoice.status
1369
- ] }),
1379
+ /* @__PURE__ */ jsxRuntime.jsxs(
1380
+ "div",
1381
+ {
1382
+ className: "nice-invoice-view__status",
1383
+ style: { color: STATUS_COLOR[invoice.status] },
1384
+ children: [
1385
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, children: "●" }),
1386
+ " ",
1387
+ invoice.status
1388
+ ]
1389
+ }
1390
+ ),
1370
1391
  showActions && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-invoice-view__actions", children: [
1371
1392
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => onAction == null ? void 0 : onAction("download"), children: "↓" }),
1372
1393
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => onAction == null ? void 0 : onAction("print"), children: "⎙" }),
@@ -1459,7 +1480,14 @@ const NiceInvoiceView = React.forwardRef(
1459
1480
  /* @__PURE__ */ jsxRuntime.jsx("h4", { children: L.timeline }),
1460
1481
  /* @__PURE__ */ jsxRuntime.jsx("ol", { children: invoice.history.map((h, i) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
1461
1482
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-invoice-view__t-date", children: fmtDate$1(h.at, locale) }),
1462
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-invoice-view__t-status", style: { color: STATUS_COLOR[h.status] }, children: h.status }),
1483
+ /* @__PURE__ */ jsxRuntime.jsx(
1484
+ "span",
1485
+ {
1486
+ className: "nice-invoice-view__t-status",
1487
+ style: { color: STATUS_COLOR[h.status] },
1488
+ children: h.status
1489
+ }
1490
+ ),
1463
1491
  h.note && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nice-invoice-view__t-note", children: [
1464
1492
  " — ",
1465
1493
  h.note
@@ -1750,7 +1778,17 @@ const NicePurchaseOrder = React.forwardRef(
1750
1778
  }
1751
1779
  );
1752
1780
  const NiceHRDashboard = React.forwardRef(
1753
- function NiceHRDashboard2({ employees, labels, hideWidgets, locale, density = "comfortable", onWidgetClick, className, style, id }, ref) {
1781
+ function NiceHRDashboard2({
1782
+ employees,
1783
+ labels,
1784
+ hideWidgets,
1785
+ locale,
1786
+ density = "comfortable",
1787
+ onWidgetClick,
1788
+ className,
1789
+ style,
1790
+ id
1791
+ }, ref) {
1754
1792
  const L = {
1755
1793
  headcount: "Headcount",
1756
1794
  fte: "FTE",
@@ -1770,7 +1808,14 @@ const NiceHRDashboard = React.forwardRef(
1770
1808
  const k = e.department ?? "—";
1771
1809
  byDepartment.set(k, (byDepartment.get(k) ?? 0) + 1);
1772
1810
  }
1773
- return { headcount: employees.length, active: active.length, fte, vacationAvg, sickAvg, byDepartment };
1811
+ return {
1812
+ headcount: employees.length,
1813
+ active: active.length,
1814
+ fte,
1815
+ vacationAvg,
1816
+ sickAvg,
1817
+ byDepartment
1818
+ };
1774
1819
  }, [employees]);
1775
1820
  const fmt = (n, d = 1) => n.toLocaleString(locale, { maximumFractionDigits: d });
1776
1821
  const Widget = ({ kind, label, value, hint }) => /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1786,25 +1831,51 @@ const NiceHRDashboard = React.forwardRef(
1786
1831
  ]
1787
1832
  }
1788
1833
  );
1789
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, id, className: `nice-hr-dashboard nice-hr-dashboard--${density} ${className ?? ""}`, style, role: "group", "aria-label": "HR dashboard", children: [
1790
- !(hideWidgets == null ? void 0 : hideWidgets.headcount) && /* @__PURE__ */ jsxRuntime.jsx(Widget, { kind: "headcount", label: L.headcount, value: fmt(stats.headcount, 0), hint: `${L.activeEmployees}: ${fmt(stats.active, 0)}` }),
1791
- !(hideWidgets == null ? void 0 : hideWidgets.fte) && /* @__PURE__ */ jsxRuntime.jsx(Widget, { kind: "fte", label: L.fte, value: fmt(stats.fte, 2) }),
1792
- !(hideWidgets == null ? void 0 : hideWidgets.vacation) && /* @__PURE__ */ jsxRuntime.jsx(Widget, { kind: "vacation", label: L.vacationBalance, value: `${fmt(stats.vacationAvg, 1)} d` }),
1793
- !(hideWidgets == null ? void 0 : hideWidgets.sick) && /* @__PURE__ */ jsxRuntime.jsx(Widget, { kind: "sick", label: L.sickLeave, value: `${fmt(stats.sickAvg, 1)} d` }),
1794
- !(hideWidgets == null ? void 0 : hideWidgets.departments) && /* @__PURE__ */ jsxRuntime.jsx(
1795
- Widget,
1796
- {
1797
- kind: "departments",
1798
- label: L.departments,
1799
- value: fmt(stats.byDepartment.size, 0),
1800
- hint: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "nice-hr-dashboard__dept-list", children: [...stats.byDepartment.entries()].slice(0, 5).map(([d, n]) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
1801
- d,
1802
- ": ",
1803
- n
1804
- ] }, d)) })
1805
- }
1806
- )
1807
- ] });
1834
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1835
+ "div",
1836
+ {
1837
+ ref,
1838
+ id,
1839
+ className: `nice-hr-dashboard nice-hr-dashboard--${density} ${className ?? ""}`,
1840
+ style,
1841
+ role: "group",
1842
+ "aria-label": "HR dashboard",
1843
+ children: [
1844
+ !(hideWidgets == null ? void 0 : hideWidgets.headcount) && /* @__PURE__ */ jsxRuntime.jsx(
1845
+ Widget,
1846
+ {
1847
+ kind: "headcount",
1848
+ label: L.headcount,
1849
+ value: fmt(stats.headcount, 0),
1850
+ hint: `${L.activeEmployees}: ${fmt(stats.active, 0)}`
1851
+ }
1852
+ ),
1853
+ !(hideWidgets == null ? void 0 : hideWidgets.fte) && /* @__PURE__ */ jsxRuntime.jsx(Widget, { kind: "fte", label: L.fte, value: fmt(stats.fte, 2) }),
1854
+ !(hideWidgets == null ? void 0 : hideWidgets.vacation) && /* @__PURE__ */ jsxRuntime.jsx(
1855
+ Widget,
1856
+ {
1857
+ kind: "vacation",
1858
+ label: L.vacationBalance,
1859
+ value: `${fmt(stats.vacationAvg, 1)} d`
1860
+ }
1861
+ ),
1862
+ !(hideWidgets == null ? void 0 : hideWidgets.sick) && /* @__PURE__ */ jsxRuntime.jsx(Widget, { kind: "sick", label: L.sickLeave, value: `${fmt(stats.sickAvg, 1)} d` }),
1863
+ !(hideWidgets == null ? void 0 : hideWidgets.departments) && /* @__PURE__ */ jsxRuntime.jsx(
1864
+ Widget,
1865
+ {
1866
+ kind: "departments",
1867
+ label: L.departments,
1868
+ value: fmt(stats.byDepartment.size, 0),
1869
+ hint: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "nice-hr-dashboard__dept-list", children: [...stats.byDepartment.entries()].slice(0, 5).map(([d, n]) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
1870
+ d,
1871
+ ": ",
1872
+ n
1873
+ ] }, d)) })
1874
+ }
1875
+ )
1876
+ ]
1877
+ }
1878
+ );
1808
1879
  }
1809
1880
  );
1810
1881
  const wait = (ms) => new Promise((r) => setTimeout(r, ms));