@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 +17 -0
- package/dist/index.cjs +40 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1964,11 +1964,16 @@ var DropdownMenuSub = ({
|
|
|
1964
1964
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, { ...props, children });
|
|
1965
1965
|
};
|
|
1966
1966
|
var MENU_ITEM_SELECTOR = '[role="menuitem"]:not([data-disabled]),[role="menuitemcheckbox"]:not([data-disabled]),[role="menuitemradio"]:not([data-disabled])';
|
|
1967
|
-
var DropdownMenuContent = React15.forwardRef(({ className, sideOffset = 4, onKeyDown, children, ...props }, ref) => {
|
|
1967
|
+
var DropdownMenuContent = React15.forwardRef(({ className, sideOffset = 4, onKeyDown, onFocus, children, ...props }, ref) => {
|
|
1968
1968
|
const ctx = useDropdownMenuSearch();
|
|
1969
1969
|
const setListId = ctx?.setListId;
|
|
1970
1970
|
const searching = isSearchActive(ctx);
|
|
1971
1971
|
const resultCount = ctx?.matchCount ?? 0;
|
|
1972
|
+
const openFocusHandledRef = React15.useRef(false);
|
|
1973
|
+
const searchVisible = ctx?.visible ?? false;
|
|
1974
|
+
React15.useEffect(() => {
|
|
1975
|
+
if (!searchVisible) openFocusHandledRef.current = false;
|
|
1976
|
+
}, [searchVisible]);
|
|
1972
1977
|
const composedContentRef = React15.useCallback(
|
|
1973
1978
|
(node) => {
|
|
1974
1979
|
assignRefs(node, ref);
|
|
@@ -1982,6 +1987,13 @@ var DropdownMenuContent = React15.forwardRef(({ className, sideOffset = 4, onKey
|
|
|
1982
1987
|
ref: composedContentRef,
|
|
1983
1988
|
sideOffset,
|
|
1984
1989
|
className: cn(styles22["dropdown-menu-content"], className),
|
|
1990
|
+
onFocus: (event) => {
|
|
1991
|
+
onFocus?.(event);
|
|
1992
|
+
if (openFocusHandledRef.current) return;
|
|
1993
|
+
openFocusHandledRef.current = true;
|
|
1994
|
+
if (event.target !== event.currentTarget || !ctx?.enabled || !ctx.visible) return;
|
|
1995
|
+
ctx.requestFocus();
|
|
1996
|
+
},
|
|
1985
1997
|
onKeyDown: (event) => {
|
|
1986
1998
|
onKeyDown?.(event);
|
|
1987
1999
|
if (!ctx?.enabled) return;
|
|
@@ -2234,9 +2246,15 @@ var FilterDropdown = ({
|
|
|
2234
2246
|
const filteredOptions = options.filter(
|
|
2235
2247
|
(option) => option.value && option.value.trim() !== "" && option.label && option.label.trim() !== ""
|
|
2236
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
|
+
};
|
|
2237
2255
|
const clearAll = (className) => (
|
|
2238
2256
|
// An empty textValue keeps this out of search results, so Enter can't clear every filter
|
|
2239
|
-
/* @__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" }) })
|
|
2240
2258
|
);
|
|
2241
2259
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2242
2260
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs(
|
|
@@ -2655,22 +2673,26 @@ var Select = ({
|
|
|
2655
2673
|
interactedRef.current = true;
|
|
2656
2674
|
}, []);
|
|
2657
2675
|
const interactedSinceOpen = React15.useCallback(() => interactedRef.current, []);
|
|
2676
|
+
const [lockedSide, setLockedSide] = React15.useState();
|
|
2658
2677
|
React15.useEffect(() => {
|
|
2659
|
-
if (open)
|
|
2678
|
+
if (!open) return;
|
|
2679
|
+
interactedRef.current = false;
|
|
2680
|
+
setLockedSide(void 0);
|
|
2660
2681
|
}, [open]);
|
|
2661
2682
|
const handleOpenChange = React15.useCallback(
|
|
2662
2683
|
(nextOpen) => {
|
|
2663
2684
|
if (nextOpen) {
|
|
2664
2685
|
resetForOpen();
|
|
2665
2686
|
interactedRef.current = false;
|
|
2687
|
+
setLockedSide(void 0);
|
|
2666
2688
|
}
|
|
2667
2689
|
onOpenChange?.(nextOpen);
|
|
2668
2690
|
},
|
|
2669
2691
|
[onOpenChange, resetForOpen]
|
|
2670
2692
|
);
|
|
2671
2693
|
const value = React15.useMemo(
|
|
2672
|
-
() => ({ ...search, markInteracted, interactedSinceOpen }),
|
|
2673
|
-
[search, markInteracted, interactedSinceOpen]
|
|
2694
|
+
() => ({ ...search, markInteracted, interactedSinceOpen, lockedSide, lockSide: setLockedSide }),
|
|
2695
|
+
[search, markInteracted, interactedSinceOpen, lockedSide]
|
|
2674
2696
|
);
|
|
2675
2697
|
return /* @__PURE__ */ jsx(SelectSearchContext.Provider, { value, children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { open, onOpenChange: handleOpenChange, ...props }) });
|
|
2676
2698
|
};
|
|
@@ -2730,19 +2752,30 @@ var SelectContent = React15.forwardRef(
|
|
|
2730
2752
|
onKeyDownCapture,
|
|
2731
2753
|
onPointerMoveCapture,
|
|
2732
2754
|
onFocus,
|
|
2755
|
+
side,
|
|
2756
|
+
avoidCollisions,
|
|
2733
2757
|
...props
|
|
2734
2758
|
}, ref) => {
|
|
2735
2759
|
const ctx = useSelectSearch();
|
|
2736
2760
|
const setListId = ctx?.setListId;
|
|
2737
2761
|
const searching = isSearchActive(ctx);
|
|
2738
2762
|
const resultCount = ctx?.matchCount ?? 0;
|
|
2763
|
+
const contentRef = React15.useRef(null);
|
|
2764
|
+
const lockedSide = ctx?.lockedSide;
|
|
2765
|
+
const lockSide = ctx?.lockSide;
|
|
2739
2766
|
const composedContentRef = React15.useCallback(
|
|
2740
2767
|
(node) => {
|
|
2741
2768
|
assignRefs(node, ref);
|
|
2769
|
+
contentRef.current = node;
|
|
2742
2770
|
setListId?.(node?.id || void 0);
|
|
2743
2771
|
},
|
|
2744
2772
|
[ref, setListId]
|
|
2745
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]);
|
|
2746
2779
|
const handleFocus = (event) => {
|
|
2747
2780
|
onFocus?.(event);
|
|
2748
2781
|
if (!ctx?.enabled || !ctx.visible || ctx.interactedSinceOpen()) return;
|
|
@@ -2788,6 +2821,8 @@ var SelectContent = React15.forwardRef(
|
|
|
2788
2821
|
className
|
|
2789
2822
|
),
|
|
2790
2823
|
position,
|
|
2824
|
+
side: lockedSide ?? side,
|
|
2825
|
+
avoidCollisions: lockedSide ? false : avoidCollisions,
|
|
2791
2826
|
onFocus: handleFocus,
|
|
2792
2827
|
onKeyDown: handleKeyDown,
|
|
2793
2828
|
onKeyDownCapture: (event) => {
|