_mixins.scss 13 KB

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