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.
@@ -3762,6 +3762,7 @@ function SPortal({
3762
3762
  viewportPadding = 0,
3763
3763
  onOpenAutoFocus,
3764
3764
  onCloseAutoFocus,
3765
+ onPointerDownOutside,
3765
3766
  children,
3766
3767
  className,
3767
3768
  style,
@@ -3790,7 +3791,9 @@ function SPortal({
3790
3791
  onPointerDownOutside: (e) => {
3791
3792
  if (persistent || anchorRef.current?.contains(e.target)) {
3792
3793
  e.preventDefault();
3794
+ return;
3793
3795
  }
3796
+ onPointerDownOutside?.(e);
3794
3797
  },
3795
3798
  onFocusOutside: (e) => {
3796
3799
  if (persistent || anchorRef.current?.contains(e.target)) {
@@ -3895,6 +3898,7 @@ var SSelect = forwardRef(function SSelect2({
3895
3898
  const triggerRef = useRef(null);
3896
3899
  const searchInputRef = useRef(null);
3897
3900
  const listRef = useRef(null);
3901
+ const dismissedByPointerRef = useRef(false);
3898
3902
  const flat = useMemo(() => flattenOptions(options), [options]);
3899
3903
  const selectable = useMemo(() => selectableOptions(flat), [flat]);
3900
3904
  const hasLeaf = useMemo(() => flat.some((o) => !o.isGroup), [flat]);
@@ -3924,7 +3928,9 @@ var SSelect = forwardRef(function SSelect2({
3924
3928
  const commitOpen = (next) => {
3925
3929
  setOpen(next);
3926
3930
  onOpenChange?.(next);
3927
- if (!next) {
3931
+ if (next) {
3932
+ dismissedByPointerRef.current = false;
3933
+ } else {
3928
3934
  setPendingOpen(false);
3929
3935
  setSearch("");
3930
3936
  if (rules && rules.length > 0) {
@@ -4148,8 +4154,12 @@ var SSelect = forwardRef(function SSelect2({
4148
4154
  event.preventDefault();
4149
4155
  requestAnimationFrame(() => searchInputRef.current?.focus());
4150
4156
  },
4157
+ onPointerDownOutside: () => {
4158
+ dismissedByPointerRef.current = true;
4159
+ },
4151
4160
  onCloseAutoFocus: (event) => {
4152
4161
  event.preventDefault();
4162
+ if (dismissedByPointerRef.current) return;
4153
4163
  triggerRef.current?.focus();
4154
4164
  },
4155
4165
  className: "rounded-[var(--cmp-listBox-radius)] bg-[var(--cmp-listBox-bg)] shadow-[2px_2px_12px_2px_rgba(0,0,0,0.1)]",