1
1
import { Template as ActionButton } from "@spectrum-css/actionbutton/stories/template.js" ;
2
2
import { Template as Button } from "@spectrum-css/button/stories/template.js" ;
3
3
import { Template as IllustratedMessage } from "@spectrum-css/illustratedmessage/stories/template.js" ;
4
- import { Template as Typography } from "@spectrum-css/typography/stories/template.js" ;
5
4
import { html } from "lit" ;
6
5
import { classMap } from "lit/directives/class-map.js" ;
7
6
import { ifDefined } from "lit/directives/if-defined.js" ;
7
+ import { styleMap } from "lit/directives/style-map.js" ;
8
8
9
9
10
10
@@ -15,6 +15,7 @@ export const Template = ({
15
15
isDragged = false ,
16
16
isFilled = false ,
17
17
customClasses = [ ] ,
18
+ customStyles = { } ,
18
19
title,
19
20
description,
20
21
label,
@@ -34,27 +35,47 @@ export const Template = ({
34
35
id =${ ifDefined ( id ) }
35
36
role="region"
36
37
tabindex="0"
37
- style=" ${ isDragged && isFilled ? `background-image:url(${ image } );` : null } width: 300px;"
38
+ style=${ [ isDragged && isFilled ? `background-image:url(${ image } );` : null , styleMap ( customStyles ) ] . filter ( Boolean ) . join ( "; " ) }
38
39
>
39
- ${ IllustratedMessage ( {
40
- ...globals ,
41
- title : title ,
42
- description : description ,
43
- customIllustration : customSvg ,
44
- size : size
45
- } ) }
46
- < div class ="${ rootClass } -actions ">
47
- ${ isDragged && isFilled
48
- ? ActionButton ( {
49
- label : label ,
50
- customClasses : [ `${ rootClass } -button` ] ,
51
- isSelected : true ,
52
- isEmphasized : true
53
- } )
54
- : Button ( {
55
- label : label ,
56
- size : size
57
- } ) }
40
+ < svg
41
+ class ="${ rootClass } -stroke "
42
+ xmlns ="http://www.w3.org/2000/svg "
43
+ viewBox ="0 0 206 122 "
44
+ preserveAspectRatio ="none "
45
+ >
46
+ < rect
47
+ x ="1 "
48
+ y ="1 "
49
+ width ="204 "
50
+ height ="120 "
51
+ rx ="8 "
52
+ ry ="8 "
53
+ fill ="none "
54
+ stroke-linecap ="round "
55
+ class ="${ rootClass } -stroke-path "
56
+ />
57
+ </ svg >
58
+ < div class ="${ rootClass } -content ">
59
+ ${ IllustratedMessage ( {
60
+ ...globals ,
61
+ title : title ,
62
+ description : description ,
63
+ customIllustration : customSvg ,
64
+ size : size
65
+ } ) }
66
+ < div class ="${ rootClass } -actions ">
67
+ ${ isDragged && isFilled
68
+ ? ActionButton ( {
69
+ label : label ,
70
+ customClasses : [ `${ rootClass } -button` ] ,
71
+ isSelected : true ,
72
+ isEmphasized : true
73
+ } )
74
+ : Button ( {
75
+ label : label ,
76
+ size : size
77
+ } ) }
78
+ </ div >
58
79
</ div >
59
80
</ div >
60
81
` ;
@@ -63,27 +84,5 @@ export const Template = ({
63
84
const customSvg = ( ) => html `
64
85
< svg class ="spectrum-IllustratedMessage-illustration " fill ="none " viewBox ="0 0 96 96 " xmlns ="http://www.w3.org/2000/svg ">
65
86
< path d ="m33.454 15.74c-4.1061 0-7.4545 3.3125-7.4545 7.4231v36.154c0 4.1106 3.3484 7.4231 7.4545 7.4231h29.091c4.1061 0 7.4545-3.3125 7.4545-7.4231v-21.254c0-1.9724-0.7882-3.8618-2.1875-5.253l-14.987-14.9c-1.3989-1.3908-3.2937-2.1701-5.2671-2.1701h-14.104zm-3.4545 7.4231c0-1.8796 1.5357-3.4231 3.4545-3.4231h14.104c0.92 0 1.7999 0.3634 2.4469 1.0067l14.987 14.9c0.6466 0.6429 1.0077 1.5123 1.0077 2.4164v21.254c0 1.8796-1.5357 3.4231-3.4545 3.4231h-29.091c-1.9188 0-3.4545-1.5435-3.4545-3.4231v-36.154zm9.7659 22.028c-0.8552-0.6991-2.1152-0.5726-2.8143 0.2825-0.6991 0.8552-0.5726 2.1152 0.2825 2.8143l8.2189 6.7193c0.3659 0.4459 0.9208 0.7309 1.5426 0.7323h0.0189l0.0167-2e-4c0.4638 0.0071 0.9295-0.1465 1.308-0.4605l8.4378-7c0.8501-0.7053 0.9675-1.9662 0.2623-2.8163-0.7053-0.8501-1.9662-0.9675-2.8163-0.2623l-5.2138 4.3254 0.0345-15.782c0.0024-1.1046-0.8911-2.002-1.9956-2.0044-1.1046-0.0024-2.002 0.8911-2.0044 1.9956l-0.0344 15.743-5.2434-4.2867zm-12.766 30.548c-1.1046 0-2 0.8954-2 2s0.8954 2 2 2h7.5c1.1046 0 2-0.8954 2-2s-0.8954-2-2-2h-7.5zm-15-9.5c-1.1046 0-2-0.8954-2-2v-7.5c0-1.1046 0.8954-2 2-2s2 0.8954 2 2v7.5c0 1.1046-0.8954 2-2 2zm70-1.5c0 1.1046 0.8954 2 2 2s2-0.8954 2-2v-7.5c0-1.1046-0.8954-2-2-2s-2 0.8954-2 2v7.5zm-61-22c0-1.1046-0.8954-2-2-2h-3.5c-3.0376 0-5.5 2.4624-5.5 5.5v3.5c0 1.1046 0.8954 2 2 2s2-0.8954 2-2v-3.5c0-0.8284 0.6716-1.5 1.5-1.5h3.5c1.1046 0 2-0.8954 2-2zm56-2c-1.1046 0-2 0.8954-2 2s0.8954 2 2 2h3.5c0.8284 0 1.5 0.6716 1.5 1.5v3.5c0 1.1046 0.8954 2 2 2s2-0.8954 2-2v-3.5c0-3.0376-2.4624-5.5-5.5-5.5h-3.5zm-65 28c-1.1046 0-2 0.8954-2 2v3.5c0 3.0376 2.4624 5.5 5.5 5.5h3.5c1.1046 0 2-0.8954 2-2s-0.8954-2-2-2h-3.5c-0.8284 0-1.5-0.6716-1.5-1.5v-3.5c0-1.1046-0.8954-2-2-2zm74 2c0-1.1046-0.8954-2-2-2s-2 0.8954-2 2v3.5c0 0.8284-0.6716 1.5-1.5 1.5h-3.5c-1.1046 0-2 0.8954-2 2s0.8954 2 2 2h3.5c3.0376 0 5.5-2.4624 5.5-5.5v-3.5zm-44 7c0-1.1046 0.8954-2 2-2h7.5c1.1046 0 2 0.8954 2 2s-0.8954 2-2 2h-7.5c-1.1046 0-2-0.8954-2-2zm19-2c-1.1046 0-2 0.8954-2 2s0.8954 2 2 2h7.5c1.1046 0 2-0.8954 2-2s-0.8954-2-2-2h-7.5z " clip-rule ="evenodd " fill-rule ="evenodd "/>
66
- </ svg >
67
- ` ;
68
-
69
- export const SizingTemplate = ( args ) => html `
70
- ${ [ "s" , "m" , "l" ] . map ( ( size ) => {
71
- return html ` < div >
72
- ${ Typography ( {
73
- semantics : "detail" ,
74
- size : "s" ,
75
- content : [
76
- {
77
- s : "Small" ,
78
- m : "Medium" ,
79
- l : "Large" ,
80
- } [ size ] ,
81
- ] ,
82
- } ) }
83
- ${ Template ( {
84
- ...args ,
85
- size,
86
- } ) }
87
- </ div > ` ;
88
- } ) }
87
+ </ svg >
89
88
` ;
0 commit comments