Blame view

src/styles/mixins/input.less 5.74 KB
95436eeb   梁灏   add InputNumber UI
1
2
3
  .hover(@color: @input-hover-border-color) {
      border-color: tint(@color, 20%);
  }
e93f1e9a   梁灏   update some styles
4
5
6
  .hover-error() {
      border-color: @error-color;
  }
95436eeb   梁灏   add InputNumber UI
7
8
9
10
11
12
  
  .active(@color: @input-hover-border-color) {
      border-color: tint(@color, 20%);
      outline: 0;
      box-shadow: 0 0 0 2px fade(@color, 20%);
  }
e93f1e9a   梁灏   update some styles
13
14
15
16
17
  .active-error() {
      border-color: @error-color;
      outline: 0;
      box-shadow: 0 0 0 2px fade(@error-color, 20%);
  }
95436eeb   梁灏   add InputNumber UI
18
19
20
21
22
23
24
25
26
27
28
29
  
  .disabled() {
      background-color: @input-disabled-bg;
      opacity: 1;
      cursor: @cursor-disabled;
      color: #ccc;
      &:hover {
          .hover(@input-border-color);
      }
  }
  
  .input-large() {
86cf21fd   梁灏   optimize button l...
30
      font-size: @font-size-base;
95436eeb   梁灏   add InputNumber UI
31
32
33
34
35
36
37
      padding: @input-padding-vertical-large @input-padding-horizontal;
      height: @input-height-large;
  }
  
  .input-small() {
      padding: @input-padding-vertical-small @input-padding-horizontal;
      height: @input-height-small;
ab8aaf95   梁灏   add Dropdown comp...
38
      border-radius: @btn-border-radius-small;
95436eeb   梁灏   add InputNumber UI
39
40
41
42
43
44
45
46
  }
  
  .input() {
      display: inline-block;
      width: 100%;
      height: @input-height-base;
      line-height: @line-height-base;
      padding: @input-padding-vertical-base @input-padding-horizontal;
86cf21fd   梁灏   optimize button l...
47
      font-size: @font-size-small;
95436eeb   梁灏   add InputNumber UI
48
      border: 1px solid @input-border-color;
ab8aaf95   梁灏   add Dropdown comp...
49
      border-radius: @btn-border-radius;
95436eeb   梁灏   add InputNumber UI
50
51
52
53
54
55
      color: @input-color;
      background-color: @input-bg;
      background-image: none;
      position: relative;
      cursor: text;
      .placeholder();
e2645048   jingsam   :fire: remove tra...
56
      transition: border @transition-time @ease-in-out, background @transition-time @ease-in-out, box-shadow @transition-time @ease-in-out;
95436eeb   梁灏   add InputNumber UI
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  
      &:hover {
          .hover();
      }
  
      &:focus {
          .active();
      }
  
      &[disabled],
      fieldset[disabled] & {
          .disabled();
      }
  
      // Reset height for textarea
      textarea& {
          max-width: 100%;
          height: auto;
          vertical-align: bottom;
86cf21fd   梁灏   optimize button l...
76
          font-size: @font-size-base;
95436eeb   梁灏   add InputNumber UI
77
78
79
80
81
82
83
84
85
86
      }
  
      // Size
      &-large {
          .input-large();
      }
  
      &-small {
          .input-small();
      }
0f822c9b   梁灏   add Input component
87
88
  }
  
e93f1e9a   梁灏   update some styles
89
90
91
92
93
94
95
96
97
98
  .input-error() {
      border: 1px solid @error-color;
      &:hover {
          .hover-error;
      }
      &:focus {
          .active-error;
      }
  }
  
