File tree Expand file tree Collapse file tree 4 files changed +13
-31
lines changed
packages/components/src/components/ToastProvider/components Expand file tree Collapse file tree 4 files changed +13
-31
lines changed Original file line number Diff line number Diff line change 11.base {
22 --toast-inline-size : 360px ;
3+ --toast-transition-z-index : ;
34 --toast-transition-duration : 300ms ;
4- --toast-outline-color : transparent;
55 --toast-transition-block-size : 0 ;
6- --toast-outline-width : var (--kbq-size-3xs );
76
87 outline : none;
98 position : relative;
109 border-radius : var (--kbq-size-s );
1110 inline-size : var (--toast-inline-size );
11+ z-index : var (--toast-transition-z-index );
1212 transition :
1313 margin-block-end var (--kbq-transition-slow ),
1414 margin-block-start var (--kbq-transition-slow ),
1515 block-size var (--kbq-transition-slow );
1616 will-change : margin-bottom, margin-top, block-size;
1717 transition-duration : var (--toast-transition-duration );
18-
19- & : focus-visible {
20- --toast-outline-color : var (--kbq-states-line-focus-theme );
21- }
22-
23- & ::after {
24- inset : 0 ;
25- content : '' ;
26- position : absolute;
27- pointer-events : none;
28- border-radius : inherit;
29- z-index : var (--kbq-layer-absolute );
30- transition : outline-color var (--kbq-transition-default );
31- outline-offset : calc (-1 * var (--toast-outline-width ) / 2 );
32- outline : var (--toast-outline-width ) solid var (--toast-outline-color );
33- }
3418}
3519
3620.base [data-placement ^= 'bottom' ] {
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ export function Toast({
7878 ) ;
7979
8080 return (
81- < div { ...toastProps } >
81+ < div { ...toastProps } tabIndex = { undefined } >
8282 < div className = { s . wrapper } >
8383 { ! hideCloseButton && (
8484 < IconButton { ...closeButtonProps } >
Original file line number Diff line number Diff line change 11.base {
22 display : flex;
33 position : fixed;
4+ flex-direction : column;
45 z-index : var (--kbq-layer-toast );
56 border-radius : var (--kbq-size-s );
67
910 }
1011}
1112
12- .ascending {
13- flex-direction : column-reverse;
14- }
15-
16- .descending {
17- flex-direction : column;
18- }
19-
2013.base : where ([data-placement ^= 'top' ].ascending ) > * {
2114 margin-block-end : var (--kbq-size-s );
2215
23- & : first -child {
16+ & : last -child {
2417 margin-block-end : 0 ;
2518 }
2619}
2720
2821.base : where ([data-placement ^= 'bottom' ].ascending ) > * {
2922 margin-block-start : var (--kbq-size-s );
3023
31- & : last -child {
24+ & : first -child {
3225 margin-block-start : 0 ;
3326 }
3427}
Original file line number Diff line number Diff line change @@ -70,10 +70,15 @@ export function ToastRegionRender(
7070 props
7171 ) ;
7272
73+ const visibleToasts =
74+ stackDirection === 'ascending'
75+ ? [ ...state . visibleToasts ] . reverse ( )
76+ : state . visibleToasts ;
77+
7378 return createPortal (
7479 < div { ...regionProps } >
7580 < TransitionGroup component = { null } appear enter >
76- { state . visibleToasts . map ( ( toast , idx ) => {
81+ { visibleToasts . map ( ( toast , idx ) => {
7782 const nodeRef = getNodeRef ( toast . key ) ;
7883
7984 return (
@@ -95,7 +100,7 @@ export function ToastRegionRender(
95100 data-placement = { placement }
96101 style = {
97102 {
98- zIndex :
103+ '--toast-transition-z-index' :
99104 stackDirection === 'ascending'
100105 ? - ( idx + 1 )
101106 : - ( total - ( idx + 1 ) ) ,
You can’t perform that action at this time.
0 commit comments