Skip to content

Commit e1c0a01

Browse files
Enforce logical properties (#296)
This PR updates all places to use logical properties. It also adds a stylelint plugin to help enforce it
1 parent 724fa3b commit e1c0a01

38 files changed

+199
-198
lines changed

.stylelintrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": ["stylelint-config-idiomatic-order"],
3-
"plugins": ["stylelint-prettier"],
3+
"plugins": ["stylelint-prettier", "stylelint-use-logical"],
44
"overrides": [],
55
"rules": {
66
"prettier/prettier": true,
@@ -10,6 +10,7 @@
1010
"message": "CSS variables should be prefixed with op-"
1111
}
1212
],
13-
"selector-class-pattern": null
13+
"selector-class-pattern": null,
14+
"csstools/use-logical": "always"
1415
}
1516
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"stylelint": "^16.23.1",
6767
"stylelint-config-idiomatic-order": "^10.0.0",
6868
"stylelint-prettier": "^5.0.3",
69+
"stylelint-use-logical": "^2.1.2",
6970
"vite": "^7.1.4"
7071
},
7172
"peerDependencies": {

src/addons/panel.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
position: absolute;
55
z-index: var(--op-z-index-sidebar);
6-
width: var(--op-panel-width);
7-
height: 100vh;
86
background-color: var(--op-color-background);
7+
block-size: 100vh;
98
color: var(--op-color-on-background);
9+
inline-size: var(--op-panel-width);
1010
inset-inline-end: calc(-1 * var(--op-panel-width)); /* this pushes the panel off the screen to the right */
1111
overflow-y: scroll;
1212
padding-block-end: var(--op-space-large);
@@ -23,7 +23,7 @@
2323
padding: var(--op-space-medium);
2424
border-radius: 100%;
2525
cursor: pointer;
26-
float: right;
26+
float: inline-end;
2727

2828
&:hover {
2929
background-color: var(--op-color-neutral-plus-seven);

src/addons/tom-select.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.ts-wrapper {
33
/* Control */
44
.ts-control {
5-
min-height: var(--op-input-height-large);
65
align-items: center;
76
border: none;
87
border-radius: var(--op-radius-large);
@@ -12,22 +11,23 @@
1211
font-size: var(--op-font-x-small);
1312
font-weight: var(--op-font-weight-light);
1413
line-height: var(--op-line-height-base);
14+
min-block-size: var(--op-input-height-large);
1515
}
1616

1717
/* Active control */
1818
&.dropdown-active {
1919
.ts-control {
20-
border-bottom-left-radius: 0;
21-
border-bottom-right-radius: 0;
20+
border-end-end-radius: 0;
21+
border-end-start-radius: 0;
2222
}
2323
}
2424

2525
/* Dropdown */
2626
.ts-dropdown {
2727
border: none;
2828
margin: 0;
29-
border-bottom-left-radius: var(--op-radius-large);
30-
border-bottom-right-radius: var(--op-radius-large);
29+
border-end-end-radius: var(--op-radius-large);
30+
border-end-start-radius: var(--op-radius-large);
3131
box-shadow: var(--op-border-all) var(--op-color-border);
3232
contain: paint;
3333

src/components/accordion.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
summary {
1111
display: grid;
12-
min-height: var(--_op-accordion-summary-min-height);
1312
align-items: center;
1413
cursor: pointer;
1514
gap: var(--op-space-2x-small);
1615
grid-template-columns: auto 1fr auto;
16+
min-block-size: var(--_op-accordion-summary-min-height);
1717

1818
&::marker,
1919
&::-webkit-details-marker {
@@ -38,7 +38,7 @@
3838
}
3939

4040
&::details-content {
41-
height: 0;
41+
block-size: 0;
4242
transition: var(--op-transition-accordion-content);
4343
}
4444

@@ -48,7 +48,7 @@
4848
}
4949

5050
&::details-content {
51-
height: auto;
51+
block-size: auto;
5252
}
5353
}
5454

src/components/alert.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
&.alert--flash {
3737
position: fixed;
3838
z-index: var(--op-z-index-alert-group);
39-
top: var(--op-space-large);
40-
right: var(--op-space-large);
4139
animation: var(--op-animation-flash);
40+
inset-block-start: var(--op-space-large);
41+
inset-inline-end: var(--op-space-large);
4242
}
4343

4444
&.alert--warning {

src/components/avatar.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
z-index: 1;
1919
display: block;
2020
overflow: hidden;
21-
width: var(--__op-avatar-size);
22-
min-width: var(--__op-avatar-size);
23-
height: var(--__op-avatar-size);
24-
min-height: var(--__op-avatar-size);
2521
border-radius: var(--_op-avatar-border-radius);
22+
block-size: var(--__op-avatar-size);
23+
inline-size: var(--__op-avatar-size);
24+
min-block-size: var(--__op-avatar-size);
25+
min-inline-size: var(--__op-avatar-size);
2626

2727
&::before {
2828
position: absolute;
@@ -43,8 +43,8 @@
4343
}
4444

4545
img {
46-
width: 100%;
47-
height: 100%;
46+
block-size: 100%;
47+
inline-size: 100%;
4848
object-fit: cover;
4949
}
5050

src/components/button.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
--__op-btn-padding: var(--_op-btn-padding-large);
1717

1818
display: inline-flex;
19-
min-height: var(--__op-btn-height);
2019
align-items: center;
2120
justify-content: center;
2221
padding: var(--__op-btn-padding);
@@ -29,6 +28,7 @@
2928
font-size: var(--__op-btn-font-size);
3029
font-weight: var(--op-font-weight-normal);
3130
gap: var(--op-space-x-small);
31+
min-block-size: var(--__op-btn-height);
3232
text-align: center;
3333
text-decoration: none;
3434
transition: var(--op-transition-input);
@@ -92,9 +92,9 @@
9292

9393
/* Icon Modifier */
9494
&.btn--icon {
95-
width: var(--__op-btn-height);
96-
min-width: var(--__op-btn-height);
9795
padding: 0;
96+
inline-size: var(--__op-btn-height);
97+
min-inline-size: var(--__op-btn-height);
9898
}
9999

100100
/* Icon With Label Modifier */

src/components/button_group.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
}
3131

3232
&:first-child:not(:last-child) {
33-
border-bottom-right-radius: 0;
34-
border-top-right-radius: 0;
33+
border-end-end-radius: 0;
34+
border-start-end-radius: 0;
3535
}
3636

3737
&:last-child:not(:first-child) {
38-
border-bottom-left-radius: 0;
39-
border-top-left-radius: 0;
38+
border-end-start-radius: 0;
39+
border-start-start-radius: 0;
4040
}
4141
}
4242
}

src/components/card.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
}
5151

5252
.card__header {
53-
border-top-left-radius: var(--_op-card-radius);
54-
border-top-right-radius: var(--_op-card-radius);
53+
border-start-end-radius: var(--_op-card-radius);
54+
border-start-start-radius: var(--_op-card-radius);
5555

5656
h1,
5757
h2,
@@ -64,7 +64,7 @@
6464
}
6565

6666
.card__footer {
67-
border-bottom-left-radius: var(--_op-card-radius);
68-
border-bottom-right-radius: var(--_op-card-radius);
67+
border-end-end-radius: var(--_op-card-radius);
68+
border-end-start-radius: var(--_op-card-radius);
6969
}
7070
}

0 commit comments

Comments
 (0)