@eqtylab/equality 4.3.0 → 4.3.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  Notable changes to Equality are recorded here, following [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4
4
 
5
+ ## 4.3.2 - 2026-09-24
6
+
7
+ ### Fixed
8
+
9
+ - `FilterDropdown`'s "Clear all" no longer closes the menu. Focus moves to the search box,
10
+ or to the menu without search, instead of falling out to an enclosing dialog.
11
+ - A searchable `Select` keeps the side it opened on while searching. A query that shrank
12
+ the list flipped it to the other side, where it stayed, capped to that side's space.
13
+
14
+ ## 4.3.1 - 2026-09-24
15
+
16
+ ### Fixed
17
+
18
+ - A searchable `DropdownMenu`, `FilterDropdown` or `RadioDropdown` inside a `Dialog` or
19
+ `Sheet` now focuses its search box when opened. The dialog's focus trap pulled focus
20
+ back out, leaving it on the menu.
21
+
5
22
  ## 4.3.0 - 2026-09-24
6
23
 
7
24
  ### Added
package/dist/index.cjs CHANGED
@@ -2067,11 +2067,16 @@ var DropdownMenuSub = ({
2067
2067
  return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Sub, { ...props, children });
2068
2068
  };
2069
2069
  var MENU_ITEM_SELECTOR = '[role="menuitem"]:not([data-disabled]),[role="menuitemcheckbox"]:not([data-disabled]),[role="menuitemradio"]:not([data-disabled])';
2070
- var DropdownMenuContent = React15__namespace.forwardRef(({ className, sideOffset = 4, onKeyDown, children, ...props }, ref) => {
2070
+ var DropdownMenuContent = React15__namespace.forwardRef(({ className, sideOffset = 4, onKeyDown, onFocus, children, ...props }, ref) => {
2071
2071
  const ctx = useDropdownMenuSearch();
2072
2072
  const setListId = ctx?.setListId;
2073
2073
  const searching = isSearchActive(ctx);
2074
2074
  const resultCount = ctx?.matchCount ?? 0;
2075
+ const openFocusHandledRef = React15__namespace.useRef(false);
2076
+ const searchVisible = ctx?.visible ?? false;
2077
+ React15__namespace.useEffect(() => {
2078
+ if (!searchVisible) openFocusHandledRef.current = false;
2079
+ }, [searchVisible]);
2075
2080
  const composedContentRef = React15__namespace.useCallback(
2076
2081
  (node) => {
2077
2082
  assignRefs(node, ref);
@@ -2085,6 +2090,13 @@ var DropdownMenuContent = React15__namespace.forwardRef(({ className, sideOffset
2085
2090
  ref: composedContentRef,
2086
2091
  sideOffset,
2087
2092
  className: cn(styles22__default.default["dropdown-menu-content"], className),
2093
+ onFocus: (event) => {
2094
+ onFocus?.(event);
2095
+ if (openFocusHandledRef.current) return;
2096
+ openFocusHandledRef.current = true;
2097
+ if (event.target !== event.currentTarget || !ctx?.enabled || !ctx.visible) return;
2098
+ ctx.requestFocus();
2099
+ },
2088
2100
  onKeyDown: (event) => {
2089
2101
  onKeyDown?.(event);
2090
2102
  if (!ctx?.enabled) return;
@@ -2337,9 +2349,15 @@ var FilterDropdown = ({
2337
2349
  const filteredOptions = options.filter(
2338
2350
  (option) => option.value && option.value.trim() !== "" && option.label && option.label.trim() !== ""
2339
2351
  );
2352
+ const handleClearAll = (event) => {
2353
+ event.preventDefault();
2354
+ const menu = event.currentTarget.closest('[role="menu"]');
2355
+ (menu?.querySelector("[data-dropdown-search]") ?? menu)?.focus();
2356
+ onClearAll();
2357
+ };
2340
2358
  const clearAll = (className) => (
2341
2359
  // An empty textValue keeps this out of search results, so Enter can't clear every filter
2342
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { textValue: "", onSelect: onClearAll, className, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: buttonVariants({ variant: "link", size: "sm" }), children: "Clear all" }) })
2360
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { textValue: "", onSelect: handleClearAll, className, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: buttonVariants({ variant: "link", size: "sm" }), children: "Clear all" }) })
2343
2361
  );
2344
2362
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
2345
2363
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2758,22 +2776,26 @@ var Select = ({
2758
2776
  interactedRef.current = true;
2759
2777
  }, []);
2760
2778
  const interactedSinceOpen = React15__namespace.useCallback(() => interactedRef.current, []);
2779
+ const [lockedSide, setLockedSide] = React15__namespace.useState();
2761
2780
  React15__namespace.useEffect(() => {
2762
- if (open) interactedRef.current = false;
2781
+ if (!open) return;
2782
+ interactedRef.current = false;
2783
+ setLockedSide(void 0);
2763
2784
  }, [open]);
2764
2785
  const handleOpenChange = React15__namespace.useCallback(
2765
2786
  (nextOpen) => {
2766
2787
  if (nextOpen) {
2767
2788
  resetForOpen();
2768
2789
  interactedRef.current = false;
2790
+ setLockedSide(void 0);
2769
2791
  }
2770
2792
  onOpenChange?.(nextOpen);
2771
2793
  },
2772
2794
  [onOpenChange, resetForOpen]
2773
2795
  );
2774
2796
  const value = React15__namespace.useMemo(
2775
- () => ({ ...search, markInteracted, interactedSinceOpen }),
2776
- [search, markInteracted, interactedSinceOpen]
2797
+ () => ({ ...search, markInteracted, interactedSinceOpen, lockedSide, lockSide: setLockedSide }),
2798
+ [search, markInteracted, interactedSinceOpen, lockedSide]
2777
2799
  );
2778
2800
  return /* @__PURE__ */ jsxRuntime.jsx(SelectSearchContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { open, onOpenChange: handleOpenChange, ...props }) });
2779
2801
  };
@@ -2833,19 +2855,30 @@ var SelectContent = React15__namespace.forwardRef(
2833
2855
  onKeyDownCapture,
2834
2856
  onPointerMoveCapture,
2835
2857
  onFocus,
2858
+ side,
2859
+ avoidCollisions,
2836
2860
  ...props
2837
2861
  }, ref) => {
2838
2862
  const ctx = useSelectSearch();
2839
2863
  const setListId = ctx?.setListId;
2840
2864
  const searching = isSearchActive(ctx);
2841
2865
  const resultCount = ctx?.matchCount ?? 0;
2866
+ const contentRef = React15__namespace.useRef(null);
2867
+ const lockedSide = ctx?.lockedSide;
2868
+ const lockSide = ctx?.lockSide;
2842
2869
  const composedContentRef = React15__namespace.useCallback(
2843
2870
  (node) => {
2844
2871
  assignRefs(node, ref);
2872
+ contentRef.current = node;
2845
2873
  setListId?.(node?.id || void 0);
2846
2874
  },
2847
2875
  [ref, setListId]
2848
2876
  );
2877
+ React15__namespace.useEffect(() => {
2878
+ if (position !== "popper" || !searching || lockedSide) return;
2879
+ const placed = contentRef.current?.dataset.side;
2880
+ if (placed) lockSide?.(placed);
2881
+ }, [position, searching, lockedSide, lockSide]);
2849
2882
  const handleFocus = (event) => {
2850
2883
  onFocus?.(event);
2851
2884
  if (!ctx?.enabled || !ctx.visible || ctx.interactedSinceOpen()) return;
@@ -2891,6 +2924,8 @@ var SelectContent = React15__namespace.forwardRef(
2891
2924
  className
2892
2925
  ),
2893
2926
  position,
2927
+ side: lockedSide ?? side,
2928
+ avoidCollisions: lockedSide ? false : avoidCollisions,
2894
2929
  onFocus: handleFocus,
2895
2930
  onKeyDown: handleKeyDown,
2896
2931
  onKeyDownCapture: (event) => {