@radix-ui/react-select 2.3.0-rc.1780413158372 → 2.3.0-rc.1780417876104
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 +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +19 -11
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +19 -11
- package/dist/index.mjs.map +2 -2
- package/package.json +14 -13
package/dist/index.d.mts
CHANGED
|
@@ -45,9 +45,19 @@ interface SelectPortalProps {
|
|
|
45
45
|
* Specify a container element to portal the content into.
|
|
46
46
|
*/
|
|
47
47
|
container?: PortalProps['container'];
|
|
48
|
+
/**
|
|
49
|
+
* Used to force mounting when more control is needed. Useful when controlling
|
|
50
|
+
* animation with React animation libraries.
|
|
51
|
+
*/
|
|
52
|
+
forceMount?: true;
|
|
48
53
|
}
|
|
49
54
|
declare const SelectPortal: React.FC<SelectPortalProps>;
|
|
50
55
|
interface SelectContentProps extends SelectContentImplProps {
|
|
56
|
+
/**
|
|
57
|
+
* Used to force mounting when more control is needed. Useful when
|
|
58
|
+
* controlling animation with React animation libraries.
|
|
59
|
+
*/
|
|
60
|
+
forceMount?: true;
|
|
51
61
|
}
|
|
52
62
|
declare const SelectContent: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
63
|
type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
|
package/dist/index.d.ts
CHANGED
|
@@ -45,9 +45,19 @@ interface SelectPortalProps {
|
|
|
45
45
|
* Specify a container element to portal the content into.
|
|
46
46
|
*/
|
|
47
47
|
container?: PortalProps['container'];
|
|
48
|
+
/**
|
|
49
|
+
* Used to force mounting when more control is needed. Useful when controlling
|
|
50
|
+
* animation with React animation libraries.
|
|
51
|
+
*/
|
|
52
|
+
forceMount?: true;
|
|
48
53
|
}
|
|
49
54
|
declare const SelectPortal: React.FC<SelectPortalProps>;
|
|
50
55
|
interface SelectContentProps extends SelectContentImplProps {
|
|
56
|
+
/**
|
|
57
|
+
* Used to force mounting when more control is needed. Useful when
|
|
58
|
+
* controlling animation with React animation libraries.
|
|
59
|
+
*/
|
|
60
|
+
forceMount?: true;
|
|
51
61
|
}
|
|
52
62
|
declare const SelectContent: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
63
|
type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
|
package/dist/index.js
CHANGED
|
@@ -83,6 +83,7 @@ var import_react_id = require("@radix-ui/react-id");
|
|
|
83
83
|
var PopperPrimitive = __toESM(require("@radix-ui/react-popper"));
|
|
84
84
|
var import_react_popper = require("@radix-ui/react-popper");
|
|
85
85
|
var import_react_portal = require("@radix-ui/react-portal");
|
|
86
|
+
var import_react_presence = require("@radix-ui/react-presence");
|
|
86
87
|
var import_react_primitive = require("@radix-ui/react-primitive");
|
|
87
88
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
88
89
|
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
|
@@ -313,29 +314,37 @@ var SelectIcon = React.forwardRef(
|
|
|
313
314
|
);
|
|
314
315
|
SelectIcon.displayName = ICON_NAME;
|
|
315
316
|
var PORTAL_NAME = "SelectPortal";
|
|
317
|
+
var [PortalProvider, usePortalContext] = createSelectContext(PORTAL_NAME, {
|
|
318
|
+
forceMount: void 0
|
|
319
|
+
});
|
|
316
320
|
var SelectPortal = (props) => {
|
|
317
|
-
|
|
321
|
+
const { __scopeSelect, forceMount, ...portalProps } = props;
|
|
322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: props.__scopeSelect, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { asChild: true, ...portalProps }) });
|
|
318
323
|
};
|
|
319
324
|
SelectPortal.displayName = PORTAL_NAME;
|
|
320
325
|
var CONTENT_NAME = "SelectContent";
|
|
321
326
|
var SelectContent = React.forwardRef(
|
|
322
327
|
(props, forwardedRef) => {
|
|
328
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeSelect);
|
|
329
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
323
330
|
const context = useSelectContext(CONTENT_NAME, props.__scopeSelect);
|
|
324
331
|
const [fragment, setFragment] = React.useState();
|
|
325
332
|
(0, import_react_use_layout_effect.useLayoutEffect)(() => {
|
|
326
333
|
setFragment(new DocumentFragment());
|
|
327
334
|
}, []);
|
|
328
|
-
|
|
329
|
-
const frag = fragment;
|
|
330
|
-
return frag ? ReactDOM.createPortal(
|
|
331
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentProvider, { scope: props.__scopeSelect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: props.__scopeSelect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: props.children }) }) }),
|
|
332
|
-
frag
|
|
333
|
-
) : null;
|
|
334
|
-
}
|
|
335
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentImpl, { ...props, ref: forwardedRef });
|
|
335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: ({ present }) => present ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentImpl, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentFragment, { ...contentProps, fragment }) });
|
|
336
336
|
}
|
|
337
337
|
);
|
|
338
338
|
SelectContent.displayName = CONTENT_NAME;
|
|
339
|
+
var SelectContentFragment = React.forwardRef((props, forwardedRef) => {
|
|
340
|
+
const { __scopeSelect, children, fragment } = props;
|
|
341
|
+
if (!fragment) return null;
|
|
342
|
+
return ReactDOM.createPortal(
|
|
343
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentProvider, { scope: __scopeSelect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: forwardedRef, children }) }) }),
|
|
344
|
+
fragment
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
SelectContentFragment.displayName = "SelectContentFragment";
|
|
339
348
|
var CONTENT_MARGIN = 10;
|
|
340
349
|
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME);
|
|
341
350
|
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
@@ -1127,9 +1136,8 @@ var SelectArrow = React.forwardRef(
|
|
|
1127
1136
|
(props, forwardedRef) => {
|
|
1128
1137
|
const { __scopeSelect, ...arrowProps } = props;
|
|
1129
1138
|
const popperScope = usePopperScope(__scopeSelect);
|
|
1130
|
-
const context = useSelectContext(ARROW_NAME, __scopeSelect);
|
|
1131
1139
|
const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);
|
|
1132
|
-
return
|
|
1140
|
+
return contentContext.position === "popper" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;
|
|
1133
1141
|
}
|
|
1134
1142
|
);
|
|
1135
1143
|
SelectArrow.displayName = ARROW_NAME;
|