sellmate-design-system-react 0.8.0 → 0.8.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.
@@ -3499,6 +3499,7 @@ function SPortal({
3499
3499
  viewportPadding = 0,
3500
3500
  onOpenAutoFocus,
3501
3501
  onCloseAutoFocus,
3502
+ onPointerDownOutside,
3502
3503
  children,
3503
3504
  className,
3504
3505
  style,
@@ -3527,7 +3528,9 @@ function SPortal({
3527
3528
  onPointerDownOutside: (e) => {
3528
3529
  if (persistent || anchorRef.current?.contains(e.target)) {
3529
3530
  e.preventDefault();
3531
+ return;
3530
3532
  }
3533
+ onPointerDownOutside?.(e);
3531
3534
  },
3532
3535
  onFocusOutside: (e) => {
3533
3536
  if (persistent || anchorRef.current?.contains(e.target)) {
@@ -3632,6 +3635,7 @@ var SSelect = forwardRef(function SSelect2({
3632
3635
  const triggerRef = useRef(null);
3633
3636
  const searchInputRef = useRef(null);
3634
3637
  const listRef = useRef(null);
3638
+ const dismissedByPointerRef = useRef(false);
3635
3639
  const flat = useMemo(() => flattenOptions(options), [options]);
3636
3640
  const selectable = useMemo(() => selectableOptions(flat), [flat]);
3637
3641
  const hasLeaf = useMemo(() => flat.some((o) => !o.isGroup), [flat]);
@@ -3661,7 +3665,9 @@ var SSelect = forwardRef(function SSelect2({
3661
3665
  const commitOpen = (next) => {
3662
3666
  setOpen(next);
3663
3667
  onOpenChange?.(next);
3664
- if (!next) {
3668
+ if (next) {
3669
+ dismissedByPointerRef.current = false;
3670
+ } else {
3665
3671
  setPendingOpen(false);
3666
3672
  setSearch("");
3667
3673
  if (rules && rules.length > 0) {
@@ -3885,8 +3891,12 @@ var SSelect = forwardRef(function SSelect2({
3885
3891
  event.preventDefault();
3886
3892
  requestAnimationFrame(() => searchInputRef.current?.focus());
3887
3893
  },
3894
+ onPointerDownOutside: () => {
3895
+ dismissedByPointerRef.current = true;
3896
+ },
3888
3897
  onCloseAutoFocus: (event) => {
3889
3898
  event.preventDefault();
3899
+ if (dismissedByPointerRef.current) return;
3890
3900
  triggerRef.current?.focus();
3891
3901
  },
3892
3902
  className: "rounded-[var(--cmp-listBox-radius)] bg-[var(--cmp-listBox-bg)] shadow-[2px_2px_12px_2px_rgba(0,0,0,0.1)]",