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.
package/dist/index.cjs CHANGED
@@ -4427,6 +4427,7 @@ function SPortal({
4427
4427
  viewportPadding = 0,
4428
4428
  onOpenAutoFocus,
4429
4429
  onCloseAutoFocus,
4430
+ onPointerDownOutside,
4430
4431
  children,
4431
4432
  className,
4432
4433
  style,
@@ -4455,7 +4456,9 @@ function SPortal({
4455
4456
  onPointerDownOutside: (e) => {
4456
4457
  if (persistent || anchorRef.current?.contains(e.target)) {
4457
4458
  e.preventDefault();
4459
+ return;
4458
4460
  }
4461
+ onPointerDownOutside?.(e);
4459
4462
  },
4460
4463
  onFocusOutside: (e) => {
4461
4464
  if (persistent || anchorRef.current?.contains(e.target)) {
@@ -6359,6 +6362,7 @@ var SSelect = react.forwardRef(function SSelect2({
6359
6362
  const triggerRef = react.useRef(null);
6360
6363
  const searchInputRef = react.useRef(null);
6361
6364
  const listRef = react.useRef(null);
6365
+ const dismissedByPointerRef = react.useRef(false);
6362
6366
  const flat = react.useMemo(() => flattenOptions(options), [options]);
6363
6367
  const selectable = react.useMemo(() => selectableOptions(flat), [flat]);
6364
6368
  const hasLeaf = react.useMemo(() => flat.some((o) => !o.isGroup), [flat]);
@@ -6388,7 +6392,9 @@ var SSelect = react.forwardRef(function SSelect2({
6388
6392
  const commitOpen = (next) => {
6389
6393
  setOpen(next);
6390
6394
  onOpenChange?.(next);
6391
- if (!next) {
6395
+ if (next) {
6396
+ dismissedByPointerRef.current = false;
6397
+ } else {
6392
6398
  setPendingOpen(false);
6393
6399
  setSearch("");
6394
6400
  if (rules && rules.length > 0) {
@@ -6612,8 +6618,12 @@ var SSelect = react.forwardRef(function SSelect2({
6612
6618
  event.preventDefault();
6613
6619
  requestAnimationFrame(() => searchInputRef.current?.focus());
6614
6620
  },
6621
+ onPointerDownOutside: () => {
6622
+ dismissedByPointerRef.current = true;
6623
+ },
6615
6624
  onCloseAutoFocus: (event) => {
6616
6625
  event.preventDefault();
6626
+ if (dismissedByPointerRef.current) return;
6617
6627
  triggerRef.current?.focus();
6618
6628
  },
6619
6629
  className: "rounded-[var(--cmp-listBox-radius)] bg-[var(--cmp-listBox-bg)] shadow-[2px_2px_12px_2px_rgba(0,0,0,0.1)]",