_ElevationProfile.scss 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. @mixin elevationProfile() {
  2. $width: 550px;
  3. $chart-height: 180px;
  4. $header-height: 30px;
  5. $header-icon-height: 16px;
  6. $header-button-width: 34px;
  7. $loading-spinner-size: 30px;
  8. $loading-spinner-size-small: $header-icon-height;
  9. $actions-spacing-h: $side-spacing--half;
  10. $actions-spacing-v: $cap-spacing--half;
  11. $statistics-font-size: $font-size--tiny;
  12. $statistics-slope-values-spacing: $side-spacing--half;
  13. $popover-padding: $cap-spacing $side-spacing;
  14. $popover-border: 1px solid $border-color;
  15. $popover-background-color: $background-color;
  16. $legend-font-size: $font-size--small;
  17. $legend-label-spacing: $side-spacing--plus-half;
  18. $checkbox-size: 14px;
  19. $checkbox-border-size: 1px;
  20. $checkbox-icon-size: 10px;
  21. $color-indicator-width: 8px;
  22. $color-indicator-height: 8px;
  23. $color-indicator-spacing: $side-spacing--half;
  24. //----------------------------------------------------------------------------
  25. // Widget
  26. //----------------------------------------------------------------------------
  27. .esri-elevation-profile {
  28. position: relative;
  29. padding: $cap-spacing $side-spacing;
  30. &.esri-component.esri-widget--panel {
  31. width: $width;
  32. max-width: 100%; // Don't overflow parent container, especially on mobile
  33. }
  34. &__header {
  35. display: flex;
  36. flex-direction: row;
  37. height: $header-height;
  38. align-items: center;
  39. justify-content: flex-end;
  40. button {
  41. @extend .esri-button;
  42. @extend .esri-button--tertiary;
  43. width: $header-button-width;
  44. flex-shrink: 0;
  45. flex-grow: 0;
  46. z-index: 1; // Above chart.
  47. &:focus:not(:focus-visible) {
  48. outline: none;
  49. border: none;
  50. }
  51. }
  52. }
  53. &__footer {
  54. display: flex;
  55. flex-wrap: wrap;
  56. align-items: center;
  57. justify-content: flex-end;
  58. margin-top: $cap-spacing;
  59. }
  60. &__action-button {
  61. width: auto;
  62. margin-inline-start: $actions-spacing-h;
  63. &:focus:not(:focus-visible) {
  64. outline: none;
  65. border: none;
  66. }
  67. }
  68. &__main-container {
  69. position: relative;
  70. width: 100%;
  71. height: $chart-height;
  72. margin-top: -$header-height; // Compensate for chart padding (used to show spinner)
  73. }
  74. &__chart-container {
  75. position: relative;
  76. width: 100%;
  77. height: 100%;
  78. padding-top: $header-icon-height / 2; // Align top of the chart with icon of header buttons
  79. }
  80. &__prompt-container {
  81. display: flex;
  82. width: 100%;
  83. height: 100%;
  84. margin-bottom: 0;
  85. padding: $cap-spacing $side-spacing;
  86. padding-top: $cap-spacing--double + $cap-spacing;
  87. text-align: center;
  88. align-items: center;
  89. justify-content: center;
  90. > p {
  91. margin: 0;
  92. width: 100%;
  93. }
  94. }
  95. &__chart-spinner {
  96. font-size: $loading-spinner-size;
  97. color: $border-color--active;
  98. opacity: 0;
  99. transition: opacity 150ms ease-in-out;
  100. pointer-events: none;
  101. // Position it in the middle of the container
  102. position: absolute;
  103. left: 50%;
  104. top: 50%;
  105. margin-left: -$loading-spinner-size / 2; // center horizontally
  106. // We show a spinner with a delay so that it is only visible if a preview
  107. // takes too long to be generated.
  108. &--visible {
  109. transition-delay: 1000ms;
  110. opacity: 1;
  111. }
  112. &--small {
  113. font-size: $loading-spinner-size-small;
  114. top: 0;
  115. left: 0;
  116. margin-left: 0;
  117. }
  118. }
  119. // Portrait mode
  120. // We have vertical space so we'll size the chart and let the widget scale vertically.
  121. &--portrait,
  122. &--portrait.esri-component.esri-widget--panel {
  123. height: auto;
  124. }
  125. &--portrait &__footer {
  126. flex-direction: column;
  127. }
  128. &--portrait &__action-button {
  129. align-self: stretch;
  130. margin-inline-start: 0;
  131. &:not(:last-of-type) {
  132. margin-bottom: $actions-spacing-v;
  133. }
  134. }
  135. }
  136. //----------------------------------------------------------------------------
  137. // Settings
  138. //----------------------------------------------------------------------------
  139. .esri-elevation-profile-settings {
  140. &__popover-content {
  141. font-family: $font-family;
  142. padding: $popover-padding;
  143. color: $font-color;
  144. border: $popover-border;
  145. background-color: $popover-background-color;
  146. }
  147. &__select {
  148. min-width: 150px;
  149. }
  150. &__select-label {
  151. display: block;
  152. margin-bottom: $cap-spacing--eighth;
  153. font-size: $font-size__body;
  154. }
  155. }
  156. //----------------------------------------------------------------------------
  157. // Legend
  158. //----------------------------------------------------------------------------
  159. .esri-elevation-profile-legend {
  160. margin-top: $cap-spacing--half;
  161. }
  162. //----------------------------------------------------------------------------
  163. // Legend Item
  164. //----------------------------------------------------------------------------
  165. .esri-elevation-profile-legend-item {
  166. position: relative;
  167. background: $background-color--offset;
  168. &:not(:last-of-type) {
  169. margin-bottom: $cap-spacing--eighth;
  170. }
  171. &--disabled {
  172. filter: grayscale(1);
  173. opacity: $opacity--disabled;
  174. }
  175. &__color-indicator {
  176. position: absolute;
  177. top: 0;
  178. left: 0;
  179. width: 3px;
  180. height: 100%;
  181. }
  182. &__header {
  183. display: flex;
  184. flex-direction: row;
  185. align-items: center;
  186. justify-content: flex-start;
  187. }
  188. &__content {
  189. display: block;
  190. padding: $cap-spacing $side-spacing;
  191. padding-top: 0;
  192. }
  193. &__collapse-toggle {
  194. width: auto;
  195. color: $interactive-font-color;
  196. flex-shrink: 0;
  197. &:focus:not(:focus-visible) {
  198. outline: none;
  199. border: none;
  200. }
  201. }
  202. &__collapse-toggle__icon {
  203. margin: 0 $side-spacing--quarter;
  204. transform: rotate(0);
  205. transition: transform 0.1s ease-in-out;
  206. }
  207. &--expanded &__collapse-toggle__icon {
  208. transform: rotate(180deg);
  209. }
  210. &__label {
  211. display: flex;
  212. flex-direction: row;
  213. align-items: center;
  214. flex-shrink: 1;
  215. flex-grow: 1;
  216. min-width: 0; // allow the legend to shrink as much as needed.
  217. padding-inline-start: $side-spacing;
  218. // Only change the cursor when the checkbox is not disabled
  219. &:not(&--disabled) {
  220. cursor: pointer;
  221. }
  222. > span {
  223. text-overflow: ellipsis;
  224. overflow: hidden;
  225. }
  226. }
  227. &__checkbox {
  228. font-size: $checkbox-icon-size;
  229. line-height: $checkbox-icon-size;
  230. display: inline-block;
  231. width: $checkbox-size;
  232. height: $checkbox-size;
  233. margin-inline-end: $side-spacing--half;
  234. padding: ($checkbox-size - $checkbox-icon-size - $checkbox-border-size * 2) / 2;
  235. transition: all 0.1s ease-in-out;
  236. border: solid 1px $border-color;
  237. background: none;
  238. flex-shrink: 0;
  239. appearance: none;
  240. &:before {
  241. color: $interactive-font-color--inverse;
  242. }
  243. &--checked {
  244. background: $border-color--active;
  245. border-color: $border-color--active;
  246. &:before {
  247. color: $interactive-font-color--inverse;
  248. }
  249. }
  250. // Only change the cursor when the checkbox is not disabled
  251. &:not(:disabled) {
  252. cursor: pointer;
  253. }
  254. &:focus:not(:focus-visible) {
  255. outline: none;
  256. }
  257. }
  258. }
  259. //----------------------------------------------------------------------------
  260. // Statistics
  261. //----------------------------------------------------------------------------
  262. .esri-elevation-profile-statistics {
  263. --max-width: 1px;
  264. display: grid;
  265. grid-template-columns: repeat(auto-fit, minmax(var(--max-width), 1fr));
  266. gap: $cap-spacing--eighth $side-spacing--plus-half;
  267. width: 100%;
  268. contain: layout paint style;
  269. &__statistic {
  270. display: block;
  271. width: max-content;
  272. white-space: nowrap;
  273. text-align: start;
  274. &__label {
  275. font-size: $font-size--tiny;
  276. font-weight: $font-weight--regular;
  277. }
  278. &__value {
  279. font-size: $font-size--tiny;
  280. font-weight: $font-weight--bold;
  281. line-height: 0.95em; // condense things slightly
  282. }
  283. }
  284. &__slope-value {
  285. > [class^="esri-icon"] {
  286. font-size: $statistics-font-size; // Keep the icon small.
  287. &:not(:first-child) {
  288. margin-inline-start: $statistics-slope-values-spacing;
  289. }
  290. }
  291. }
  292. }
  293. .esri-elevation-profile--portrait {
  294. .esri-elevation-profile-statistics {
  295. gap: ($cap-spacing--eighth * 3) $side-spacing--plus-half;
  296. margin-bottom: $cap-spacing;
  297. }
  298. .esri-elevation-profile-statistics__statistic__value {
  299. margin-top: 2px;
  300. }
  301. }
  302. //----------------------------------------------------------------------------
  303. // RTL
  304. //----------------------------------------------------------------------------
  305. html[dir="rtl"] {
  306. .esri-elevation-profile-legend-item {
  307. &__color-indicator {
  308. left: auto;
  309. right: 0;
  310. }
  311. }
  312. .esri-elevation-profile {
  313. &__chart-spinner--small {
  314. left: auto;
  315. right: 0;
  316. }
  317. }
  318. }
  319. }
  320. @if $include_ElevationProfile == true {
  321. @include elevationProfile();
  322. }