_modals.less 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. // /**
  2. // * Copyright © Magento, Inc. All rights reserved.
  3. // * See COPYING.txt for license details.
  4. // */
  5. //
  6. // Lib -> Components -> Modals
  7. // _____________________________________________
  8. //
  9. // Variables
  10. // ---------------------------------------------
  11. @import '../../source/_variables.less';
  12. @modal__background-color: @color-white;
  13. @modal__box-shadow: 0 0 12px 2px rgba(0, 0, 0, .35);
  14. @modal-popup__indent-vertical: 5rem;
  15. @modal-popup__padding: 3rem;
  16. @modal-popup__width: 75%;
  17. @modal-popup__z-index: @modal__z-index;
  18. @modal-slide__first__indent-left: 14.8rem;
  19. @modal-slide__indent-left: 4.5rem;
  20. @modal-slide__padding: 2.6rem;
  21. @modal-slide__z-index: @modal__z-index;
  22. @modal-slide-header__padding-vertical: 2.1rem;
  23. @modal-popup-confirm__width: 50rem;
  24. @modal-popup-image-box__border-color: @color-gray80;
  25. @modal-popup-image-box__max-width: 78rem;
  26. @modal-popup-image-box-preview__max-width: @modal-popup-image-box-preview-image__max-height + (2 * @indent__base);
  27. @modal-popup-image-box-preview-image__max-height: 54rem;
  28. //
  29. // Utilities
  30. // ---------------------------------------------
  31. .lib-modal() {
  32. bottom: 0;
  33. left: 0;
  34. min-width: 0;
  35. position: fixed;
  36. right: 0;
  37. top: 0;
  38. visibility: hidden;
  39. opacity: 0;
  40. -webkit-transition: visibility 0s .3s, opacity .3s ease;
  41. transition: visibility 0s .3s, opacity .3s ease;
  42. &._show {
  43. visibility: visible;
  44. opacity: 1;
  45. -webkit-transition: opacity .3s ease;
  46. transition: opacity .3s ease;
  47. .modal-inner-wrap {
  48. -webkit-transform: translate(0, 0);
  49. transform: translate(0, 0);
  50. }
  51. }
  52. .modal-inner-wrap {
  53. .lib-css(background-color, @modal__background-color);
  54. .lib-css(box-shadow, @modal__box-shadow);
  55. opacity: 1;
  56. pointer-events: auto;
  57. }
  58. }
  59. .lib-modal-slide() {
  60. .lib-css(left, @modal-slide__first__indent-left);
  61. .lib-css(z-index, @modal-slide__z-index);
  62. &._show {
  63. .modal-inner-wrap {
  64. -webkit-transform: translateX(0);
  65. transform: translateX(0);
  66. }
  67. }
  68. .modal-inner-wrap {
  69. height: 100%;
  70. overflow-y: auto;
  71. position: static;
  72. -webkit-transform: translateX(100%);
  73. transform: translateX(100%);
  74. -webkit-transition: -webkit-transform .3s ease-in-out;
  75. transition: transform .3s ease-in-out;
  76. width: auto;
  77. }
  78. }
  79. .lib-modal-popup() {
  80. .lib-css(z-index, @modal-popup__z-index);
  81. left: 0;
  82. overflow-y: auto;
  83. &.confirm {
  84. .modal-inner-wrap {
  85. .lib-css(max-width, @modal-popup-confirm__width);
  86. .modal-content {
  87. padding-right: 7rem;
  88. }
  89. }
  90. }
  91. &._show {
  92. .modal-inner-wrap {
  93. -webkit-transform: translateY(0);
  94. transform: translateY(0);
  95. }
  96. }
  97. .modal-inner-wrap {
  98. .lib-css(margin, @modal-popup__indent-vertical auto);
  99. .lib-css(width, @modal-popup__width);
  100. .lib-vendor-prefix-display(flex);
  101. .lib-vendor-prefix-flex-direction(column);
  102. box-sizing: border-box;
  103. height: auto;
  104. left: 0;
  105. position: absolute;
  106. right: 0;
  107. -webkit-transform: translateY(-200%);
  108. transform: translateY(-200%);
  109. -webkit-transition: -webkit-transform .2s ease;
  110. transition: transform .2s ease;
  111. }
  112. }
  113. //
  114. // Common
  115. // _____________________________________________
  116. & when (@media-common = true) {
  117. body {
  118. &._has-modal {
  119. height: 100%;
  120. overflow: hidden;
  121. width: 100%;
  122. }
  123. }
  124. // Modals overlay
  125. .modals-overlay {
  126. &:extend(.abs-modal-overlay all);
  127. .lib-css(z-index, @overlay__z-index);
  128. }
  129. .modal-slide,
  130. .modal-popup {
  131. .lib-modal();
  132. }
  133. .modal-slide {
  134. .lib-modal-slide();
  135. &._inner-scroll {
  136. .modal-inner-wrap {
  137. overflow-y: visible;
  138. .lib-vendor-prefix-display(flex);
  139. .lib-vendor-prefix-flex-direction(column);
  140. }
  141. .modal-header,
  142. .modal-footer {
  143. .lib-vendor-prefix-flex-grow(0);
  144. .lib-vendor-prefix-flex-shrink(0);
  145. }
  146. .modal-content {
  147. overflow-y: auto;
  148. }
  149. .modal-footer {
  150. margin-top: auto;
  151. }
  152. }
  153. .modal-header,
  154. .modal-content,
  155. .modal-footer {
  156. .lib-css(padding, 0 @modal-slide__padding @modal-slide__padding);
  157. }
  158. .modal-header {
  159. .lib-css(padding-bottom, @modal-slide-header__padding-vertical);
  160. .lib-css(padding-top, @modal-slide-header__padding-vertical);
  161. }
  162. }
  163. .modal-popup {
  164. .lib-modal-popup();
  165. // If applied, switching outer popup scroll to inner
  166. &._inner-scroll {
  167. overflow-y: visible;
  168. .ie11 & {
  169. overflow-y: auto;
  170. }
  171. .modal-inner-wrap {
  172. max-height: 90%;
  173. .ie11 & {
  174. max-height: none;
  175. }
  176. }
  177. .modal-content {
  178. overflow-y: auto;
  179. }
  180. }
  181. .modal-header,
  182. .modal-content,
  183. .modal-footer {
  184. .lib-css(padding-left, @modal-popup__padding);
  185. .lib-css(padding-right, @modal-popup__padding);
  186. }
  187. .modal-header,
  188. .modal-footer {
  189. .lib-vendor-prefix-flex-grow(0);
  190. .lib-vendor-prefix-flex-shrink(0);
  191. }
  192. .modal-header {
  193. .lib-css(padding-bottom, @modal-popup__padding / 2.5);
  194. .lib-css(padding-top, @modal-popup__padding);
  195. }
  196. .modal-footer {
  197. margin-top: auto;
  198. .lib-css(padding-bottom, @modal-popup__padding);
  199. .lib-css(padding-top, @modal-popup__padding);
  200. }
  201. .modal-footer-actions {
  202. text-align: right;
  203. }
  204. }
  205. }
  206. //
  207. // Mobile
  208. // _____________________________________________
  209. // Mobile transform to modal-slide
  210. .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
  211. .modal-popup {
  212. &.modal-slide {
  213. .lib-modal-slide();
  214. .modal-inner-wrap {
  215. margin: 0;
  216. max-height: none;
  217. }
  218. }
  219. }
  220. }