@@ -428,6 +428,9 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
428
428
}
429
429
430
430
private _renderColorPicker ( ) {
431
+ const previewColor = this . value
432
+ ? `hsla(${ this . hue } deg, ${ this . saturation } %, ${ this . lightness } %, ${ this . alpha / 100 } )`
433
+ : 'transparent' ;
431
434
return html `
432
435
<div
433
436
class= ${ classMap ( {
@@ -478,11 +481,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
478
481
class = "color-picker__preview color-picker__transparent-bg"
479
482
title = "Copy"
480
483
aria-label = "Copy"
481
- style = ${ styleMap ( {
482
- '--preview-color' : `hsla(${ this . hue } deg, ${ this . saturation } %, ${
483
- this . lightness
484
- } %, ${ this . alpha / 100 } )`,
485
- } ) }
484
+ style = ${ styleMap ( { '--preview-color' : previewColor } ) }
486
485
@click = ${ this . handleCopy } > </ butto n>
487
486
</ div>
488
487
<div class= "color-picker__user-input" aria-live = "polite" >
@@ -547,6 +546,9 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
547
546
}
548
547
549
548
private _renderPreviewButton ( ) {
549
+ const previewColor = this . value
550
+ ? `hsla(${ this . hue } deg, ${ this . saturation } %, ${ this . lightness } %, ${ this . alpha / 100 } )`
551
+ : 'transparent' ;
550
552
return html `<butto n
551
553
type= "button"
552
554
part = "trigger"
@@ -559,11 +561,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
559
561
'color-dropdown__trigger--large' : this . size === 'large' ,
560
562
'color-picker__transparent-bg' : true ,
561
563
} ) }
562
- style= ${ styleMap ( {
563
- '--preview-color' : `hsla(${ this . hue } deg, ${ this . saturation } %, ${
564
- this . lightness
565
- } %, ${ this . alpha / 100 } )`,
566
- } ) }
564
+ style= ${ styleMap ( { '--preview-color' : previewColor } ) }
567
565
?dis abled= ${ this . disabled }
568
566
aria- has popup= "true"
569
567
aria- expand ed= "false"
0 commit comments