You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_notification.scss 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. /**
  2. *
  3. * @group notification
  4. */
  5. $v-notification-title-color: $v-focus-color !default;
  6. /**
  7. *
  8. *
  9. * @param {string} $primary-stylename (v-Notification) -
  10. * @param {bool} $include-additional-styles -
  11. *
  12. * @group notification
  13. */
  14. @mixin valo-notification ($primary-stylename: v-Notification, $include-additional-styles: contains($v-included-additional-styles, notification)) {
  15. // Positional offsets
  16. .#{$primary-stylename} {
  17. &.v-position-top {
  18. top: $v-layout-spacing-vertical;
  19. }
  20. &.v-position-right {
  21. right: $v-layout-spacing-horizontal;
  22. }
  23. &.v-position-bottom {
  24. bottom: $v-layout-spacing-vertical;
  25. }
  26. &.v-position-left {
  27. left: $v-layout-spacing-horizontal;
  28. }
  29. &.v-position-assistive {
  30. top: -9999px;
  31. left: -9999px;
  32. }
  33. }
  34. // Custom animations for positions
  35. @if $v-animations-enabled {
  36. .#{$primary-stylename}-animate-in {
  37. @include animation(valo-animate-in-fade 180ms 10ms backwards);
  38. &.v-position-top {
  39. @include animation(valo-animate-in-slide-down 400ms 10ms backwards);
  40. }
  41. &.v-position-bottom {
  42. @include animation(valo-animate-in-slide-up 400ms 10ms backwards);
  43. }
  44. }
  45. .#{$primary-stylename}-animate-out {
  46. @include animation(valo-animate-out-fade 150ms);
  47. &.v-position-top,
  48. &.v-position-bottom {
  49. @include animation(valo-animate-out-slide-down-fade 200ms);
  50. }
  51. }
  52. }
  53. // Default style (a.k.a. humanized)
  54. .#{$primary-stylename} {
  55. border-radius: $v-border-radius;
  56. text-align: center;
  57. position: fixed !important;
  58. -webkit-backface-visibility: hidden;
  59. -moz-backface-visibility: hidden;
  60. -ms-backface-visibility: hidden;
  61. backface-visibility: hidden;
  62. @include valo-notification-style($primary-stylename);
  63. }
  64. .#{$primary-stylename}-caption {
  65. margin: 0;
  66. display: inline-block;
  67. text-align: left;
  68. font-weight: inherit;
  69. line-height: inherit;
  70. white-space: nowrap;
  71. letter-spacing: 0;
  72. }
  73. .#{$primary-stylename}-description, .#{$primary-stylename}-details {
  74. margin: 0;
  75. display: inline-block;
  76. vertical-align: middle;
  77. max-width: 30em;
  78. text-align: left;
  79. max-height: 20em;
  80. overflow: auto;
  81. }
  82. .#{$primary-stylename}-caption ~ .#{$primary-stylename}-description,
  83. .#{$primary-stylename}-caption ~ .#{$primary-stylename}-details {
  84. margin-left: round($v-font-size * 1.5);
  85. }
  86. .v-icon + .#{$primary-stylename}-caption {
  87. margin-left: round($v-font-size);
  88. }
  89. .#{$primary-stylename}-system {
  90. @include valo-notification-bar-style($primary-stylename);
  91. @include valo-notification-system-style($primary-stylename);
  92. }
  93. .#{$primary-stylename}.tray {
  94. text-align: left;
  95. .#{$primary-stylename}-caption {
  96. //display: block;
  97. }
  98. .#{$primary-stylename}-caption + .#{$primary-stylename}-description {
  99. display: block;
  100. margin: .5em 0 0;
  101. }
  102. @include valo-notification-tray-style;
  103. }
  104. .#{$primary-stylename}.warning {
  105. @include valo-notification-warning-style($primary-stylename);
  106. }
  107. .#{$primary-stylename}.error {
  108. @include valo-notification-error-style($primary-stylename);
  109. }
  110. @if $include-additional-styles {
  111. .#{$primary-stylename}.dark {
  112. @include valo-notification-dark-style($primary-stylename);
  113. }
  114. .#{$primary-stylename}.bar {
  115. @include valo-notification-bar-style($primary-stylename);
  116. }
  117. .#{$primary-stylename}.small {
  118. @include valo-notification-small-style($primary-stylename);
  119. }
  120. .#{$primary-stylename}.closable {
  121. @include valo-notification-closable-style;
  122. &.dark,
  123. &.error,
  124. &.system {
  125. &:after {
  126. color: #fff;
  127. border-color: #fff;
  128. border-color: rgba(255,255,255,.3);
  129. }
  130. &:active:after {
  131. background-color: #fff;
  132. color: #000;
  133. }
  134. }
  135. &.tray:after {
  136. top: round($v-unit-size/2.3);
  137. margin-top: 0;
  138. }
  139. }
  140. .#{$primary-stylename}.success,
  141. .#{$primary-stylename}.failure {
  142. background: #fff;
  143. color: #555;
  144. border: 2px solid $v-friendly-color;
  145. .#{$primary-stylename}-caption {
  146. color: $v-friendly-color;
  147. font-weight: $v-font-weight + 100;
  148. &:before {
  149. font-family: ThemeIcons;
  150. content: "\f00c";
  151. margin-right: .5em;
  152. }
  153. }
  154. &.bar {
  155. margin: -2px !important;
  156. }
  157. }
  158. .#{$primary-stylename}.failure {
  159. border-color: $v-error-indicator-color;
  160. .#{$primary-stylename}-caption {
  161. color: $v-error-indicator-color;
  162. &:before {
  163. content: "\f05e";
  164. }
  165. }
  166. }
  167. }
  168. }
  169. /**
  170. *
  171. *
  172. *
  173. * @group notification
  174. */
  175. @mixin valo-notification-closable-style {
  176. padding-right: $v-unit-size + round($v-unit-size/1.7);
  177. overflow: hidden !important; // Override GWT PopupPanel
  178. cursor: pointer;
  179. &:after {
  180. content: "\00d7";
  181. font-size: 1.5em;
  182. position: absolute;
  183. top: 50%;
  184. margin-top: round($v-unit-size/-3);
  185. right: round($v-unit-size/3);
  186. width: round($v-unit-size/1.5);
  187. height: round($v-unit-size/1.5);
  188. line-height: round($v-unit-size/1.5) - 1px;
  189. cursor: pointer;
  190. $color: if(is-dark-color($v-overlay-background-color), #fff, #000);
  191. color: $color;
  192. @include opacity(.5);
  193. text-align: center;
  194. border: first-number($v-border) solid $color;
  195. border-color: rgba($color, .3);
  196. border-radius: 50%;
  197. @include transition(opacity 200ms);
  198. }
  199. &:hover:after {
  200. @include opacity(1);
  201. }
  202. &:active:after {
  203. $color: if(is-dark-color($v-overlay-background-color), #000, #fff);
  204. $bg: if(is-dark-color($v-overlay-background-color), #fff, #000);
  205. background-color: $bg;
  206. color: $color;
  207. @include opacity(.3);
  208. @include transition(none 200ms);
  209. }
  210. }
  211. /**
  212. *
  213. * @param {string} $primary-style
  214. *
  215. * @group notification
  216. */
  217. @mixin valo-notification-style ($primary-style) {
  218. background: $v-overlay-background-color;
  219. @include box-shadow(0px 5px 15px 0px rgba(0,0,0,0.15));
  220. padding: round($v-unit-size/2) round($v-unit-size/1.7);
  221. .#{$primary-style}-caption {
  222. color: $v-notification-title-color;
  223. font-size: round($v-font-size * 1.2);
  224. line-height: 1;
  225. }
  226. .#{$primary-style}-description {
  227. line-height: 1.4;
  228. }
  229. }
  230. /**
  231. *
  232. * @param {string} $primary-style
  233. *
  234. * @group notification
  235. */
  236. @mixin valo-notification-bar-style ($primary-style) {
  237. left: 0 !important;
  238. right: 0;
  239. max-width: 100%;
  240. margin: 0 !important;
  241. border-radius: 0;
  242. @include box-shadow(0 0 20px 0 rgba(0,0,0,0.25));
  243. padding: round($v-unit-size/3) round($v-unit-size/2.5);
  244. .#{$primary-style}-description, .#{$primary-style}-details {
  245. max-width: 50em;
  246. }
  247. &.v-position-top {
  248. top: 0;
  249. @if $v-animations-enabled {
  250. &[class*="animate-in"] {
  251. @include animation(valo-animate-in-slide-down 300ms 10ms backwards);
  252. }
  253. &[class*="animate-out"] {
  254. @include animation(valo-animate-out-slide-up 200ms);
  255. }
  256. }
  257. }
  258. &.v-position-bottom {
  259. bottom: 0;
  260. @if $v-animations-enabled {
  261. &[class*="animate-in"] {
  262. @include animation(valo-animate-in-slide-up 300ms 10ms backwards);
  263. }
  264. &[class*="animate-out"] {
  265. @include animation(valo-animate-out-slide-down 200ms);
  266. }
  267. }
  268. }
  269. }
  270. /**
  271. *
  272. *
  273. *
  274. * @group notification
  275. */
  276. @mixin valo-notification-dark-style ($primary-style) {
  277. background-color: #444;
  278. background-color: rgba(#444, .9);
  279. font-weight: $v-font-weight + 100;
  280. line-height: round($v-font-size * 1.4);
  281. .#{$primary-style}-caption {
  282. color: #fff;
  283. vertical-align: middle;
  284. }
  285. .#{$primary-style}-description, .#{$primary-style}-details {
  286. color: #e6e6e6;
  287. }
  288. }
  289. /**
  290. *
  291. * @param {string} $primary-style
  292. *
  293. * @group notification
  294. */
  295. @mixin valo-notification-system-style ($primary-style) {
  296. @include valo-notification-dark-style($primary-style);
  297. // No need to underline the "click here" text, let's imply that the whole banner is clickable
  298. u {
  299. text-decoration: none;
  300. }
  301. }
  302. /**
  303. *
  304. *
  305. *
  306. * @group notification
  307. */
  308. @mixin valo-notification-tray-style {}
  309. /**
  310. *
  311. * @param {string} $primary-style
  312. *
  313. * @group notification
  314. */
  315. @mixin valo-notification-warning-style ($primary-style) {
  316. background: #FFF3D2;
  317. .#{$primary-style}-caption {
  318. color: #AC7C00;
  319. }
  320. .#{$primary-style}-description {
  321. color: #9D874D;
  322. }
  323. }
  324. /**
  325. *
  326. * @param {string} $primary-style
  327. *
  328. * @group notification
  329. */
  330. @mixin valo-notification-error-style ($primary-style) {
  331. background: $v-error-indicator-color;
  332. font-weight: $v-font-weight + 100;
  333. @include box-shadow(0px 5px 15px 0px rgba(0,0,0,0.25));
  334. .#{$primary-style}-caption {
  335. color: valo-font-color($v-error-indicator-color, 1);
  336. }
  337. .#{$primary-style}-description {
  338. color: valo-font-color($v-error-indicator-color, .8);
  339. }
  340. }
  341. /**
  342. *
  343. * @param {string} $primary-style
  344. *
  345. * @group notification
  346. */
  347. @mixin valo-notification-small-style ($primary-style) {
  348. padding: round($v-unit-size/3.3) round($v-unit-size/2.8);
  349. .#{$primary-style}-caption {
  350. font-size: $v-font-size;
  351. }
  352. .#{$primary-style}-description {
  353. font-size: round($v-font-size * 0.85);
  354. }
  355. }