|
| 1 | +go-tablist { |
| 2 | + /** |
| 3 | + @prop --tab-padding: |
| 4 | + Padding for tabs |
| 5 | + - default: 0.75rem 1.25rem |
| 6 | + */ |
| 7 | + --tab-padding: 0.5rem 1rem; |
| 8 | + /** |
| 9 | + @prop --tab-bg-color: |
| 10 | + Background color for tabs |
| 11 | + - default: transparent |
| 12 | + */ |
| 13 | + --tab-bg-color: transparent; |
| 14 | + /** |
| 15 | + @prop --tab-hover-bg-color: |
| 16 | + Background color for tabs on hover |
| 17 | + - default: var(--go-color-neutral-200) |
| 18 | + */ |
| 19 | + --tab-hover-bg-color: var(--go-color-neutral-200); |
| 20 | + |
| 21 | + /** |
| 22 | + @prop --tab-text-color: |
| 23 | + Text color for tabs |
| 24 | + - default: var(--go-color-neutral-800) |
| 25 | + */ |
| 26 | + --tab-text-color: var(--go-color-neutral-800); |
| 27 | + |
| 28 | + /** |
| 29 | + @prop --tab-hover-text-color: |
| 30 | + Text color for tabs on hover |
| 31 | + - default: var(--go-color-neutral-900) |
| 32 | + */ |
| 33 | + --tab-hover-text-color: var(--go-color-neutral-900); |
| 34 | + |
| 35 | + /** |
| 36 | + @prop --tab-focus-color: |
| 37 | + Focus outline color for tabs |
| 38 | + - default: var(--go-color-primary-600) |
| 39 | + */ |
| 40 | + --tab-focus-color: var(--go-color-primary-600); |
| 41 | + /** |
| 42 | + @prop --tab-active-color: |
| 43 | + Text color for active tab |
| 44 | + - default: var(--go-color-primary-800) |
| 45 | + */ |
| 46 | + --tab-active-color: var(--go-color-primary-600); |
| 47 | + /** |
| 48 | + @prop --tab-active-bg-color: |
| 49 | + Background color for active tab |
| 50 | + - default: transparent |
| 51 | + */ |
| 52 | + --tab-active-bg-color: transparent; |
| 53 | + /** |
| 54 | + @prop --tab-border-width: |
| 55 | + Border width for tabs |
| 56 | + - default: 0.2em |
| 57 | + */ |
| 58 | + --tab-border-width: 0.2em; |
| 59 | + /** |
| 60 | + @prop --tab-active-indicator-color: |
| 61 | + Color of the active tab indicator |
| 62 | + - default: var(--tab-active-color) |
| 63 | + */ |
| 64 | + --tab-active-indicator-color: var(--tab-active-color); |
| 65 | + /** |
| 66 | + @prop --tabs-active-indicator-width: |
| 67 | + Width of the active tab indicator |
| 68 | + - default: 0 |
| 69 | + */ |
| 70 | + --tabs-active-indicator-width: 0; |
| 71 | + |
| 72 | + /** |
| 73 | + @prop --tabs-active-indicator-height: |
| 74 | + Height of the active tab indicator |
| 75 | + - default: 0.2em |
| 76 | + */ |
| 77 | + --tabs-active-indicator-height: 0.2em; |
| 78 | + /** |
| 79 | + @prop --tabs-active-indicator-color: |
| 80 | + Color of the active tab indicator |
| 81 | + - default: var(--tab-active-color) |
| 82 | + */ |
| 83 | + --tabs-active-indicator-color: var(--tab-active-color); |
| 84 | + |
| 85 | + /** |
| 86 | + @prop --tab-icon-gap: |
| 87 | + Gap between tab icons |
| 88 | + - default: 0.5rem |
| 89 | + */ |
| 90 | + --tab-icon-gap: 0.5rem; |
| 91 | + |
| 92 | + [role='tablist'] { |
| 93 | + overflow: auto; |
| 94 | + display: flex; |
| 95 | + flex-wrap: nowrap; |
| 96 | + width: 100%; |
| 97 | + position: relative; |
| 98 | + } |
| 99 | + [role='tab'] { |
| 100 | + display: flex; |
| 101 | + flex-direction: column; |
| 102 | + align-items: center; |
| 103 | + justify-content: center; |
| 104 | + gap: var(--tab-icon-gap); |
| 105 | + @include tablet() { |
| 106 | + flex-direction: row; |
| 107 | + } |
| 108 | + |
| 109 | + padding: var(--tab-padding); |
| 110 | + border: var(--tab-border-width) solid transparent; |
| 111 | + white-space: nowrap; |
| 112 | + background: var(--tab-bg-color); |
| 113 | + color: var(--tab-text-color); |
| 114 | + font-weight: 500; |
| 115 | + @include transition(background-color, color); |
| 116 | + .go-tab-icon-slot { |
| 117 | + svg, |
| 118 | + img { |
| 119 | + display: block; |
| 120 | + } |
| 121 | + } |
| 122 | + .go-tab-icon-active { |
| 123 | + display: none; |
| 124 | + } |
| 125 | + &:hover, |
| 126 | + &:focus { |
| 127 | + color: var(--tab-hover-text-color); |
| 128 | + background: var(--tab-hover-bg-color); |
| 129 | + } |
| 130 | + &:not(.active) { |
| 131 | + cursor: pointer; |
| 132 | + } |
| 133 | + &[aria-selected='true'] { |
| 134 | + background: var(--tab-active-bg-color); |
| 135 | + color: var(--tab-active-color); |
| 136 | + text-decoration: none; |
| 137 | + &.has-active-icon { |
| 138 | + .go-tab-icon { |
| 139 | + display: none; |
| 140 | + } |
| 141 | + } |
| 142 | + .go-tab-icon-active { |
| 143 | + display: block; |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | + |
| 148 | + .tabs-active-indicator-track { |
| 149 | + position: absolute; |
| 150 | + width: 100%; |
| 151 | + bottom: 0; |
| 152 | + left: 0; |
| 153 | + right: 0; |
| 154 | + .tabs-active-indicator { |
| 155 | + @include transition(transform, width, height); |
| 156 | + |
| 157 | + transform: translateX(var(--tabs-active-indicator-left)); |
| 158 | + width: var(--tabs-active-indicator-width); |
| 159 | + height: var(--tabs-active-indicator-height); |
| 160 | + border-radius: var(--radius-round); |
| 161 | + background: var(--tabs-active-indicator-color); |
| 162 | + } |
| 163 | + } |
| 164 | + &.vertical { |
| 165 | + flex-direction: row; |
| 166 | + [role='tablist'] { |
| 167 | + flex-direction: column; |
| 168 | + .tabs-active-indicator-track { |
| 169 | + width: auto; |
| 170 | + top: 0; |
| 171 | + left: auto; |
| 172 | + .tabs-active-indicator { |
| 173 | + --tabs-active-indicator-width: 4px; |
| 174 | + |
| 175 | + transform: translateY(var(--tabs-active-indicator-top)); |
| 176 | + } |
| 177 | + } |
| 178 | + } |
| 179 | + [role='tab'] { |
| 180 | + text-align: start; |
| 181 | + white-space: normal; |
| 182 | + &:focus-visible { |
| 183 | + border-top-color: transparent; |
| 184 | + border-left-color: var(--tab-focus-color); |
| 185 | + } |
| 186 | + } |
| 187 | + } |
| 188 | + |
| 189 | + &.fill { |
| 190 | + [role='tablist'] { |
| 191 | + width: 100%; |
| 192 | + } |
| 193 | + [role='tab'] { |
| 194 | + flex: 1; |
| 195 | + } |
| 196 | + } |
| 197 | +} |
| 198 | + |
| 199 | +@include theme-dark() { |
| 200 | + go-tablist { |
| 201 | + --tab-text-color: var(--go-color-neutral-700); |
| 202 | + --tab-hover-text-color: var(--go-color-neutral-900); |
| 203 | + --tab-active-color: var(--go-color-primary-800); |
| 204 | + } |
| 205 | +} |
0 commit comments