Skip to content

Commit 5562a55

Browse files
committed
Add support for feedback icons
1 parent fc0e9a1 commit 5562a55

File tree

5 files changed

+45
-26
lines changed

5 files changed

+45
-26
lines changed

dist/select2-bootstrap4.css

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,24 @@
5252
border-color: #ced4da;
5353
box-shadow: none; }
5454

55-
select.is-invalid ~ .select2-container--bootstrap4 .select2-selection,
56-
form.was-validated select:invalid ~ .select2-container--bootstrap4 .select2-selection {
57-
border-color: #dc3545; }
58-
select.is-invalid ~ .select2-container--bootstrap4 .select2-selection:focus,
59-
form.was-validated select:invalid ~ .select2-container--bootstrap4 .select2-selection:focus {
60-
border-color: #dc3545;
61-
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25); }
62-
6355
select.is-valid ~ .select2-container--bootstrap4 .select2-selection,
6456
form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-selection {
65-
border-color: #28a745; }
57+
border-color: #28a745;
58+
padding-right: calc(1em + 2.3125rem) !important;
59+
background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e") right 0.75rem center/8px 10px no-repeat, #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e") center right 1.75rem/calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) no-repeat; }
6660
select.is-valid ~ .select2-container--bootstrap4 .select2-selection:focus,
6761
form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-selection:focus {
6862
border-color: #28a745;
63+
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25); }
64+
65+
select.is-invalid ~ .select2-container--bootstrap4 .select2-selection,
66+
form.was-validated select:invalid ~ .select2-container--bootstrap4 .select2-selection {
67+
border-color: #dc3545;
68+
padding-right: calc(1em + 2.3125rem) !important;
69+
background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e") right 0.75rem center/8px 10px no-repeat, #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e") center right 1.75rem/calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) no-repeat; }
70+
select.is-invalid ~ .select2-container--bootstrap4 .select2-selection:focus,
71+
form.was-validated select:invalid ~ .select2-container--bootstrap4 .select2-selection:focus {
72+
border-color: #dc3545;
6973
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25); }
7074

7175
.select2-container--bootstrap4 .select2-dropdown {

dist/select2-bootstrap4.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ <h3>Example of <a href="https://github.com/ttskch/select2-bootstrap4-theme" targ
192192

193193
<div class="form-group">
194194
<label>Example of validated select</label>
195+
<select data-placeholder="Valid example" class="form-control is-valid" data-allow-clear="1">
196+
<option></option>
197+
</select>
198+
<div class="valid-feedback">
199+
Everything is fine.
200+
</div>
201+
</div>
202+
<div class="form-group">
195203
<select data-placeholder="Invalid example" class="form-control is-invalid" data-allow-clear="1">
196204
<option></option>
197205
</select>

0 commit comments

Comments
 (0)