|
| 1 | +@import "../../themes/functions.string"; |
| 2 | +@import "../../themes/mixins"; |
| 3 | + |
| 4 | +// Segment Button: Common |
| 5 | +// -------------------------------------------------- |
| 6 | + |
| 7 | +:host { |
| 8 | + @include border-radius(var(--border-radius)); |
| 9 | + |
| 10 | + display: flex; |
| 11 | + |
| 12 | + position: relative; |
| 13 | + |
| 14 | + flex-direction: column; |
| 15 | + |
| 16 | + height: auto; |
| 17 | + |
| 18 | + background: var(--background); |
| 19 | + |
| 20 | + color: var(--color); |
| 21 | + |
| 22 | + text-decoration: none; |
| 23 | + text-overflow: ellipsis; |
| 24 | + |
| 25 | + white-space: nowrap; |
| 26 | + |
| 27 | + cursor: pointer; |
| 28 | + |
| 29 | + grid-row: 1; |
| 30 | + |
| 31 | + font-kerning: none; |
| 32 | +} |
| 33 | + |
| 34 | +.button-native { |
| 35 | + @include border-radius(0); |
| 36 | + @include margin(var(--margin-top), var(--margin-end), var(--margin-bottom), var(--margin-start)); |
| 37 | + @include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start)); |
| 38 | + @include transform(translate3d(0, 0, 0)); |
| 39 | + |
| 40 | + display: flex; |
| 41 | + position: relative; |
| 42 | + |
| 43 | + flex-direction: inherit; |
| 44 | + |
| 45 | + flex-grow: 1; |
| 46 | + align-items: center; |
| 47 | + justify-content: center; |
| 48 | + |
| 49 | + width: 100%; |
| 50 | + min-width: inherit; |
| 51 | + max-width: inherit; |
| 52 | + |
| 53 | + height: auto; |
| 54 | + min-height: inherit; |
| 55 | + max-height: inherit; |
| 56 | + |
| 57 | + transition: var(--transition); |
| 58 | + |
| 59 | + border: none; |
| 60 | + |
| 61 | + outline: none; |
| 62 | + |
| 63 | + background: transparent; |
| 64 | + |
| 65 | + contain: content; |
| 66 | + pointer-events: none; |
| 67 | + |
| 68 | + overflow: hidden; |
| 69 | + |
| 70 | + z-index: 2; |
| 71 | +} |
| 72 | + |
| 73 | +.button-inner { |
| 74 | + display: flex; |
| 75 | + position: relative; |
| 76 | + |
| 77 | + flex-flow: inherit; |
| 78 | + align-items: center; |
| 79 | + justify-content: center; |
| 80 | + |
| 81 | + width: 100%; |
| 82 | + height: 100%; |
| 83 | + |
| 84 | + z-index: 1; |
| 85 | +} |
| 86 | + |
| 87 | +// Segment Button Icon |
| 88 | +// -------------------------------------------------- |
| 89 | + |
| 90 | +::slotted(ion-icon) { |
| 91 | + flex-shrink: 0; |
| 92 | + |
| 93 | + order: -1; |
| 94 | + |
| 95 | + pointer-events: none; |
| 96 | +} |
| 97 | + |
| 98 | +// Segment Button Label |
| 99 | +// -------------------------------------------------- |
| 100 | + |
| 101 | +::slotted(ion-label) { |
| 102 | + display: block; |
| 103 | + |
| 104 | + align-self: center; |
| 105 | + |
| 106 | + max-width: 100%; |
| 107 | + |
| 108 | + text-overflow: ellipsis; |
| 109 | + |
| 110 | + white-space: nowrap; |
| 111 | + |
| 112 | + overflow: hidden; |
| 113 | + |
| 114 | + box-sizing: border-box; |
| 115 | + |
| 116 | + pointer-events: none; |
| 117 | +} |
| 118 | + |
| 119 | +// Segment Button Layout |
| 120 | +// -------------------------------------------------- |
| 121 | + |
| 122 | +// Layout: icon top |
| 123 | +:host(.segment-button-layout-icon-top) .button-native { |
| 124 | + flex-direction: column; |
| 125 | +} |
| 126 | + |
| 127 | +// Layout: icon start |
| 128 | +:host(.segment-button-layout-icon-start) .button-native { |
| 129 | + flex-direction: row; |
| 130 | +} |
| 131 | + |
| 132 | +// Layout: icon end |
| 133 | +:host(.segment-button-layout-icon-end) .button-native { |
| 134 | + flex-direction: row-reverse; |
| 135 | +} |
| 136 | + |
| 137 | +// Layout: icon bottom |
| 138 | +:host(.segment-button-layout-icon-bottom) .button-native { |
| 139 | + flex-direction: column-reverse; |
| 140 | +} |
| 141 | + |
| 142 | +// Layout: icon hide |
| 143 | +:host(.segment-button-layout-icon-hide) ::slotted(ion-icon) { |
| 144 | + display: none; |
| 145 | +} |
| 146 | + |
| 147 | +// Layout: label hide |
| 148 | +:host(.segment-button-layout-label-hide) ::slotted(ion-label) { |
| 149 | + display: none; |
| 150 | +} |
| 151 | + |
| 152 | +// Segment Button: Indicator |
| 153 | +// -------------------------------------------------- |
| 154 | + |
| 155 | +.segment-button-indicator { |
| 156 | + // @include transform-origin(left); |
| 157 | + |
| 158 | + position: absolute; |
| 159 | + |
| 160 | + opacity: 0; |
| 161 | + |
| 162 | + box-sizing: border-box; |
| 163 | + |
| 164 | + will-change: transform, opacity; |
| 165 | + |
| 166 | + pointer-events: none; |
| 167 | +} |
| 168 | + |
| 169 | +.segment-button-indicator-background { |
| 170 | + width: 100%; |
| 171 | + height: var(--indicator-height); |
| 172 | + |
| 173 | + transform: var(--indicator-transform); |
| 174 | + |
| 175 | + box-shadow: var(--indicator-box-shadow); |
| 176 | + |
| 177 | + pointer-events: none; |
| 178 | +} |
| 179 | + |
| 180 | +.segment-button-indicator-animated { |
| 181 | + transition: var(--indicator-transition); |
| 182 | +} |
| 183 | + |
| 184 | +:host(.segment-button-checked) .segment-button-indicator { |
| 185 | + opacity: 1; |
| 186 | +} |
| 187 | + |
| 188 | +// Segment: Reduced Motion |
| 189 | +// -------------------------------------------------- |
| 190 | + |
| 191 | +@media (prefers-reduced-motion: reduce) { |
| 192 | + .segment-button-indicator-background { |
| 193 | + transform: none; |
| 194 | + } |
| 195 | + |
| 196 | + .segment-button-indicator-animated { |
| 197 | + transition: none; |
| 198 | + } |
| 199 | +} |
0 commit comments