_mixins.scss 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. ////////////////////////////////////////
  2. // Widget Common Mixins
  3. @use "sass:math";
  4. @mixin boxShadow($arguments) {
  5. box-shadow: #{$arguments};
  6. }
  7. @mixin defaultBoxShadow() {
  8. @include boxShadow("0 1px 2px rgba(0, 0, 0, 0.3)");
  9. }
  10. @mixin borderBoxShadow($color: $border-color) {
  11. box-shadow: 0 0 0 1px $color;
  12. }
  13. @mixin cardBoxShadow($color: $border-color) {
  14. box-shadow: 0 1px 0 $color;
  15. }
  16. @mixin pointerStyle($width, $height) {
  17. content: "";
  18. position: absolute;
  19. width: $width + px;
  20. height: $height + px;
  21. }
  22. @mixin outlineStyle() {
  23. outline: 2px solid $interactive-font-color;
  24. outline-offset: 2px;
  25. z-index: 1;
  26. }
  27. @function sqrt($r) {
  28. $x0: 1;
  29. $x1: $x0;
  30. @for $i from 1 through 10 {
  31. $x1: $x0 - math.div($x0 * $x0 - abs($r), 2 * $x0);
  32. $x0: $x1;
  33. }
  34. @return $x1;
  35. }
  36. @mixin contentMaxHeightDockedSide($contentHeight) {
  37. $pageMenuHeight: $contentHeight - 60;
  38. .esri-popup--is-docked {
  39. &-top-left,
  40. &-top-right,
  41. &-bottom-left,
  42. &-bottom-right {
  43. .esri-popup__content {
  44. max-height: #{$contentHeight}px;
  45. }
  46. }
  47. }
  48. }
  49. @mixin popupHeight_BasedOnViewSize($height) {
  50. $pageMenuHeight: $height - 50;
  51. .esri-popup__main-container {
  52. max-height: $height;
  53. }
  54. &.esri-popup--feature-menu-open {
  55. .esri-popup__feature-menu-viewport {
  56. max-height: $pageMenuHeight;
  57. }
  58. }
  59. }
  60. @mixin wordbreak() {
  61. /* For Firefox */
  62. white-space: pre-wrap;
  63. word-break: break-all;
  64. /**
  65. * IE should ignore these.
  66. * Modern browsers should override break-all.
  67. */
  68. word-wrap: break-word;
  69. word-break: break-word;
  70. }
  71. @mixin measurementWidgetStyles($selector) {
  72. .#{$selector} {
  73. &__container {
  74. position: relative;
  75. padding: $cap-spacing 0;
  76. overflow-y: auto;
  77. a {
  78. text-decoration: none;
  79. }
  80. }
  81. &__header {
  82. position: relative;
  83. font-size: $font-size__body;
  84. align-items: flex-start;
  85. justify-content: space-between;
  86. display: flex;
  87. flex: 0 0 auto;
  88. }
  89. &__header-title,
  90. h1 &__header-title {
  91. font: {
  92. size: $font-size__header-text;
  93. weight: $font-weight--bold;
  94. }
  95. padding: 8px 0;
  96. margin: 0;
  97. display: block;
  98. flex: 1;
  99. word-break: break-word;
  100. text-align: left;
  101. }
  102. &__panel--error {
  103. color: $font-color--error;
  104. padding: 0 $side-spacing;
  105. animation: esri-fade-in 250ms ease-in-out;
  106. }
  107. &__hint {
  108. padding: 0 $side-spacing;
  109. animation: esri-fade-in 250ms ease-in-out;
  110. &-text {
  111. margin: $cap-spacing 0;
  112. padding: 0;
  113. }
  114. }
  115. &__measurement {
  116. padding: $cap-spacing $side-spacing;
  117. margin: $cap-spacing 0;
  118. background-color: $background-color--offset;
  119. animation: esri-fade-in 250ms ease-in-out;
  120. &-item {
  121. display: flex;
  122. padding-bottom: $cap-spacing;
  123. flex-flow: column;
  124. &--disabled {
  125. display: flex;
  126. color: rgba($font-color, $opacity--disabled);
  127. }
  128. &-title {
  129. padding-bottom: $cap-spacing--quarter;
  130. }
  131. &-value {
  132. font-weight: $font-weight--bold;
  133. }
  134. }
  135. }
  136. &__settings {
  137. display: flex;
  138. justify-content: space-between;
  139. padding: $cap-spacing--half $side-spacing;
  140. }
  141. &__units {
  142. display: flex;
  143. flex: 0 1 48%;
  144. flex-flow: column;
  145. padding: 0;
  146. animation: esri-fade-in 250ms ease-in-out;
  147. &:only-child {
  148. flex: 1 0 100%;
  149. }
  150. }
  151. &__units-select {
  152. width: 100%;
  153. padding: {
  154. left: 0.5em;
  155. right: 2.7em;
  156. }
  157. &-wrapper {
  158. width: 100%;
  159. }
  160. }
  161. &__actions {
  162. display: flex;
  163. flex-flow: column;
  164. justify-content: center;
  165. padding: 0 $side-spacing;
  166. }
  167. }
  168. [dir="rtl"] {
  169. .#{$selector}__units-select {
  170. padding: {
  171. left: 2.7em;
  172. right: 0.5em;
  173. }
  174. }
  175. }
  176. }
  177. // Smart Mapping Sliders
  178. @mixin smartMappingSlider($class) {
  179. .#{$class} {
  180. direction: ltr;
  181. min-width: $smartmapping-slider__width;
  182. .esri-slider {
  183. font-size: $font-size--small;
  184. position: relative;
  185. z-index: 1;
  186. .esri-slider__content {
  187. flex-direction: row;
  188. height: $smartmapping-slider__base-height;
  189. margin: 0 auto 0 40%;
  190. }
  191. .esri-slider__track {
  192. background-color: transparent;
  193. display: flex;
  194. flex: 0 0 auto;
  195. }
  196. .esri-slider__anchor {
  197. border-bottom: 1px solid $interactive-font-color;
  198. border-top: 1px solid $background-color;
  199. width: $smartmapping-slider__ramp-width;
  200. &:hover,
  201. &:focus {
  202. .esri-slider__label {
  203. text-decoration: underline;
  204. }
  205. .esri-slider__thumb {
  206. background-color: $interactive-font-color--hover;
  207. border: none;
  208. transform: none;
  209. &:after {
  210. border-left-color: $interactive-font-color--hover;
  211. }
  212. &:before {
  213. background-color: $button-color--bright;
  214. transform: translate3d(-$smartmapping-slider__thumb-size--offset * 0.25, 0, 0);
  215. }
  216. }
  217. }
  218. }
  219. .esri-slider__thumb {
  220. background-color: $smartmapping-slider__thumb-background-color;
  221. border-radius: 0;
  222. border: none;
  223. height: $smartmapping-slider__thumb-size;
  224. left: -$smartmapping-slider__thumb-size;
  225. top: -$smartmapping-slider__thumb-size--offset;
  226. width: $smartmapping-slider__thumb-size--offset;
  227. &:before {
  228. position: absolute;
  229. top: 0;
  230. left: -$smartmapping-slider__thumb-size--offset * 0.25;
  231. width: $smartmapping-slider__thumb-size--offset * 0.5;
  232. content: "";
  233. height: $smartmapping-slider__thumb-size;
  234. background-color: $interactive-font-color;
  235. transition: transform 125ms ease-in-out, background-color 125ms ease-in-out;
  236. }
  237. &:after {
  238. position: absolute;
  239. top: 0;
  240. left: $smartmapping-slider__thumb-size--offset;
  241. content: "";
  242. border-bottom: $smartmapping-slider__thumb-pointer-size solid #0000;
  243. border-left: $smartmapping-slider__thumb-pointer-size solid $interactive-font-color;
  244. border-top: $smartmapping-slider__thumb-pointer-size solid #0000;
  245. height: 0;
  246. width: 0;
  247. }
  248. }
  249. .esri-slider__label {
  250. left: auto;
  251. line-height: 20px;
  252. min-width: 50px;
  253. right: 50px;
  254. text-align: right;
  255. &:hover {
  256. background-color: $background-color--hover;
  257. }
  258. }
  259. .esri-slider__segment {
  260. &:hover {
  261. cursor: default;
  262. }
  263. }
  264. .esri-slider__range-input {
  265. margin: auto;
  266. text-align: center;
  267. width: 50%;
  268. }
  269. .esri-slider__label-input {
  270. text-align: right;
  271. width: 70px;
  272. }
  273. .esri-slider__max,
  274. .esri-slider__min {
  275. flex: none;
  276. margin: $cap-spacing--three-quarters auto;
  277. padding: $cap-spacing--three-quarters $cap-spacing;
  278. position: relative;
  279. width: auto;
  280. z-index: 0;
  281. &:before {
  282. content: "";
  283. position: absolute;
  284. left: 0;
  285. top: 0;
  286. height: 100%;
  287. width: 100%;
  288. z-index: -1;
  289. }
  290. &.esri-slider__range--active {
  291. background-color: $background-color;
  292. }
  293. .esri-slider__range-input {
  294. margin: 0 auto;
  295. }
  296. }
  297. .esri-slider__extra-content {
  298. display: flex;
  299. height: 100%;
  300. }
  301. .esri-histogram__svg {
  302. overflow: visible;
  303. }
  304. .esri-histogram__label {
  305. fill: $font-color;
  306. stroke-width: 2;
  307. }
  308. .esri-histogram__average-line,
  309. .esri-histogram__label {
  310. paint-order: stroke;
  311. stroke: $background-color;
  312. }
  313. .zoom-cap--max {
  314. position: absolute;
  315. top: 0;
  316. }
  317. .zoom-cap--min {
  318. position: absolute;
  319. bottom: 0;
  320. }
  321. .zoom-cap {
  322. height: 11px;
  323. width: $smartmapping-slider__ramp-width;
  324. stroke-width: 0;
  325. .zoom-cap--mask {
  326. fill: #fff;
  327. }
  328. .zoom-cap--line {
  329. fill: #fff;
  330. }
  331. .zoom-cap--underline {
  332. fill: #323232;
  333. }
  334. &:hover {
  335. cursor: pointer;
  336. .zoom-cap--mask {
  337. fill: #fff;
  338. }
  339. .zoom-cap--line {
  340. fill: #0079c1;
  341. }
  342. .zoom-cap--underline {
  343. fill: #fff;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. .#{$class}__ramp {
  350. display: flex;
  351. height: 100%;
  352. width: $smartmapping-slider__ramp-width;
  353. position: relative;
  354. svg {
  355. height: 100%;
  356. width: 100%;
  357. position: absolute;
  358. stroke: $smartmapping-slider__ramp-stroke-color;
  359. stroke-width: $smartmapping-slider__ramp-stroke-width;
  360. left: 0;
  361. rect {
  362. height: 100%;
  363. width: 100%;
  364. }
  365. path {
  366. stroke-width: $smartmapping-slider__ramp-path-stroke-width;
  367. }
  368. }
  369. }
  370. .#{$class}__histogram-container {
  371. display: flex;
  372. flex: 1 1 0;
  373. height: 100%;
  374. width: $smartmapping-slider__histogram-width;
  375. }
  376. .#{$class}.#{$class}--interactive-track {
  377. .esri-slider {
  378. .esri-slider__content {
  379. margin: 0 auto 0 35%;
  380. }
  381. .esri-slider__track {
  382. background-color: transparent;
  383. width: 12px;
  384. }
  385. }
  386. .esri-slider__anchor--active {
  387. .esri-slider__label {
  388. text-decoration: underline;
  389. }
  390. .esri-slider__thumb {
  391. background-color: $interactive-font-color--hover;
  392. border: none;
  393. transform: none;
  394. &:after {
  395. border-left-color: $interactive-font-color--hover;
  396. }
  397. &:before {
  398. background-color: $button-color--bright;
  399. transform: translate3d(-$smartmapping-slider__thumb-size--offset * 0.25, 0, 0);
  400. }
  401. }
  402. }
  403. .esri-slider__segment--interactive {
  404. background-size: 12px 100%;
  405. background-repeat: no-repeat;
  406. background-position: 50% 50%;
  407. background-image: url(../base/images/SM-Slider_TrackBackground_idle.svg);
  408. &.esri-slider__segment--active {
  409. background-color: #eee;
  410. background-image: url(../base/images/SM-Slider_TrackBackground_hover.svg);
  411. }
  412. &:hover,
  413. &:focus {
  414. cursor: pointer;
  415. background-color: #eee;
  416. background-image: url(../base/images/SM-Slider_TrackBackground_hover.svg);
  417. }
  418. }
  419. }
  420. }
  421. @mixin loopingProgressBar($selector) {
  422. #{$selector}:before,
  423. #{$selector}:after {
  424. content: "";
  425. opacity: 1;
  426. position: absolute;
  427. height: 1px;
  428. top: 0;
  429. transition: opacity 500ms ease-in-out;
  430. }
  431. #{$selector}:before {
  432. background-color: $border-color;
  433. width: 100%;
  434. z-index: 0;
  435. }
  436. #{$selector}:after {
  437. background-color: $interactive-font-color;
  438. width: $looping-progress-bar-width;
  439. z-index: 0;
  440. animation: looping-progresss-bar-ani $looping-progress-bar-params;
  441. }
  442. }
  443. /**
  444. * Adds the base styles for an arrow facing down.
  445. */
  446. @mixin arrowButton() {
  447. $size: 18px;
  448. $icon-size: 10px;
  449. $padding: ($size - $icon-size) * 0.5;
  450. font-size: $icon-size;
  451. line-height: $icon-size;
  452. width: $size;
  453. height: $size;
  454. padding: $padding;
  455. cursor: pointer;
  456. transition: all 0.1s ease-in-out;
  457. text-align: center;
  458. border: none;
  459. background: none;
  460. appearance: none;
  461. @each $icomoon-selector in $icomoon-selectors {
  462. @extend #{$icomoon-selector};
  463. }
  464. @extend .esri-icon-left;
  465. &:hover:not(:disabled) {
  466. background: $background-color--hover;
  467. }
  468. &:disabled {
  469. opacity: 0.4;
  470. cursor: default;
  471. }
  472. &.esri-arrow-down {
  473. transform: rotate(-90deg);
  474. }
  475. &.esri-arrow-up {
  476. transform: rotate(90deg);
  477. }
  478. &.esri-arrow-left {
  479. transform: rotate(0deg);
  480. }
  481. &.esri-arrow-right {
  482. transform: rotate(180deg);
  483. }
  484. }
  485. /**
  486. * Styles for Sortable
  487. */
  488. @mixin sortableChosen($selector) {
  489. transition: background-color 125ms ease-in-out;
  490. &.#{$selector} {
  491. background-color: $background-color--active;
  492. opacity: $opacity--sortable;
  493. }
  494. }
  495. @mixin timeSlider() {
  496. $tick-width: 1px;
  497. $focus-ring-width: 2px;
  498. $thumb-size: 16px;
  499. $tick-padding: 3px;
  500. $tick-height: 3px;
  501. $tick-height-primary: 6px;
  502. .esri-slider.esri-slider--horizontal {
  503. width: inherit;
  504. flex-grow: 1;
  505. padding: 30px 13px 28px 13px;
  506. .esri-widget__anchor,
  507. .esri-slider__anchor {
  508. outline: none !important;
  509. color: inherit;
  510. }
  511. .esri-slider__anchor:focus .esri-slider__thumb {
  512. outline: solid $focus-ring-width $border-color--active;
  513. outline-offset: $focus-ring-width;
  514. overflow: visible;
  515. }
  516. .esri-slider__segment.esri-slider__segment-0 {
  517. background-color: unset; // Reset blue first segment
  518. }
  519. .esri-slider__thumb {
  520. width: $thumb-size;
  521. height: $thumb-size;
  522. left: -$thumb-size * 0.5;
  523. top: -$thumb-size * 0.5;
  524. }
  525. .esri-slider__tick {
  526. width: $tick-width + ($tick-padding * 2);
  527. height: 20px;
  528. padding: $tick-padding; // Make ticks slightly easier to click on
  529. margin: -$tick-padding;
  530. background: none;
  531. &:after {
  532. content: "";
  533. display: block;
  534. width: $tick-width;
  535. background: #6e6e6e66;
  536. }
  537. &.secondary-tick:after {
  538. height: $tick-height;
  539. }
  540. &.primary-tick {
  541. &:after {
  542. height: $tick-height-primary;
  543. }
  544. .primary-tick__ampm {
  545. font-size: $font-size--tiny;
  546. }
  547. }
  548. }
  549. .esri-slider__ticks {
  550. margin: 0;
  551. margin-top: $cap-spacing--half;
  552. width: calc(100% - #{$tick-width});
  553. }
  554. .esri-slider__tick-label {
  555. font-size: $font-size--tiny-time-slider;
  556. line-height: normal;
  557. margin-top: $cap-spacing;
  558. text-align: center;
  559. }
  560. .esri-slider__label {
  561. font-size: $font-size--small;
  562. }
  563. .esri-slider__label-input {
  564. font-size: $font-size--tiny-time-slider;
  565. }
  566. }
  567. }