|
| 1 | +/* CSS Variables for customization */ |
| 2 | +.container { |
| 3 | + --animation-duration: 600ms; |
| 4 | + --bar-width: 80%; |
| 5 | + --bar-max-width: 400px; |
| 6 | + --bar-height: 8px; |
| 7 | + --gap: 2px; |
| 8 | + --border-radius: 6px; |
| 9 | + --label-font-size: 0.875rem; |
| 10 | + --background-color: var(--sapBackgroundColor, #fafafa); |
| 11 | + |
| 12 | + display: flex; |
| 13 | + flex-direction: column; |
| 14 | + align-items: center; |
| 15 | + gap: 4px; |
| 16 | + width: 100%; |
| 17 | + padding-bottom: 8px; |
| 18 | + |
| 19 | + /* Initial animation */ |
| 20 | + animation: fadeInUp var(--animation-duration) ease-out; |
| 21 | +} |
| 22 | + |
| 23 | +/* Respect user's motion preferences */ |
| 24 | +@media (prefers-reduced-motion: reduce) { |
| 25 | + .container { |
| 26 | + animation: fadeIn var(--animation-duration) ease-out; |
| 27 | + } |
| 28 | + |
| 29 | + .segment { |
| 30 | + transition: none !important; |
| 31 | + } |
| 32 | + |
| 33 | + .waveOverlay { |
| 34 | + animation: none !important; |
| 35 | + } |
| 36 | + |
| 37 | + .percentage { |
| 38 | + animation: none !important; |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +/* Label styling */ |
| 43 | +.labelContainer { |
| 44 | + display: flex; |
| 45 | + gap: 6px; |
| 46 | + flex-wrap: wrap; |
| 47 | + justify-content: left; |
| 48 | + width: var(--bar-width); |
| 49 | +} |
| 50 | + |
| 51 | +.labelGroup { |
| 52 | + display: flex; |
| 53 | + align-items: center; |
| 54 | + gap: 6px; |
| 55 | +} |
| 56 | + |
| 57 | +.label, |
| 58 | +.percentage { |
| 59 | + font-size: var(--label-font-size); |
| 60 | + font-weight: 400; |
| 61 | + color: var(--sapTextColor, #374151); |
| 62 | + transition: color 0.3s ease, font-weight 0.3s ease; |
| 63 | +} |
| 64 | + |
| 65 | +.label.healthy, |
| 66 | +.percentage.healthy { |
| 67 | + color: green; |
| 68 | + font-weight: 700; |
| 69 | +} |
| 70 | + |
| 71 | +/* Bar container */ |
| 72 | +.barContainer { |
| 73 | + display: flex; |
| 74 | + gap: var(--gap); |
| 75 | + width: var(--bar-width); |
| 76 | + max-width: var(--bar-max-width); |
| 77 | + background-color: var(--background-color); |
| 78 | + border-radius: var(--border-radius); |
| 79 | + padding: 2px; |
| 80 | + overflow: hidden; |
| 81 | +} |
| 82 | + |
| 83 | +/* Individual segments */ |
| 84 | +.segment { |
| 85 | + flex: var(--segment-percentage); |
| 86 | + min-width: 10px; |
| 87 | + background-color: var(--segment-color); |
| 88 | + border-radius: var(--border-radius); |
| 89 | + height: var(--bar-height); |
| 90 | + position: relative; |
| 91 | + overflow: hidden; |
| 92 | + |
| 93 | + /* Smooth transitions for flex changes */ |
| 94 | + transition: flex var(--animation-duration) cubic-bezier(0.4, 0, 0.2, 1); |
| 95 | + |
| 96 | + /* Initial state for animation */ |
| 97 | + transform: scaleX(0); |
| 98 | + transform-origin: left; |
| 99 | + animation: growWidth var(--animation-duration) cubic-bezier(0.4, 0, 0.2, 1) forwards; |
| 100 | +} |
| 101 | + |
| 102 | +/* Stagger the segment animations */ |
| 103 | +.segment:nth-child(1) { animation-delay: 0ms; } |
| 104 | +.segment:nth-child(2) { animation-delay: 100ms; } |
| 105 | +.segment:nth-child(3) { animation-delay: 200ms; } |
| 106 | +.segment:nth-child(4) { animation-delay: 300ms; } |
| 107 | +.segment:nth-child(5) { animation-delay: 400ms; } |
| 108 | + |
| 109 | +/* Wave animation overlay */ |
| 110 | +.waveOverlay { |
| 111 | + position: absolute; |
| 112 | + top: 0; |
| 113 | + left: -80%; |
| 114 | + width: 80%; |
| 115 | + height: 100%; |
| 116 | + background: linear-gradient(90deg, |
| 117 | + transparent 0%, |
| 118 | + rgba(255, 255, 255, 0.15) 25%, |
| 119 | + rgba(255, 255, 255, 0.25) 50%, |
| 120 | + rgba(255, 255, 255, 0.15) 75%, |
| 121 | + transparent 100%); |
| 122 | + border-radius: var(--border-radius); |
| 123 | + pointer-events: none; |
| 124 | + |
| 125 | + /* Continuous wave animation */ |
| 126 | + animation: wave 3s ease-in-out infinite; |
| 127 | + animation-delay: var(--animation-duration); |
| 128 | +} |
| 129 | + |
| 130 | +/* Keyframe animations */ |
| 131 | +@keyframes fadeInUp { |
| 132 | + from { |
| 133 | + opacity: 0; |
| 134 | + transform: translateY(20px); |
| 135 | + } |
| 136 | + to { |
| 137 | + opacity: 1; |
| 138 | + transform: translateY(0); |
| 139 | + } |
| 140 | +} |
| 141 | + |
| 142 | +@keyframes fadeIn { |
| 143 | + from { |
| 144 | + opacity: 0; |
| 145 | + } |
| 146 | + to { |
| 147 | + opacity: 1; |
| 148 | + } |
| 149 | +} |
| 150 | + |
| 151 | +@keyframes growWidth { |
| 152 | + from { |
| 153 | + transform: scaleX(0); |
| 154 | + } |
| 155 | + to { |
| 156 | + transform: scaleX(1); |
| 157 | + } |
| 158 | +} |
| 159 | + |
| 160 | +@keyframes wave { |
| 161 | + 0% { |
| 162 | + left: -80%; |
| 163 | + } |
| 164 | + 50% { |
| 165 | + left: 100%; |
| 166 | + } |
| 167 | + 100% { |
| 168 | + left: -80%; |
| 169 | + } |
| 170 | +} |
| 171 | + |
| 172 | +/* Theme Support */ |
| 173 | +[data-ui5-theme-root*="dark"] .container, |
| 174 | +[data-ui5-theme*="dark"] .container { |
| 175 | + --background-color: #2a2a2a; |
| 176 | +} |
| 177 | + |
| 178 | +[data-ui5-theme-root*="dark"] .label, |
| 179 | +[data-ui5-theme*="dark"] .label, |
| 180 | +[data-ui5-theme-root*="dark"] .percentage, |
| 181 | +[data-ui5-theme*="dark"] .percentage { |
| 182 | + color: #ffffff; |
| 183 | +} |
0 commit comments