Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override form_check to write print-color-adjust instead of color-adjust #770

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dist/scss/components/_view.scss

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/scss/vendors/bootstrap/_2_components.scss

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

154 changes: 154 additions & 0 deletions dist/scss/vendors/bootstrap/overrides/_form_check.scss

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dist/scss/vendors/bootstrap/overrides/_forms.scss

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/scss/components/_view.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "sass:math";

.#{$tdp-css-prefix}-view {
&.multiple {
overflow-y: auto;
Expand Down Expand Up @@ -37,8 +39,8 @@
position: absolute;
top: 50%;
left: 50%;
margin-left: -$nothing/2;
margin-top: -$nothing/2;
margin-left: math.div(-$nothing, 2);
margin-top: math.div(-$nothing, 2);
font-size: $nothing;
z-index: 9;
}
Expand Down
2 changes: 1 addition & 1 deletion src/scss/vendors/bootstrap/_2_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@import "~bootstrap/scss/close";
@import "~bootstrap/scss/containers";
@import "~bootstrap/scss/dropdown";
@import "~bootstrap/scss/forms";
@import "./overrides/forms";
@import "~bootstrap/scss/grid";
@import "~bootstrap/scss/images";
@import "~bootstrap/scss/list-group";
Expand Down
154 changes: 154 additions & 0 deletions src/scss/vendors/bootstrap/overrides/_form_check.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
//
// Check/radio
//

.form-check {
display: block;
min-height: $form-check-min-height;
padding-left: $form-check-padding-start;
margin-bottom: $form-check-margin-bottom;

.form-check-input {
float: left;
margin-left: $form-check-padding-start * -1;
}
}

.form-check-input {
width: $form-check-input-width;
height: $form-check-input-width;
margin-top: ($line-height-base - $form-check-input-width) * .5; // line-height minus check height
vertical-align: top;
background-color: $form-check-input-bg;
background-repeat: no-repeat;
background-position: center;
background-size: contain;
border: $form-check-input-border;
appearance: none;
// This was changed from color-adjust to print-color-adjust to avoid a warning of autoprefixer: https://github.com/twbs/bootstrap/issues/36259
print-color-adjust: exact; // Keep themed appearance for print
@include transition($form-check-transition);

&[type="checkbox"] {
@include border-radius($form-check-input-border-radius);
}

&[type="radio"] {
// stylelint-disable-next-line property-disallowed-list
border-radius: $form-check-radio-border-radius;
}

&:active {
filter: $form-check-input-active-filter;
}

&:focus {
border-color: $form-check-input-focus-border;
outline: 0;
box-shadow: $form-check-input-focus-box-shadow;
}

&:checked {
background-color: $form-check-input-checked-bg-color;
border-color: $form-check-input-checked-border-color;

&[type="checkbox"] {
@if $enable-gradients {
background-image: escape-svg($form-check-input-checked-bg-image), var(--#{$variable-prefix}gradient);
} @else {
background-image: escape-svg($form-check-input-checked-bg-image);
}
}

&[type="radio"] {
@if $enable-gradients {
background-image: escape-svg($form-check-radio-checked-bg-image), var(--#{$variable-prefix}gradient);
} @else {
background-image: escape-svg($form-check-radio-checked-bg-image);
}
}
}

&[type="checkbox"]:indeterminate {
background-color: $form-check-input-indeterminate-bg-color;
border-color: $form-check-input-indeterminate-border-color;

@if $enable-gradients {
background-image: escape-svg($form-check-input-indeterminate-bg-image), var(--#{$variable-prefix}gradient);
} @else {
background-image: escape-svg($form-check-input-indeterminate-bg-image);
}
}

&:disabled {
pointer-events: none;
filter: none;
opacity: $form-check-input-disabled-opacity;
}

// Use disabled attribute in addition of :disabled pseudo-class
// See: https://github.com/twbs/bootstrap/issues/28247
&[disabled],
&:disabled {
~ .form-check-label {
opacity: $form-check-label-disabled-opacity;
}
}
}

.form-check-label {
color: $form-check-label-color;
cursor: $form-check-label-cursor;
}

//
// Switch
//

.form-switch {
padding-left: $form-switch-padding-start;

.form-check-input {
width: $form-switch-width;
margin-left: $form-switch-padding-start * -1;
background-image: escape-svg($form-switch-bg-image);
background-position: left center;
@include border-radius($form-switch-border-radius);
@include transition($form-switch-transition);

&:focus {
background-image: escape-svg($form-switch-focus-bg-image);
}

&:checked {
background-position: $form-switch-checked-bg-position;

@if $enable-gradients {
background-image: escape-svg($form-switch-checked-bg-image), var(--#{$variable-prefix}gradient);
} @else {
background-image: escape-svg($form-switch-checked-bg-image);
}
}
}
}

.form-check-inline {
display: inline-block;
margin-right: $form-check-inline-margin-end;
}

.btn-check {
position: absolute;
clip: rect(0, 0, 0, 0);
pointer-events: none;

&[disabled],
&:disabled {
+ .btn {
pointer-events: none;
filter: none;
opacity: $form-check-btn-check-disabled-opacity;
}
}
}

9 changes: 9 additions & 0 deletions src/scss/vendors/bootstrap/overrides/_forms.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import "~bootstrap/scss/forms/labels";
@import "~bootstrap/scss/forms/form-text";
@import "~bootstrap/scss/forms/form-control";
@import "~bootstrap/scss/forms/form-select";
@import "./form_check";
@import "~bootstrap/scss/forms/form-range";
@import "~bootstrap/scss/forms/floating-labels";
@import "~bootstrap/scss/forms/input-group";
@import "~bootstrap/scss/forms/validation";
1 change: 0 additions & 1 deletion workspace.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// Use the storybook entrypoint to load variables etc.
@import './src/scss/storybook.scss';
@import './src/scss/main.scss';