@@ -3,7 +3,7 @@ import type { ToastProviderProps as RekaToastProviderProps } from 'reka-ui'
33
44export interface ToastProviderProps extends RekaToastProviderProps {
55 size? : ' 1' | ' 2' | ' 3'
6- position? : ' top-left' | ' top-right' | ' bottom-left' | ' bottom-right'
6+ position? : ' top-left' | ' top-right' | ' top-center ' | ' bottom-left' | ' bottom-right' | ' bottom-center '
77}
88 </script >
99
@@ -32,18 +32,21 @@ const forwarded = useForwardPropsWithout(props, ['position', 'size'])
3232const { messages } = useToastManager ()
3333
3434const yPosition = computed (() => {
35- return props .position .split (' -' )[0 ] as ' top' | ' bottom'
35+ return props .position .split (' -' )[0 ] as ' top' | ' bottom' | ' center '
3636})
3737
3838const xPosition = computed (() => {
39- return props .position .split (' -' )[1 ] as ' left' | ' right'
39+ return props .position .split (' -' )[1 ] as ' left' | ' right' | ' center '
4040})
4141
4242const swipeDirection = computed (() => {
4343 if (props .swipeDirection ) {
4444 return props .swipeDirection
4545 }
46- return xPosition .value
46+ if (xPosition .value !== ' center' ) {
47+ return xPosition .value
48+ }
49+ return yPosition .value === ' top' ? ' up' : ' down'
4750})
4851 </script >
4952
@@ -122,6 +125,9 @@ const swipeDirection = computed(() => {
122125.ui-ToastViewport :where([data-x-position = " right" ]) {
123126 right : var (--toast-x-position );
124127}
128+ .ui-ToastViewport :where([data-x-position = " center" ]) {
129+ left : calc (50% - var (--toast-width ) / 2 );
130+ }
125131.ui-ToastViewport :where([data-y-position = " top" ]) {
126132 top : var (--toast-y-position );
127133}
0 commit comments