@clerk/shared 4.0.0-snapshot.v20251215203425 → 4.0.0-snapshot.v20251215212157
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/runtime/error-FQfTKcEF.d.ts.map +1 -1
- package/dist/runtime/globs.d.mts.map +1 -1
- package/dist/runtime/index-TCL_gZUn.d.ts.map +1 -1
- package/dist/runtime/loadClerkJsScript.js +2 -2
- package/dist/runtime/loadClerkJsScript.mjs +2 -2
- package/dist/runtime/poller.d.mts.map +1 -1
- package/dist/runtime/react/index.d.mts +10 -7
- package/dist/runtime/react/index.d.mts.map +1 -1
- package/dist/runtime/react/index.d.ts +10 -7
- package/dist/runtime/react/index.d.ts.map +1 -1
- package/dist/runtime/react/index.js +11 -51
- package/dist/runtime/react/index.js.map +1 -1
- package/dist/runtime/react/index.mjs +11 -51
- package/dist/runtime/react/index.mjs.map +1 -1
- package/dist/runtime/{versionSelector-Dk9qBo_s.js → versionSelector-Cya5GkG0.js} +2 -2
- package/dist/runtime/{versionSelector-Dk9qBo_s.js.map → versionSelector-Cya5GkG0.js.map} +1 -1
- package/dist/runtime/{versionSelector-CxJwijym.mjs → versionSelector-DQ_xKgnp.mjs} +2 -2
- package/dist/runtime/{versionSelector-CxJwijym.mjs.map → versionSelector-DQ_xKgnp.mjs.map} +1 -1
- package/dist/runtime/versionSelector.js +1 -1
- package/dist/runtime/versionSelector.mjs +1 -1
- package/dist/types/index.d.mts.map +1 -1
- package/package.json +1 -1
|
@@ -2497,47 +2497,16 @@ const usePaymentElement = () => {
|
|
|
2497
2497
|
};
|
|
2498
2498
|
};
|
|
2499
2499
|
|
|
2500
|
-
//#endregion
|
|
2501
|
-
//#region src/react/portal-root-manager.ts
|
|
2502
|
-
/**
|
|
2503
|
-
* PortalRootManager manages a stack of portal root containers.
|
|
2504
|
-
* This allows PortalProvider to work across separate React trees
|
|
2505
|
-
* (e.g., when Clerk modals are rendered in a different tree via Components.tsx).
|
|
2506
|
-
*/
|
|
2507
|
-
var PortalRootManager = class {
|
|
2508
|
-
stack = [];
|
|
2509
|
-
/**
|
|
2510
|
-
* Push a new portal root getter onto the stack.
|
|
2511
|
-
* @param getContainer Function that returns the container element
|
|
2512
|
-
*/
|
|
2513
|
-
push(getContainer) {
|
|
2514
|
-
this.stack.push(getContainer);
|
|
2515
|
-
}
|
|
2516
|
-
/**
|
|
2517
|
-
* Pop the most recent portal root from the stack.
|
|
2518
|
-
*/
|
|
2519
|
-
pop() {
|
|
2520
|
-
this.stack.pop();
|
|
2521
|
-
}
|
|
2522
|
-
/**
|
|
2523
|
-
* Get the current (topmost) portal root container.
|
|
2524
|
-
* @returns The container element or null if no provider is active
|
|
2525
|
-
*/
|
|
2526
|
-
getCurrent() {
|
|
2527
|
-
if (this.stack.length === 0) return null;
|
|
2528
|
-
const getContainer = this.stack[this.stack.length - 1];
|
|
2529
|
-
return getContainer();
|
|
2530
|
-
}
|
|
2531
|
-
};
|
|
2532
|
-
const portalRootManager = new PortalRootManager();
|
|
2533
|
-
|
|
2534
2500
|
//#endregion
|
|
2535
2501
|
//#region src/react/PortalProvider.tsx
|
|
2536
2502
|
const [PortalContext, , usePortalContextWithoutGuarantee] = createContextAndHook("PortalProvider");
|
|
2537
2503
|
/**
|
|
2538
|
-
*
|
|
2504
|
+
* UNSAFE_PortalProvider allows you to specify a custom container for Clerk floating UI elements
|
|
2539
2505
|
* (popovers, modals, tooltips, etc.) that use portals.
|
|
2540
2506
|
*
|
|
2507
|
+
* Only components within this provider will be affected. Components outside the provider
|
|
2508
|
+
* will continue to use the default document.body for portals.
|
|
2509
|
+
*
|
|
2541
2510
|
* This is particularly useful when using Clerk components inside external UI libraries
|
|
2542
2511
|
* like Radix Dialog or React Aria Components, where portaled elements need to render
|
|
2543
2512
|
* within the dialog's container to remain interactable.
|
|
@@ -2548,38 +2517,29 @@ const [PortalContext, , usePortalContextWithoutGuarantee] = createContextAndHook
|
|
|
2548
2517
|
* const containerRef = useRef(null);
|
|
2549
2518
|
* return (
|
|
2550
2519
|
* <RadixDialog ref={containerRef}>
|
|
2551
|
-
* <
|
|
2520
|
+
* <UNSAFE_PortalProvider getContainer={() => containerRef.current}>
|
|
2552
2521
|
* <UserButton />
|
|
2553
|
-
* </
|
|
2522
|
+
* </UNSAFE_PortalProvider>
|
|
2554
2523
|
* </RadixDialog>
|
|
2555
2524
|
* );
|
|
2556
2525
|
* }
|
|
2557
2526
|
* ```
|
|
2558
2527
|
*/
|
|
2559
|
-
const
|
|
2560
|
-
const getContainerRef = useRef(getContainer);
|
|
2561
|
-
getContainerRef.current = getContainer;
|
|
2562
|
-
useEffect(() => {
|
|
2563
|
-
const getContainerWrapper = () => getContainerRef.current();
|
|
2564
|
-
portalRootManager.push(getContainerWrapper);
|
|
2565
|
-
return () => {
|
|
2566
|
-
portalRootManager.pop();
|
|
2567
|
-
};
|
|
2568
|
-
}, []);
|
|
2528
|
+
const UNSAFE_PortalProvider = ({ children, getContainer }) => {
|
|
2569
2529
|
const contextValue = React.useMemo(() => ({ value: { getContainer } }), [getContainer]);
|
|
2570
2530
|
return /* @__PURE__ */ React.createElement(PortalContext.Provider, { value: contextValue }, children);
|
|
2571
2531
|
};
|
|
2572
2532
|
/**
|
|
2573
2533
|
* Hook to get the current portal root container.
|
|
2574
|
-
*
|
|
2575
|
-
*
|
|
2534
|
+
* Returns the getContainer function from context if inside a PortalProvider,
|
|
2535
|
+
* otherwise returns a function that returns null (default behavior).
|
|
2576
2536
|
*/
|
|
2577
2537
|
const usePortalRoot = () => {
|
|
2578
2538
|
const contextValue = usePortalContextWithoutGuarantee();
|
|
2579
2539
|
if (contextValue && "getContainer" in contextValue && contextValue.getContainer) return contextValue.getContainer;
|
|
2580
|
-
return
|
|
2540
|
+
return () => null;
|
|
2581
2541
|
};
|
|
2582
2542
|
|
|
2583
2543
|
//#endregion
|
|
2584
|
-
export { ClerkInstanceContext, ClientContext, OptionsContext, OrganizationProvider,
|
|
2544
|
+
export { ClerkInstanceContext, ClientContext, OptionsContext, OrganizationProvider, SessionContext, UNSAFE_PortalProvider, UserContext, __experimental_CheckoutProvider, PaymentElement as __experimental_PaymentElement, PaymentElementProvider as __experimental_PaymentElementProvider, useAPIKeys as __experimental_useAPIKeys, useCheckout as __experimental_useCheckout, usePaymentAttempts as __experimental_usePaymentAttempts, usePaymentElement as __experimental_usePaymentElement, usePaymentMethods as __experimental_usePaymentMethods, usePlans as __experimental_usePlans, useStatements as __experimental_useStatements, useSubscription as __experimental_useSubscription, __internal_usePaymentAttemptQuery, usePlanDetailsQuery as __internal_usePlanDetailsQuery, __internal_useStatementQuery, assertContextExists, createContextAndHook, isDeeplyEqual, useAssertWrappedByClerkProvider, useAttemptToEnableOrganizations, useClerk, useClerkInstanceContext, useClientContext, useDeepEqualMemo, useOptionsContext, useOrganization, useOrganizationContext, useOrganizationList, usePortalRoot, useReverification, useSafeLayoutEffect, useSession, useSessionContext, useSessionList, useUser, useUserContext };
|
|
2585
2545
|
//# sourceMappingURL=index.mjs.map
|