Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[popups] Create Portal part #937

Merged
merged 41 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fcab89c
[popups] Create Portal part
atomiks Dec 2, 2024
0b04b1d
Update demos
atomiks Dec 2, 2024
bef0861
Remove container prop
atomiks Dec 2, 2024
aa86ee0
Modify Portal tests
atomiks Dec 2, 2024
79a9d79
docs:api
atomiks Dec 4, 2024
4ac160f
Fix types
atomiks Dec 5, 2024
db27eb0
docs:api
atomiks Dec 5, 2024
4176b25
Update new demos
atomiks Dec 5, 2024
c45f7e8
Use single Portal component
atomiks Dec 9, 2024
793d479
Merge branch 'master' into feat/portal
atomiks Dec 9, 2024
352c75f
docs:api
atomiks Dec 9, 2024
b28a528
Reorder types
atomiks Dec 9, 2024
d6911c2
Merge branch 'master' into feat/portal
atomiks Dec 9, 2024
7d231f2
Wrap
atomiks Dec 9, 2024
f394a5e
Types
atomiks Dec 9, 2024
197c303
Update docs
atomiks Dec 9, 2024
f0d4191
Lint
atomiks Dec 9, 2024
e1d41f0
Merge remote-tracking branch 'upstream/master' into feat/Portal
atomiks Dec 9, 2024
c1cd7ea
Add to Reference parts
atomiks Dec 9, 2024
83ea77a
Add part to tooltip
atomiks Dec 9, 2024
1463eab
Merge
atomiks Dec 9, 2024
1076689
Fix merge
atomiks Dec 9, 2024
f30637b
Fix merge
atomiks Dec 9, 2024
5c99a84
Fix comment
atomiks Dec 9, 2024
3ab3cf4
Merge
atomiks Dec 10, 2024
f111765
Foreign Portal
atomiks Dec 10, 2024
093c2ff
Wrap Select.Portal
atomiks Dec 10, 2024
890f59d
Refactor codegen
atomiks Dec 10, 2024
c225078
Document wrapped Portal
atomiks Dec 10, 2024
80c8269
use client
atomiks Dec 10, 2024
a4ec17e
import
atomiks Dec 10, 2024
6bdf352
Docgen
atomiks Dec 11, 2024
db1eadf
docs:api
atomiks Dec 11, 2024
15ed42e
Remove translations
atomiks Dec 11, 2024
40801c7
Add displayName
atomiks Dec 11, 2024
3d14156
Update all demos
atomiks Dec 11, 2024
17aaf70
Update MobileNav
atomiks Dec 11, 2024
d5bf1c0
Adjust MobileNav portal
atomiks Dec 11, 2024
5eab017
Consistent comment
atomiks Dec 11, 2024
eae72fa
docs:api
atomiks Dec 11, 2024
14d7c3b
Match language of other jsdocs
atomiks Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/data/api/alert-dialog-popup.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"finalFocus": { "type": { "name": "custom", "description": "ref" } },
"initialFocus": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
Expand Down
18 changes: 18 additions & 0 deletions docs/data/api/alert-dialog-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"props": {
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" }
},
"name": "AlertDialogPortal",
"imports": [
"import { AlertDialog } from '@base-ui-components/react/alert-dialog';\nconst AlertDialogPortal = AlertDialog.Portal;"
],
"classes": [],
"spread": true,
"themeDefaultProps": null,
"muiName": "AlertDialogPortal",
"filename": "/packages/react/src/alert-dialog/portal/AlertDialogPortal.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/react-alert-dialog/\">Alert Dialog</a></li></ul>",
"cssComponent": false
}
1 change: 0 additions & 1 deletion docs/data/api/dialog-popup.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"finalFocus": { "type": { "name": "custom", "description": "ref" } },
"initialFocus": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
Expand Down
18 changes: 18 additions & 0 deletions docs/data/api/dialog-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"props": {
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" }
},
"name": "DialogPortal",
"imports": [
"import { Dialog } from '@base-ui-components/react/dialog';\nconst DialogPortal = Dialog.Portal;"
],
"classes": [],
"spread": true,
"themeDefaultProps": null,
"muiName": "DialogPortal",
"filename": "/packages/react/src/dialog/portal/DialogPortal.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/react-dialog/\">Dialog</a></li></ul>",
"cssComponent": false
}
18 changes: 18 additions & 0 deletions docs/data/api/menu-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"props": {
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" }
},
"name": "MenuPortal",
"imports": [
"import { Menu } from '@base-ui-components/react/menu';\nconst MenuPortal = Menu.Portal;"
],
"classes": [],
"spread": true,
"themeDefaultProps": null,
"muiName": "MenuPortal",
"filename": "/packages/react/src/menu/portal/MenuPortal.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/react-menu/\">Menu</a></li></ul>",
"cssComponent": false
}
1 change: 0 additions & 1 deletion docs/data/api/menu-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"default": "5"
},
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;func" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"positionMethod": {
"type": { "name": "enum", "description": "'absolute'<br>&#124;&nbsp;'fixed'" },
Expand Down
4 changes: 0 additions & 4 deletions docs/data/api/popover-backdrop.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"container": {
"type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;func" },
"default": "false"
},
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } }
},
Expand Down
18 changes: 18 additions & 0 deletions docs/data/api/popover-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"props": {
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" }
},
"name": "PopoverPortal",
"imports": [
"import { Popover } from '@base-ui-components/react/popover';\nconst PopoverPortal = Popover.Portal;"
],
"classes": [],
"spread": true,
"themeDefaultProps": null,
"muiName": "PopoverPortal",
"filename": "/packages/react/src/popover/portal/PopoverPortal.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/react-popover/\">Popover</a></li></ul>",
"cssComponent": false
}
1 change: 0 additions & 1 deletion docs/data/api/popover-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"default": "5"
},
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;func" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"positionMethod": {
"type": { "name": "enum", "description": "'absolute'<br>&#124;&nbsp;'fixed'" },
Expand Down
1 change: 0 additions & 1 deletion docs/data/api/preview-card-backdrop.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;func" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } }
},
Expand Down
18 changes: 18 additions & 0 deletions docs/data/api/preview-card-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"props": {
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" }
},
"name": "PreviewCardPortal",
"imports": [
"import { PreviewCard } from '@base-ui-components/react/preview-card';\nconst PreviewCardPortal = PreviewCard.Portal;"
],
"classes": [],
"spread": true,
"themeDefaultProps": null,
"muiName": "PreviewCardPortal",
"filename": "/packages/react/src/preview-card/portal/PreviewCardPortal.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/react-preview-card/\">Preview Card</a></li></ul>",
"cssComponent": false
}
1 change: 0 additions & 1 deletion docs/data/api/preview-card-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"default": "5"
},
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;func" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"positionMethod": {
"type": { "name": "enum", "description": "'absolute'<br>&#124;&nbsp;'fixed'" },
Expand Down
4 changes: 0 additions & 4 deletions docs/data/api/select-backdrop.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"container": {
"type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;func" },
"default": "false"
},
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } }
},
Expand Down
18 changes: 18 additions & 0 deletions docs/data/api/select-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"props": {
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" }
},
"name": "SelectPortal",
"imports": [
"import { Select } from '@base-ui-components/react/select';\nconst SelectPortal = Select.Portal;"
],
"classes": [],
"spread": true,
"themeDefaultProps": null,
"muiName": "SelectPortal",
"filename": "/packages/react/src/select/portal/SelectPortal.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/react-select/\">Select</a></li></ul>",
"cssComponent": false
}
6 changes: 0 additions & 6 deletions docs/data/api/select-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
},
"default": "5"
},
"container": {
"type": {
"name": "union",
"description": "(props, propName) => {\n if (props[propName] == null) {\n return new Error(`Prop '${propName}' is required but wasn't specified`);\n }\n if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {\n return new Error(`Expected prop '${propName}' to be of type Element`);\n }\n return null;\n}<br>&#124;&nbsp;{ current?: (props, propName) => {\n if (props[propName] == null) {\n return null;\n }\n if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {\n return new Error(`Expected prop '${propName}' to be of type Element`);\n }\n return null;\n} }"
}
},
"positionMethod": {
"type": { "name": "enum", "description": "'absolute'<br>&#124;&nbsp;'fixed'" },
"default": "'absolute'"
Expand Down
18 changes: 18 additions & 0 deletions docs/data/api/tooltip-portal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"props": {
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;ref" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" }
},
"name": "TooltipPortal",
"imports": [
"import { Tooltip } from '@base-ui-components/react/tooltip';\nconst TooltipPortal = Tooltip.Portal;"
],
"classes": [],
"spread": true,
"themeDefaultProps": null,
"muiName": "TooltipPortal",
"filename": "/packages/react/src/tooltip/portal/TooltipPortal.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/react-tooltip/\">Tooltip</a></li></ul>",
"cssComponent": false
}
1 change: 0 additions & 1 deletion docs/data/api/tooltip-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"default": "5"
},
"container": { "type": { "name": "union", "description": "HTML element<br>&#124;&nbsp;func" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"positionMethod": {
"type": { "name": "enum", "description": "'absolute'<br>&#124;&nbsp;'fixed'" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ export default function AlertDialogIntroduction() {
Subscribe
</AlertDialog.Trigger>
<AlertDialog.Backdrop className={classes.backdrop} />
<AlertDialog.Popup className={classes.popup}>
<AlertDialog.Title className={classes.title}>Subscribe</AlertDialog.Title>
<AlertDialog.Description>
Are you sure you want to subscribe?
</AlertDialog.Description>
<div className={classes.controls}>
<AlertDialog.Close className={classes.close}>Yes</AlertDialog.Close>
<AlertDialog.Close className={classes.close}>No</AlertDialog.Close>
</div>
</AlertDialog.Popup>
<AlertDialog.Portal>
<AlertDialog.Popup className={classes.popup}>
<AlertDialog.Title className={classes.title}>Subscribe</AlertDialog.Title>
<AlertDialog.Description>
Are you sure you want to subscribe?
</AlertDialog.Description>
<div className={classes.controls}>
<AlertDialog.Close className={classes.close}>Yes</AlertDialog.Close>
<AlertDialog.Close className={classes.close}>No</AlertDialog.Close>
</div>
</AlertDialog.Popup>
</AlertDialog.Portal>
</AlertDialog.Root>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ export default function AlertDialogIntroduction() {
Subscribe
</AlertDialog.Trigger>
<AlertDialog.Backdrop className={classes.backdrop} />
<AlertDialog.Popup className={classes.popup}>
<AlertDialog.Title className={classes.title}>Subscribe</AlertDialog.Title>
<AlertDialog.Description>
Are you sure you want to subscribe?
</AlertDialog.Description>
<div className={classes.controls}>
<AlertDialog.Close className={classes.close}>Yes</AlertDialog.Close>
<AlertDialog.Close className={classes.close}>No</AlertDialog.Close>
</div>
</AlertDialog.Popup>
<AlertDialog.Portal>
<AlertDialog.Popup className={classes.popup}>
<AlertDialog.Title className={classes.title}>Subscribe</AlertDialog.Title>
<AlertDialog.Description>
Are you sure you want to subscribe?
</AlertDialog.Description>
<div className={classes.controls}>
<AlertDialog.Close className={classes.close}>Yes</AlertDialog.Close>
<AlertDialog.Close className={classes.close}>No</AlertDialog.Close>
</div>
</AlertDialog.Popup>
</AlertDialog.Portal>
</AlertDialog.Root>
);
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ export default function AlertDialogIntroduction() {
<AlertDialog.Root>
<TriggerButton>Subscribe</TriggerButton>
<Backdrop />
<Popup>
<Title>Subscribe</Title>
<Description>Are you sure you want to subscribe?</Description>
<Controls>
<CloseButton>Yes</CloseButton>
<CloseButton>No</CloseButton>
</Controls>
</Popup>
<AlertDialog.Portal>
<Popup>
<Title>Subscribe</Title>
<Description>Are you sure you want to subscribe?</Description>
<Controls>
<CloseButton>Yes</CloseButton>
<CloseButton>No</CloseButton>
</Controls>
</Popup>
</AlertDialog.Portal>
</AlertDialog.Root>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ export default function AlertDialogIntroduction() {
<AlertDialog.Root>
<TriggerButton>Subscribe</TriggerButton>
<Backdrop />
<Popup>
<Title>Subscribe</Title>
<Description>Are you sure you want to subscribe?</Description>
<Controls>
<CloseButton>Yes</CloseButton>
<CloseButton>No</CloseButton>
</Controls>
</Popup>
<AlertDialog.Portal>
<Popup>
<Title>Subscribe</Title>
<Description>Are you sure you want to subscribe?</Description>
<Controls>
<CloseButton>Yes</CloseButton>
<CloseButton>No</CloseButton>
</Controls>
</Popup>
</AlertDialog.Portal>
</AlertDialog.Root>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<AlertDialog.Root>
<TriggerButton>Subscribe</TriggerButton>
<Backdrop />
<Popup>
<Title>Subscribe</Title>
<Description>Are you sure you want to subscribe?</Description>
<Controls>
<CloseButton>Yes</CloseButton>
<CloseButton>No</CloseButton>
</Controls>
</Popup>
<AlertDialog.Portal>
<Popup>
<Title>Subscribe</Title>
<Description>Are you sure you want to subscribe?</Description>
<Controls>
<CloseButton>Yes</CloseButton>
<CloseButton>No</CloseButton>
</Controls>
</Popup>
</AlertDialog.Portal>
</AlertDialog.Root>
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ export default function UnstyledDialogIntroduction() {
<AlertDialog.Root>
<TriggerButton>Subscribe</TriggerButton>
<Backdrop />
<Popup>
<Title>Subscribe</Title>
<Description>Are you sure you want to subscribe?</Description>
<Controls>
<CloseButton>Yes</CloseButton>
<CloseButton>No</CloseButton>
</Controls>
</Popup>
<AlertDialog.Portal>
<Popup>
<Title>Subscribe</Title>
<Description>Are you sure you want to subscribe?</Description>
<Controls>
<CloseButton>Yes</CloseButton>
<CloseButton>No</CloseButton>
</Controls>
</Popup>
</AlertDialog.Portal>
</AlertDialog.Root>
);
}
Expand Down
Loading
Loading