Blame view

src/styles/mixins/input.less 4.76 KB
95436eeb   梁灏   add InputNumber UI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  .hover(@color: @input-hover-border-color) {
      border-color: tint(@color, 20%);
  }
  
  .active(@color: @input-hover-border-color) {
      border-color: tint(@color, 20%);
      outline: 0;
      box-shadow: 0 0 0 2px fade(@color, 20%);
  }
  
  .disabled() {
      background-color: @input-disabled-bg;
      opacity: 1;
      cursor: @cursor-disabled;
      color: #ccc;
      &:hover {
          .hover(@input-border-color);
      }
  }
  
  .input-large() {
86cf21fd   梁灏   optimize button l...
22
      font-size: @font-size-base;
95436eeb   梁灏   add InputNumber UI
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
      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;
      border-radius: @border-radius-small;
  }
  
  .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...
39
      font-size: @font-size-small;
95436eeb   梁灏   add InputNumber UI
40
41
42
43
44
45
46
47
      border: 1px solid @input-border-color;
      border-radius: @border-radius-base;
      color: @input-color;
      background-color: @input-bg;
      background-image: none;
      position: relative;
      cursor: text;
      .placeholder();
e2645048   jingsam   :fire: remove tra...
48
      transition: border @transition-time @ease-in-out, background @transition-time @ease-in-out, box-shadow @transition-time @ease-in-out;
95436eeb   梁灏   add InputNumber UI
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  
      &: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...
68
          font-size: @font-size-base;
95436eeb   梁灏   add InputNumber UI
69
70
71
72
73
74
75
76
77
78
      }
  
      // Size
      &-large {
          .input-large();
      }
  
      &-small {
          .input-small();
      }
0f822c9b   梁灏   add Input component
79
80
81
82
83
84
85
  }
  
  .input-group(@inputClass) {
      display: table;
      width: 100%;
      border-collapse: separate;
      position: relative;
86cf21fd   梁灏   optimize button l...
86
87
88
89
90
      font-size: @font-size-small;
  
      &-large{
          font-size: @font-size-base;
      }
0f822c9b   梁灏   add Input component
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
  
      // 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;
  
          &:not(:first-child):not(:last-child) {
              border-radius: 0;
          }
      }
  
      &-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...
142
          font-size: inherit;
0f822c9b   梁灏   add Input component
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
169
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
          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();
      }
  }