@@ -23,8 +23,18 @@ export const Tab = forwardRef((props, forwardedRef) => (
23
23
) ) as TabComponent
24
24
Tab . toString = ( ) => `.${ StyledTab . className } `
25
25
26
+ export const TabsList = styled ( List , {
27
+ display : 'flex' ,
28
+ gridArea : 'tabs' ,
29
+ borderBottom : '1px solid $grey4' ,
30
+ } )
31
+
26
32
export const TabsRoot = styled ( Root , {
27
33
$$indicatorSize : '2px' ,
34
+
35
+ display : 'grid' ,
36
+ gap : '0px 0px' ,
37
+
28
38
[ `& ${ Tab } ` ] : {
29
39
...buttonBaseStyle ,
30
40
cursor : 'pointer' ,
@@ -33,23 +43,96 @@ export const TabsRoot = styled(Root, {
33
43
border : 'none' ,
34
44
35
45
'&[data-state="active"]' : {
36
- boxShadow : 'inset 0 -$$indicatorSize 0 0 currentColor' ,
37
46
cursor : 'auto' ,
38
47
} ,
39
48
} ,
40
49
variants : {
50
+ size : {
51
+ small : {
52
+ $$indicatorSize : '1px' ,
53
+ [ `& ${ Tab } ` ] : sizeVariants . small ,
54
+ } ,
55
+ default : {
56
+ $$indicatorSize : '2px' ,
57
+ [ `& ${ Tab } ` ] : sizeVariants . default ,
58
+ } ,
59
+ large : {
60
+ $$indicatorSize : '4px' ,
61
+ [ `& ${ Tab } ` ] : sizeVariants . large ,
62
+ } ,
63
+ } ,
64
+ position : {
65
+ top : {
66
+ gridTemplateColumns : '1fr' ,
67
+ gridTemplateRows : 'auto 1fr' ,
68
+ gridTemplateAreas : `"tabs" "content"` ,
69
+ [ `& ${ Tab } ` ] : {
70
+ '&[data-state="active"]' : {
71
+ boxShadow : 'inset 0 -$$indicatorSize 0 0 currentColor' ,
72
+ } ,
73
+ } ,
74
+ [ `& ${ TabsList } ` ] : {
75
+ flexDirection : 'row' ,
76
+ } ,
77
+ } ,
78
+ bottom : {
79
+ gridTemplateColumns : '1fr' ,
80
+ gridTemplateRows : '1fr auto' ,
81
+ gridTemplateAreas : `"content" "tabs"` ,
82
+ [ `& ${ Tab } ` ] : {
83
+ '&[data-state="active"]' : {
84
+ boxShadow : 'inset 0 $$indicatorSize 0 0 currentColor' ,
85
+ } ,
86
+ } ,
87
+ [ `& ${ TabsList } ` ] : {
88
+ flexDirection : 'row' ,
89
+ } ,
90
+ } ,
91
+ left : {
92
+ gridTemplateColumns : 'auto 1fr' ,
93
+ gridTemplateRows : '1fr' ,
94
+ gridTemplateAreas : `"tabs content"` ,
95
+ [ `& ${ Tab } ` ] : {
96
+ '&[data-state="active"]' : {
97
+ boxShadow : 'inset -$$indicatorSize 0 0 0 currentColor' ,
98
+ } ,
99
+ } ,
100
+ [ `& ${ TabsList } ` ] : {
101
+ flexDirection : 'column' ,
102
+ } ,
103
+ } ,
104
+ right : {
105
+ gridTemplateColumns : '1fr auto' ,
106
+ gridTemplateRows : '1fr' ,
107
+ gridTemplateAreas : `"content tabs"` ,
108
+ [ `& ${ Tab } ` ] : {
109
+ '&[data-state="active"]' : {
110
+ boxShadow : 'inset $$indicatorSize 0 0 0 currentColor' ,
111
+ } ,
112
+ } ,
113
+ [ `& ${ TabsList } ` ] : {
114
+ flexDirection : 'column' ,
115
+ } ,
116
+ } ,
117
+ } ,
41
118
variant : {
42
119
brand : {
43
120
[ `& ${ Tab } ` ] : buttonVariants . brand ,
121
+ [ `& ${ TabsList } ` ] : {
122
+ backgroundColor : '$brand' ,
123
+ } ,
44
124
} ,
45
125
primary : {
46
126
[ `& ${ Tab } ` ] : buttonVariants . primary ,
127
+ [ `& ${ TabsList } ` ] : {
128
+ backgroundColor : '$primary' ,
129
+ } ,
47
130
} ,
48
131
secondary : {
49
132
[ `& ${ Tab } ` ] : {
50
133
...buttonVariants . secondary ,
51
134
'&[data-state="active"]' : {
52
- boxShadow : 'none' ,
135
+ boxShadow : 'none !important ' ,
53
136
backgroundColor : '$$active' ,
54
137
textDecoration : 'underline' ,
55
138
} ,
@@ -59,33 +142,15 @@ export const TabsRoot = styled(Root, {
59
142
[ `& ${ Tab } ` ] : buttonVariants . tertiary ,
60
143
} ,
61
144
} ,
62
- size : {
63
- small : {
64
- $$indicatorSize : '1px' ,
65
- [ `& ${ Tab } ` ] : sizeVariants . small ,
66
- } ,
67
- default : {
68
- $$indicatorSize : '2px' ,
69
- [ `& ${ Tab } ` ] : sizeVariants . default ,
70
- } ,
71
- large : {
72
- $$indicatorSize : '4px' ,
73
- [ `& ${ Tab } ` ] : sizeVariants . large ,
74
- } ,
75
- } ,
76
145
} ,
77
146
defaultVariants : {
78
147
variant : 'tertiary' ,
79
148
size : 'default' ,
149
+ position : 'top' ,
80
150
} ,
81
151
} )
82
152
83
- export const TabsList = styled ( List , {
84
- display : 'flex' ,
85
- borderBottom : '1px solid $grey4' ,
86
- '& *:not(:first-child)' : {
87
- borderLeft : 'none!important' ,
88
- } ,
153
+ export const TabContent = styled ( Content , {
154
+ padding : '$3' ,
155
+ gridArea : 'content' ,
89
156
} )
90
-
91
- export const TabContent = styled ( Content , { padding : '$3' } )
0 commit comments