index.scss 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. @import '@/uni_modules/lime-style/index.scss';
  2. @import '@/uni_modules/lime-style/mixins/utilities.scss';
  3. @import '@/uni_modules/lime-style/mixins/hairline.scss';
  4. $input: #{$prefix}-input;
  5. /* #ifdef uniVersion >= 4.75 */
  6. $use-css-var: true;
  7. /* #endif */
  8. $input-padding-y: create-var(input-padding-y, $spacer); //输入框垂直方向内间距
  9. $input-padding-x: create-var(input-padding-x, $spacer); //输入框垂直方向内间距
  10. $input-text-color: create-var(input-text-color, $text-color-1); // 'default' 状态输入框文本颜色
  11. $input-success-text-color: create-var(input-success-text-color, $success-color); // 'success' 状态输入框文本颜色
  12. $input-warning-text-color: create-var(input-warning-text-color, $warning-color); // 'warning' 状态输入框文本颜色
  13. $input-error-text-color: create-var(input-error-text-color, $error-color); // 'error' 状态输入框文本颜色
  14. $input-tips-color: create-var(input-tips-color, $text-color-3); // 'default' 状态辅助文本颜色
  15. $input-success-tips-color: create-var(input-success-tips-color, $success-color); // 'success' 状态辅助文本颜色
  16. $input-warning-tips-color: create-var(input-warning-tips-color, $warning-color); // 'warning' 状态辅助文本颜色
  17. $input-error-tips-color: create-var(input-error-tips-color, $error-color); // 'error' 状态辅助文本颜色
  18. $input-bg-color: create-var(input-bg-color, $bg-color-container); // 输入框背景颜色
  19. $input-border-color: create-var(input-border-color, $border-color-2); // 输入框分割线颜色
  20. $input-border-left-space: create-var(input-border-left-space, $spacer);
  21. $input-border-right-space: create-var(input-border-right-space, 0);
  22. $input-placeholder-text-color: create-var(input-placeholder-text-color, $text-color-3); // 输入框占位符文本颜色
  23. $input-placeholder-text-font-size: create-var(input-placeholder-text-font-size, 28rpx); // 输入框占位符文本字体大小
  24. $input-prefix-icon-color: create-var(input-prefix-icon-color, $text-color-1); // // 输入框前缀图标颜色
  25. $input-suffix-icon-color: create-var(input-suffix-icon-color, $text-color-3); // 输入框后缀图标颜色
  26. $input-suffix-icon-size: create-var(input-suffix-icon-size, 22px); // 输入框后缀图标颜色
  27. $input-label-text-color: create-var(input-label-text-color, $text-color-1); // 左侧文本颜色
  28. $input-suffix-text-color: create-var(input-suffix-text-color, $text-color-1); // 后置图标前的后置内容文本颜色
  29. $input-disabled-text-color: create-var(input-disabled-text-color, $text-color-4); // 输入框禁用态文本颜色
  30. $input-disabled-bg-color: create-var(input-disabled-bg-color, $fill-3); // 输入框禁用态文本颜色
  31. $input-border-radius: create-var(input-border-radius, $border-radius); // 边框圆角大小
  32. $input-label-font-size: create-var(input-label-min-width, $font-size-md);
  33. $input-classic-padding-x: create-var(input-classic-padding-x, $spacer);
  34. $input-classic-padding-y: create-var(input-classic-padding-y, $spacer-sm);
  35. /* #ifndef UNI-APP-X && APP */
  36. $input-label-min-width: create-var(input-label-min-width, 2em);
  37. $input-label-max-width: create-var(input-label-max-width, 5em);
  38. /* #endif */
  39. /* #ifdef UNI-APP-X && APP */
  40. $input-label-min-width: create-var(input-label-min-width, 32px);
  41. $input-label-max-width: create-var(input-label-max-width, 80px);
  42. /* #endif */
  43. .#{$input} {
  44. @include flex;
  45. background-color: $input-bg-color;
  46. align-items: center;
  47. // flex: 1;
  48. width: 100%;
  49. box-sizing: border-box;
  50. // padding: $input-padding-y $input-padding-x;
  51. @include padding($input-padding-y $input-padding-x);
  52. &--horizontal {
  53. @include flex-row;
  54. }
  55. &--vertical {
  56. @include flex-column;
  57. align-items: stretch;//flex-start;
  58. }
  59. /* #ifdef UNI-APP-X && APP */
  60. &__border {
  61. position: absolute;
  62. left: $input-border-left-space;
  63. right: $input-border-right-space;
  64. bottom: 0;
  65. height: 1rpx;
  66. background-color: $input-border-color;
  67. }
  68. /* #endif */
  69. &--border {
  70. position: relative;
  71. /* #ifdef APP-HARMONY */
  72. // border-bottom: 0.5px solid $input-border-color;
  73. /* #endif */
  74. /* #ifndef UNI-APP-X && APP */
  75. &::after {
  76. @include hairline-bottom($input-border-color, $input-border-left-space, $input-border-right-space)
  77. }
  78. /* #endif */
  79. }
  80. &--classic {
  81. // padding: $input-classic-padding;
  82. @include padding($input-classic-padding-y $input-classic-padding-x);
  83. // border-radius: $input-border-radius;
  84. @include border-radius($input-border-radius);
  85. // border: 0.5px solid $input-border-color;
  86. border-width: 0.5px;
  87. border-style: solid;
  88. // align-items: center;
  89. &-default {
  90. border-color: $input-border-color
  91. }
  92. &-error {
  93. border-color: $input-error-tips-color
  94. }
  95. &-success {
  96. border-color: $input-success-tips-color
  97. }
  98. &-warning {
  99. border-color: $input-warning-tips-color
  100. }
  101. &-disabled {
  102. background-color: $input-disabled-bg-color
  103. }
  104. }
  105. &__wrap--prefix {
  106. @include flex;
  107. @include flex-row;
  108. align-items: center;
  109. }
  110. &__icon--prefix {
  111. font-size: 44rpx;
  112. color: $input-prefix-icon-color;
  113. /* #ifndef UNI-APP-X && APP */
  114. display: inline-flex;
  115. /* #endif */
  116. /* #ifndef UNI-APP-X && APP*/
  117. text {
  118. font-size: inherit;
  119. color: inherit
  120. }
  121. /* #endif */
  122. }
  123. &__label {
  124. min-width: $input-label-min-width;
  125. font-size: $font-size-md;
  126. line-height: 48rpx;
  127. color: $input-label-text-color;
  128. margin-right: $spacer;
  129. /* #ifndef UNI-APP-X && APP*/
  130. word-wrap: break-word;
  131. /* #endif */
  132. .#{$input}--horizontal & {
  133. max-width: $input-label-max-width;
  134. }
  135. .#{$input}--vertical & {
  136. font-size: $font-size;
  137. padding-bottom: 8rpx;
  138. }
  139. &--gap {
  140. margin-left: 8rpx;
  141. }
  142. }
  143. &__wrap {
  144. // width: 100%;
  145. @include flex;
  146. @include flex-column;
  147. // flex-wrap: wrap; // 鸿蒙加上这句会导致提示文本不显示
  148. justify-content: center;
  149. // flex-shrink: 1;
  150. flex: 1;
  151. .#{$input}__content {
  152. @include flex;
  153. @include flex-row;
  154. width: 100%;
  155. align-items: center;
  156. // line-height: 48rpx;
  157. // font-size: $font-size-md;
  158. }
  159. &--clearable-icon,
  160. &--suffix-icon,
  161. &--suffix {
  162. flex: 0 0 auto;
  163. padding-left: $spacer-sm;
  164. box-sizing: content-box;
  165. }
  166. &--clearable-icon,
  167. &--suffix-icon {
  168. font-size: $input-suffix-icon-size !important;
  169. color: $input-suffix-icon-color !important;
  170. /* #ifndef UNI-APP-X && APP*/
  171. display: inline-flex;
  172. text {
  173. font-size: inherit;
  174. color: inherit
  175. }
  176. /* #endif */
  177. }
  178. &--suffix {
  179. // font-size: $font-size-md;
  180. // color: $input-suffix-text-color;
  181. &-text{
  182. font-size: $font-size-md;
  183. color: $input-suffix-text-color;
  184. }
  185. /* #ifndef UNI-APP-X && APP*/
  186. text {
  187. font-size: inherit;
  188. color: inherit
  189. }
  190. /* #endif */
  191. }
  192. }
  193. &__control {
  194. flex: 1;
  195. /* #ifdef WEB */
  196. display: flex;
  197. align-items: center;
  198. /* #endif */
  199. box-sizing: border-box;
  200. // width: 100%;
  201. min-width: 0; // for flex-shrink in field__button
  202. min-height: 48rpx;
  203. margin: 0;
  204. padding: 0;
  205. color: $input-text-color;
  206. // line-height: inherit;
  207. background-color: transparent;
  208. border: 0;
  209. // resize: none;
  210. // font-size: inherit;
  211. /* #ifndef UNI-APP-X && APP */
  212. line-height: 48rpx;
  213. /* #endif */
  214. font-size: $font-size-md;
  215. &--disabled {
  216. color: $input-disabled-text-color;
  217. opacity: 1;
  218. /* #ifndef UNI-APP-X && APP */
  219. cursor: not-allowed;
  220. -webkit-text-fill-color: currentColor; // fix disabled color in iOS
  221. /* #endif */
  222. }
  223. &--read-only {
  224. /* #ifndef UNI-APP-X && APP */
  225. cursor: default;
  226. /* #endif */
  227. }
  228. }
  229. &--left {
  230. text-align: left;
  231. }
  232. &--right {
  233. text-align: right;
  234. }
  235. &--center {
  236. text-align: center;
  237. }
  238. &__placeholder {
  239. color: $input-placeholder-text-color;
  240. font-size: $input-placeholder-text-font-size;
  241. &--disabled {
  242. font-size: $input-placeholder-text-font-size;
  243. color: $input-disabled-text-color;
  244. }
  245. }
  246. &__tips {
  247. font-size: $font-size-sm;
  248. line-height: 40rpx;
  249. padding-top: 8rpx;
  250. &--default {
  251. color: $input-tips-color;
  252. }
  253. &--success {
  254. color: $input-success-tips-color;
  255. }
  256. &--warning {
  257. color: $input-warning-tips-color;
  258. }
  259. &--error {
  260. color: $input-error-tips-color;
  261. }
  262. }
  263. }