浏览代码

Refactor `border-radius` in components to use CSS variables (#2240)

Paweł Kuna 5 月之前
父节点
当前提交
c20d076b74

+ 5 - 0
.changeset/mighty-clocks-wonder.md

@@ -0,0 +1,5 @@
+---
+"@tabler/core": patch
+---
+
+Refactor `border-radius` in components to use CSS variables

+ 4 - 2
core/scss/ui/_signature.scss

@@ -1,12 +1,14 @@
 .signature {
+  --#{$prefix}signature-padding: var(--#{$prefix}spacer-1);
+  --#{$prefix}signature-border-radius: var(--#{$prefix}border-radius);
   border: var(--#{$prefix}border-width) solid var(--#{$prefix}border-color);
-  padding: var(--#{$prefix}spacer-1);
+  padding: var(--#{$prefix}signature-padding);
   border-radius: var(--#{$prefix}border-radius);
 }
 
 .signature-canvas {
   border: var(--#{$prefix}border-width) dashed var(--#{$prefix}border-color);
-  border-radius: var(--#{$prefix}border-radius-sm);
+  border-radius: calc(var(--#{$prefix}signature-border-radius) - var(--#{$prefix}signature-padding));
   display: block;
   cursor: crosshair;
   width: 100%;

+ 1 - 1
core/scss/ui/forms/_form-colorinput.scss

@@ -21,7 +21,7 @@ Color Input
   height: 1.5rem;
   color: $white;
   border: var(--#{$prefix}border-width) var(--#{$prefix}border-style) $input-border-color-translucent;
-  border-radius: 3px;
+  border-radius: var(--#{$prefix}border-radius);
   box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);
 
   &:before {

+ 6 - 5
core/scss/ui/forms/_form-imagecheck.scss

@@ -2,6 +2,7 @@
 Image check
  */
 .form-imagecheck {
+  --#{$prefix}form-imagecheck-radius: var(--#{$prefix}border-radius);
   position: relative;
   margin: 0;
   cursor: pointer;
@@ -19,7 +20,7 @@ Image check
   margin: 0;
   user-select: none;
   border: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color);
-  border-radius: 3px;
+  border-radius: var(--#{$prefix}form-imagecheck-radius);
 
   .form-imagecheck-input:focus ~ & {
     border-color: var(--#{$prefix}primary);
@@ -73,13 +74,13 @@ Image check
   @include transition(opacity $transition-time);
 
   &:first-child {
-    border-top-left-radius: 2px;
-    border-top-right-radius: 2px;
+    border-top-left-radius: calc(var(--#{$prefix}form-imagecheck-radius) - 1px);
+    border-top-right-radius: calc(var(--#{$prefix}form-imagecheck-radius) - 1px);
   }
 
   &:last-child {
-    border-bottom-right-radius: 2px;
-    border-bottom-left-radius: 2px;
+    border-bottom-right-radius: calc(var(--#{$prefix}form-imagecheck-radius) - 1px);
+    border-bottom-left-radius: calc(var(--#{$prefix}form-imagecheck-radius) - 1px);
   }
 
   .form-imagecheck:hover &,

+ 1 - 1
core/scss/ui/forms/_form-selectgroup.scss

@@ -42,7 +42,7 @@ Select group
   cursor: pointer;
   user-select: none;
   border: var(--#{$prefix}border-width) var(--#{$prefix}border-style) $input-border-color;
-  border-radius: 3px;
+  border-radius: var(--#{$prefix}border-radius);
   box-shadow: $input-box-shadow;
   @include transition(border-color $transition-time, background $transition-time, color $transition-time);
 

+ 1 - 1
core/scss/utils/_colors.scss

@@ -96,5 +96,5 @@
 }
 
 .bg-surface-backdrop {
-  background-color: rgba($modal-backdrop-bg, $modal-backdrop-opacity) !important;
+  background-color: color-transparent($modal-backdrop-bg, $modal-backdrop-opacity) !important;
 }

+ 5 - 0
core/scss/vendor/_coloris.scss

@@ -1,6 +1,11 @@
 .clr-picker {
   box-shadow: var(--#{$prefix}shadow-dropdown);
   background-color: var(--#{$prefix}bg-surface);
+  border-radius: var(--#{$prefix}border-radius);
+}
+
+.clr-gradient {
+  border-radius: var(--#{$prefix}border-radius) var(--#{$prefix}border-radius) 0 0;
 }
 
 input.clr-color {

+ 1 - 0
core/scss/vendor/_litepicker.scss

@@ -62,6 +62,7 @@
     .container__months {
       box-shadow: none;
       background-color: var(--#{$prefix}bg-forms);
+      border-radius: calc(var(--#{$prefix}border-radius) - 1px);
     }
   }
 }