Blame view

node_modules/bootstrap-vue/src/components/form-input/_form-input.scss 5.62 KB
4cd4fd28   郭伟龙   feat: 初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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
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
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
217
// Temporary fix for cssnano bug: https://github.com/cssnano/cssnano/issues/712
// By moving center to last value in `background-position` property
// See: https://github.com/bootstrap-vue/bootstrap-vue/issues/2599
@if $enable-validation-icons {
  .form-control {
    .was-validated &:invalid,
    .was-validated &:valid,
    &.is-invalid,
    &.is-valid {
      background-position: right $input-height-inner-quarter center;
    }
  }
}

// Bootstrap v4.x does not have special styling for color input
// So we define some basic styles to compensate
input[type="color"].form-control {
  height: $input-height;
  // We use the smaller padding to make the color block larger
  padding: ($input-padding-y-sm * 0.5) ($input-padding-x-sm * 0.5);
}

input[type="color"].form-control.form-control-sm,
.input-group-sm input[type="color"].form-control {
  height: $input-height-sm;
  // We use the smaller padding to make the color block larger
  padding: ($input-padding-y-sm * 0.5) ($input-padding-x-sm * 0.5);
}

input[type="color"].form-control.form-control-lg,
.input-group-lg input[type="color"].form-control {
  height: $input-height-lg;
  padding: ($input-padding-y-sm * 0.5) ($input-padding-x-sm * 0.5);
}

input[type="color"].form-control:disabled {
  // Disabled styling needs to be a bit different than regular inputs
  background-color: $gray-500;
  opacity: $btn-disabled-opacity;
}

// --- Base `.input-group > .custom-range` styling (no PR yet on Bootstrap v4) ---
.input-group {
  > .custom-range {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    margin-bottom: 0;

    + .form-control,
    + .form-control-plaintext,
    + .custom-select,
    + .custom-range,
    + .custom-file {
      margin-left: -$input-border-width;
    }
  }

  > .form-control,
  > .form-control-plaintext,
  > .custom-select,
  > .custom-range,
  > .custom-file {
    + .custom-range {
      margin-left: -$input-border-width;
    }
  }

  > .custom-range:focus {
    z-index: 3;
  }

  > .custom-range {
    &:not(:last-child) {
      @include border-right-radius(0);
    }
    &:not(:first-child) {
      @include border-left-radius(0);
    }
  }

  > .custom-range {
    height: $input-height;
    padding: 0 $input-padding-x;
    background-color: $input-bg;
    background-clip: padding-box;
    border: $input-border-width solid $input-border-color;
    height: $input-height;

    @if $enable-rounded {
      border-radius: $input-border-radius;
    } @else {
      border-radius: 0;
    }

    @include box-shadow($input-box-shadow);
    @include transition($input-transition);
    // Bootstrap v4.3.2 has deprecated this mixin
    // @include form-control-focus();
    // So we manually add its content here
    &:focus {
      color: $input-focus-color; // only needed for fallback to text input
      background-color: $input-focus-bg;
      border-color: $input-focus-border-color;
      outline: 0;
      @if $enable-shadows {
        box-shadow: $input-box-shadow, $input-focus-box-shadow;
      } @else {
        box-shadow: $input-focus-box-shadow;
      }
    }

    &:disabled,
    &[readonly] {
      background-color: $input-disabled-bg;
    }
  }
}

.input-group-lg > .custom-range {
  height: $input-height-lg;
  padding: 0 $input-padding-x-lg;
  @include border-radius($input-border-radius-lg);
}

.input-group-sm > .custom-range {
  height: $input-height-sm;
  padding: 0 $input-padding-x-sm;
  @include border-radius($input-border-radius-sm);
}

// --- <b-form-input>: custom-range validation styling - valid (no PR yet for Bootstrap v4.2) ---
// Mixin for generating `.input-group .custom-range` validation styling
@mixin bv-custom-range-validation-state($state, $color) {
  .input-group .custom-range {
    .was-validated &:#{$state},
    &.is-#{$state} {
      border-color: $color;

      &:focus {
        border-color: $color;
        box-shadow: 0 0 0 $input-focus-width rgba($color, 0.25);
      }
    }
  }

  .custom-range {
    .was-validated &:#{$state},
    &.is-#{$state} {
      // Pseudo-elements must be split across multiple rulesets to have an affect
      &:focus {
        &::-webkit-slider-thumb {
          box-shadow: 0 0 0 1px $body-bg, 0 0 0 $input-btn-focus-width lighten($color, 35%);
        }
        &::-moz-range-thumb {
          box-shadow: 0 0 0 1px $body-bg, 0 0 0 $input-btn-focus-width lighten($color, 35%);
        }
        &::-ms-thumb {
          box-shadow: 0 0 0 1px $body-bg, 0 0 0 $input-btn-focus-width lighten($color, 35%);
        }
      }

      &::-webkit-slider-thumb {
        background-color: $color;
        background-image: none;

        &:active {
          background-color: lighten($color, 35%);
          background-image: none;
        }
      }

      &::-webkit-slider-runnable-track {
        background-color: rgba($color, 0.35);
      }

      &::-moz-range-thumb {
        background-color: $color;
        background-image: none;

        &:active {
          background-color: lighten($color, 35%);
          background-image: none;
        }
      }

      &::-moz-range-track {
        background: rgba($color, 0.35);
      }

      ~ .#{$state}-feedback,
      ~ .#{$state}-tooltip {
        display: block;
      }

      &::-ms-thumb {
        background-color: $color;
        background-image: none;

        &:active {
          background-color: lighten($color, 35%);
          background-image: none;
        }
      }

      &::-ms-track-lower {
        background: rgba($color, 0.35);
      }
      &::-ms-track-upper {
        background: rgba($color, 0.35);
      }
    }
  }
}

@include bv-custom-range-validation-state("valid", $form-feedback-valid-color);
@include bv-custom-range-validation-state("invalid", $form-feedback-invalid-color);