@@ -4,22 +4,21 @@ import { Story } from '@storybook/web-components';
4
4
import { html } from 'lit-html' ;
5
5
6
6
const swatches = [
7
- '#d0021b' ,
8
- '#f5a623' ,
9
- '#f8e71c' ,
10
- '#8b572a' ,
11
- '#7ed321' ,
12
- '#417505' ,
13
- '#bd10e0' ,
14
- '#9013fe' ,
15
- '#4a90e2' ,
16
- '#50e3c2' ,
17
- '#b8e986' ,
18
- '#000000' ,
19
- '#444' ,
20
- '#888' ,
21
- '#ccc' ,
22
- '#fff' ,
7
+ { label : 'Blood Orange' , value : '#d0021b' } ,
8
+ { label : 'Marigold' , value : '#f5a623' } ,
9
+ { label : 'Yellow Sun' , value : '#f8e71c' } ,
10
+ { label : 'Milk Chocolate' , value : '#8b572a' } ,
11
+ { label : 'Lemon Lime' , value : '#7ed321' } ,
12
+ { label : 'Avocado' , value : '#417505' } ,
13
+ { label : 'Vivid Mulberry' , value : '#bd10e0' } ,
14
+ { label : 'Electric Violet' , value : '#9013fe' } ,
15
+ { label : 'Tufts Blue' , value : '#4a90e2' } ,
16
+ { label : 'Crayola' , value : '#b8e986' } ,
17
+ { label : 'Black' , value : '#000000' } ,
18
+ { label : 'Grey' , value : '#888' } ,
19
+ { label : 'Outer Space' , value : '#444' } ,
20
+ { label : 'Chinese Silver' , value : '#ccc' } ,
21
+ { label : 'White' , value : '#fff' } ,
23
22
] ;
24
23
25
24
const swatchesTransparent = [
@@ -56,12 +55,16 @@ export default {
56
55
57
56
const Template : Story = props => html `
58
57
< uui-color-swatches .value =${ props . value ?? '' } label ="my color pallette">
59
- ${ props . swatches . map (
60
- ( swatch : string ) =>
61
- html `< uui-color-swatch label ="${ swatch } " .showLabel =${ props . showLabel }
62
- > ${ swatch } </ uui-color-swatch
63
- > `
64
- ) }
58
+ ${ props . swatches . map ( ( swatch : any ) => {
59
+ const label = typeof swatch === 'string' ? swatch : swatch . label ;
60
+ const value = typeof swatch === 'string' ? swatch : swatch . value ;
61
+
62
+ return html `< uui-color-swatch
63
+ label ="${ label } "
64
+ .showLabel =${ props . showLabel }
65
+ > ${ value } </ uui-color-swatch
66
+ > ` ;
67
+ } ) }
65
68
</ uui-color-swatches >
66
69
` ;
67
70
0 commit comments