Skip to content

Build your personal knowledge base with Trilium Notes

style(next): use the new check box and radio button style only for the elements using the "tn-checkbox" and "tn-radio" CSS classes

Adorian Doraned201ff9a4b0
diff --git a/src/public/stylesheets/theme-next/forms.css b/src/public/stylesheets/theme-next/forms.css
index 20f1f686b9..27d1b49eda 100644
--- a/src/public/stylesheets/theme-next/forms.css
+++ b/src/public/stylesheets/theme-next/forms.css
@@ -186,23 +186,20 @@ optgroup {
/* Check box & radio button commons */
/* The parent label */
-label:has(>input[type="radio"]),
-label:has(>input[type="checkbox"]) {
+label.tn-radio,
+label.tn-checkbox {
--box-size: 1em;
--box-label-gap: .5em;
position: relative;
+ padding-left: calc(var(--box-size) + var(--box-label-gap)) !important;
user-select: none;
-}
-label:has(>input[type="radio"]),
-label:has(>input[type="checkbox"]) {
- padding-left: calc(var(--box-size) + var(--box-label-gap)) !important;
}
/* The original input */
-label > input[type="radio"],
-label > input[type="checkbox"] {
+label.tn-radio > input[type="radio"],
+label.tn-checkbox > input[type="checkbox"] {
position: absolute;
top: 0;
left: 0;
@@ -211,10 +208,10 @@ label > input[type="checkbox"] {
opacity: 0 !important;
}
-label:has(>input[type="radio"])::before,
-label:has(>input[type="radio"])::after,
-label:has(>input[type="checkbox"])::before,
-label:has(>input[type="checkbox"])::after {
+label.tn-radio::before,
+label.tn-radio::after,
+label.tn-checkbox::before,
+label.tn-checkbox::after {
content: "";
position: absolute;
top: 50%;
@@ -224,20 +221,20 @@ label:has(>input[type="checkbox"])::after {
height: var(--box-size);
}
-label:has(>input[type="radio"]:focus-visible)::before,
-label:has(>input[type="checkbox"]:focus-visible)::before {
+label.tn-radio:has(>input[type="radio"]:focus-visible)::before,
+label.tn-checkbox:has(>input[type="checkbox"]:focus-visible)::before {
outline: 2px solid var(--input-focus-outline-color);
}
/* Check boxes */
/* The check box background */
-label:has(>input[type="checkbox"])::before {
+label.tn-checkbox::before {
border-radius: 3px;
background: var(--radio-checkbox-background);
}
-label:has(>input[type="checkbox"]:not(:disabled)):hover:before {
+label.tn-checkbox:has(>input[type="checkbox"]:not(:disabled)):hover:before {
background: var(--radio-checkbox-hover-background);
}
@@ -250,7 +247,7 @@ label:has(>input[type="checkbox"]:not(:disabled)):hover:before {
}
/* The tick mark */
-label:has(>input[type="checkbox"])::after {
+label.tn-checkbox::after {
mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3ctitle%3echeck-bold%3c/title%3e%3cpath d='M9%2c20.42L2.79%2c14.21L5.62%2c11.38L9%2c14.77L18.88%2c4.88L21.71%2c7.71L9%2c20.42Z' /%3e%3c/svg%3e");
mask-position: center center;
mask-size: .95em;
@@ -261,7 +258,7 @@ label:has(>input[type="checkbox"])::after {
opacity 300ms linear;
}
-label:has(>input[type="checkbox"]:checked)::after {
+label.tn-checkbox:has(>input[type="checkbox"]:checked)::after {
opacity: 1;
transform: scale(1);
transition: opacity 100ms ease-in-out;
@@ -270,17 +267,17 @@ label:has(>input[type="checkbox"]:checked)::after {
/* Radio buttons */
-label:has(>input[type="radio"])::before,
-label:has(>input[type="radio"])::after {
+label.tn-radio::before,
+label.tn-radio::after {
border-radius: 50%;
}
/* The outer circle */
-label:has(>input[type="radio"])::before {
+label.tn-radio::before {
background: var(--radio-checkbox-background);
}
-label:has(>input[type="radio"]:not(:disabled)):hover::before {
+label.tn-radio:has(>input[type="radio"]:not(:disabled)):hover::before {
background: var(--radio-checkbox-hover-background);
}
@@ -293,7 +290,7 @@ label:has(>input[type="radio"]:not(:disabled)):hover::before {
}
/* The inner circle */
-label:has(>input[type="radio"])::after {
+label.tn-radio::after {
background: var(--radio-checkbox-indicator-color);
transform: scale(0);
opacity: 0;
@@ -301,7 +298,7 @@ label:has(>input[type="radio"])::after {
transform 300ms ease-in;
}
-label:has(>input[type="radio"]:checked)::after {
+label.tn-radio:has(>input[type="radio"]:checked)::after {
transform: scale(.5);
opacity: 1;
transition: opacity 150ms linear;
@@ -310,10 +307,10 @@ label:has(>input[type="radio"]:checked)::after {
/* Disabled check boxes and radio buttons */
-label:has(> input[type="radio"]:disabled)::before,
-label:has(> input[type="radio"]:disabled)::after,
-label:has(> input[type="checkbox"]:disabled)::before,
-label:has(> input[type="checkbox"]:disabled)::after {
+label.tn-radio:has(> input[type="radio"]:disabled)::before,
+label.tn-radio:has(> input[type="radio"]:disabled)::after,
+label.tn-checkbox:has(> input[type="checkbox"]:disabled)::before,
+label.tn-checkbox:has(> input[type="checkbox"]:disabled)::after {
opacity: .5;
}