@spteck/react-controls-v2 2.3.8 → 2.3.91

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.js CHANGED
@@ -9634,27 +9634,27 @@ var Zu = function(e, t, n) {
9634
9634
  children: [/* @__PURE__ */ R(_t, { children: /* @__PURE__ */ R(yt, { children: ({ renderHeaderCell: e }) => /* @__PURE__ */ R(vt, { children: e() }) }) }), /* @__PURE__ */ R(k, {})]
9635
9635
  })
9636
9636
  });
9637
- }, _d = H`
9638
- &::-webkit-scrollbar {
9639
- width: 5px;
9640
- height: 5px;
9641
- }
9642
- &::-webkit-scrollbar-track {
9643
- background: ${V.colorNeutralBackground4};
9644
- border-radius: ${V.borderRadiusMedium};
9645
- }
9646
- &::-webkit-scrollbar-thumb {
9647
- background: ${V.colorBrandBackground};
9648
- border-radius: ${V.borderRadiusMedium};
9649
- }
9650
- &::-webkit-scrollbar-thumb:hover {
9651
- background: ${V.colorBrandBackgroundHover};
9652
- }
9653
- `;
9637
+ }, _d = In({ scrollbar: {
9638
+ scrollbarWidth: "thin",
9639
+ scrollbarColor: `${V.colorBrandBackground} ${V.colorNeutralBackground4}`,
9640
+ "&::-webkit-scrollbar": {
9641
+ width: "5px",
9642
+ height: "5px"
9643
+ },
9644
+ "&::-webkit-scrollbar-track": {
9645
+ background: V.colorNeutralBackground4,
9646
+ borderRadius: V.borderRadiusMedium
9647
+ },
9648
+ "&::-webkit-scrollbar-thumb": {
9649
+ background: V.colorBrandBackground,
9650
+ borderRadius: V.borderRadiusMedium
9651
+ },
9652
+ "&::-webkit-scrollbar-thumb:hover": { background: V.colorBrandBackgroundHover }
9653
+ } });
9654
9654
  //#endregion
9655
9655
  //#region src/components/DataGridV2/DataGridV2.tsx
