tag.scss 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. //@import '../theme/variables.scss';
  2. @import "./variables.scss";
  3. @import "./mixin.scss";
  4. $module: #{$prefix}-tag;
  5. $colors: "amber", "blue", "cyan", "green", "grey", "indigo", "light-blue", "light-green", "lime", "orange", "pink",
  6. "purple", "red", "teal", "violet", "yellow";
  7. $types: "ghost", "solid", "light";
  8. .#{$module} {
  9. box-sizing: border-box;
  10. border-radius: $radius-tag;
  11. background-color: transparent;
  12. position: relative;
  13. user-select: none;
  14. // hidden avatar tag image
  15. overflow: hidden;
  16. white-space: nowrap;
  17. vertical-align: bottom;
  18. @include all-center;
  19. display: inline-flex;
  20. &-default,
  21. &-small {
  22. @include font-size-small;
  23. height: $height-tag_small;
  24. padding: $spacing-tag_small-paddingY $spacing-tag_small-paddingX;
  25. &:focus-visible {
  26. outline: $width-tag-outline solid $color-tag-outline-focus;
  27. }
  28. }
  29. &-square {
  30. border-radius: $radius-tag;
  31. }
  32. &-circle {
  33. border-radius: $radius-tag_circle;
  34. }
  35. &-large {
  36. @include font-size-small;
  37. padding: $spacing-tag_large-paddingY $spacing-tag_large-paddingX;
  38. height: $height-tag_large;
  39. &:focus-visible {
  40. outline: $width-tag-outline solid $color-tag-outline-focus;
  41. }
  42. }
  43. &-invisible {
  44. display: none;
  45. }
  46. &-content {
  47. flex: 1;
  48. &-ellipsis {
  49. overflow: hidden;
  50. white-space: nowrap;
  51. text-overflow: ellipsis;
  52. }
  53. &-center {
  54. display: flex;
  55. @include all-center;
  56. height: 100%;
  57. min-width: 0;
  58. }
  59. }
  60. &-close {
  61. @include all-center;
  62. color: $color-tag_close-icon-default;
  63. padding-left: $spacing-tag_close-paddingLeft;
  64. cursor: pointer;
  65. &:hover {
  66. color: $color-tag_close-icon-hover;
  67. }
  68. &:active {
  69. color: $color-tag_close-icon-active;
  70. }
  71. }
  72. &-closable {
  73. padding: $spacing-tag_closable-paddingTop $spacing-tag_closable-paddingRight $spacing-tag_closable-paddingBottom
  74. $spacing-tag_closable-paddingLeft;
  75. }
  76. &-avatar-square,
  77. &-avatar-circle {
  78. .#{$prefix}-avatar {
  79. margin-right: $spacing-tag_avatar-marginRight;
  80. }
  81. }
  82. &-avatar-square {
  83. padding: $spacing-tag_avatar_square-paddingTop $spacing-tag_avatar_square-paddingRight
  84. $spacing-tag_avatar_square-paddingBottom $spacing-tag_avatar_square-paddingLeft;
  85. .#{$prefix}-avatar {
  86. & > img {
  87. background-color: $color-tag_avatar_square_img-bg-default;
  88. }
  89. }
  90. }
  91. &-avatar-circle {
  92. padding: $spacing-tag_avatar_circle-paddingTop $spacing-tag_avatar_circle-paddingRight
  93. $spacing-tag_avatar_circle-paddingBottom $spacing-tag_avatar_circle-paddingLeft;
  94. }
  95. &-avatar-square.#{$module}-default,
  96. &-avatar-square.#{$module}-small {
  97. .#{$prefix}-avatar {
  98. width: $height-tag_small;
  99. height: $height-tag_small;
  100. }
  101. }
  102. &-avatar-square.#{$module}-large {
  103. .#{$prefix}-avatar {
  104. width: $height-tag_large;
  105. height: $height-tag_large;
  106. }
  107. }
  108. &-avatar-circle.#{$module}-small,
  109. &-avatar-circle.#{$module}-default {
  110. // when avatarShape=circle change tag border radius
  111. border-radius: $height-tag_small * 0.5 + 1;
  112. .#{$prefix}-avatar {
  113. width: $width-tag_avatar_circle_small;
  114. height: $width-tag_avatar_circle_small;
  115. }
  116. }
  117. &-avatar-circle.#{$module}-large {
  118. border-radius: $height-tag_large * 0.5 + 1;
  119. .#{$prefix}-avatar {
  120. width: $width-tag_avatar_circle_large;
  121. height: $width-tag_avatar_circle_large;
  122. }
  123. }
  124. }
  125. .#{$module}-group {
  126. display: block;
  127. .#{$module} {
  128. margin-bottom: $spacing-tag_group-marginBottom;
  129. margin-right: $spacing-tag_group-marginRight;
  130. }
  131. height: auto;
  132. &-max.#{$module}-group-small {
  133. height: ($height-tag_small + 2);
  134. }
  135. &-max.#{$module}-group-large {
  136. height: ($height-tag_large + 2);
  137. }
  138. // &-small {
  139. // height: ($height-tag_small + 2);
  140. // }
  141. // &-large {
  142. // height: ($height-tag_large + 2);
  143. // }
  144. }
  145. .#{$module}-rest-group-popover {
  146. .#{$module} {
  147. margin-right: $spacing-tag_group-marginRight;
  148. margin-bottom: $spacing-tag_group-marginBottom;
  149. &:last-of-type {
  150. margin-right: 0;
  151. }
  152. }
  153. }
  154. @each $c in $colors {
  155. @each $t in $types {
  156. .#{$module}-#{$c}-#{$t} {
  157. @include tag-style($c, $t);
  158. }
  159. }
  160. }
  161. @each $t in $types {
  162. .#{$module}-white-#{$t} {
  163. background-color: $color-tag_white-bg-default;
  164. border: $width-tag-border solid $color-tag_white-border-default;
  165. color: $color-tag_white-text-default;
  166. // .#{$module}-close {
  167. // color: $tag-color-white-default-icon;
  168. // }
  169. }
  170. }
  171. .#{$module}-white-ghost,
  172. .#{$module}-white-light,
  173. .#{$module}-white-solid {
  174. .#{$module}-close {
  175. color: $color-tag_white-icon-default;
  176. }
  177. }
  178. .#{$module}-avatar-square,
  179. .#{$module}-avatar-circle {
  180. background-color: $color-tag_avatar-bg-default;
  181. border: $width-tag_avatar-border solid $color-tag_avatar-border-default;
  182. color: $color-tag_avatar-text-default;
  183. }
  184. .#{$module}-solid {
  185. .#{$module}-close {
  186. color: $color-tag_close-icon_deep-default;
  187. opacity: .8;
  188. &:hover {
  189. opacity: 1.0;
  190. }
  191. &:active {
  192. opacity: .9;
  193. }
  194. }
  195. }
  196. @import './rtl.scss';