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.
@@ -3785,6 +3785,7 @@ function SPortal({
3785
3785
  viewportPadding = 0,
3786
3786
  onOpenAutoFocus,
3787
3787
  onCloseAutoFocus,
3788
+ onPointerDownOutside,
3788
3789
  children,
3789
3790
  className,
3790
3791
  style,
@@ -3813,7 +3814,9 @@ function SPortal({
3813
3814
  onPointerDownOutside: (e) => {
3814
3815
  if (persistent || anchorRef.current?.contains(e.target)) {
3815
3816
  e.preventDefault();
3817
+ return;
3816
3818
  }
3819
+ onPointerDownOutside?.(e);
3817
3820
  },
3818
3821
  onFocusOutside: (e) => {
3819
3822
  if (persistent || anchorRef.current?.contains(e.target)) {
@@ -3918,6 +3921,7 @@ var SSelect = react.forwardRef(function SSelect2({
3918
3921
  const triggerRef = react.useRef(null);
3919
3922
  const searchInputRef = react.useRef(null);
3920
3923
  const listRef = react.useRef(null);
3924
+ const dismissedByPointerRef = react.useRef(false);
3921
3925
  const flat = react.useMemo(() => flattenOptions(options), [options]);
3922
3926
  const selectable = react.useMemo(() => selectableOptions(flat), [flat]);
3923
3927
  const hasLeaf = react.useMemo(() => flat.some((o) => !o.isGroup), [flat]);
@@ -3947,7 +3951,9 @@ var SSelect = react.forwardRef(function SSelect2({
3947
3951
  const commitOpen = (next) => {
3948
3952
  setOpen(next);
3949
3953
  onOpenChange?.(next);
3950
- if (!next) {
3954
+ if (next) {
3955
+ dismissedByPointerRef.current = false;
3956
+ } else {
3951
3957
  setPendingOpen(false);
3952
3958
  setSearch("");
3953
3959
  if (rules && rules.length > 0) {
@@ -4171,8 +4177,12 @@ var SSelect = react.forwardRef(function SSelect2({
4171
4177
  event.preventDefault();
4172
4178
  requestAnimationFrame(() => searchInputRef.current?.focus());
4173
4179
  },
4180
+ onPointerDownOutside: () => {
4181
+ dismissedByPointerRef.current = true;
4182
+ },
4174
4183
  onCloseAutoFocus: (event) => {
4175
4184
  event.preventDefault();
4185
+ if (dismissedByPointerRef.current) return;
4176
4186
  triggerRef.current?.focus();
4177
4187
  },
4178
4188
  className: "rounded-[var(--cmp-listBox-radius)] bg-[var(--cmp-listBox-bg)] shadow-[2px_2px_12px_2px_rgba(0,0,0,0.1)]",