9656
9656
  function vd(e, t) {
9657
- let { columns: n, items: r, enableSorting: i = !1, enableResizing: a = !1, selectionMode: o = "none", onSelectionChange: s, defaultSelectedItems: c = [], defaultSortState: l, onSortChange: u, columnSizingOptions: d, resizableColumnsOptions: f, noItemsMessage: p, isLoadingData: m, isLoadingDataMessage: h, dataGridBodyClassName: g, dataGridBodyStyles: _, refreshData: v, enableInfiniteScroll: y, onLoadMore: b, infiniteScrollPageSize: x, hasNextPage: S, isLoadingMore: C, autoShowLastPage: w = !0, virtualizedHeight: T = 600, virtualizedItemSize: E = 44, startIndex: D, onRowClick: O } = e, k = M.useMemo(() => n.map((e) => Fn({
9657
+ let n = _d().scrollbar, { columns: r, items: i, enableSorting: a = !1, enableResizing: o = !1, selectionMode: s = "none", onSelectionChange: c, defaultSelectedItems: l = [], defaultSortState: u, onSortChange: d, columnSizingOptions: f, resizableColumnsOptions: p, noItemsMessage: m, isLoadingData: h, isLoadingDataMessage: g, dataGridBodyClassName: _, dataGridBodyStyles: v, refreshData: y, enableInfiniteScroll: b, onLoadMore: x, infiniteScrollPageSize: S, hasNextPage: C, isLoadingMore: w, autoShowLastPage: T = !0, virtualizedHeight: E = 600, virtualizedItemSize: D = 44, startIndex: O, onRowClick: k } = e, A = M.useMemo(() => r.map((e) => Fn({
9658
9658
  columnId: e.column,
9659
9659
  renderHeaderCell: () => /* @__PURE__ */ R(rt, { children: e.header }),
9660
9660
  renderCell: (t) => /* @__PURE__ */ R(Sn, {
@@ -9664,138 +9664,139 @@ function vd(e, t) {
9664
9664
  children: e.onRender ? e.onRender(t) : String(t[e.column] ?? "")
9665
9665
  }),
9666
9666
  compare: e.order
9667
- })), [n]), A = M.useCallback((e) => r.findIndex((t) => t === e), [r]), [j, ee] = M.useState(new Set(c.map((e) => A(e)))), [te, ne] = M.useState(0);
9667
+ })), [r]), j = M.useCallback((e) => i.findIndex((t) => t === e), [i]), [ee, te] = M.useState(new Set(l.map((e) => j(e)))), [ne, re] = M.useState(0);
9668
9668
  M.useEffect(() => {
9669
- c.length && ee(new Set(c.map((e) => A(e))));
9669
+ l.length && te(new Set(l.map((e) => j(e))));
9670
9670
  }, [
9671
- c,
9672
- r,
9673
- A
9671
+ l,
9672
+ i,
9673
+ j
9674
9674
  ]), M.useEffect(() => {
9675
- v && ee(/* @__PURE__ */ new Set());
9676
- }, [v]);
9677
- let re = (e, t) => {
9675
+ y && te(/* @__PURE__ */ new Set());
9676
+ }, [y]);
9677
+ let ie = (e, t) => {
9678
9678
  let n = /* @__PURE__ */ new Set();
9679
9679
  t.selectedItems.forEach((e) => {
9680
9680
  let t = Number(e);
9681
9681
  isNaN(t) || n.add(t);
9682
- }), ee(n), s && s(Array.from(n).map((e) => r[e]));
9683
- }, ie = (e, t) => {
9684
- u && u(t);
9685
- }, [ae, oe] = M.useState(null), se = M.useMemo(() => new Map(r.map((e, t) => [e, t])), [r]);
9682
+ }), te(n), c && c(Array.from(n).map((e) => i[e]));
9683
+ }, ae = (e, t) => {
9684
+ d && d(t);
9685
+ }, [oe, se] = M.useState(null), ce = M.useMemo(() => new Map(i.map((e, t) => [e, t])), [i]);
9686
9686
  M.useEffect(() => {
9687
- o === "row" && ae != null && ae >= r.length && oe(null);
9687
+ s === "row" && oe != null && oe >= i.length && se(null);
9688
9688
  }, [
9689
- r,
9690
- ae,
9691
- o
9689
+ i,
9690
+ oe,
9691
+ s
9692
9692
  ]), M.useEffect(() => {
9693
- v && o === "row" && oe(null);
9694
- }, [v, o]);
9695
- let ce = M.useRef(null), le = M.useRef(r.length), ue = M.useRef(!1), de = M.useRef(!1), fe = M.useRef(!1);
9693
+ y && s === "row" && se(null);
9694
+ }, [y, s]);
9695
+ let le = M.useRef(null), ue = M.useRef(i.length), de = M.useRef(!1), fe = M.useRef(!1), pe = M.useRef(!1);
9696
9696
  M.useImperativeHandle(t, () => ({
9697
9697
  scrollToIndex: (e, t = "auto") => {
9698
- let n = ce.current;
9698
+ let n = le.current;
9699
9699
  n && "scrollToItem" in n && n.scrollToItem(Math.max(0, e), t);
9700
9700
  },
9701
9701
  resetGrid: () => {
9702
- ne((e) => e + 1), le.current = 0, ue.current = !1, de.current = !1, fe.current = !1, pe.current = -1, ee(/* @__PURE__ */ new Set()), oe(null);
9702
+ re((e) => e + 1), ue.current = 0, de.current = !1, fe.current = !1, pe.current = !1, me.current = -1, te(/* @__PURE__ */ new Set()), se(null);
9703
9703
  },
9704
- getSelectedRow: () => ae !== null && ae < r.length ? {
9705
- item: r[ae],
9706
- index: ae
9704
+ getSelectedRow: () => oe !== null && oe < i.length ? {
9705
+ item: i[oe],
9706
+ index: oe
9707
9707
  } : null,
9708
9708
  setSelectedRow: (e) => {
9709
- let t = r.findIndex((t) => t === e);
9710
- t !== -1 && (oe(t), s?.([e]));
9709
+ let t = i.findIndex((t) => t === e);
9710
+ t !== -1 && (se(t), c?.([e]));
9711
9711
  }
9712
9712
  })), M.useEffect(() => {
9713
- if (!ue.current && typeof D == "number" && ce.current) {
9714
- let e = ce.current;
9715
- "scrollToItem" in e && e.scrollToItem(Math.min(D, Math.max(r.length - 1, 0)), "start"), ue.current = !0;
9716
- }
9717
- }, [D, r.length]), M.useEffect(() => {
9718
- let e = le.current, t = r.length, n = t > e;
9719
- if (le.current = t, !w || !n || e === 0) return;
9720
- let i = ce.current;
9721
- i && "scrollToItem" in i && i.scrollToItem(Math.max(t - 1, 0), "end");
9722
- }, [r.length, w]);
9723
- let pe = M.useRef(-1), me = M.useCallback(({ visibleStopIndex: e }) => {
9724
- if (!y || !b || C || fe.current) return;
9725
- if (!de.current) {
9726
- de.current = !0;
9713
+ if (!de.current && typeof O == "number" && le.current) {
9714
+ let e = le.current;
9715
+ "scrollToItem" in e && e.scrollToItem(Math.min(O, Math.max(i.length - 1, 0)), "start"), de.current = !0;
9716
+ }
9717
+ }, [O, i.length]), M.useEffect(() => {
9718
+ let e = ue.current, t = i.length, n = t > e;
9719
+ if (ue.current = t, !T || !n || e === 0) return;
9720
+ let r = le.current;
9721
+ r && "scrollToItem" in r && r.scrollToItem(Math.max(t - 1, 0), "end");
9722
+ }, [i.length, T]);
9723
+ let me = M.useRef(-1), he = M.useCallback(({ visibleStopIndex: e }) => {
9724
+ if (!b || !x || w || pe.current) return;
9725
+ if (!fe.current) {
9726
+ fe.current = !0;
9727
9727
  return;
9728
9728
  }
9729
- let t = x ?? 20;
9730
- if (r.length < t) return;
9729
+ let t = S ?? 20;
9730
+ if (i.length < t) return;
9731
9731
  let n = Math.max(5, Math.ceil(t / 5));
9732
- e >= r.length - n && S && pe.current !== r.length && (pe.current = r.length, fe.current = !0, b());
9732
+ e >= i.length - n && C && me.current !== i.length && (me.current = i.length, pe.current = !0, x());
9733
9733
  }, [
9734
- y,
9735
9734
  b,
9736
- S,
9735
+ x,
9737
9736
  C,
9738
- r.length,
9739
- x
9737
+ w,
9738
+ i.length,
9739
+ S
9740
9740
  ]);
9741
9741
  return M.useEffect(() => {
9742
- fe.current && r.length > pe.current && (fe.current = !1);
9743
- }, [r.length]), /* @__PURE__ */ z("div", {
9742
+ pe.current && i.length > me.current && (pe.current = !1);
9743
+ }, [i.length]), /* @__PURE__ */ z("div", {
9744
9744
  style: M.useMemo(() => ({
9745
9745
  overflowX: "auto",
9746
9746
  overflowY: "hidden",
9747
9747
  position: "relative"
9748
9748
  }), []),
9749
- className: _d,
9750
- children: [m && /* @__PURE__ */ R(Y, {
9749
+ className: n,
9750
+ children: [h && /* @__PURE__ */ R(Y, {
9751
9751
  alignItems: "center",
9752
9752
  justifyContent: "center",
9753
- height: `${T}px`,
9754
- children: M.isValidElement(h) ? h : /* @__PURE__ */ z(vn, {
9753
+ height: `${E}px`,
9754
+ children: M.isValidElement(g) ? g : /* @__PURE__ */ z(vn, {
9755
9755
  size: "extra-tiny",
9756
9756
  children: [
9757
9757
  " ",
9758
- h ?? "Loading data...",
9758
+ g ?? "Loading data...",
9759
9759
  " "
9760
9760
  ]
9761
9761
  })
9762
- }), !m && r.length ? /* @__PURE__ */ z(gi, {
9763
- items: r,
9764
- columns: k,
9765
- sortable: i,
9766
- onSortChange: i ? ie : void 0,
9767
- selectionMode: o === "none" || o === "row" ? void 0 : o === "multiple" ? "multiselect" : o === "single" ? "single" : void 0,
9768
- selectedItems: j,
9769
- onSelectionChange: re,
9770
- defaultSortState: l,
9771
- resizableColumns: a,
9772
- columnSizingOptions: d,
9773
- resizableColumnsOptions: f,
9762
+ }), !h && i.length ? /* @__PURE__ */ z(gi, {
9763
+ items: i,
9764
+ columns: A,
9765
+ sortable: a,
9766
+ onSortChange: a ? ae : void 0,
9767
+ selectionMode: s === "none" || s === "row" ? void 0 : s === "multiple" ? "multiselect" : s === "single" ? "single" : void 0,
9768
+ selectedItems: ee,
9769
+ onSelectionChange: ie,
9770
+ defaultSortState: u,
9771
+ resizableColumns: o,
9772
+ columnSizingOptions: f,
9773
+ resizableColumnsOptions: p,
9774
9774
  focusMode: "cell",
9775
- className: g,
9776
- style: _,
9775
+ className: Ln(_, n),
9776
+ style: v,
9777
9777
  children: [/* @__PURE__ */ R(yi, { children: /* @__PURE__ */ R(xi, { children: ({ renderHeaderCell: e }) => /* @__PURE__ */ R(bi, { children: e() }) }) }), /* @__PURE__ */ R(_i, {
9778
- itemSize: E,
9779
- height: T,
9778
+ itemSize: D,
9779
+ height: E,
9780
9780
  width: "100%",
9781
- listProps: { onItemsRendered: me },
9781
+ listProps: { onItemsRendered: he },
9782
+ className: n,
9782
9783
  children: (e, t) => (() => {
9783
- let n = e.item, i = se.get(n) ?? r.indexOf(n), a = o === "row", c = a && ae === i, l = (e) => {
9784
- oe(i), s?.([n]), O?.(n, i);
9784
+ let n = e.item, r = ce.get(n) ?? i.indexOf(n), a = s === "row", o = a && oe === r, l = (e) => {
9785
+ se(r), c?.([n]), k?.(n, r);
9785
9786
  };
9786
9787
  return /* @__PURE__ */ R(xi, {
9787
9788
  style: {
9788
9789
  ...t,
9789
9790
  cursor: a ? "pointer" : void 0,
9790
- background: c ? V.colorSubtleBackgroundSelected : void 0
9791
+ background: o ? V.colorSubtleBackgroundSelected : void 0
9791
9792
  },
9792
9793
  onClick: l,
9793
- "aria-selected": c || void 0,
9794
+ "aria-selected": o || void 0,
9794
9795
  children: ({ renderCell: e }) => /* @__PURE__ */ R(vi, { children: e(n) })
9795
9796
  });
9796
9797
  })()
9797
9798
  })]
9798
- }, te) : !m && !r.length ? /* @__PURE__ */ R("div", { children: p }) : null]
9799
+ }, ne) : !h && !i.length ? /* @__PURE__ */ R("div", { children: m }) : null]
9799
9800
  });
9800
9801
  }
9801
9802
  var yd = M.forwardRef(vd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spteck/react-controls-v2",
3
- "version": "2.3.8",
3
+ "version": "2.3.91",
4
4
  "description": "Framework-agnostic React controls for Vite, Next.js, and SPFx - based on Fluent UI 9",
5
5
  "license": "MIT",
6
6
  "author": "João Mendes",