componentes-sinco 1.2.0 → 1.2.1

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
@@ -2621,6 +2621,7 @@ function SCAutocomplete({
2621
2621
  ) || null;
2622
2622
  const [open, setOpen] = import_react19.default.useState(false);
2623
2623
  const componentClickActiveRef = import_react19.default.useRef(false);
2624
+ const listboxScrollRef = import_react19.default.useRef(null);
2624
2625
  const containerRef = import_react19.default.useRef(null);
2625
2626
  const [chipLimit, setChipLimit] = import_react19.default.useState(2);
2626
2627
  const outsideChipsMeasureRef = import_react19.default.useRef(null);
@@ -2786,12 +2787,18 @@ function SCAutocomplete({
2786
2787
  event2.defaultMuiPrevented = true;
2787
2788
  },
2788
2789
  onClick: (event2) => {
2789
- var _a2;
2790
+ var _a2, _b, _c;
2790
2791
  event2.preventDefault();
2791
2792
  event2.stopPropagation();
2792
2793
  event2.defaultMuiPrevented = true;
2793
- (_a2 = item.onComponentClick) == null ? void 0 : _a2.call(item, event2, option);
2794
+ const savedScroll = (_b = (_a2 = listboxScrollRef.current) == null ? void 0 : _a2.scrollTop) != null ? _b : 0;
2795
+ (_c = item.onComponentClick) == null ? void 0 : _c.call(item, event2, option);
2794
2796
  setOpen(true);
2797
+ requestAnimationFrame(() => {
2798
+ if (listboxScrollRef.current) {
2799
+ listboxScrollRef.current.scrollTop = savedScroll;
2800
+ }
2801
+ });
2795
2802
  setTimeout(() => {
2796
2803
  componentClickActiveRef.current = false;
2797
2804
  }, 200);
@@ -2832,7 +2839,11 @@ function SCAutocomplete({
2832
2839
  return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
2833
2840
  import_material13.Box,
2834
2841
  __spreadProps(__spreadValues({
2835
- ref
2842
+ ref: (node) => {
2843
+ listboxScrollRef.current = node;
2844
+ if (typeof ref === "function") ref(node);
2845
+ else if (ref) ref.current = node;
2846
+ }
2836
2847
  }, props), {
2837
2848
  sx: __spreadValues({
2838
2849
  position: "relative",