@eqtylab/equality 4.3.1 → 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 +9 -0
- package/dist/index.cjs +27 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2246,9 +2246,15 @@ var FilterDropdown = ({
|
|
|
2246
2246
|
const filteredOptions = options.filter(
|
|
2247
2247
|
(option) => option.value && option.value.trim() !== "" && option.label && option.label.trim() !== ""
|
|
2248
2248
|
);
|
|
2249
|
+
const handleClearAll = (event) => {
|
|
2250
|
+
event.preventDefault();
|
|
2251
|
+
const menu = event.currentTarget.closest('[role="menu"]');
|
|
2252
|
+
(menu?.querySelector("[data-dropdown-search]") ?? menu)?.focus();
|
|
2253
|
+
onClearAll();
|
|
2254
|
+
};
|
|
2249
2255
|
const clearAll = (className) => (
|
|
2250
2256
|
// An empty textValue keeps this out of search results, so Enter can't clear every filter
|
|
2251
|
-
/* @__PURE__ */ jsx(DropdownMenuItem, { textValue: "", onSelect:
|
|
2257
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, { textValue: "", onSelect: handleClearAll, className, children: /* @__PURE__ */ jsx("span", { className: buttonVariants({ variant: "link", size: "sm" }), children: "Clear all" }) })
|
|
2252
2258
|
);
|
|
2253
2259
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2254
2260
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs(
|
|
@@ -2667,22 +2673,26 @@ var Select = ({
|
|
|
2667
2673
|
interactedRef.current = true;
|
|
2668
2674
|
}, []);
|
|
2669
2675
|
const interactedSinceOpen = React15.useCallback(() => interactedRef.current, []);
|
|
2676
|
+
const [lockedSide, setLockedSide] = React15.useState();
|
|
2670
2677
|
React15.useEffect(() => {
|
|
2671
|
-
if (open)
|
|
2678
|
+
if (!open) return;
|
|
2679
|
+
interactedRef.current = false;
|
|
2680
|
+
setLockedSide(void 0);
|
|
2672
2681
|
}, [open]);
|
|
2673
2682
|
const handleOpenChange = React15.useCallback(
|
|
2674
2683
|
(nextOpen) => {
|
|
2675
2684
|
if (nextOpen) {
|
|
2676
2685
|
resetForOpen();
|
|
2677
2686
|
interactedRef.current = false;
|
|
2687
|
+
setLockedSide(void 0);
|
|
2678
2688
|
}
|
|
2679
2689
|
onOpenChange?.(nextOpen);
|
|
2680
2690
|
},
|
|
2681
2691
|
[onOpenChange, resetForOpen]
|
|
2682
2692
|
);
|
|
2683
2693
|
const value = React15.useMemo(
|
|
2684
|
-
() => ({ ...search, markInteracted, interactedSinceOpen }),
|
|
2685
|
-
[search, markInteracted, interactedSinceOpen]
|
|
2694
|
+
() => ({ ...search, markInteracted, interactedSinceOpen, lockedSide, lockSide: setLockedSide }),
|
|
2695
|
+
[search, markInteracted, interactedSinceOpen, lockedSide]
|
|
2686
2696
|
);
|
|
2687
2697
|
return /* @__PURE__ */ jsx(SelectSearchContext.Provider, { value, children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { open, onOpenChange: handleOpenChange, ...props }) });
|
|
2688
2698
|
};
|
|
@@ -2742,19 +2752,30 @@ var SelectContent = React15.forwardRef(
|
|
|
2742
2752
|
onKeyDownCapture,
|
|
2743
2753
|
onPointerMoveCapture,
|
|
2744
2754
|
onFocus,
|
|
2755
|
+
side,
|
|
2756
|
+
avoidCollisions,
|
|
2745
2757
|
...props
|
|
2746
2758
|
}, ref) => {
|
|
2747
2759
|
const ctx = useSelectSearch();
|
|
2748
2760
|
const setListId = ctx?.setListId;
|
|
2749
2761
|
const searching = isSearchActive(ctx);
|
|
2750
2762
|
const resultCount = ctx?.matchCount ?? 0;
|
|
2763
|
+
const contentRef = React15.useRef(null);
|
|
2764
|
+
const lockedSide = ctx?.lockedSide;
|
|
2765
|
+
const lockSide = ctx?.lockSide;
|
|
2751
2766
|
const composedContentRef = React15.useCallback(
|
|
2752
2767
|
(node) => {
|
|
2753
2768
|
assignRefs(node, ref);
|
|
2769
|
+
contentRef.current = node;
|
|
2754
2770
|
setListId?.(node?.id || void 0);
|
|
2755
2771
|
},
|
|
2756
2772
|
[ref, setListId]
|
|
2757
2773
|
);
|
|
2774
|
+
React15.useEffect(() => {
|
|
2775
|
+
if (position !== "popper" || !searching || lockedSide) return;
|
|
2776
|
+
const placed = contentRef.current?.dataset.side;
|
|
2777
|
+
if (placed) lockSide?.(placed);
|
|
2778
|
+
}, [position, searching, lockedSide, lockSide]);
|
|
2758
2779
|
const handleFocus = (event) => {
|
|
2759
2780
|
onFocus?.(event);
|
|
2760
2781
|
if (!ctx?.enabled || !ctx.visible || ctx.interactedSinceOpen()) return;
|
|
@@ -2800,6 +2821,8 @@ var SelectContent = React15.forwardRef(
|
|
|
2800
2821
|
className
|
|
2801
2822
|
),
|
|
2802
2823
|
position,
|
|
2824
|
+
side: lockedSide ?? side,
|
|
2825
|
+
avoidCollisions: lockedSide ? false : avoidCollisions,
|
|
2803
2826
|
onFocus: handleFocus,
|
|
2804
2827
|
onKeyDown: handleKeyDown,
|
|
2805
2828
|
onKeyDownCapture: (event) => {
|