Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit 9e0bca3

Browse files
author
clivezhg
authored
Merge pull request #19 from CyberDepot/master
Add RTL Support
2 parents 37b8dec + ea5e4ac commit 9e0bca3

File tree

1 file changed

+87
-25
lines changed

1 file changed

+87
-25
lines changed

src/select2totree.css

Lines changed: 87 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,132 @@
1-
/*!
1+
/*!
22
* Select2-to-Tree CSS 1.1.1
33
* https://github.com/clivezhg/select2-to-tree
44
*/
5-
.s2-to-tree * {
6-
box-sizing: border-box;
7-
}
5+
.s2-to-tree * {
6+
box-sizing: border-box;
7+
}
88

9-
.s2-to-tree .select2-results__option.l1 {
9+
.s2-to-tree .select2-dropdown[dir*="ltr"] .select2-results__option.l1 {
1010
margin-left: 0.6em;
1111
font-size: 1em;
1212
}
13-
.s2-to-tree .select2-results__option.l2 {
13+
.s2-to-tree .select2-dropdown[dir*="ltr"] .select2-results__option.l2 {
1414
margin-left: 1.4em;
1515
font-size: 0.95em;
1616
}
17-
.s2-to-tree .select2-results__option.l3 {
17+
.s2-to-tree .select2-dropdown[dir*="ltr"] .select2-results__option.l3 {
1818
margin-left: 2.2em;
1919
font-size: 0.91em;
2020
}
21-
.s2-to-tree .select2-results__option.l4 {
21+
.s2-to-tree .select2-dropdown[dir*="ltr"] .select2-results__option.l4 {
2222
margin-left: 3.0em;
2323
font-size: 0.87em;
2424
}
25-
.s2-to-tree .select2-results__option.l5 {
25+
.s2-to-tree .select2-dropdown[dir*="ltr"] .select2-results__option.l5 {
2626
margin-left: 3.8em;
2727
font-size: 0.83em;
2828
}
29-
.s2-to-tree .select2-results__option.l6 {
29+
.s2-to-tree .select2-dropdown[dir*="ltr"] .select2-results__option.l6 {
3030
margin-left: 4.5em;
3131
font-size: 0.8em;
3232
}
33-
.s2-to-tree .select2-results__option.l7 {
33+
.s2-to-tree .select2-dropdown[dir*="ltr"] .select2-results__option.l7 {
3434
margin-left: 5.3em;
3535
font-size: 0.77em;
3636
}
37-
.s2-to-tree .select2-results__option.l8 {
37+
.s2-to-tree .select2-dropdown[dir*="ltr"] .select2-results__option.l8 {
3838
margin-left: 6.0em;
3939
font-size: 0.75em;
4040
}
4141

42-
.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:hover {
43-
color: red;
44-
cursor: pointer;
42+
.s2-to-tree .select2-dropdown[dir*="ltr"] .item-label {
43+
display: inline-block;
44+
margin-left: 0.5em;
45+
padding: 3px;
46+
width: calc(100% - 11px); /* IE8 will fit the content */
4547
}
46-
.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:before { /* no :: in IE8 */
48+
49+
.s2-to-tree .select2-dropdown[dir*="ltr"] li.select2-results__option.non-leaf .expand-collapse:before { /* no :: in IE8 */
4750
content: "+";
4851
position: absolute;
4952
left: -0.35em;
5053
top: 0.1em;
5154
font-size: larger;
5255
}
53-
.s2-to-tree li.select2-results__option.non-leaf.opened .expand-collapse:before {
54-
content: "−";
55-
}
5656

57-
.s2-to-tree .select2-results__option[aria-disabled="true"] .expand-collapse {
58-
color: black;
57+
58+
59+
60+
61+
62+
63+
.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l1 {
64+
margin-right: 0.6em;
65+
font-size: 1em;
66+
}
67+
.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l2 {
68+
margin-right: 1.4em;
69+
font-size: 0.95em;
70+
}
71+
.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l3 {
72+
margin-right: 2.2em;
73+
font-size: 0.91em;
74+
}
75+
.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l4 {
76+
margin-right: 3.0em;
77+
font-size: 0.87em;
78+
}
79+
.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l5 {
80+
margin-right: 3.8em;
81+
font-size: 0.83em;
82+
}
83+
.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l6 {
84+
margin-right: 4.5em;
85+
font-size: 0.8em;
86+
}
87+
.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l7 {
88+
margin-right: 5.3em;
89+
font-size: 0.77em;
90+
}
91+
.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l8 {
92+
margin-right: 6.0em;
93+
font-size: 0.75em;
5994
}
6095

61-
.s2-to-tree .item-label {
96+
.s2-to-tree .select2-dropdown[dir*="rtl"] .item-label {
6297
display: inline-block;
63-
margin-left: 0.5em;
98+
margin-right: 0.5em;
6499
padding: 3px;
65100
width: calc(100% - 11px); /* IE8 will fit the content */
66101
}
67102

103+
.s2-to-tree .select2-dropdown[dir*="rtl"] li.select2-results__option.non-leaf .expand-collapse:before { /* no :: in IE8 */
104+
content: "+";
105+
position: absolute;
106+
right: -0.35em;
107+
top: 0.1em;
108+
font-size: larger;
109+
}
110+
111+
112+
113+
114+
115+
116+
117+
.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:hover {
118+
color: red;
119+
cursor: pointer;
120+
}
121+
122+
.s2-to-tree li.select2-results__option.non-leaf.opened .expand-collapse:before {
123+
content: "−";
124+
}
125+
126+
.s2-to-tree .select2-results__option[aria-disabled="true"] .expand-collapse {
127+
color: black;
128+
}
129+
68130
.s2-to-tree li.select2-results__option {
69131
position: relative;
70132
padding: 0px;
@@ -81,8 +143,8 @@
81143
}
82144

83145
.s2-to-tree.select2-container .select2-results__option--highlighted[aria-selected] > span.item-label {
84-
background-color: #5897fb;
85-
color: white;
146+
background-color: #5897fb;
147+
color: white;
86148
}
87149
.s2-to-tree.select2-container li.select2-results__option[aria-selected="true"] > span.item-label {
88150
background-color: #ddd;

0 commit comments

Comments
 (0)