select.scss 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. @use 'sass:map';
  2. @use 'mixins/mixins' as *;
  3. @use 'mixins/utils' as *;
  4. @use 'mixins/var' as *;
  5. @use 'common/var' as *;
  6. @use './select-dropdown.scss';
  7. @use './select/common.scss' as *;
  8. @mixin select-tag-normal {
  9. white-space: normal;
  10. z-index: getCssVar('index-normal');
  11. display: flex;
  12. align-items: center;
  13. flex-wrap: wrap;
  14. cursor: pointer;
  15. .#{$namespace}-tag {
  16. box-sizing: border-box;
  17. border-color: transparent;
  18. margin: 2px 6px 2px 0;
  19. &:last-child {
  20. margin-right: 0;
  21. }
  22. .#{$namespace}-icon-close {
  23. background-color: getCssVar('text-color', 'placeholder');
  24. right: -7px;
  25. top: 0;
  26. color: $color-white;
  27. &:hover {
  28. background-color: getCssVar('text-color', 'secondary');
  29. }
  30. &::before {
  31. display: block;
  32. transform: translate(0, 0.5px);
  33. }
  34. }
  35. }
  36. .#{$namespace}-tag--info {
  37. background-color: getCssVar('fill-color');
  38. }
  39. }
  40. @include b(select) {
  41. @include set-component-css-var('select', $select);
  42. }
  43. @include b(select) {
  44. display: inline-block;
  45. position: relative;
  46. vertical-align: middle;
  47. line-height: map.get($input-height, 'default');
  48. @include e(popper) {
  49. @include picker-popper(
  50. map.get($select-dropdown, 'bg-color'),
  51. map.get($select-dropdown, 'border'),
  52. map.get($select-dropdown, 'shadow')
  53. );
  54. }
  55. .#{$namespace}-select-tags-wrapper {
  56. &.has-prefix {
  57. margin-left: map.get($select-tags-prefix-padding, 'default');
  58. }
  59. }
  60. @each $size in (large, small) {
  61. @include m($size) {
  62. line-height: map.get($input-height, $size);
  63. .#{$namespace}-select-tags-wrapper {
  64. &.has-prefix {
  65. margin-left: map.get($select-tags-prefix-padding, $size);
  66. }
  67. }
  68. }
  69. }
  70. .#{$namespace}-select__tags > span {
  71. display: inline-block;
  72. }
  73. &:hover:not(.#{$namespace}-select--disabled) {
  74. .#{$namespace}-input__wrapper {
  75. box-shadow: 0 0 0 1px getCssVar('select-border-color-hover') inset;
  76. }
  77. }
  78. @include select-common(select);
  79. .#{$namespace}-input__wrapper {
  80. cursor: pointer;
  81. @include when(focus) {
  82. @include inset-input-border(
  83. getCssVar('select-input-focus-border-color'),
  84. true
  85. );
  86. }
  87. }
  88. .#{$namespace}-input__inner {
  89. cursor: pointer;
  90. }
  91. .#{$namespace}-input {
  92. display: flex;
  93. & .#{$namespace}-select__caret {
  94. color: getCssVar('select-input-color');
  95. font-size: getCssVar('select-input-font-size');
  96. transition: transform getCssVar('transition-duration');
  97. transform: rotateZ(0deg);
  98. cursor: pointer;
  99. @include when(reverse) {
  100. transform: rotateZ(-180deg);
  101. }
  102. @include when(show-close) {
  103. font-size: getCssVar('select-font-size');
  104. text-align: center;
  105. transform: rotateZ(0deg);
  106. border-radius: getCssVar('border-radius-circle');
  107. color: getCssVar('select-input-color');
  108. transition: getCssVar('transition', 'color');
  109. &:hover {
  110. color: getCssVar('select-close-hover-color');
  111. }
  112. }
  113. &.#{$namespace}-icon {
  114. position: relative;
  115. height: inherit;
  116. z-index: 2;
  117. }
  118. }
  119. &.is-disabled {
  120. & .#{$namespace}-input__wrapper {
  121. cursor: not-allowed;
  122. &:hover {
  123. @include inset-input-border(#{getCssVar('select-disabled-border')});
  124. }
  125. }
  126. & .#{$namespace}-input__inner {
  127. cursor: not-allowed;
  128. }
  129. & .#{$namespace}-select__caret {
  130. cursor: not-allowed;
  131. }
  132. }
  133. &.is-focus .#{$namespace}-input__wrapper {
  134. @include inset-input-border(
  135. getCssVar('select-input-focus-border-color'),
  136. true
  137. );
  138. }
  139. }
  140. @include e(input) {
  141. border: none;
  142. outline: none;
  143. padding: 0;
  144. margin-left: 15px;
  145. color: getCssVar('select-multiple-input-color');
  146. font-size: getCssVar('select-font-size');
  147. appearance: none;
  148. height: 28px;
  149. background-color: transparent;
  150. @include when(disabled) {
  151. cursor: not-allowed;
  152. }
  153. &--iOS {
  154. position: absolute;
  155. left: 0;
  156. top: 0;
  157. z-index: 6;
  158. }
  159. @include when(small) {
  160. height: 14px;
  161. }
  162. }
  163. @include e(close) {
  164. cursor: pointer;
  165. position: absolute;
  166. top: 8px;
  167. z-index: getCssVar('index-top');
  168. right: 25px;
  169. color: getCssVar('select-input-color');
  170. line-height: 18px;
  171. font-size: getCssVar('select-input-font-size');
  172. &:hover {
  173. color: getCssVar('select-close-hover-color');
  174. }
  175. }
  176. @include e(tags) {
  177. position: absolute;
  178. line-height: normal;
  179. top: 50%;
  180. transform: translateY(-50%);
  181. @include select-tag-normal;
  182. @include when(disabled) {
  183. cursor: not-allowed;
  184. }
  185. }
  186. @include e(collapse-tags) {
  187. @include select-tag-normal;
  188. }
  189. @include e(collapse-tag) {
  190. line-height: inherit;
  191. height: inherit;
  192. display: flex;
  193. }
  194. }