Skip to content

Commit

Permalink
[popups] Require Portal part (#1222)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks authored Jan 7, 2025
1 parent 2f1205a commit 1908c94
Show file tree
Hide file tree
Showing 124 changed files with 2,677 additions and 1,886 deletions.
5 changes: 0 additions & 5 deletions docs/reference/generated/alert-dialog-backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the element in the DOM while the alert dialog is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
5 changes: 0 additions & 5 deletions docs/reference/generated/alert-dialog-popup.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the element in the DOM while the alert dialog is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
17 changes: 17 additions & 0 deletions docs/reference/generated/alert-dialog-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "AlertDialogPortal",
"description": "A portal element that moves the popup to a different part of the DOM.\nBy default, the portal element is appended to `<body>`.",
"props": {
"container": {
"type": "React.Ref | HTMLElement | null",
"description": "A parent element to render the portal element into."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the portal mounted in the DOM while the popup is hidden."
}
},
"dataAttributes": {},
"cssVariables": {}
}
5 changes: 0 additions & 5 deletions docs/reference/generated/dialog-backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the dialog is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
5 changes: 0 additions & 5 deletions docs/reference/generated/dialog-popup.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the dialog is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
17 changes: 17 additions & 0 deletions docs/reference/generated/dialog-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "DialogPortal",
"description": "A portal element that moves the popup to a different part of the DOM.\nBy default, the portal element is appended to `<body>`.",
"props": {
"container": {
"type": "React.Ref | HTMLElement | null",
"description": "A parent element to render the portal element into."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the portal mounted in the DOM while the popup is hidden."
}
},
"dataAttributes": {},
"cssVariables": {}
}
5 changes: 0 additions & 5 deletions docs/reference/generated/menu-backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the menu is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Portal",
"name": "MenuPortal",
"description": "A portal element that moves the popup to a different part of the DOM.\nBy default, the portal element is appended to `<body>`.",
"props": {
"container": {
"type": "React.Ref | HTMLElement | null",
"description": "A parent element to render the portal into."
"description": "A parent element to render the portal element into."
},
"keepMounted": {
"type": "boolean",
Expand Down
5 changes: 0 additions & 5 deletions docs/reference/generated/menu-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the menu is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
5 changes: 0 additions & 5 deletions docs/reference/generated/popover-backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the popover is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
17 changes: 17 additions & 0 deletions docs/reference/generated/popover-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "PopoverPortal",
"description": "A portal element that moves the popup to a different part of the DOM.\nBy default, the portal element is appended to `<body>`.",
"props": {
"container": {
"type": "React.Ref | HTMLElement | null",
"description": "A parent element to render the portal element into."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the portal mounted in the DOM while the popup is hidden."
}
},
"dataAttributes": {},
"cssVariables": {}
}
5 changes: 0 additions & 5 deletions docs/reference/generated/popover-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the popover is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
5 changes: 0 additions & 5 deletions docs/reference/generated/preview-card-backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the preview card is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
17 changes: 17 additions & 0 deletions docs/reference/generated/preview-card-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "PreviewCardPortal",
"description": "A portal element that moves the popup to a different part of the DOM.\nBy default, the portal element is appended to `<body>`.",
"props": {
"container": {
"type": "React.Ref | HTMLElement | null",
"description": "A parent element to render the portal element into."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the portal mounted in the DOM while the popup is hidden."
}
},
"dataAttributes": {},
"cssVariables": {}
}
5 changes: 0 additions & 5 deletions docs/reference/generated/preview-card-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the preview card is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
5 changes: 0 additions & 5 deletions docs/reference/generated/select-backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the select menu is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/select-portal.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"props": {
"container": {
"type": "React.Ref | HTMLElement | null",
"description": "A parent element to render the portal into."
"description": "A parent element to render the portal element into."
}
},
"dataAttributes": {},
Expand Down
17 changes: 17 additions & 0 deletions docs/reference/generated/tooltip-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "TooltipPortal",
"description": "A portal element that moves the popup to a different part of the DOM.\nBy default, the portal element is appended to `<body>`.",
"props": {
"container": {
"type": "React.Ref | HTMLElement | null",
"description": "A parent element to render the portal element into."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the portal mounted in the DOM while the popup is hidden."
}
},
"dataAttributes": {},
"cssVariables": {}
}
5 changes: 0 additions & 5 deletions docs/reference/generated/tooltip-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@
"type": "string | (state) => string",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
"type": "boolean",
"default": "false",
"description": "Whether to keep the HTML element in the DOM while the tooltip is hidden."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Expand Down
1 change: 1 addition & 0 deletions docs/src/app/(private)/experiments/anchor-positioning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default function AnchorPositioning() {
arrowPadding,
trackAnchor,
mounted: true,
keepMounted: true,
});

const handleInitialScroll = React.useCallback((node: HTMLDivElement | null) => {
Expand Down
16 changes: 10 additions & 6 deletions docs/src/app/(private)/experiments/anchor-side-animations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ export default function AnchorSideAnimations() {
</p>
<Popover.Root>
<Popover.Trigger>transition</Popover.Trigger>
<Popover.Positioner side="top">
<Popover.Popup className={classes.Popup} data-type="transition" />
</Popover.Positioner>
<Popover.Portal>
<Popover.Positioner side="top">
<Popover.Popup className={classes.Popup} data-type="transition" />
</Popover.Positioner>
</Popover.Portal>
</Popover.Root>

<Popover.Root>
<Popover.Trigger>animation</Popover.Trigger>
<Popover.Positioner side="top">
<Popover.Popup className={classes.Popup} data-type="animation" />
</Popover.Positioner>
<Popover.Portal>
<Popover.Positioner side="top">
<Popover.Popup className={classes.Popup} data-type="animation" />
</Popover.Positioner>
</Popover.Portal>
</Popover.Root>
</div>
);
Expand Down
Loading

0 comments on commit 1908c94

Please sign in to comment.