_mixins.scss 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. ////////////////////////////////////////
  2. // Widget Common Mixins
  3. @mixin boxShadow($arguments) {
  4. box-shadow: #{$arguments};
  5. }
  6. @mixin defaultBoxShadow() {
  7. @include boxShadow("0 1px 2px rgba(0, 0, 0, 0.3)");
  8. }
  9. @mixin borderBoxShadow($color: $border-color) {
  10. box-shadow: 0 0 0 1px $color;
  11. }
  12. @mixin cardBoxShadow($color: $border-color) {
  13. box-shadow: 0 1px 0 $color;
  14. }
  15. @mixin pointerStyle($width, $height) {
  16. content: "";
  17. position: absolute;
  18. width: $width + px;
  19. height: $height + px;
  20. }
  21. @mixin outlineStyle() {
  22. outline: 2px solid $interactive-font-color;
  23. outline-offset: 2px;
  24. z-index: 1;
  25. }
  26. @function sqrt($r) {
  27. $x0: 1;
  28. $x1: $x0;
  29. @for $i from 1 through 10 {
  30. $x1: $x0 - ($x0 * $x0 - abs($r)) / (2 * $x0);
  31. $x0: $x1;
  32. }
  33. @return $x1;
  34. }
  35. @mixin contentMaxHeightDockedSide($contentHeight) {
  36. $pageMenuHeight: $contentHeight - 60;
  37. .esri-popup--is-docked {
  38. &-top-left,
  39. &-top-right,
  40. &-bottom-left,
  41. &-bottom-right {
  42. .esri-popup__content {
  43. max-height: #{$contentHeight}px;
  44. }
  45. }
  46. }
  47. }
  48. @mixin popupHeight_BasedOnViewSize($height) {
  49. $pageMenuHeight: $height - 50;
  50. .esri-popup__main-container {
  51. max-height: $height;
  52. }
  53. &.esri-popup--feature-menu-open {
  54. .esri-popup__feature-menu-viewport {
  55. max-height: $pageMenuHeight;
  56. }
  57. }
  58. }
  59. @mixin wordbreak() {
  60. /* For Firefox */
  61. white-space: pre-wrap;
  62. word-break: break-all;
  63. /**
  64. * IE should ignore these.
  65. * Modern browsers should override break-all.
  66. */
  67. word-wrap: break-word;
  68. word-break: break-word;
  69. }
  70. @mixin measurementWidgetStyles($selector) {
  71. .#{$selector} {
  72. &__container {
  73. position: relative;
  74. padding: $cap-spacing 0;
  75. overflow-y: auto;
  76. a {
  77. text-decoration: none;
  78. }
  79. }
  80. &__header {
  81. position: relative;
  82. font-size: $font-size__body;
  83. align-items: flex-start;
  84. justify-content: space-between;
  85. display: flex;
  86. flex: 0 0 auto;
  87. }
  88. &__header-title,
  89. h1 &__header-title {
  90. font: {
  91. size: $font-size__header-text;
  92. weight: $font-weight--bold;
  93. }
  94. padding: 8px 0;
  95. margin: 0;
  96. display: block;
  97. flex: 1;
  98. word-break: break-word;
  99. text-align: left;
  100. }
  101. &__panel--error {
  102. color: $font-color--error;
  103. padding: 0 $side-spacing;
  104. animation: esri-fade-in 250ms ease-in-out;
  105. }
  106. &__hint {
  107. padding: 0 $side-spacing;
  108. animation: esri-fade-in 250ms ease-in-out;
  109. &-text {
  110. margin: $cap-spacing 0;
  111. padding: 0;
  112. }
  113. }
  114. &__measurement {
  115. padding: $cap-spacing $side-spacing;
  116. margin: $cap-spacing 0;
  117. background-color: $background-color--offset;
  118. animation: esri-fade-in 250ms ease-in-out;
  119. &-item {
  120. display: flex;
  121. padding-bottom: $cap-spacing;
  122. flex-flow: column;
  123. &--disabled {
  124. display: flex;
  125. color: rgba($font-color, $opacity--disabled);
  126. }
  127. &-title {
  128. padding-bottom: $cap-spacing--quarter;
  129. }
  130. &-value {
  131. font-weight: $font-weight--bold;
  132. }
  133. }
  134. }
  135. &__settings {
  136. display: flex;
  137. justify-content: space-between;
  138. padding: $cap-spacing--half $side-spacing;
  139. }
  140. &__units {
  141. display: flex;
  142. flex: 0 1 48%;
  143. flex-flow: column;
  144. padding: 0;
  145. animation: esri-fade-in 250ms ease-in-out;
  146. &:only-child {
  147. flex: 1 0 100%;
  148. }
  149. }
  150. &__units-select {
  151. width: 100%;
  152. padding: {
  153. left: 0.5em;
  154. right: 2.7em;
  155. }
  156. &-wrapper {
  157. width: 100%;
  158. }
  159. }
  160. &__actions {
  161. display: flex;
  162. flex-flow: column;
  163. justify-content: center;
  164. padding: 0 $side-spacing;
  165. }
  166. }
  167. html[dir="rtl"] {
  168. .#{$selector}__units-select {
  169. padding: {
  170. left: 2.7em;
  171. right: 0.5em;
  172. }
  173. }
  174. }
  175. }
  176. // Smart Mapping Sliders
  177. @mixin smartMappingSlider($class) {
  178. .#{$class} {
  179. direction: ltr;
  180. min-width: $smartmapping-slider__width;
  181. .esri-slider {
  182. font-size: $font-size--small;
  183. .esri-slider__thumb {
  184. background-color: $smartmapping-slider__thumb-background-color;
  185. border-radius: 0;
  186. border: none;
  187. width: $smartmapping-slider__thumb-size--offset;
  188. height: $smartmapping-slider__thumb-size;
  189. }
  190. .esri-slider__content {
  191. flex-direction: row;
  192. height: $smartmapping-slider__base-height;
  193. margin: 0 auto 0 40%;
  194. }
  195. .esri-slider__track {
  196. flex: 0 1 0px;
  197. width: 0px;
  198. }
  199. .esri-slider__anchor {
  200. border-bottom: 1px solid $interactive-font-color;
  201. border-top: 1px solid $background-color;
  202. width: $smartmapping-slider__ramp-width;
  203. &:hover,
  204. &:focus {
  205. .esri-slider__label {
  206. text-decoration: underline;
  207. }
  208. .esri-slider__thumb {
  209. background-color: $interactive-font-color--hover;
  210. border: none;
  211. transform: none;
  212. &:after {
  213. border-left-color: $interactive-font-color--hover;
  214. }
  215. &:before {
  216. background-color: $button-color--bright;
  217. transform: translate3d(-$smartmapping-slider__thumb-size--offset/4, 0, 0);
  218. }
  219. }
  220. }
  221. }
  222. .esri-slider__thumb {
  223. left: -$smartmapping-slider__thumb-size;
  224. top: -$smartmapping-slider__thumb-size--offset;
  225. &:before {
  226. position: absolute;
  227. top: 0;
  228. left: -$smartmapping-slider__thumb-size--offset/4;
  229. width: $smartmapping-slider__thumb-size--offset/2;
  230. content: "";
  231. height: $smartmapping-slider__thumb-size;
  232. background-color: $interactive-font-color;
  233. transition: transform 125ms ease-in-out, background-color 125ms ease-in-out;
  234. }
  235. &:after {
  236. position: absolute;
  237. top: 0;
  238. left: $smartmapping-slider__thumb-size--offset;
  239. content: "";
  240. border-bottom: $smartmapping-slider__thumb-pointer-size solid #0000;
  241. border-left: $smartmapping-slider__thumb-pointer-size solid $interactive-font-color;
  242. border-top: $smartmapping-slider__thumb-pointer-size solid #0000;
  243. height: 0;
  244. width: 0;
  245. }
  246. }
  247. .esri-slider__label {
  248. left: auto;
  249. line-height: 20px;
  250. min-width: 50px;
  251. right: 50px;
  252. text-align: right;
  253. &:hover {
  254. background-color: $background-color--hover;
  255. }
  256. }
  257. .esri-slider__range-input {
  258. margin: auto;
  259. text-align: center;
  260. width: 50%;
  261. }
  262. .esri-slider__label-input {
  263. text-align: right;
  264. width: 70px;
  265. }
  266. .esri-slider__max,
  267. .esri-slider__min {
  268. flex: 0 0 $smartmapping-slider__range-input-height;
  269. height: $smartmapping-slider__range-input-height;
  270. padding: $cap-spacing--three-quarters 0;
  271. }
  272. .esri-slider__extra-content {
  273. height: 100%;
  274. }
  275. .esri-histogram__average-line,
  276. .esri-histogram__label {
  277. stroke: $interactive-font-color;
  278. }
  279. .zoom-cap--max {
  280. position: absolute;
  281. top: 0;
  282. }
  283. .zoom-cap--min {
  284. position: absolute;
  285. bottom: 0;
  286. }
  287. .zoom-cap {
  288. height: 11px;
  289. width: $smartmapping-slider__ramp-width;
  290. stroke-width: 0;
  291. .zoom-cap--mask {
  292. fill: #fff;
  293. }
  294. .zoom-cap--line {
  295. fill: #fff;
  296. }
  297. .zoom-cap--underline {
  298. fill: #323232;
  299. }
  300. &:hover {
  301. cursor: pointer;
  302. .zoom-cap--mask {
  303. fill: #fff;
  304. }
  305. .zoom-cap--line {
  306. fill: #0079c1;
  307. }
  308. .zoom-cap--underline {
  309. fill: #fff;
  310. }
  311. }
  312. }
  313. }
  314. }
  315. .#{$class}__ramp {
  316. display: inline-block;
  317. height: 100%;
  318. width: $smartmapping-slider__ramp-width;
  319. position: relative;
  320. svg {
  321. height: 100%;
  322. width: 100%;
  323. position: absolute;
  324. stroke: $smartmapping-slider__ramp-stroke-color;
  325. stroke-width: $smartmapping-slider__ramp-stroke-width;
  326. left: 0;
  327. rect {
  328. height: 100%;
  329. width: 100%;
  330. }
  331. path {
  332. stroke-width: $smartmapping-slider__ramp-path-stroke-width;
  333. }
  334. }
  335. }
  336. .#{$class}__histogram-container {
  337. display: inline-block;
  338. height: 100%;
  339. width: $smartmapping-slider__histogram-width;
  340. }
  341. }
  342. @mixin loopingProgressBar($selector) {
  343. #{$selector}:before,
  344. #{$selector}:after {
  345. content: "";
  346. opacity: 1;
  347. position: absolute;
  348. height: 1px;
  349. top: 0;
  350. transition: opacity 500ms ease-in-out;
  351. }
  352. #{$selector}:before {
  353. background-color: $border-color;
  354. width: 100%;
  355. z-index: 0;
  356. }
  357. #{$selector}:after {
  358. background-color: $interactive-font-color;
  359. width: $looping-progress-bar-width;
  360. z-index: 0;
  361. animation: looping-progresss-bar-ani $looping-progress-bar-params;
  362. }
  363. }
  364. /**
  365. * Adds the base styles for an arrow facing down.
  366. */
  367. @mixin arrowButton() {
  368. $size: 18px;
  369. $icon-size: 10px;
  370. $padding: ($size - $icon-size) / 2;
  371. font-size: $icon-size;
  372. line-height: $icon-size;
  373. width: $size;
  374. height: $size;
  375. padding: $padding;
  376. cursor: pointer;
  377. transition: all 0.1s ease-in-out;
  378. text-align: center;
  379. border: none;
  380. background: none;
  381. appearance: none;
  382. @extend [class^="esri-icon-"];
  383. @extend .esri-icon-left;
  384. &:hover:not(:disabled) {
  385. background: $background-color--hover;
  386. }
  387. &:disabled {
  388. opacity: 0.4;
  389. cursor: default;
  390. }
  391. &.esri-arrow-down {
  392. transform: rotate(-90deg);
  393. }
  394. &.esri-arrow-up {
  395. transform: rotate(90deg);
  396. }
  397. &.esri-arrow-left {
  398. transform: rotate(0deg);
  399. }
  400. &.esri-arrow-right {
  401. transform: rotate(180deg);
  402. }
  403. }
  404. /**
  405. * Styles for Sortable
  406. */
  407. @mixin sortableChosen($selector) {
  408. transition: background-color 125ms ease-in-out;
  409. &.#{$selector} {
  410. background-color: $background-color--active;
  411. opacity: $opacity--sortable;
  412. }
  413. }