Skip to content

Commit 171eeeb

Browse files
committed
refactor: improve syntax
1 parent c8aa3dd commit 171eeeb

File tree

9 files changed

+22
-17
lines changed

9 files changed

+22
-17
lines changed

scss/_dropdown.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
.dropstart {
146146
.dropdown-menu[data-coreui-popper] {
147147
top: 0;
148-
149148
@include ltr-rtl("right", 100%);
150149
@include ltr-rtl("left", auto);
151150
margin-top: 0;

scss/_reboot.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ a {
249249
text-decoration: $link-hover-decoration;
250250
}
251251
}
252-
253252
// And undo these styles for placeholder links/named anchors (without href).
254253
// It would be more straightforward to just use a[href] in previous block, but that
255254
// causes specificity issues in many other styles that are too complex to fix.

scss/_tooltip.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
z-index: var(--#{$prefix}tooltip-zindex);
1919
display: block;
2020
margin: var(--#{$prefix}tooltip-margin);
21+
@include deprecate("`$tooltip-margin`", "v4", "v4.x", true);
2122
// Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
2223
// So reset our font and text properties to avoid inheriting weird values.
2324
@include reset-text();

scss/_type.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
}
4343
}
4444

45-
4645
//
4746
// Emphasis
4847
//

scss/forms/_floating-labels.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
> .form-control-plaintext,
5757
> .form-select {
5858
~ label {
59-
opacity: $form-floating-label-opacity;
59+
color: rgba(var(--#{$prefix}body-color-rgb), #{$form-floating-label-opacity});
6060
transform: $form-floating-label-transform;
6161

6262
&::after {
@@ -73,7 +73,7 @@
7373
// Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
7474
> .form-control:-webkit-autofill {
7575
~ label {
76-
opacity: $form-floating-label-opacity;
76+
color: rgba(var(--#{$prefix}body-color-rgb), #{$form-floating-label-opacity});
7777
transform: $form-floating-label-transform;
7878
}
7979
}

scss/forms/_form-control.scss

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
@include font-size($input-font-size);
1111
font-weight: $input-font-weight;
1212
line-height: $input-line-height;
13-
color: $input-color;
13+
color: var(--#{$prefix}input-color, $input-color);
1414
appearance: none; // Fix appearance for date inputs in Safari
15-
background-color: $input-bg;
15+
background-color: var(--#{$prefix}input-bg, $input-bg);
1616
background-clip: padding-box;
17-
border: $input-border-width solid $input-border-color;
17+
border: $input-border-width solid var(--#{$prefix}input-border-color, $input-border-color);
1818

1919
// Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
2020
@include border-radius($input-border-radius, 0);
@@ -32,9 +32,9 @@
3232

3333
// Customize the `:focus` state to imitate native WebKit styles.
3434
&:focus {
35-
color: $input-focus-color;
36-
background-color: $input-focus-bg;
37-
border-color: $input-focus-border-color;
35+
color: var(--#{$prefix}input-focus-color, $input-focus-color);
36+
background-color: var(--#{$prefix}input-focus-bg, $input-focus-bg);
37+
border-color: var(--#{$prefix}input-focus-border-color, $input-focus-border-color);
3838
outline: 0;
3939
@if $enable-shadows {
4040
@include box-shadow($input-box-shadow, $input-focus-box-shadow);
@@ -44,6 +44,9 @@
4444
}
4545
}
4646

47+
// Add some height to date inputs on iOS
48+
// https://github.com/twbs/bootstrap/issues/23307
49+
// TODO: we can remove this workaround once https://bugs.webkit.org/show_bug.cgi?id=198959 is resolved
4750
&::-webkit-date-and-time-value {
4851
// On Android Chrome, form-control's "width: 100%" makes the input width too small
4952
// Tested under Android 11 / Chrome 89, Android 12 / Chrome 100, Android 13 / Chrome 109
@@ -96,8 +99,8 @@
9699
padding: $input-padding-y $input-padding-x;
97100
margin: (-$input-padding-y) (-$input-padding-x);
98101
margin-inline-end: $input-padding-x;
99-
color: $form-file-button-color;
100-
@include gradient-bg($form-file-button-bg);
102+
color: var(--#{$prefix}form-file-button-color, $form-file-button-color);
103+
@include gradient-bg(var(--#{$prefix}form-file-button-bg, $form-file-button-bg));
101104
pointer-events: none;
102105
border-color: inherit;
103106
border-style: solid;
@@ -108,7 +111,7 @@
108111
}
109112

110113
&:hover:not(:disabled):not([readonly])::file-selector-button {
111-
background-color: $form-file-button-hover-bg;
114+
background-color: var(--#{$prefix}form-file-button-hover-bg, $form-file-button-hover-bg);
112115
}
113116
}
114117

@@ -123,7 +126,7 @@
123126
padding: $input-padding-y 0;
124127
margin-bottom: 0; // match inputs if this class comes on inputs with default margins
125128
line-height: $input-line-height;
126-
color: $input-plaintext-color;
129+
color: var(--#{$prefix}input-plaintext-color, $input-plaintext-color);
127130
background-color: transparent;
128131
border: solid transparent;
129132
border-width: $input-border-width 0;

scss/forms/_form-select.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// https://primer.github.io/.
55

66
.form-select {
7+
--#{$prefix}form-select-bg-img: #{escape-svg($form-select-indicator)};
8+
79
display: block;
810
width: 100%;
911
@include ltr-rtl-value-only("padding", $form-select-padding-y $form-select-indicator-padding $form-select-padding-y $form-select-padding-x, $form-select-padding-y $form-select-padding-x $form-select-padding-y $form-select-indicator-padding);
@@ -15,7 +17,7 @@
1517
color: var(--#{$prefix}form-select-color, $form-select-color);
1618
appearance: none;
1719
background-color: var(--#{$prefix}form-select-bg, $form-select-bg);
18-
background-image: escape-svg($form-select-indicator);
20+
background-image: var(--#{$prefix}form-select-bg-img), var(--#{$prefix}form-select-bg-icon, none);
1921
background-repeat: no-repeat;
2022
@include ltr-rtl-value-only("background-position", $form-select-bg-position);
2123
background-size: $form-select-bg-size;

scss/mixins/_forms.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
@if $enable-validation-icons {
9292
&:not([multiple]):not([size]),
9393
&:not([multiple])[size="1"] {
94+
--#{$prefix}form-select-bg-icon: #{escape-svg($icon)};
9495
@include ltr-rtl("padding-right", $form-select-feedback-icon-padding-end);
95-
background-image: escape-svg($form-select-indicator), escape-svg($icon);
9696
@include ltr-rtl-value-only("background-position", #{$form-select-bg-position, $form-select-feedback-icon-position});
9797
background-size: $form-select-bg-size, $form-select-feedback-icon-size;
9898
}

scss/mixins/_list-group.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@include deprecate("`list-group-item-variant()`", "v4.3.0", "v6.0.0");
2+
13
// List Groups
24
// scss-docs-start list-group-mixin
35
@mixin list-group-item-variant($state, $variant) {

0 commit comments

Comments
 (0)