_ElevationProfile.scss 10 KB

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