Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 41c4713

Browse files
committed
feat(portal): move to tsx
1 parent ae1d8f6 commit 41c4713

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

packages/c-portal/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@
2929
},
3030
"dependencies": {
3131
"@chakra-ui/utils": "^2.0.3",
32-
"@chakra-ui/vue-composables": "0.1.0-alpha.9"
32+
"@chakra-ui/vue-composables": "0.1.0-alpha.10",
33+
"@chakra-ui/vue-utils": "0.1.0-alpha.10"
3334
},
3435
"devDependencies": {
3536
"vue": "^3.2.37"
3637
},
3738
"peerDependencies": {
3839
"vue": "^3.1.4"
3940
}
40-
}
41+
}

packages/c-portal/src/portal.ts renamed to packages/c-portal/src/portal.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from "vue"
1212
import { createPortalTarget, ensureTarget, unmountTarget } from "./portal.utils"
1313
import { useStackProvider } from "@chakra-ui/vue-composables"
14+
import { getValidChildren } from "@chakra-ui/vue-utils"
1415

1516
export interface CPortalProps extends Omit<TeleportProps, "to"> {
1617
/**
@@ -60,18 +61,11 @@ const CPortal = defineComponent({
6061

6162
useStackProvider()
6263

63-
return () => {
64-
return h(
65-
// @ts-ignore
66-
Teleport,
67-
{
68-
...props,
69-
...attrs,
70-
to: target.value,
71-
},
72-
slots
73-
)
74-
}
64+
return () => (
65+
<Teleport {...{ ...props, ...attrs }} to={target.value}>
66+
{() => getValidChildren(slots)}
67+
</Teleport>
68+
)
7569
},
7670
})
7771

0 commit comments

Comments
 (0)