Skip to content

Commit 849a9c7

Browse files
committed
Started work on the classic theme
Some people like the old theme, so we're going to also include that one as well as the easier-to-extend flat theme.
1 parent a2766b7 commit 849a9c7

16 files changed

Lines changed: 216 additions & 173 deletions

dist/css/select2.css

Lines changed: 48 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
display: block;
4646
padding: 4px; }
4747
.select2-container .dropdown .search input {
48-
outline: 0;
4948
padding: 4px;
5049
width: 100%; }
5150
.select2-container .dropdown .results {
@@ -124,71 +123,54 @@
124123
background-color: #5897fb;
125124
color: white; }
126125

127-
.s2-container {
128-
margin: 0;
129-
position: relative;
130-
zoom: 1;
131-
vertical-align: middle; }
132-
.s2-container.s2-active {
133-
border: 1px solid #5897fb;
134-
border-top: bottom; }
135-
.s2-container .s2-single-select {
136-
display: block;
137-
height: 26px;
138-
padding: 0 0 0 8px;
139-
overflow: hidden;
140-
position: relative;
141-
border: 1px solid #aaa;
142-
white-space: nowrap;
143-
line-height: 26px;
126+
.select2-container.select2-theme-classic .selection .single-select {
127+
background-color: #f6f6f6;
128+
border: 1px solid #aaa;
129+
border-radius: 4px;
130+
outline: 0;
131+
background-image: -webkit-linear-gradient(top, #ffffff 50%, #eee 100%);
132+
background-image: -o-linear-gradient(top, #ffffff 50%, #eee 100%);
133+
background-image: linear-gradient(to bottom, #ffffff 50%, #eee 100%);
134+
background-repeat: repeat-x;
135+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eee', GradientType=0); }
136+
.select2-container.select2-theme-classic .selection .single-select:focus {
137+
border: 1px solid #5897fb; }
138+
.select2-container.select2-theme-classic .selection .single-select .rendered-selection {
144139
color: #444;
145-
text-decoration: none;
146-
border-radius: 4px;
147-
background-clip: padding-box;
148-
-webkit-touch-callout: none;
149-
-webkit-user-select: none;
150-
-moz-user-select: none;
151-
-ms-user-select: none;
152-
user-select: none;
153-
background-color: #fff;
154-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff));
155-
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%);
156-
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%);
157-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0);
158-
background-image: linear-gradient(to top, #eee 0%, #fff 50%); }
159-
.s2-container .s2-single-select .s2-selection {
160-
margin-right: 26px;
140+
line-height: 28px; }
141+
.select2-container.select2-theme-classic .selection .single-select .rendered-selection .placeholder {
142+
color: #999; }
143+
.select2-container.select2-theme-classic.open .selection .single-select {
144+
border: 1px solid #5897fb;
145+
background-image: -webkit-linear-gradient(top, #eee 50%, #ffffff 100%);
146+
background-image: -o-linear-gradient(top, #eee 50%, #ffffff 100%);
147+
background-image: linear-gradient(to bottom, #eee 50%, #ffffff 100%);
148+
background-repeat: repeat-x;
149+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eee', endColorstr='#ffffff', GradientType=0); }
150+
.select2-container.select2-theme-classic.open .selection .single-select, .select2-container.select2-theme-classic.open .selection .multiple-select {
151+
border-bottom: none;
152+
border-bottom-left-radius: 0;
153+
border-bottom-right-radius: 0; }
154+
.select2-container.select2-theme-classic .dropdown {
155+
background-color: white;
156+
border-top: none; }
157+
.select2-container.select2-theme-classic .dropdown .search input {
158+
border: 1px solid #aaa;
159+
outline: 0; }
160+
.select2-container.select2-theme-classic .dropdown .results > .options {
161+
max-height: 200px;
162+
overflow-y: auto; }
163+
.select2-container.select2-theme-classic .dropdown .results .options .option[role=group] {
164+
padding: 0; }
165+
.select2-container.select2-theme-classic .dropdown .results .options .option[role=group] .group-label {
166+
cursor: default;
161167
display: block;
162-
overflow: hidden;
163-
white-space: nowrap;
164-
text-overflow: ellipsis; }
165-
.s2-container .s2-open .select2-container-active .select2-choice, .s2-container .s2-open .select2-container-active .select2-choices {
166-
border: 1px solid #5897fb;
167-
outline: none;
168-
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
169-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); }
170-
171-
.s2-search input {
172-
-webkit-box-sizing: border-box;
173-
/* webkit */
174-
-moz-box-sizing: border-box;
175-
/* firefox */
176-
box-sizing: border-box;
177-
/* css3 */ }
178-
179-
.s2-dropdown {
180-
width: 100%;
181-
margin-top: -1px;
182-
position: absolute;
183-
z-index: 9999;
184-
overflow: scroll;
185-
background: #fff;
186-
color: #000;
168+
padding: 6px; }
169+
.select2-container.select2-theme-classic .dropdown .results .options .option[aria-disabled=true] {
170+
color: grey; }
171+
.select2-container.select2-theme-classic .dropdown .results .options .option[aria-selected].highlighted {
172+
background-color: #3875d7;
173+
color: white; }
174+
.select2-container.select2-theme-classic.open .dropdown {
187175
border: 1px solid #5897fb;
188-
border-top: none;
189-
border-radius: 0 0 4px 4px;
190-
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
191-
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); }
192-
193-
.s2-hidden {
194-
display: none; }
176+
border-top: none; }

dist/css/select2.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.

dist/js/select2.amd.full.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,7 @@ define('select2/defaults',[
19251925
language: ['select2/i18n/en'],
19261926
matcher: matcher,
19271927
minimumInputLength: 0,
1928+
theme: 'default',
19281929
templateResult: function (result) {
19291930
return result.text;
19301931
},
@@ -2308,14 +2309,16 @@ define('select2/core',[
23082309

23092310
Select2.prototype.render = function () {
23102311
var $container = $(
2311-
'<span class="select2 select2-container select2-theme-default">' +
2312+
'<span class="select2 select2-container">' +
23122313
'<span class="selection"></span>' +
23132314
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
23142315
'</span>'
23152316
);
23162317

23172318
this.$container = $container;
23182319

2320+
this.$container.addClass('select2-theme-' + this.options.get('theme'));
2321+
23192322
$container.data('element', this.$element);
23202323

23212324
return $container;

dist/js/select2.amd.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,7 @@ define('select2/defaults',[
19251925
language: ['select2/i18n/en'],
19261926
matcher: matcher,
19271927
minimumInputLength: 0,
1928+
theme: 'default',
19281929
templateResult: function (result) {
19291930
return result.text;
19301931
},
@@ -2308,14 +2309,16 @@ define('select2/core',[
23082309

23092310
Select2.prototype.render = function () {
23102311
var $container = $(
2311-
'<span class="select2 select2-container select2-theme-default">' +
2312+
'<span class="select2 select2-container">' +
23122313
'<span class="selection"></span>' +
23132314
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
23142315
'</span>'
23152316
);
23162317

23172318
this.$container = $container;
23182319

2320+
this.$container.addClass('select2-theme-' + this.options.get('theme'));
2321+
23192322
$container.data('element', this.$element);
23202323

23212324
return $container;

dist/js/select2.full.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11460,6 +11460,7 @@ define('select2/defaults',[
1146011460
language: ['select2/i18n/en'],
1146111461
matcher: matcher,
1146211462
minimumInputLength: 0,
11463+
theme: 'default',
1146311464
templateResult: function (result) {
1146411465
return result.text;
1146511466
},
@@ -11843,14 +11844,16 @@ define('select2/core',[
1184311844

1184411845
Select2.prototype.render = function () {
1184511846
var $container = $(
11846-
'<span class="select2 select2-container select2-theme-default">' +
11847+
'<span class="select2 select2-container">' +
1184711848
'<span class="selection"></span>' +
1184811849
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
1184911850
'</span>'
1185011851
);
1185111852

1185211853
this.$container = $container;
1185311854

11855+
this.$container.addClass('select2-theme-' + this.options.get('theme'));
11856+
1185411857
$container.data('element', this.$element);
1185511858

1185611859
return $container;

dist/js/select2.full.min.js

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

dist/js/select2.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2353,6 +2353,7 @@ define('select2/defaults',[
23532353
language: ['select2/i18n/en'],
23542354
matcher: matcher,
23552355
minimumInputLength: 0,
2356+
theme: 'default',
23562357
templateResult: function (result) {
23572358
return result.text;
23582359
},
@@ -2736,14 +2737,16 @@ define('select2/core',[
27362737

27372738
Select2.prototype.render = function () {
27382739
var $container = $(
2739-
'<span class="select2 select2-container select2-theme-default">' +
2740+
'<span class="select2 select2-container">' +
27402741
'<span class="selection"></span>' +
27412742
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
27422743
'</span>'
27432744
);
27442745

27452746
this.$container = $container;
27462747

2748+
this.$container.addClass('select2-theme-' + this.options.get('theme'));
2749+
27472750
$container.data('element', this.$element);
27482751

27492752
return $container;

dist/js/select2.min.js

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/examples.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,9 @@ <h2>Example code</h2>
502502

503503
var $language = $(".js-example-language");
504504

505-
$basicSingle.select2();
505+
$basicSingle.select2({
506+
theme: "classic"
507+
});
506508
$basicMultiple.select2()
507509

508510
$placeholderSingle.select2({

0 commit comments

Comments
 (0)