bpr-library 0.0.15 → 0.0.16

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.
@@ -14,7 +14,7 @@ interface BaseDataTableProps<T> {
14
14
  data: (T & {
15
15
  id: number;
16
16
  })[];
17
- actions?: (row: T) => React.ReactNode;
17
+ actions?: (row: T, close?: () => void) => React.ReactNode;
18
18
  sortedBy?: IColumnSort<T>;
19
19
  handleSort?: (data?: IColumnSort<T>) => void;
20
20
  useContext?: boolean;
package/dist/index.js CHANGED
@@ -601,7 +601,7 @@ function D0() {
601
601
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
602
602
  )), l = this.props.ref, l !== void 0 ? l : null;
603
603
  }
604
- function d(l, f, g, C, t0, m0) {
604
+ function h(l, f, g, C, t0, m0) {
605
605
  var S = g.ref;
606
606
  return l = {
607
607
  $$typeof: z,
@@ -634,7 +634,7 @@ function D0() {
634
634
  value: m0
635
635
  }), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
636
636
  }
637
- function h(l, f, g, C, t0, m0) {
637
+ function d(l, f, g, C, t0, m0) {
638
638
  var S = f.children;
639
639
  if (S !== void 0)
640
640
  if (C)
@@ -673,7 +673,7 @@ React keys must be passed directly to JSX without using spread:
673
673
  return S && w(
674
674
  g,
675
675
  typeof l == "function" ? l.displayName || l.name || "Unknown" : l
676
- ), d(
676
+ ), h(
677
677
  l,
678
678
  S,
679
679
  g,
@@ -702,7 +702,7 @@ React keys must be passed directly to JSX without using spread:
702
702
  )(), f0 = v(o(i)), M0 = {};
703
703
  Q.Fragment = b, Q.jsx = function(l, f, g) {
704
704
  var C = 1e4 > U.recentlyCreatedOwnerStacks++;
705
- return h(
705
+ return d(
706
706
  l,
707
707
  f,
708
708
  g,
@@ -712,7 +712,7 @@ React keys must be passed directly to JSX without using spread:
712
712
  );
713
713
  }, Q.jsxs = function(l, f, g) {
714
714
  var C = 1e4 > U.recentlyCreatedOwnerStacks++;
715
- return h(
715
+ return d(
716
716
  l,
717
717
  f,
718
718
  g,
@@ -850,10 +850,10 @@ function i0({
850
850
  y: i,
851
851
  style: s
852
852
  }) {
853
- const [w, m] = H(c?.current ? c.current.getBoundingClientRect().width : 0), d = O(null);
853
+ const [w, m] = H(c?.current ? c.current.getBoundingClientRect().width : 0), h = O(null);
854
854
  return A(() => {
855
- let h = null, M = null;
856
- if (typeof n == "number" && typeof i == "number" && d.current) {
855
+ let d = null, M = null;
856
+ if (typeof n == "number" && typeof i == "number" && h.current) {
857
857
  const p = {
858
858
  getBoundingClientRect: () => ({
859
859
  x: n,
@@ -867,37 +867,37 @@ function i0({
867
867
  toJSON: () => {
868
868
  }
869
869
  }),
870
- contextElement: d.current
870
+ contextElement: h.current
871
871
  };
872
- h = b0(p, d.current, {
872
+ d = b0(p, h.current, {
873
873
  placement: "bottom-start",
874
874
  modifiers: [
875
875
  { name: "flip", options: { fallbackPlacements: ["top-start"] } },
876
876
  { name: "preventOverflow", options: { boundary: "viewport" } }
877
877
  ]
878
878
  });
879
- } else c?.current && d.current && (h = b0(c.current, d.current, {
879
+ } else c?.current && h.current && (d = b0(c.current, h.current, {
880
880
  placement: "bottom-start",
881
881
  modifiers: [
882
882
  { name: "flip", options: { fallbackPlacements: ["top-start"] } },
883
883
  { name: "preventOverflow", options: { boundary: "viewport" } }
884
884
  ]
885
885
  }), M = new ResizeObserver(() => {
886
- m(c.current.getBoundingClientRect().width), h.update();
886
+ m(c.current.getBoundingClientRect().width), d.update();
887
887
  }), M.observe(c.current));
888
888
  return () => {
889
- M && c?.current && M.disconnect(), h && h.destroy();
889
+ M && c?.current && M.disconnect(), d && d.destroy();
890
890
  };
891
891
  }, [c?.current, n, i]), A(() => {
892
- const h = (M) => {
893
- d.current && !d.current.contains(M.target) && (c?.current && c.current.contains(M.target) || t());
892
+ const d = (M) => {
893
+ h.current && !h.current.contains(M.target) && (c?.current && c.current.contains(M.target) || t());
894
894
  };
895
- return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
895
+ return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
896
896
  }, [t, c?.current]), $0(
897
897
  /* @__PURE__ */ e.jsx(
898
898
  "div",
899
899
  {
900
- ref: d,
900
+ ref: h,
901
901
  className: f1.container,
902
902
  style: typeof n == "number" && typeof i == "number" ? { minWidth: "unset", position: "fixed", ...s } : { minWidth: o ? "unset" : `${w}px`, ...s },
903
903
  tabIndex: -1,
@@ -918,8 +918,8 @@ const o3 = ({
918
918
  error: w = !1,
919
919
  // freeSolo = false,
920
920
  fullWidth: m = !1,
921
- customMenuItemRenderer: d,
922
- isLoading: h,
921
+ customMenuItemRenderer: h,
922
+ isLoading: d,
923
923
  className: M = "",
924
924
  handleSearch: p
925
925
  }) => {
@@ -985,7 +985,7 @@ const o3 = ({
985
985
  width: m ? "100%" : "min-content"
986
986
  },
987
987
  children: [
988
- h && /* @__PURE__ */ e.jsx(_0, {}),
988
+ d && /* @__PURE__ */ e.jsx(_0, {}),
989
989
  /* @__PURE__ */ e.jsxs("div", { className: V.select_container, children: [
990
990
  B.length > 0 && /* @__PURE__ */ e.jsx("ul", { className: V.selected_list, children: B.map((v) => /* @__PURE__ */ e.jsxs(
991
991
  "li",
@@ -1068,7 +1068,7 @@ const o3 = ({
1068
1068
  D.stopPropagation(), P ? q(v) : U(v);
1069
1069
  },
1070
1070
  onMouseEnter: () => b(y),
1071
- children: d ? d(v, P) : W(v)
1071
+ children: h ? h(v, P) : W(v)
1072
1072
  },
1073
1073
  v.id
1074
1074
  );
@@ -1104,8 +1104,8 @@ function v0({
1104
1104
  onFileSelect: s,
1105
1105
  multipleFile: w = !1,
1106
1106
  onClick: m,
1107
- className: d,
1108
- disabled: h,
1107
+ className: h,
1108
+ disabled: d,
1109
1109
  ...M
1110
1110
  }) {
1111
1111
  const p = O(null), u = (x) => {
@@ -1122,10 +1122,10 @@ function v0({
1122
1122
  ${R.btn}
1123
1123
  ${R[o]} ${c ? R.icon_padding : ""}
1124
1124
  ${n ? R.active : ""}
1125
- ${h ? R.disabled : ""}
1126
- ${d}
1125
+ ${d ? R.disabled : ""}
1126
+ ${h}
1127
1127
  `,
1128
- disabled: h,
1128
+ disabled: d,
1129
1129
  onClick: s ? z : m,
1130
1130
  children: [
1131
1131
  t,
@@ -1155,7 +1155,7 @@ function v0({
1155
1155
  multiple: w,
1156
1156
  ref: p,
1157
1157
  onChange: u,
1158
- disabled: h
1158
+ disabled: d
1159
1159
  }
1160
1160
  )
1161
1161
  ]
@@ -1172,8 +1172,8 @@ function Y({
1172
1172
  onFileSelect: s,
1173
1173
  onClick: w,
1174
1174
  children: m,
1175
- style: d,
1176
- ...h
1175
+ style: h,
1176
+ ...d
1177
1177
  }) {
1178
1178
  const M = O(null), p = (z) => {
1179
1179
  z.target.files && s && s(z.target.files);
@@ -1183,12 +1183,12 @@ function Y({
1183
1183
  return /* @__PURE__ */ e.jsxs(
1184
1184
  "button",
1185
1185
  {
1186
- ...h,
1186
+ ...d,
1187
1187
  type: r,
1188
1188
  className: `${R.icon_btn} ${R[o]} ${n ? R.active : ""} ${i}`,
1189
1189
  onClick: s ? u : w,
1190
1190
  style: {
1191
- ...d,
1191
+ ...h,
1192
1192
  width: t,
1193
1193
  height: t
1194
1194
  },
@@ -1286,9 +1286,9 @@ function Y1({
1286
1286
  });
1287
1287
  }
1288
1288
  return u;
1289
- }, [n]), d = () => {
1289
+ }, [n]), h = () => {
1290
1290
  i(s ? new Date(n.getFullYear() + 1, n.getMonth(), 1) : new Date(n.getFullYear(), n.getMonth() + 1, 1));
1291
- }, h = () => {
1291
+ }, d = () => {
1292
1292
  i(s ? new Date(n.getFullYear() - 1, n.getMonth(), 1) : new Date(n.getFullYear(), n.getMonth() - 1, 1));
1293
1293
  }, M = (p) => {
1294
1294
  s && (i(new Date(n.getFullYear(), p, 1)), w(!1));
@@ -1300,7 +1300,7 @@ function Y1({
1300
1300
  {
1301
1301
  icon: "arrow-left",
1302
1302
  variant: "secondary",
1303
- onClick: h
1303
+ onClick: d
1304
1304
  }
1305
1305
  ),
1306
1306
  s ? /* @__PURE__ */ e.jsx("p", { className: E.month, children: n.getFullYear() }) : /* @__PURE__ */ e.jsxs(
@@ -1323,7 +1323,7 @@ function Y1({
1323
1323
  {
1324
1324
  icon: "arrow-right",
1325
1325
  variant: "secondary",
1326
- onClick: d
1326
+ onClick: h
1327
1327
  }
1328
1328
  )
1329
1329
  ] }),
@@ -1469,14 +1469,14 @@ function h2(c) {
1469
1469
  }
1470
1470
  const m2 = (c, t = {}) => (r, o, n) => {
1471
1471
  const { enabled: i, anonymousActionType: s, store: w, ...m } = t;
1472
- let d;
1472
+ let h;
1473
1473
  try {
1474
- d = (i ?? (j0 ? "production" : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
1474
+ h = (i ?? (j0 ? "production" : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
1475
1475
  } catch {
1476
1476
  }
1477
- if (!d)
1477
+ if (!h)
1478
1478
  return c(r, o, n);
1479
- const { connection: h, ...M } = s2(w, d, m);
1479
+ const { connection: d, ...M } = s2(w, h, m);
1480
1480
  let p = !0;
1481
1481
  n.setState = ((x, b, a) => {
1482
1482
  const _ = r(x, b);
@@ -1484,7 +1484,7 @@ const m2 = (c, t = {}) => (r, o, n) => {
1484
1484
  const k = a === void 0 ? {
1485
1485
  type: s || h2(new Error().stack) || "anonymous"
1486
1486
  } : typeof a == "string" ? { type: a } : a;
1487
- return w === void 0 ? (h?.send(k, o()), _) : (h?.send(
1487
+ return w === void 0 ? (d?.send(k, o()), _) : (d?.send(
1488
1488
  {
1489
1489
  ...k,
1490
1490
  type: `${w}/${k.type}`
@@ -1496,14 +1496,14 @@ const m2 = (c, t = {}) => (r, o, n) => {
1496
1496
  ), _);
1497
1497
  }), n.devtools = {
1498
1498
  cleanup: () => {
1499
- h && typeof h.unsubscribe == "function" && h.unsubscribe(), i2(m.name, w);
1499
+ d && typeof d.unsubscribe == "function" && d.unsubscribe(), i2(m.name, w);
1500
1500
  }
1501
1501
  };
1502
1502
  const u = (...x) => {
1503
1503
  const b = p;
1504
1504
  p = !1, r(...x), p = b;
1505
1505
  }, z = c(n.setState, o, n);
1506
- if (M.type === "untracked" ? h?.init(z) : (M.stores[M.store] = n, h?.init(
1506
+ if (M.type === "untracked" ? d?.init(z) : (M.stores[M.store] = n, d?.init(
1507
1507
  Object.fromEntries(
1508
1508
  Object.entries(M.stores).map(([x, b]) => [
1509
1509
  x,
@@ -1519,7 +1519,7 @@ const m2 = (c, t = {}) => (r, o, n) => {
1519
1519
  ), x = !0), b(...a);
1520
1520
  };
1521
1521
  }
1522
- return h.subscribe((x) => {
1522
+ return d.subscribe((x) => {
1523
1523
  var b;
1524
1524
  switch (x.type) {
1525
1525
  case "ACTION":
@@ -1556,20 +1556,20 @@ const m2 = (c, t = {}) => (r, o, n) => {
1556
1556
  case "DISPATCH":
1557
1557
  switch (x.payload.type) {
1558
1558
  case "RESET":
1559
- return u(z), w === void 0 ? h?.init(n.getState()) : h?.init(o0(m.name));
1559
+ return u(z), w === void 0 ? d?.init(n.getState()) : d?.init(o0(m.name));
1560
1560
  case "COMMIT":
1561
1561
  if (w === void 0) {
1562
- h?.init(n.getState());
1562
+ d?.init(n.getState());
1563
1563
  return;
1564
1564
  }
1565
- return h?.init(o0(m.name));
1565
+ return d?.init(o0(m.name));
1566
1566
  case "ROLLBACK":
1567
1567
  return w0(x.state, (a) => {
1568
1568
  if (w === void 0) {
1569
- u(a), h?.init(n.getState());
1569
+ u(a), d?.init(n.getState());
1570
1570
  return;
1571
1571
  }
1572
- u(a[w]), h?.init(o0(m.name));
1572
+ u(a[w]), d?.init(o0(m.name));
1573
1573
  });
1574
1574
  case "JUMP_TO_STATE":
1575
1575
  case "JUMP_TO_ACTION":
@@ -1583,7 +1583,7 @@ const m2 = (c, t = {}) => (r, o, n) => {
1583
1583
  case "IMPORT_STATE": {
1584
1584
  const { nextLiftedState: a } = x.payload, _ = (b = a.computedStates.slice(-1)[0]) == null ? void 0 : b.state;
1585
1585
  if (!_) return;
1586
- u(w === void 0 ? _ : _[w]), h?.send(
1586
+ u(w === void 0 ? _ : _[w]), d?.send(
1587
1587
  null,
1588
1588
  // FIXME no-any
1589
1589
  a
@@ -1636,8 +1636,8 @@ const m2 = (c, t = {}) => (r, o, n) => {
1636
1636
  type: s = "side",
1637
1637
  title: w,
1638
1638
  className: m,
1639
- disabledTitle: d = !1,
1640
- blockBackdrop: h = !1,
1639
+ disabledTitle: h = !1,
1640
+ blockBackdrop: d = !1,
1641
1641
  skeleton: M
1642
1642
  }) => {
1643
1643
  const [p] = H(() => Math.floor(Math.random() * 1e9)), [u, z] = H(!1), x = O(null), b = O(null), {
@@ -1691,7 +1691,7 @@ const m2 = (c, t = {}) => (r, o, n) => {
1691
1691
  ref: b,
1692
1692
  className: $.backdrop,
1693
1693
  style: { zIndex: B - 1 },
1694
- onClick: h ? () => {
1694
+ onClick: d ? () => {
1695
1695
  } : F
1696
1696
  }
1697
1697
  )
@@ -1726,7 +1726,7 @@ const m2 = (c, t = {}) => (r, o, n) => {
1726
1726
  ...i
1727
1727
  },
1728
1728
  children: [
1729
- s === "center" && !d && /* @__PURE__ */ e.jsxs("div", { className: $.title_block, children: [
1729
+ s === "center" && !h && /* @__PURE__ */ e.jsxs("div", { className: $.title_block, children: [
1730
1730
  /* @__PURE__ */ e.jsx("h2", { className: $.title, children: w }),
1731
1731
  /* @__PURE__ */ e.jsx(
1732
1732
  Y,
@@ -1842,13 +1842,13 @@ function i3({
1842
1842
  handleSort: i,
1843
1843
  useContext: s = !1
1844
1844
  }) {
1845
- const [w, m] = H(!1), [d, h] = H(), {
1845
+ const [w, m] = H(!1), [h, d] = H(), {
1846
1846
  visibleColumns: M,
1847
1847
  setVisibleColumns: p
1848
1848
  } = B2(c, t.map((a) => String(a.key))), u = O(null), z = t.filter(
1849
1849
  (a) => M.includes(String(a.key))
1850
1850
  ), x = (a, _) => {
1851
- o && s && (a.preventDefault(), a.stopPropagation(), h({ position: { x: a.clientX, y: a.clientY }, element: _ }));
1851
+ o && s && (a.preventDefault(), a.stopPropagation(), d({ position: { x: a.clientX, y: a.clientY }, element: _ }));
1852
1852
  }, b = (a) => {
1853
1853
  if (i)
1854
1854
  if (n?.key === a.key) {
@@ -1896,13 +1896,15 @@ function i3({
1896
1896
  a.id
1897
1897
  )) })
1898
1898
  ] }),
1899
- d && /* @__PURE__ */ e.jsx(
1899
+ h && /* @__PURE__ */ e.jsx(
1900
1900
  i0,
1901
1901
  {
1902
- handleClose: () => h(void 0),
1903
- x: d.position.x,
1904
- y: d.position.y,
1905
- children: o && o(d.element)
1902
+ handleClose: () => d(void 0),
1903
+ x: h.position.x,
1904
+ y: h.position.y,
1905
+ children: o && o(h.element, () => {
1906
+ d(void 0);
1907
+ })
1906
1908
  }
1907
1909
  ),
1908
1910
  w && /* @__PURE__ */ e.jsx(
@@ -1945,9 +1947,9 @@ function a3({
1945
1947
  blockPastDates: o = !1,
1946
1948
  type: n = "date"
1947
1949
  }) {
1948
- const [i, s] = H(!1), w = O(null), m = (d) => {
1949
- const h = d.getDate().toString().padStart(2, "0"), M = (d.getMonth() + 1).toString().padStart(2, "0"), p = d.getFullYear();
1950
- return `${h}.${M}.${p}`;
1950
+ const [i, s] = H(!1), w = O(null), m = (h) => {
1951
+ const d = h.getDate().toString().padStart(2, "0"), M = (h.getMonth() + 1).toString().padStart(2, "0"), p = h.getFullYear();
1952
+ return `${d}.${M}.${p}`;
1951
1953
  };
1952
1954
  return /* @__PURE__ */ e.jsxs(
1953
1955
  "div",
@@ -1964,8 +1966,8 @@ function a3({
1964
1966
  {
1965
1967
  variant: "secondary",
1966
1968
  icon: "my-calendar",
1967
- onClick: (d) => {
1968
- d.stopPropagation(), r || s(!0);
1969
+ onClick: (h) => {
1970
+ h.stopPropagation(), r || s(!0);
1969
1971
  }
1970
1972
  }
1971
1973
  ),
@@ -2042,24 +2044,24 @@ function h3({
2042
2044
  ), w = a0(() => {
2043
2045
  const m = [];
2044
2046
  if (n <= 6) {
2045
- for (let d = 1; d <= n; d++)
2046
- m.push(s(d));
2047
+ for (let h = 1; h <= n; h++)
2048
+ m.push(s(h));
2047
2049
  return m;
2048
2050
  }
2049
2051
  if (i < 5) {
2050
- for (let d = 1; d <= 5; d++)
2051
- m.push(s(d));
2052
+ for (let h = 1; h <= 5; h++)
2053
+ m.push(s(h));
2052
2054
  return m.push(/* @__PURE__ */ e.jsx("span", { className: K.dots, children: "..." }, "dots2")), m.push(s(n)), m;
2053
2055
  }
2054
2056
  if (i > n - 5) {
2055
2057
  m.push(s(1)), m.push(/* @__PURE__ */ e.jsx("span", { className: K.dots, children: "..." }, "dots1"));
2056
- for (let d = n - 4; d <= n; d++)
2057
- m.push(s(d));
2058
+ for (let h = n - 4; h <= n; h++)
2059
+ m.push(s(h));
2058
2060
  return m;
2059
2061
  }
2060
2062
  m.push(s(1)), m.push(/* @__PURE__ */ e.jsx("span", { className: K.dots, children: "..." }, "dots1"));
2061
- for (let d = i - 1; d <= i + 1 && d <= n; d++)
2062
- m.push(s(d));
2063
+ for (let h = i - 1; h <= i + 1 && h <= n; h++)
2064
+ m.push(s(h));
2063
2065
  return m.push(/* @__PURE__ */ e.jsx("span", { className: K.dots, children: "..." }, "dots2")), m.push(s(n)), m;
2064
2066
  }, [i, n]);
2065
2067
  return /* @__PURE__ */ e.jsxs("div", { className: K.pagination, style: { ...o }, children: [
@@ -2100,19 +2102,19 @@ function m3({
2100
2102
  ...i
2101
2103
  }) {
2102
2104
  const s = (m) => {
2103
- const d = m.replace(/\D/g, "");
2104
- let h = d.startsWith("380") ? d.slice(3) : d;
2105
- h = h.slice(0, 9);
2106
- const M = h.slice(0, 2), p = h.slice(2, 5), u = h.slice(5, 7), z = h.slice(7, 9);
2105
+ const h = m.replace(/\D/g, "");
2106
+ let d = h.startsWith("380") ? h.slice(3) : h;
2107
+ d = d.slice(0, 9);
2108
+ const M = d.slice(0, 2), p = d.slice(2, 5), u = d.slice(5, 7), z = d.slice(7, 9);
2107
2109
  let x = "+380";
2108
2110
  return M && (x += ` (${M}`), M.length === 2 && (x += ")"), p && (x += ` ${p}`), u && (x += `-${u}`), z && (x += `-${z}`), x;
2109
2111
  }, w = (m) => {
2110
- let d = m.target.value.replace(/\D/g, "");
2111
- d.startsWith("380") && (d = d.slice(3)), d = d.slice(0, 9);
2112
- const h = `+380${d}`;
2112
+ let h = m.target.value.replace(/\D/g, "");
2113
+ h.startsWith("380") && (h = h.slice(3)), h = h.slice(0, 9);
2114
+ const d = `+380${h}`;
2113
2115
  t && t({
2114
2116
  ...m,
2115
- target: { ...m.target, value: h }
2117
+ target: { ...m.target, value: d }
2116
2118
  });
2117
2119
  };
2118
2120
  return /* @__PURE__ */ e.jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpr-library",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "module": "dist/index.es.js",
6
6
  "main": "./dist/index.js",