22@include pfe-contexts ;
33
44$LOCAL : icon ;
5+
56$LOCAL-VARIABLES : (
67 context : light ,
78 size : pfe-var (icon-size ),
89 spacing : pfe-var (container-spacer ),
9- color : transparent ,
1010 Padding : 0 ,
1111 BackgroundColor : transparent ,
1212 BorderWidth : 0 ,
13+ // Legacy variable for changing icon color
14+ Color : pfe-broadcasted (text ),
1315);
1416
1517// Nested internal variables (pfe-local calls), maps cannot "self-reference"
1618$LOCAL-VARIABLES : map-deep-merge ($LOCAL-VARIABLES , (
17- Color : pfe-local (color , $fallback : pfe-broadcasted (text )),
19+ // Current variable for updating icon color
20+ color : pfe-local (Color ),
21+ ));
22+
23+ // Nested internal variables (pfe-local calls), maps cannot "self-reference"
24+ $LOCAL-VARIABLES : map-deep-merge ($LOCAL-VARIABLES , (
1825 BorderColor: pfe-local (color ),
1926));
2027
@@ -31,15 +38,16 @@ $LOCAL-VARIABLES: map-deep-merge($LOCAL-VARIABLES, (
3138}
3239
3340:host {
34- --context : #{pfe-local (context )} ;
41+ --context : #{pfe-local (context )} ;
3542
3643 position : relative ;
3744 display : inline-block ;
3845
39- // Supports sizing while preserving aspect ratio (despite layout)
40- max-width : calc (#{pfe-local (size )} + #{pfe-local (Padding )} * 2 );
46+ // Content-box model supports sizing while preserving aspect ratio (despite layout)
47+ box-sizing : content-box !important ;
48+ max-width : pfe-local (size );
4149 width : fit-content !important ;
42- max-height : calc ( #{ pfe-local (size )} + #{ pfe-local ( Padding )} * 2 );
50+ max-height : pfe-local (size );
4351 height : fit-content !important ;
4452 line-height : 0 ;
4553
@@ -83,7 +91,7 @@ $LOCAL-VARIABLES: map-deep-merge($LOCAL-VARIABLES, (
8391 }
8492
8593 filter feFlood {
86- flood-color : pfe-local (Color );
94+ flood-color : pfe-local (color );
8795 }
8896
8997 .pfe-icon--fallback {
@@ -107,13 +115,26 @@ $sizing: (
107115// @TODO: Sort out sizing
108116@each $label , $size in $sizing {
109117 :host ([size = " #{$label } " ]) {
110- --pfe-icon--size : #{$size } ;
118+ // Respect var if user set CSS var, but fallback to sizing property map
119+ $desired-size : pfe-local (size , $fallback : $size );
120+ max-width : $desired-size ;
121+ max-height : $desired-size ;
122+
123+ svg {
124+ width : $desired-size ;
125+ height : $desired-size ;
126+ }
111127 }
112128}
113129
114130@each $level in (critical, important, moderate, success, info, default ) {
115131 :host ([color = " #{$level } " ]) {
116- --pfe-icon--color : #{pfe-var (feedback--#{$level} )} ;
132+ filter feFlood {
133+ flood-color : pfe-local (
134+ color ,
135+ $fallback : pfe-var (feedback--#{$level} )
136+ );
137+ }
117138 @if $level != " moderate" {
118139 --pfe-icon--context : dark ;
119140 }
@@ -122,19 +143,48 @@ $sizing: (
122143
123144@each $color in (lightest, base, darker, darkest, complement, accent) {
124145 :host ([color = " #{$color } " ]) {
125- --pfe-icon--color : #{pfe-var (surface--#{$color} )} ;
126146 --pfe-icon--context : #{pfe-var (surface--#{$color}--context )} ;
147+
148+ filter feFlood {
149+ flood-color : pfe-local (
150+ color ,
151+ $fallback : pfe-var (surface--#{$color} )
152+ );
153+ }
127154 }
128155}
129156
130157// May need Feedback Darkest colors too.
131158
132159:host ([circled]:not ([circled= " false" ] )) {
133- --pfe-icon--BackgroundColor : #{pfe-local (color , $fallback : pfe-var (surface--lightest ))} ;
134- --pfe-icon--Color : #{pfe-broadcasted (text )} ;
135- --pfe-icon--Padding : .5em ;
136- --pfe-icon--BorderWidth : #{pfe-var (ui--border-width )} ;
137- --pfe-icon--BorderColor : #{pfe-local (color , $fallback : pfe-var (surface--border ))} ;
160+ padding : pfe-local (Padding , $fallback : .5em );
161+ border-width : pfe-local (BorderWidth , $fallback : pfe-var (ui--border-width ));
162+ border-color : pfe-local (color , $fallback : pfe-var (surface--border ));
163+ background-color : pfe-local (BackgroundColor , pfe-local (color , $fallback : pfe-var (surface--lightest )));
164+
165+ filter feFlood {
166+ flood-color : pfe-local (color );
167+ }
168+ }
169+
170+ /* *
171+ * Override circled items with color set to named property
172+ */
173+ @each $color in (lightest, base, darker, darkest, complement, accent) {
174+ :host ([color = #{$color } ][circled ]:not ([circled = " false" ])) {
175+ // Respect var if user set CSS var, but fallback to property
176+ $desired-color : pfe-local (color , $fallback : pfe-var (surface--#{$color} ));
177+ background-color : $desired-color ;
178+ border-color : $desired-color ;
179+ }
180+ }
181+ @each $level in (critical, important, moderate, success, info, default ) {
182+ :host ([color = " #{$level } " ][circled ]:not ([circled = " false" ])) {
183+ // Respect var if user set CSS var, but fallback to property
184+ $desired-color : pfe-local (backgroundColor , $fallback : pfe-var (feedback--#{$level} ));
185+ background-color : $desired-color ;
186+ border-color : $desired-color ;
187+ }
138188}
139189
140190:host (.load- failed) svg image {
0 commit comments