Skip to content

Commit df527ae

Browse files
committed
feat: make Checkbox support RTL
1 parent 8a661e9 commit df527ae

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

components/checkbox/index.css

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ governing permissions and limitations under the License.
2828

2929
position: relative;
3030

31-
min-height: var(--spectrum-checkbox-height);
32-
max-width: 100%;
31+
min-block-size: var(--spectrum-checkbox-height);
32+
max-inline-size: 100%;
3333

34-
margin-right: calc(var(--spectrum-checkbox-cursor-hit-x) * 2);
34+
margin-inline-end: calc(var(--spectrum-checkbox-cursor-hit-x) * 2);
3535

3636
vertical-align: top;
3737
}
@@ -56,10 +56,10 @@ governing permissions and limitations under the License.
5656

5757
/* Hit area */
5858
position: absolute;
59-
top: 0;
60-
left: calc(var(--spectrum-checkbox-cursor-hit-x) * -1);
61-
width: calc(100% + var(--spectrum-checkbox-cursor-hit-x) * 2);
62-
height: 100%;
59+
inset-block-start: 0;
60+
inset-inline-start: calc(var(--spectrum-checkbox-cursor-hit-x) * -1);
61+
inline-size: calc(100% + var(--spectrum-checkbox-cursor-hit-x) * 2);
62+
block-size: 100%;
6363

6464
opacity: .0001;
6565
z-index: 1;
@@ -99,8 +99,9 @@ governing permissions and limitations under the License.
9999
}
100100

101101
.spectrum-Checkbox-label {
102-
margin-left: var(--spectrum-checkbox-text-gap);
103-
margin-top: var(--spectrum-checkbox-label-margin-top);
102+
text-align: start;
103+
margin-inline-start: var(--spectrum-checkbox-text-gap);
104+
margin-block-start: var(--spectrum-checkbox-label-margin-top);
104105
font-size: var(--spectrum-checkbox-text-size);
105106
font-weight: var(--spectrum-checkbox-text-font-weight);
106107
line-height: var(--spectrum-checkbox-label-line-height);
@@ -110,8 +111,8 @@ governing permissions and limitations under the License.
110111
.spectrum-Checkbox-box {
111112
position: relative;
112113
box-sizing: border-box;
113-
width: var(--spectrum-checkbox-box-size);
114-
height: var(--spectrum-checkbox-box-size);
114+
inline-size: var(--spectrum-checkbox-box-size);
115+
block-size: var(--spectrum-checkbox-box-size);
115116

116117
/* Fix vertical alignment when not wrapping since we're flex-start */
117118
margin: calc((var(--spectrum-checkbox-height) - var(--spectrum-checkbox-box-size)) / 2) 0;
@@ -129,11 +130,11 @@ governing permissions and limitations under the License.
129130
.spectrum-Checkbox-checkmark,
130131
.spectrum-Checkbox-partialCheckmark {
131132
position: absolute;
132-
top: 50%;
133-
left: 50%;
133+
inset-block-start: 50%;
134+
inset-inline-start: 50%;
134135

135-
margin-top: calc(var(--spectrum-icon-checkmark-small-height) / -2);
136-
margin-left: calc(var(--spectrum-icon-checkmark-small-width) / -2);
136+
margin-block-start: calc(var(--spectrum-icon-checkmark-small-height) / -2);
137+
margin-inline-start: calc(var(--spectrum-icon-checkmark-small-width) / -2);
137138

138139
opacity: 0;
139140
transform: scale(0);

0 commit comments

Comments
 (0)