tag.scss 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. &-prefix-icon {
  47. display: flex;
  48. padding-right: $spacing-tag_prefix_icon_paddingRight;
  49. }
  50. &-suffix-icon {
  51. display: flex;
  52. padding-left: $spacing-tag_suffix_icon_paddingLeft;
  53. }
  54. &-content {
  55. flex: 1;
  56. &-ellipsis {
  57. overflow: hidden;
  58. white-space: nowrap;
  59. text-overflow: ellipsis;
  60. }
  61. &-center {
  62. display: flex;
  63. @include all-center;
  64. height: 100%;
  65. min-width: 0;
  66. }
  67. }
  68. &-close {
  69. @include all-center;
  70. color: $color-tag_close-icon-default;
  71. padding-left: $spacing-tag_close-paddingLeft;
  72. cursor: pointer;
  73. &:hover {
  74. color: $color-tag_close-icon-hover;
  75. }
  76. &:active {
  77. color: $color-tag_close-icon-active;
  78. }
  79. }
  80. &-closable {
  81. padding: $spacing-tag_closable-paddingTop $spacing-tag_closable-paddingRight $spacing-tag_closable-paddingBottom
  82. $spacing-tag_closable-paddingLeft;
  83. }
  84. &-avatar-square,
  85. &-avatar-circle {
  86. .#{$prefix}-avatar {
  87. margin-right: $spacing-tag_avatar-marginRight;
  88. }
  89. }
  90. &-avatar-square {
  91. padding: $spacing-tag_avatar_square-paddingTop $spacing-tag_avatar_square-paddingRight
  92. $spacing-tag_avatar_square-paddingBottom $spacing-tag_avatar_square-paddingLeft;
  93. .#{$prefix}-avatar {
  94. & > img {
  95. background-color: $color-tag_avatar_square_img-bg-default;
  96. }
  97. }
  98. }
  99. &-avatar-circle {
  100. padding: $spacing-tag_avatar_circle-paddingTop $spacing-tag_avatar_circle-paddingRight
  101. $spacing-tag_avatar_circle-paddingBottom $spacing-tag_avatar_circle-paddingLeft;
  102. }
  103. &-avatar-square.#{$module}-default,
  104. &-avatar-square.#{$module}-small {
  105. .#{$prefix}-avatar {
  106. width: $height-tag_small;
  107. height: $height-tag_small;
  108. }
  109. }
  110. &-avatar-square.#{$module}-large {
  111. .#{$prefix}-avatar {
  112. width: $height-tag_large;
  113. height: $height-tag_large;
  114. }
  115. }
  116. &-avatar-circle.#{$module}-small,
  117. &-avatar-circle.#{$module}-default {
  118. // when avatarShape=circle change tag border radius
  119. border-radius: $height-tag_small * 0.5 + 1;
  120. .#{$prefix}-avatar {
  121. width: $width-tag_avatar_circle_small;
  122. height: $width-tag_avatar_circle_small;
  123. }
  124. }
  125. &-avatar-circle.#{$module}-large {
  126. border-radius: $height-tag_large * 0.5 + 1;
  127. .#{$prefix}-avatar {
  128. width: $width-tag_avatar_circle_large;
  129. height: $width-tag_avatar_circle_large;
  130. }
  131. }
  132. }
  133. .#{$module}-group {
  134. display: block;
  135. height: auto;
  136. .#{$module} {
  137. margin-bottom: $spacing-tag_group-marginBottom;
  138. margin-right: $spacing-tag_group-marginRight;
  139. }
  140. &-max.#{$module}-group-small {
  141. height: ($height-tag_small + 2);
  142. }
  143. &-max.#{$module}-group-large {
  144. height: ($height-tag_large + 2);
  145. }
  146. // &-small {
  147. // height: ($height-tag_small + 2);
  148. // }
  149. // &-large {
  150. // height: ($height-tag_large + 2);
  151. // }
  152. }
  153. .#{$module}-rest-group-popover {
  154. .#{$module} {
  155. margin-right: $spacing-tag_group-marginRight;
  156. margin-bottom: $spacing-tag_group-marginBottom;
  157. &:last-of-type {
  158. margin-right: 0;
  159. }
  160. }
  161. }
  162. @each $c in $colors {
  163. @each $t in $types {
  164. .#{$module}-#{$c}-#{$t} {
  165. @include tag-style($c, $t);
  166. }
  167. }
  168. }
  169. @each $t in $types {
  170. .#{$module}-white-#{$t} {
  171. background-color: $color-tag_white-bg-default;
  172. border: $width-tag-border solid $color-tag_white-border-default;
  173. color: $color-tag_white-text-default;
  174. // .#{$module}-close {
  175. // color: $tag-color-white-default-icon;
  176. // }
  177. }
  178. }
  179. .#{$module}-white-ghost,
  180. .#{$module}-white-light,
  181. .#{$module}-white-solid {
  182. .#{$module}-close {
  183. color: $color-tag_white-icon-default;
  184. }
  185. }
  186. .#{$module}-avatar-square,
  187. .#{$module}-avatar-circle {
  188. background-color: $color-tag_avatar-bg-default;
  189. border: $width-tag_avatar-border solid $color-tag_avatar-border-default;
  190. color: $color-tag_avatar-text-default;
  191. }
  192. .#{$module}-solid {
  193. .#{$module}-close {
  194. color: $color-tag_close-icon_deep-default;
  195. opacity: .8;
  196. &:hover {
  197. opacity: 1.0;
  198. }
  199. &:active {
  200. opacity: .9;
  201. }
  202. }
  203. }
  204. @import './rtl.scss';