_data-tooltip.less 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // /**
  2. // * Copyright © Magento, Inc. All rights reserved.
  3. // * See COPYING.txt for license details.
  4. // */
  5. //
  6. // Variables
  7. // _____________________________________________
  8. @data-tooltip__background-color: @color-white;
  9. @data-tooltip__border-color: #007dbd;
  10. @data-tooltip__border-width: 1px;
  11. @data-tooltip__box-shadow: 2px 2px 8px 0 rgba(0, 0, 0, .3);
  12. @data-tooltip__z-index: @overlay__z-index - 1;
  13. @data-tooltip-tail__height: 22px;
  14. @data-tooltip-tail__width: @data-tooltip-tail__height;
  15. @data-tooltip-tail__z-index: @z-index-1;
  16. //
  17. // Tooltip
  18. // _____________________________________________
  19. .data-tooltip-trigger {
  20. cursor: pointer;
  21. }
  22. .data-tooltip-wrapper {
  23. max-width: 75%;
  24. position: absolute;
  25. top: 0;
  26. z-index: @data-tooltip__z-index;
  27. &._top {
  28. .data-tooltip-tail {
  29. display: block;
  30. left: 50%;
  31. margin-left: -@data-tooltip-tail__width / 2;
  32. top: -(@data-tooltip-tail__height / 2 - @data-tooltip__border-width);
  33. }
  34. }
  35. &._right {
  36. .data-tooltip-tail {
  37. display: block;
  38. margin-top: -@data-tooltip-tail__width / 2;
  39. right: @data-tooltip-tail__height / 2 + @data-tooltip__border-width;
  40. top: 50%;
  41. }
  42. }
  43. &._bottom {
  44. .data-tooltip-tail {
  45. bottom: @data-tooltip-tail__height / 2 + @data-tooltip__border-width;
  46. display: block;
  47. left: 50%;
  48. margin-left: -@data-tooltip-tail__width / 2;
  49. }
  50. }
  51. &._left {
  52. .data-tooltip-tail {
  53. display: block;
  54. left: -(@data-tooltip-tail__height / 2 - @data-tooltip__border-width);
  55. margin-top: -@data-tooltip-tail__width / 2;
  56. top: 50%;
  57. }
  58. }
  59. &._show {
  60. height: auto;
  61. opacity: 1;
  62. transition: opacity .2s linear;
  63. }
  64. &._hide {
  65. height: 0;
  66. opacity: 0;
  67. overflow: hidden;
  68. }
  69. }
  70. .data-tooltip {
  71. background-color: @data-tooltip__background-color;
  72. border: @data-tooltip__border-width solid @data-tooltip__border-color;
  73. box-shadow: @data-tooltip__box-shadow;
  74. padding: @indent__base;
  75. position: relative;
  76. z-index: @data-tooltip-tail__z-index;
  77. .action-close {
  78. position: absolute;
  79. right: @indent__base;
  80. top: @indent__base;
  81. &:focus {
  82. background: none;
  83. }
  84. }
  85. }
  86. .data-tooltip-title {
  87. font-size: 1.7rem;
  88. font-weight: @font-weight__semibold;
  89. margin: 0 @indent__base @indent__base 0;
  90. }
  91. .data-tooltip-content {
  92. .items {
  93. &:extend(.abs-list-reset-styles all);
  94. .item {
  95. margin: 0 0 1rem;
  96. &:last-child {
  97. margin-bottom: 0;
  98. }
  99. }
  100. }
  101. }
  102. .data-tooltip-tail {
  103. display: none;
  104. position: absolute;
  105. &:before {
  106. background-color: @data-tooltip__background-color;
  107. border: @data-tooltip__border-width solid @data-tooltip__border-color;
  108. box-shadow: @data-tooltip__box-shadow;
  109. content: '';
  110. height: @data-tooltip-tail__height;
  111. left: 0;
  112. position: absolute;
  113. top: 0;
  114. transform: rotate(45deg);
  115. width: @data-tooltip-tail__width;
  116. z-index: @data-tooltip-tail__z-index - 1;
  117. }
  118. &:after {
  119. background-color: @data-tooltip__background-color;
  120. content: '';
  121. height: @data-tooltip-tail__height - @data-tooltip__border-width * 2;
  122. left: @data-tooltip__border-width;
  123. position: absolute;
  124. top: @data-tooltip__border-width;
  125. transform: rotate(45deg);
  126. width: @data-tooltip-tail__width - @data-tooltip__border-width * 2;
  127. z-index: @data-tooltip-tail__z-index + 1;
  128. }
  129. }