Skip to content

Commit

Permalink
RSC compatibility and more SSR tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Moroz committed Jun 3, 2024
1 parent 107dd05 commit 1d07a66
Show file tree
Hide file tree
Showing 106 changed files with 624 additions and 261 deletions.
1 change: 1 addition & 0 deletions .yarn/versions/60c2f256.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ releases:

declined:
- primitives
- ssr-testing
1 change: 1 addition & 0 deletions packages/react/accordion/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createAccordionScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/alert-dialog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-alert-dialog",
"version": "1.0.6-rc.6",
"version": "1.0.6-rc.5",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/alert-dialog/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createAlertDialogScope,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/announce/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
Announce,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/avatar/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createAvatarScope,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/checkbox/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createCheckboxScope,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/collapsible/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createCollapsibleScope,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/collection/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
'use client';
export { createCollection } from './Collection';
export type { CollectionProps } from './Collection';
2 changes: 1 addition & 1 deletion packages/react/context-menu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-context-menu",
"version": "2.1.6-rc.11",
"version": "2.1.6-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/context-menu/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createContextMenuScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/dialog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-dialog",
"version": "1.0.6-rc.6",
"version": "1.0.6-rc.5",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/dialog/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createDialogScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/dismissable-layer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-dismissable-layer",
"version": "1.0.6-rc.6",
"version": "1.0.6-rc.5",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/dismissable-layer/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
DismissableLayer,
DismissableLayerBranch,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/dropdown-menu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-dropdown-menu",
"version": "2.0.7-rc.11",
"version": "2.0.7-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/dropdown-menu/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createDropdownMenuScope,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/focus-guards/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
FocusGuards,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/focus-scope/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
FocusScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-form",
"version": "0.0.4-rc.7",
"version": "0.0.4-rc.6",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/form/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createFormScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/hover-card/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-hover-card",
"version": "1.0.8-rc.9",
"version": "1.0.8-rc.8",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/hover-card/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createHoverCardScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/label/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-label",
"version": "2.0.3-rc.7",
"version": "2.0.3-rc.6",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/label/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
Label,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/menu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-menu",
"version": "2.0.7-rc.11",
"version": "2.0.7-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/menu/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createMenuScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/menubar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-menubar",
"version": "1.0.5-rc.11",
"version": "1.0.5-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/menubar/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createMenubarScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/navigation-menu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-navigation-menu",
"version": "1.1.5-rc.10",
"version": "1.1.5-rc.9",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/navigation-menu/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createNavigationMenuScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/popover/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-popover",
"version": "1.0.8-rc.9",
"version": "1.0.8-rc.8",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/popover/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createPopoverScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/popper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-popper",
"version": "1.1.4-rc.9",
"version": "1.1.4-rc.8",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/popper/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createPopperScope,
//
Expand Down
8 changes: 6 additions & 2 deletions packages/react/portal/src/Portal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import { Primitive } from '@radix-ui/react-primitive';
import { useLayoutEffect } from '@radix-ui/react-use-layout-effect';

import type * as Radix from '@radix-ui/react-primitive';

Expand All @@ -16,11 +17,14 @@ interface PortalProps extends PrimitiveDivProps {
/**
* An optional container where the portaled content should be appended.
*/
container?: HTMLElement | null;
container?: Element | null;
}

const Portal = React.forwardRef<PortalElement, PortalProps>((props, forwardedRef) => {
const { container = globalThis?.document?.body, ...portalProps } = props;
const { container: containerProp, ...portalProps } = props;
const [mounted, setMounted] = React.useState(false);
useLayoutEffect(() => setMounted(true), []);
const container = containerProp || (mounted && globalThis?.document?.body);
return container
? ReactDOM.createPortal(<Primitive.div {...portalProps} ref={forwardedRef} />, container)
: null;
Expand Down
1 change: 1 addition & 0 deletions packages/react/portal/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
Portal,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/presence/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
'use client';
export { Presence } from './Presence';
export type { PresenceProps } from './Presence';
4 changes: 2 additions & 2 deletions packages/react/primitive/src/Primitive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ const Primitive = NODES.reduce((primitive, node) => {
const { asChild, ...primitiveProps } = props;
const Comp: any = asChild ? Slot : node;

React.useEffect(() => {
if (typeof window !== 'undefined') {
(window as any)[Symbol.for('radix-ui')] = true;
}, []);
}

return <Comp {...primitiveProps} ref={forwardedRef} />;
});
Expand Down
1 change: 1 addition & 0 deletions packages/react/progress/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createProgressScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/radio-group/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-radio-group",
"version": "1.1.4-rc.11",
"version": "1.1.4-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/radio-group/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createRadioGroupScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/roving-focus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-roving-focus",
"version": "1.0.5-rc.11",
"version": "1.0.5-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/roving-focus/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createRovingFocusGroupScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/scroll-area/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-scroll-area",
"version": "1.0.6-rc.12",
"version": "1.0.6-rc.11",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/scroll-area/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createScrollAreaScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/select/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-select",
"version": "2.0.1-rc.12",
"version": "2.0.1-rc.11",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/select/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createSelectScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/slider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-slider",
"version": "1.2.0-rc.3",
"version": "1.2.0-rc.2",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/slider/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createSliderScope,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/switch/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createSwitchScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/tabs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-tabs",
"version": "1.0.5-rc.11",
"version": "1.0.5-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/tabs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createTabsScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/toast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-toast",
"version": "1.1.6-rc.6",
"version": "1.1.6-rc.5",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/toast/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createToastScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/toggle-group/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-toggle-group",
"version": "1.0.5-rc.11",
"version": "1.0.5-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/toggle-group/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createToggleGroupScope,
//
Expand Down
1 change: 1 addition & 0 deletions packages/react/toggle/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
Toggle,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/toolbar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-toolbar",
"version": "1.0.5-rc.11",
"version": "1.0.5-rc.10",
"license": "MIT",
"exports": {
".": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/toolbar/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
export {
createToolbarScope,
//
Expand Down
2 changes: 1 addition & 1 deletion packages/react/tooltip/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radix-ui/react-tooltip",
"version": "1.0.8-rc.9",
"version": "1.0.8-rc.8",
"license": "MIT",
"exports": {
".": {
Expand Down
Loading

0 comments on commit 1d07a66

Please sign in to comment.