0f822c9b   梁灏   add Input component
99
100
101
102
103
  .input-group(@inputClass) {
      display: table;
      width: 100%;
      border-collapse: separate;
      position: relative;
86cf21fd   梁灏   optimize button l...
104
      font-size: @font-size-small;
8a83e7c4   梁灏   update Form
105
      top: 1px; // fixed when using in form inline,
86cf21fd   梁灏   optimize button l...
106
107
108
109
  
      &-large{
          font-size: @font-size-base;
      }
0f822c9b   梁灏   add Input component
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  
      // Undo padding and float of grid classes
      &[class*="col-"] {
          float: none;
          padding-left: 0;
          padding-right: 0;
      }
  
      > [class*="col-"] {
          padding-right: 8px;
      }
  
      &-prepend,
      &-append,
      > .@{inputClass} {
          display: table-cell;
  
e2affe49   梁灏   fixed #397
127
128
129
130
131
132
133
134
135
136
137
          //&:not(:first-child):not(:last-child) {
          //    border-radius: 0;
          //}
      }
      &-with-prepend .@{inputClass} {
          border-top-left-radius: 0;
          border-bottom-left-radius: 0;
      }
      &-with-append .@{inputClass} {
          border-top-right-radius: 0;
          border-bottom-right-radius: 0;
0f822c9b   梁灏   add Input component
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
      }
  
      &-prepend .@{css-prefix}btn,
      &-append .@{css-prefix}btn
      {
          border-color: transparent;
          background-color: transparent;
          color: inherit;
          margin: -(@input-padding-vertical-base + 1) (-@input-padding-horizontal);
      }
  
      &-prepend,
      &-append
      {
          width: 1px; // To make addon/wrap as small as possible
          white-space: nowrap;
          vertical-align: middle;
      }
  
      .@{inputClass} {
          width: 100%;
          float: left;
          margin-bottom: 0;
          position: relative;
          z-index: 2;
      }
  
      &-prepend,
      &-append
      {
          padding: @input-padding-vertical-base @input-padding-horizontal;
86cf21fd   梁灏   optimize button l...
169
          font-size: inherit;
0f822c9b   梁灏   add Input component
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
          font-weight: normal;
          line-height: 1;
          color: @input-color;
          text-align: center;
          background-color: #eee;
          border: 1px solid @input-border-color;
          border-radius: @border-radius-base;
  
          // Reset Select's style in addon
          .@{css-prefix}select {
              margin: -(@input-padding-vertical-base + 1) (-@input-padding-horizontal);  // lesshint spaceAroundOperator: false
  
              &-selection {
                  background-color: inherit;
                  margin: -1px;
                  border: 1px solid transparent;
              }
  
              &-visible .@{css-prefix}select-selection{
                  box-shadow: none;
              }
          }
      }
  
      // Reset rounded corners
      > span > .@{inputClass}:first-child,
      > .@{inputClass}:first-child,
      &-prepend
      {
          border-bottom-right-radius: 0 !important;
          border-top-right-radius: 0 !important;
  
          // Reset Select's style in addon
          .@{css-prefix}-select .@{css-prefix}-select-selection {
              border-bottom-right-radius: 0;
              border-top-right-radius: 0;
          }
      }
  
      &-prepend {
          border-right: 0;
      }
      &-append {
          border-left: 0;
      }
  
      > .@{inputClass}:last-child,
      &-append
      {
          border-bottom-left-radius: 0 !important;
          border-top-left-radius: 0 !important;
  
          // Reset Select's style in addon
          .@{css-prefix}-select .@{css-prefix}-select-selection {
              border-bottom-left-radius: 0;
              border-top-left-radius: 0;
          }
      }
  
      // Sizing options
      &-large .@{inputClass},
      &-large > &-prepend,
      &-large > &-append
      {
          .input-large();
      }
  
      &-small .@{inputClass},
      &-small > &-prepend,
      &-small > &-append
      {
          .input-small();
      }
  }
e93f1e9a   梁灏   update some styles
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
  
  .input-group-error{
      &-prepend,
      &-append
      {
          background-color: #fff;
          border: 1px solid @error-color;
          .@{css-prefix}select {
              &-selection {
                  background-color: inherit;
                  border: 1px solid transparent;
              }
          }
      }
      &-prepend {
          border-right: 0;
      }
      &-append {
          border-left: 0;
      }
  }