1
1
@use " sass:list" ;
2
2
3
3
/* @docs */
4
- $radio-active-background-color : var ( --#{$prefix} primary) !default ;
4
+ $radio-active-background-color : $ primary !default ;
5
5
$radio-checked-box-shadow-length : 0 0 0.5em !default ;
6
6
$radio-checked-box-shadow-opacity : 0.8 !default ;
7
7
$radio-box-shadow : $control-box-shadow !default ;
@@ -13,18 +13,25 @@ $radio-line-height: 1.25 !default;
13
13
/* @docs */
14
14
15
15
// filled svg calculation
16
- @function svg_radio_fill ($color , $background-color : " transparent" ) {
17
- $start : ' <svg width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">' ;
18
- $content : ' <g transform="matrix(4.38544,0,0,4.38544,-94.4336,-58.9876)"><path d="M32.935,13.679C39.102,13.679 44.108,18.685 44.108,24.852C44.108,31.019 39.102,36.025 32.935,36.025C26.768,36.025 21.761,31.019 21.761,24.852C21.761,18.685 26.768,13.679 32.935,13.679ZM32.798,17.05C37.105,17.05 40.601,20.546 40.601,24.852C40.601,29.158 37.105,32.655 32.798,32.655C28.492,32.655 24.996,29.158 24.996,24.852C24.996,20.546 28.492,17.05 32.798,17.05Z" style="fill:#{$color } ;"/><circle cx="32.84" cy="24.8" r="7.9" style="fill:#{$background-color } ;"/></g>' ;
16
+ @function svg_radio_fill () {
17
+ $start : ' <svg width="100%" height="100%" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" fill="#e11919" stroke="#000" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">' ;
18
+ $content : ' <g id="SVGRepo_bgCarrier" stroke-width="0"></g>' +
19
+ ' <g id="SVGRepo_iconCarrier">' +
20
+ ' <path d="M483 260c0-123-100-223-223-223S37 137 37 260s100 223 223 223S483 383 483 260Z" style="fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:64px"></path>' +
21
+ ' <circle cx="256" cy="256" r="144"></circle>' + " </g>" ;
22
+
19
23
$end : " </svg>" ;
20
24
21
25
@return svg-encode (" #{$start }#{$content }#{$end } " );
22
26
}
23
27
24
28
// empty svg calculation
25
- @function svg_radio_empty ($color ) {
26
- $start : ' <svg width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">' ;
27
- $content : ' <g transform="matrix(10.1032,0,0,10.1032,-255.068,-313.298)"><circle cx="30.195" cy="35.959" r="4.85" style="fill:#{$color } ;"/></g>' ;
29
+ @function svg_radio_empty () {
30
+ $start : ' <svg width="100%" height="100%" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" fill="#000" stroke="#000" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">' ;
31
+ $content : ' <g id="SVGRepo_bgCarrier" stroke-width="0"></g>' +
32
+ ' <g id="SVGRepo_iconCarrier">' +
33
+ ' <path d="M483 260c0-123-100-223-223-223S37 137 37 260s100 223 223 223S483 383 483 260Z" style="fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:64px"></path>' +
34
+ " </g>" ;
28
35
$end : " </svg>" ;
29
36
30
37
@return svg-encode (" #{$start }#{$content }#{$end } " );
@@ -39,27 +46,34 @@ $radio-line-height: 1.25 !default;
39
46
margin-right : var (--#{$prefix}radio-margin-sibiling , $radio-margin-sibiling );
40
47
41
48
& __input {
49
+ font-size : var (--#{$prefix}radio-font-size , inherit );
42
50
width : var (--#{$prefix}radio-size , $radio-size );
43
51
height : var (--#{$prefix}radio-size , $radio-size );
44
52
margin : 0 ;
45
53
vertical-align : top ;
46
- background-position : center ;
47
- background-size : contain ;
48
54
-webkit-appearance : none ;
49
55
-moz-appearance : none ;
50
56
appearance : none ;
51
57
-webkit-print-color-adjust : exact ;
52
58
print-color-adjust : exact ;
53
- border-radius : 50% ;
54
59
cursor : pointer ;
60
+ box-shadow : var (--#{$prefix}radio-box-shadow , $radio-box-shadow );
61
+ border-radius : 50% ;
62
+ background : var (
63
+ --oruga-radio-active-background-color ,
64
+ $radio-active-background-color
65
+ );
66
+ mask-image : url (svg_radio_empty ());
67
+ background-image : none ;
68
+ background-position : center ;
69
+ background-size : contain ;
55
70
background-repeat : no-repeat ;
71
+
56
72
transition : background var (--#{$prefix}transition-duration )
57
73
var (--#{$prefix}transition-timing );
58
- box-shadow : var (--#{$prefix}radio-box-shadow , $radio-box-shadow );
59
- background-image : url (svg_radio_empty ($radio-active-background-color ));
60
74
61
75
& --checked {
62
- background -image : url (svg_radio_fill ($radio-active-background-color ));
76
+ mask -image : url (svg_radio_fill ());
63
77
}
64
78
}
65
79
@@ -71,22 +85,20 @@ $radio-line-height: 1.25 !default;
71
85
opacity : var (--#{$prefix}radio-disabled-opacity , $radio-disabled-opacity );
72
86
}
73
87
88
+ // size variants
74
89
@each $name , $value in $sizes {
75
90
& --#{$name} {
76
- font-size : var (--#{$prefix}radio-font-size-#{$name} , $value );
91
+ -- #{$prefix } radio-font-size : #{$value } ;
92
+ -- #{$prefix } radio-size : #{$value } ;
77
93
}
78
94
}
95
+
96
+ // color variants
79
97
@each $name , $pair in $colors {
80
98
$color : list .nth ($pair , 1 );
81
99
$color-invert : list .nth ($pair , 2 );
82
100
& --#{$name} {
83
- .o-radio__input {
84
- background-image : url (svg_radio_empty ($color ));
85
-
86
- & --checked {
87
- background-image : url (svg_radio_fill ($color , $color-invert ));
88
- }
89
- }
101
+ --oruga-radio-active-background-color : #{$color } ;
90
102
}
91
103
}
92
104
}
0 commit comments