Skip to content

Commit f9052f4

Browse files
committed
v6: Don't disallow calc (#41681)
* Don't disallow calc() * Remove disables that aren't needed * Remove custom subtract and add functions * Remove more disables * keep it here
1 parent 8d9e3d1 commit f9052f4

21 files changed

+55
-101
lines changed

.stylelintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"outline": "none"
1414
},
1515
"function-disallowed-list": [
16-
"calc",
1716
"lighten",
1817
"darken"
1918
],

scss/_accordion.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
&:not(.collapsed) {
4747
color: var(--#{$prefix}accordion-active-color);
4848
background-color: var(--#{$prefix}accordion-active-bg);
49-
box-shadow: inset 0 calc(-1 * var(--#{$prefix}accordion-border-width)) 0 var(--#{$prefix}accordion-border-color); // stylelint-disable-line function-disallowed-list
49+
box-shadow: inset 0 calc(-1 * var(--#{$prefix}accordion-border-width)) 0 var(--#{$prefix}accordion-border-color);
5050

5151
&::after {
5252
background-image: var(--#{$prefix}accordion-btn-active-icon);

scss/_button-group.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// Prevent double borders when buttons are next to each other
4040
> :not(.btn-check:first-child) + .btn,
4141
> .btn-group:not(:first-child) {
42-
margin-left: calc(-1 * #{$btn-border-width}); // stylelint-disable-line function-disallowed-list
42+
margin-left: calc(-1 * #{$btn-border-width});
4343
}
4444

4545
// Reset rounded corners
@@ -126,7 +126,7 @@
126126

127127
> .btn:not(:first-child),
128128
> .btn-group:not(:first-child) {
129-
margin-top: calc(-1 * #{$btn-border-width}); // stylelint-disable-line function-disallowed-list
129+
margin-top: calc(-1 * #{$btn-border-width});
130130
}
131131

132132
// Reset rounded corners

scss/_card.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
}
8181

8282
.card-subtitle {
83-
margin-top: calc(-.5 * var(--#{$prefix}card-title-spacer-y)); // stylelint-disable-line function-disallowed-list
83+
margin-top: calc(-.5 * var(--#{$prefix}card-title-spacer-y));
8484
margin-bottom: 0;
8585
color: var(--#{$prefix}card-subtitle-color);
8686
}
@@ -132,9 +132,9 @@
132132
//
133133

134134
.card-header-tabs {
135-
margin-right: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list
136-
margin-bottom: calc(-1 * var(--#{$prefix}card-cap-padding-y)); // stylelint-disable-line function-disallowed-list
137-
margin-left: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list
135+
margin-right: calc(-.5 * var(--#{$prefix}card-cap-padding-x));
136+
margin-bottom: calc(-1 * var(--#{$prefix}card-cap-padding-y));
137+
margin-left: calc(-.5 * var(--#{$prefix}card-cap-padding-x));
138138
border-bottom: 0;
139139

140140
.nav-link.active {
@@ -144,8 +144,8 @@
144144
}
145145

146146
.card-header-pills {
147-
margin-right: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list
148-
margin-left: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list
147+
margin-right: calc(-.5 * var(--#{$prefix}card-cap-padding-x));
148+
margin-left: calc(-.5 * var(--#{$prefix}card-cap-padding-x));
149149
}
150150

151151
// Card image

scss/_functions.scss

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -218,47 +218,6 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
218218
}
219219
// scss-docs-end color-functions
220220

221-
// Return valid calc
222-
@function add($value1, $value2, $return-calc: true) {
223-
@if $value1 == null {
224-
@return $value2;
225-
}
226-
227-
@if $value2 == null {
228-
@return $value1;
229-
}
230-
231-
@if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
232-
@return $value1 + $value2;
233-
}
234-
235-
@return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2);
236-
}
237-
238-
@function subtract($value1, $value2, $return-calc: true) {
239-
@if $value1 == null and $value2 == null {
240-
@return null;
241-
}
242-
243-
@if $value1 == null {
244-
@return -$value2;
245-
}
246-
247-
@if $value2 == null {
248-
@return $value1;
249-
}
250-
251-
@if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
252-
@return $value1 - $value2;
253-
}
254-
255-
@if type-of($value2) != number {
256-
$value2: unquote("(") + $value2 + unquote(")");
257-
}
258-
259-
@return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
260-
}
261-
262221
@function divide($dividend, $divisor, $precision: 10) {
263222
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
264223
$dividend: abs($dividend);

scss/_list-group.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
border-top-width: 0;
8585

8686
&.active {
87-
margin-top: calc(-1 * var(--#{$prefix}list-group-border-width)); // stylelint-disable-line function-disallowed-list
87+
margin-top: calc(-1 * var(--#{$prefix}list-group-border-width));
8888
border-top-width: var(--#{$prefix}list-group-border-width);
8989
}
9090
}
@@ -148,7 +148,7 @@
148148
border-left-width: 0;
149149

150150
&.active {
151-
margin-left: calc(-1 * var(--#{$prefix}list-group-border-width)); // stylelint-disable-line function-disallowed-list
151+
margin-left: calc(-1 * var(--#{$prefix}list-group-border-width));
152152
border-left-width: var(--#{$prefix}list-group-border-width);
153153
}
154154
}

scss/_modal.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// stylelint-disable function-disallowed-list
2-
31
// .modal-open - body class for killing the scroll
42
// .modal - container to scroll within
53
// .modal-dialog - positioning shell for the actual modal

scss/_nav.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
border-bottom: var(--#{$prefix}nav-tabs-border-width) solid var(--#{$prefix}nav-tabs-border-color);
7171

7272
.nav-link {
73-
margin-bottom: calc(-1 * var(--#{$prefix}nav-tabs-border-width)); // stylelint-disable-line function-disallowed-list
73+
margin-bottom: calc(-1 * var(--#{$prefix}nav-tabs-border-width));
7474
border: var(--#{$prefix}nav-tabs-border-width) solid transparent;
7575
@include border-top-radius(var(--#{$prefix}nav-tabs-border-radius));
7676

@@ -91,7 +91,7 @@
9191

9292
.dropdown-menu {
9393
// Make dropdown border overlap tab border
94-
margin-top: calc(-1 * var(--#{$prefix}nav-tabs-border-width)); // stylelint-disable-line function-disallowed-list
94+
margin-top: calc(-1 * var(--#{$prefix}nav-tabs-border-width));
9595
// Remove the top rounded corners here since there is a hard edge above the menu
9696
@include border-top-radius(0);
9797
}

scss/_offcanvas.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// stylelint-disable function-disallowed-list
2-
31
%offcanvas-css-vars {
42
// scss-docs-start offcanvas-css-vars
53
--#{$prefix}offcanvas-zindex: #{$zindex-offcanvas};

scss/_popover.scss

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

5757
.bs-popover-top {
5858
> .popover-arrow {
59-
bottom: calc(-1 * (var(--#{$prefix}popover-arrow-height)) - var(--#{$prefix}popover-border-width)); // stylelint-disable-line function-disallowed-list
59+
bottom: calc(-1 * (var(--#{$prefix}popover-arrow-height)) - var(--#{$prefix}popover-border-width));
6060

6161
&::before,
6262
&::after {
63-
border-width: var(--#{$prefix}popover-arrow-height) calc(var(--#{$prefix}popover-arrow-width) * .5) 0; // stylelint-disable-line function-disallowed-list
63+
border-width: var(--#{$prefix}popover-arrow-height) calc(var(--#{$prefix}popover-arrow-width) * .5) 0;
6464
}
6565

6666
&::before {
@@ -78,13 +78,13 @@
7878
/* rtl:begin:ignore */
7979
.bs-popover-end {
8080
> .popover-arrow {
81-
left: calc(-1 * (var(--#{$prefix}popover-arrow-height)) - var(--#{$prefix}popover-border-width)); // stylelint-disable-line function-disallowed-list
81+
left: calc(-1 * (var(--#{$prefix}popover-arrow-height)) - var(--#{$prefix}popover-border-width));
8282
width: var(--#{$prefix}popover-arrow-height);
8383
height: var(--#{$prefix}popover-arrow-width);
8484

8585
&::before,
8686
&::after {
87-
border-width: calc(var(--#{$prefix}popover-arrow-width) * .5) var(--#{$prefix}popover-arrow-height) calc(var(--#{$prefix}popover-arrow-width) * .5) 0; // stylelint-disable-line function-disallowed-list
87+
border-width: calc(var(--#{$prefix}popover-arrow-width) * .5) var(--#{$prefix}popover-arrow-height) calc(var(--#{$prefix}popover-arrow-width) * .5) 0;
8888
}
8989

9090
&::before {
@@ -103,11 +103,11 @@
103103

104104
.bs-popover-bottom {
105105
> .popover-arrow {
106-
top: calc(-1 * (var(--#{$prefix}popover-arrow-height)) - var(--#{$prefix}popover-border-width)); // stylelint-disable-line function-disallowed-list
106+
top: calc(-1 * (var(--#{$prefix}popover-arrow-height)) - var(--#{$prefix}popover-border-width));
107107

108108
&::before,
109109
&::after {
110-
border-width: 0 calc(var(--#{$prefix}popover-arrow-width) * .5) var(--#{$prefix}popover-arrow-height); // stylelint-disable-line function-disallowed-list
110+
border-width: 0 calc(var(--#{$prefix}popover-arrow-width) * .5) var(--#{$prefix}popover-arrow-height);
111111
}
112112

113113
&::before {
@@ -128,7 +128,7 @@
128128
left: 50%;
129129
display: block;
130130
width: var(--#{$prefix}popover-arrow-width);
131-
margin-left: calc(-.5 * var(--#{$prefix}popover-arrow-width)); // stylelint-disable-line function-disallowed-list
131+
margin-left: calc(-.5 * var(--#{$prefix}popover-arrow-width));
132132
content: "";
133133
border-bottom: var(--#{$prefix}popover-border-width) solid var(--#{$prefix}popover-header-bg);
134134
}
@@ -137,13 +137,13 @@
137137
/* rtl:begin:ignore */
138138
.bs-popover-start {
139139
> .popover-arrow {
140-
right: calc(-1 * (var(--#{$prefix}popover-arrow-height)) - var(--#{$prefix}popover-border-width)); // stylelint-disable-line function-disallowed-list
140+
right: calc(-1 * (var(--#{$prefix}popover-arrow-height)) - var(--#{$prefix}popover-border-width));
141141
width: var(--#{$prefix}popover-arrow-height);
142142
height: var(--#{$prefix}popover-arrow-width);
143143

144144
&::before,
145145
&::after {
146-
border-width: calc(var(--#{$prefix}popover-arrow-width) * .5) 0 calc(var(--#{$prefix}popover-arrow-width) * .5) var(--#{$prefix}popover-arrow-height); // stylelint-disable-line function-disallowed-list
146+
border-width: calc(var(--#{$prefix}popover-arrow-width) * .5) 0 calc(var(--#{$prefix}popover-arrow-width) * .5) var(--#{$prefix}popover-arrow-height);
147147
}
148148

149149
&::before {

0 commit comments

Comments
 (0)