@radix-ui/react-select 2.3.6 → 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 +26 -26
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import * as _radix_ui_react_context from '@radix-ui/react-context';
|
|
2
3
|
import { Scope } from '@radix-ui/react-context';
|
|
3
4
|
import * as React from 'react';
|
|
@@ -7,16 +8,7 @@ import * as PopperPrimitive from '@radix-ui/react-popper';
|
|
|
7
8
|
import { Portal } from '@radix-ui/react-portal';
|
|
8
9
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
readonly ItemAligned: "item-aligned";
|
|
12
|
-
readonly Popper: "popper";
|
|
13
|
-
};
|
|
14
|
-
type Position = (typeof Position)[keyof typeof Position];
|
|
15
|
-
declare const Direction: {
|
|
16
|
-
readonly LTR: "ltr";
|
|
17
|
-
readonly RTL: "rtl";
|
|
18
|
-
};
|
|
19
|
-
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
11
|
+
type Direction = 'ltr' | 'rtl';
|
|
20
12
|
type ScopedProps<P> = P & {
|
|
21
13
|
__scopeSelect?: Scope;
|
|
22
14
|
};
|
|
@@ -43,7 +35,7 @@ interface SelectProviderProps extends SelectSharedProps {
|
|
|
43
35
|
defaultValue?: string;
|
|
44
36
|
onValueChange?(value: string): void;
|
|
45
37
|
}
|
|
46
|
-
declare function SelectProvider(props: ScopedProps<SelectProviderProps>):
|
|
38
|
+
declare function SelectProvider(props: ScopedProps<SelectProviderProps>): react_jsx_runtime.JSX.Element;
|
|
47
39
|
declare const Select: React.FC<SelectProps>;
|
|
48
40
|
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
49
41
|
interface SelectTriggerProps extends PrimitiveButtonProps {
|
|
@@ -100,7 +92,7 @@ interface SelectContentImplProps extends Omit<SelectPopperPositionProps, keyof S
|
|
|
100
92
|
* Can be prevented.
|
|
101
93
|
*/
|
|
102
94
|
onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
|
|
103
|
-
position?:
|
|
95
|
+
position?: 'item-aligned' | 'popper';
|
|
104
96
|
}
|
|
105
97
|
interface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps {
|
|
106
98
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import * as _radix_ui_react_context from '@radix-ui/react-context';
|
|
2
3
|
import { Scope } from '@radix-ui/react-context';
|
|
3
4
|
import * as React from 'react';
|
|
@@ -7,16 +8,7 @@ import * as PopperPrimitive from '@radix-ui/react-popper';
|
|
|
7
8
|
import { Portal } from '@radix-ui/react-portal';
|
|
8
9
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
readonly ItemAligned: "item-aligned";
|
|
12
|
-
readonly Popper: "popper";
|
|
13
|
-
};
|
|
14
|
-
type Position = (typeof Position)[keyof typeof Position];
|
|
15
|
-
declare const Direction: {
|
|
16
|
-
readonly LTR: "ltr";
|
|
17
|
-
readonly RTL: "rtl";
|
|
18
|
-
};
|
|
19
|
-
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
11
|
+
type Direction = 'ltr' | 'rtl';
|
|
20
12
|
type ScopedProps<P> = P & {
|
|
21
13
|
__scopeSelect?: Scope;
|
|
22
14
|
};
|
|
@@ -43,7 +35,7 @@ interface SelectProviderProps extends SelectSharedProps {
|
|
|
43
35
|
defaultValue?: string;
|
|
44
36
|
onValueChange?(value: string): void;
|
|
45
37
|
}
|
|
46
|
-
declare function SelectProvider(props: ScopedProps<SelectProviderProps>):
|
|
38
|
+
declare function SelectProvider(props: ScopedProps<SelectProviderProps>): react_jsx_runtime.JSX.Element;
|
|
47
39
|
declare const Select: React.FC<SelectProps>;
|
|
48
40
|
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
49
41
|
interface SelectTriggerProps extends PrimitiveButtonProps {
|
|
@@ -100,7 +92,7 @@ interface SelectContentImplProps extends Omit<SelectPopperPositionProps, keyof S
|
|
|
100
92
|
* Can be prevented.
|
|
101
93
|
*/
|
|
102
94
|
onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
|
|
103
|
-
position?:
|
|
95
|
+
position?: 'item-aligned' | 'popper';
|
|
104
96
|
}
|
|
105
97
|
interface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps {
|
|
106
98
|
}
|
package/dist/index.js
CHANGED
|
@@ -99,14 +99,6 @@ var import_react_visually_hidden = require("@radix-ui/react-visually-hidden");
|
|
|
99
99
|
var import_aria_hidden = require("aria-hidden");
|
|
100
100
|
var import_react_remove_scroll = require("react-remove-scroll");
|
|
101
101
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
102
|
-
var Position = {
|
|
103
|
-
ItemAligned: "item-aligned",
|
|
104
|
-
Popper: "popper"
|
|
105
|
-
};
|
|
106
|
-
var Direction = {
|
|
107
|
-
LTR: "ltr",
|
|
108
|
-
RTL: "rtl"
|
|
109
|
-
};
|
|
110
102
|
var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
111
103
|
var SELECTION_KEYS = [" ", "Enter"];
|
|
112
104
|
var SELECT_NAME = "Select";
|
|
@@ -375,7 +367,7 @@ var SelectContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
375
367
|
/* @__PURE__ */ __name(function SelectContentImpl2(props, forwardedRef) {
|
|
376
368
|
const { __scopeSelect } = props;
|
|
377
369
|
const {
|
|
378
|
-
position =
|
|
370
|
+
position = "item-aligned",
|
|
379
371
|
onCloseAutoFocus,
|
|
380
372
|
onEscapeKeyDown,
|
|
381
373
|
onPointerDownOutside,
|
|
@@ -504,7 +496,7 @@ var SelectContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
504
496
|
},
|
|
505
497
|
[context.value]
|
|
506
498
|
);
|
|
507
|
-
const SelectPosition = position ===
|
|
499
|
+
const SelectPosition = position === "popper" ? SelectPopperPosition : SelectItemAlignedPosition;
|
|
508
500
|
const popperContentProps = SelectPosition === SelectPopperPosition ? {
|
|
509
501
|
side,
|
|
510
502
|
sideOffset,
|
|
@@ -620,7 +612,7 @@ var SelectItemAlignedPosition = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */
|
|
|
620
612
|
const contentRect = content.getBoundingClientRect();
|
|
621
613
|
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
622
614
|
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
623
|
-
if (context.dir !==
|
|
615
|
+
if (context.dir !== "rtl") {
|
|
624
616
|
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
625
617
|
const left = valueNodeRect.left - itemTextOffset;
|
|
626
618
|
const leftDelta = triggerRect.left - left;
|
|
@@ -905,8 +897,10 @@ var SelectItem = /* @__PURE__ */ React.forwardRef(
|
|
|
905
897
|
const textId = (0, import_react_id.useId)();
|
|
906
898
|
const pointerTypeRef = React.useRef("touch");
|
|
907
899
|
const handleSelect = /* @__PURE__ */ __name(() => {
|
|
908
|
-
|
|
909
|
-
|
|
900
|
+
if (!disabled) {
|
|
901
|
+
context.onValueChange(value);
|
|
902
|
+
context.onOpenChange(false);
|
|
903
|
+
}
|
|
910
904
|
}, "handleSelect");
|
|
911
905
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
912
906
|
SelectItemContextProvider,
|
|
@@ -942,20 +936,10 @@ var SelectItem = /* @__PURE__ */ React.forwardRef(
|
|
|
942
936
|
onFocus: (0, import_primitive.composeEventHandlers)(itemProps.onFocus, () => setIsFocused(true)),
|
|
943
937
|
onBlur: (0, import_primitive.composeEventHandlers)(itemProps.onBlur, () => setIsFocused(false)),
|
|
944
938
|
onClick: (0, import_primitive.composeEventHandlers)(itemProps.onClick, () => {
|
|
945
|
-
if (
|
|
946
|
-
return;
|
|
947
|
-
}
|
|
948
|
-
if (pointerTypeRef.current !== "mouse") {
|
|
949
|
-
handleSelect();
|
|
950
|
-
}
|
|
939
|
+
if (pointerTypeRef.current !== "mouse") handleSelect();
|
|
951
940
|
}),
|
|
952
941
|
onPointerUp: (0, import_primitive.composeEventHandlers)(itemProps.onPointerUp, () => {
|
|
953
|
-
if (
|
|
954
|
-
return;
|
|
955
|
-
}
|
|
956
|
-
if (pointerTypeRef.current === "mouse") {
|
|
957
|
-
handleSelect();
|
|
958
|
-
}
|
|
942
|
+
if (pointerTypeRef.current === "mouse") handleSelect();
|
|
959
943
|
}),
|
|
960
944
|
onPointerDown: (0, import_primitive.composeEventHandlers)(itemProps.onPointerDown, (event) => {
|
|
961
945
|
pointerTypeRef.current = event.pointerType;
|
|
@@ -1163,7 +1147,7 @@ var SelectArrow = /* @__PURE__ */ React.forwardRef(
|
|
|
1163
1147
|
const { __scopeSelect, ...arrowProps } = props;
|
|
1164
1148
|
const popperScope = usePopperScope(__scopeSelect);
|
|
1165
1149
|
const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);
|
|
1166
|
-
return contentContext.position ===
|
|
1150
|
+
return contentContext.position === "popper" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;
|
|
1167
1151
|
}, "SelectArrow")
|
|
1168
1152
|
);
|
|
1169
1153
|
var BUBBLE_INPUT_NAME = "SelectBubbleInput";
|