@radix-ui/react-select 2.3.6-rc.1784938226983 → 2.3.7
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.d.mts +4 -12
- package/dist/index.d.ts +4 -12
- package/dist/index.js +10 -26
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +10 -26
- package/dist/index.mjs.map +2 -2
- package/package.json +23 -23
package/dist/index.mjs
CHANGED
|
@@ -29,14 +29,6 @@ import { VISUALLY_HIDDEN_STYLES } from "@radix-ui/react-visually-hidden";
|
|
|
29
29
|
import { hideOthers } from "aria-hidden";
|
|
30
30
|
import { RemoveScroll } from "react-remove-scroll";
|
|
31
31
|
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
32
|
-
var Position = {
|
|
33
|
-
ItemAligned: "item-aligned",
|
|
34
|
-
Popper: "popper"
|
|
35
|
-
};
|
|
36
|
-
var Direction = {
|
|
37
|
-
LTR: "ltr",
|
|
38
|
-
RTL: "rtl"
|
|
39
|
-
};
|
|
40
32
|
var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
41
33
|
var SELECTION_KEYS = [" ", "Enter"];
|
|
42
34
|
var SELECT_NAME = "Select";
|
|
@@ -305,7 +297,7 @@ var SelectContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
305
297
|
/* @__PURE__ */ __name(function SelectContentImpl2(props, forwardedRef) {
|
|
306
298
|
const { __scopeSelect } = props;
|
|
307
299
|
const {
|
|
308
|
-
position =
|
|
300
|
+
position = "item-aligned",
|
|
309
301
|
onCloseAutoFocus,
|
|
310
302
|
onEscapeKeyDown,
|
|
311
303
|
onPointerDownOutside,
|
|
@@ -434,7 +426,7 @@ var SelectContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
434
426
|
},
|
|
435
427
|
[context.value]
|
|
436
428
|
);
|
|
437
|
-
const SelectPosition = position ===
|
|
429
|
+
const SelectPosition = position === "popper" ? SelectPopperPosition : SelectItemAlignedPosition;
|
|
438
430
|
const popperContentProps = SelectPosition === SelectPopperPosition ? {
|
|
439
431
|
side,
|
|
440
432
|
sideOffset,
|
|
@@ -550,7 +542,7 @@ var SelectItemAlignedPosition = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */
|
|
|
550
542
|
const contentRect = content.getBoundingClientRect();
|
|
551
543
|
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
552
544
|
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
553
|
-
if (context.dir !==
|
|
545
|
+
if (context.dir !== "rtl") {
|
|
554
546
|
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
555
547
|
const left = valueNodeRect.left - itemTextOffset;
|
|
556
548
|
const leftDelta = triggerRect.left - left;
|
|
@@ -835,8 +827,10 @@ var SelectItem = /* @__PURE__ */ React.forwardRef(
|
|
|
835
827
|
const textId = useId();
|
|
836
828
|
const pointerTypeRef = React.useRef("touch");
|
|
837
829
|
const handleSelect = /* @__PURE__ */ __name(() => {
|
|
838
|
-
|
|
839
|
-
|
|
830
|
+
if (!disabled) {
|
|
831
|
+
context.onValueChange(value);
|
|
832
|
+
context.onOpenChange(false);
|
|
833
|
+
}
|
|
840
834
|
}, "handleSelect");
|
|
841
835
|
return /* @__PURE__ */ jsx(
|
|
842
836
|
SelectItemContextProvider,
|
|
@@ -872,20 +866,10 @@ var SelectItem = /* @__PURE__ */ React.forwardRef(
|
|
|
872
866
|
onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
873
867
|
onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
874
868
|
onClick: composeEventHandlers(itemProps.onClick, () => {
|
|
875
|
-
if (
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
|
-
if (pointerTypeRef.current !== "mouse") {
|
|
879
|
-
handleSelect();
|
|
880
|
-
}
|
|
869
|
+
if (pointerTypeRef.current !== "mouse") handleSelect();
|
|
881
870
|
}),
|
|
882
871
|
onPointerUp: composeEventHandlers(itemProps.onPointerUp, () => {
|
|
883
|
-
if (
|
|
884
|
-
return;
|
|
885
|
-
}
|
|
886
|
-
if (pointerTypeRef.current === "mouse") {
|
|
887
|
-
handleSelect();
|
|
888
|
-
}
|
|
872
|
+
if (pointerTypeRef.current === "mouse") handleSelect();
|
|
889
873
|
}),
|
|
890
874
|
onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
891
875
|
pointerTypeRef.current = event.pointerType;
|
|
@@ -1093,7 +1077,7 @@ var SelectArrow = /* @__PURE__ */ React.forwardRef(
|
|
|
1093
1077
|
const { __scopeSelect, ...arrowProps } = props;
|
|
1094
1078
|
const popperScope = usePopperScope(__scopeSelect);
|
|
1095
1079
|
const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);
|
|
1096
|
-
return contentContext.position ===
|
|
1080
|
+
return contentContext.position === "popper" ? /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;
|
|
1097
1081
|
}, "SelectArrow")
|
|
1098
1082
|
);
|
|
1099
1083
|
var BUBBLE_INPUT_NAME = "SelectBubbleInput";
|