@@ -11,13 +11,13 @@ import {
1111 InlineNotification ,
1212 ToastNotification ,
1313 ActionableNotification ,
14+ unstable__Callout as Callout ,
1415} from '@carbon/react' ;
1516import figma from '@figma/code-connect' ;
1617
1718const sharedNotificationProps = {
1819 title : figma . string ( 'Title text' ) ,
1920 subtitle : figma . string ( 'Message text' ) ,
20- caption : figma . string ( 'Time text' ) , //only used on toast
2121 kind : figma . enum ( 'Status' , {
2222 Info : 'info' ,
2323 Success : 'success' ,
@@ -32,46 +32,43 @@ const sharedNotificationProps = {
3232 true : false ,
3333 false : true ,
3434 } ) ,
35- inline : figma . enum ( 'Type' , {
36- 'Inline short' : true ,
37- 'Inline long' : true ,
38- } ) ,
39- button : figma . nestedProps ( 'Button' , {
40- // currently grabbing the text from the icon button not the action button
41- // tracking here https://github.com/figma/code-connect/issues/11
42- actionButtonLabel : figma . string ( 'Button text' ) ,
43- } ) ,
44- // this doesn't work
45- // button: figma.nestedProps('Notification action button item', {
46- // actionButtonItem: figma.nestedProps('Button', {
47- // actionButtonLabel: figma.string('Button text'),
48- // }),
49- // }),
5035} ;
5136
37+ // Inline
38+ figma . connect (
39+ InlineNotification ,
40+ 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-Carbon-Design-System?node-id=4179-105911&t=nJ89fkK549fgCUuf-4' ,
41+ {
42+ variant : { Actionable : 'False' } ,
43+ props : sharedNotificationProps ,
44+ example : ( { title, kind, subtitle, hideCloseButton, lowContrast } ) => (
45+ < InlineNotification
46+ title = { title }
47+ kind = { kind }
48+ subtitle = { subtitle }
49+ hideCloseButton = { hideCloseButton }
50+ lowContrast = { lowContrast }
51+ />
52+ ) ,
53+ }
54+ ) ;
55+
56+ // Inline - actionable
5257figma . connect (
5358 ActionableNotification ,
54- 'https://www.figma.com/file /YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes--- Carbon-Design-System?type=design& node-id=4179-105911&mode=design&t=WhsTspVnawA9vgXk -4' ,
59+ 'https://www.figma.com/design /YAnB1jKx0yCUL29j6uSLpg/(v11)-Carbon-Design-System?node-id=4179-105911&t=nJ89fkK549fgCUuf -4' ,
5560 {
5661 variant : { Actionable : 'True' } ,
5762 props : sharedNotificationProps ,
58- example : ( {
59- title,
60- kind,
61- subtitle,
62- hideCloseButton,
63- lowContrast,
64- inline,
65- button,
66- } ) => (
63+ example : ( { title, kind, subtitle, hideCloseButton, lowContrast } ) => (
6764 < ActionableNotification
68- inline = { inline }
65+ inline
6966 kind = { kind }
7067 title = { title }
7168 subtitle = { subtitle }
7269 hideCloseButton = { hideCloseButton }
7370 lowContrast = { lowContrast }
74- actionButtonLabel = { button . actionButtonLabel }
71+ actionButtonLabel = "Action"
7572 onActionButtonClick = { ( ) => myFunction ( ) }
7673 onClose = { ( ) => myFunction ( ) }
7774 onCloseButtonClick = { ( ) => myFunction ( ) }
@@ -80,55 +77,99 @@ figma.connect(
8077 }
8178) ;
8279
80+ // Toast
8381figma . connect (
84- InlineNotification ,
85- 'https://www.figma.com/file /YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes--- Carbon-Design-System?type=design& node-id=4179-105911&mode=design&t=lJU3KHSU1pTpZ32z -4' ,
82+ ToastNotification ,
83+ 'https://www.figma.com/design /YAnB1jKx0yCUL29j6uSLpg/(v11)-Carbon-Design-System?node-id=84336-35011&t=nJ89fkK549fgCUuf -4' ,
8684 {
87- variant : { Type : 'Inline short' } ,
88-
89- props : sharedNotificationProps ,
90- example : ( { title, kind, subtitle, hideCloseButton, lowContrast } ) => (
91- < InlineNotification
92- title = { title }
85+ variant : { Actionable : 'False' } ,
86+ props : {
87+ title : figma . string ( 'Title text' ) ,
88+ subtitle : figma . string ( 'Message text' ) ,
89+ caption : figma . string ( 'Time text' ) ,
90+ kind : figma . enum ( 'Status' , {
91+ Info : 'info' ,
92+ Success : 'success' ,
93+ Warning : 'warning' ,
94+ Error : 'error' ,
95+ } ) ,
96+ hideCloseButton : figma . boolean ( 'Close' , {
97+ true : false ,
98+ false : true ,
99+ } ) ,
100+ lowContrast : figma . boolean ( 'High contrast' , {
101+ true : false ,
102+ false : true ,
103+ } ) ,
104+ } ,
105+ example : ( {
106+ title,
107+ kind,
108+ subtitle,
109+ caption,
110+ lowContrast,
111+ hideCloseButton,
112+ } ) => (
113+ < ToastNotification
93114 kind = { kind }
115+ title = { title }
94116 subtitle = { subtitle }
117+ caption = { caption }
95118 hideCloseButton = { hideCloseButton }
96119 lowContrast = { lowContrast }
97120 />
98121 ) ,
99122 }
100123) ;
101124
125+ // Toast -- actionable
102126figma . connect (
103- InlineNotification ,
104- 'https://www.figma.com/file /YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes--- Carbon-Design-System?type=design& node-id=4179-105911&mode=design&t=lJU3KHSU1pTpZ32z -4' ,
127+ ActionableNotification ,
128+ 'https://www.figma.com/design /YAnB1jKx0yCUL29j6uSLpg/(v11)-Carbon-Design-System?node-id=84336-35011&t=nJ89fkK549fgCUuf -4' ,
105129 {
106- variant : { Type : 'Inline long ' } ,
130+ variant : { Actionable : 'True ' } ,
107131 props : sharedNotificationProps ,
108132 example : ( { title, kind, subtitle, hideCloseButton, lowContrast } ) => (
109- < InlineNotification
110- title = { title }
133+ < ActionableNotification
111134 kind = { kind }
135+ title = { title }
112136 subtitle = { subtitle }
113137 hideCloseButton = { hideCloseButton }
114138 lowContrast = { lowContrast }
139+ actionButtonLabel = "Action"
140+ onActionButtonClick = { ( ) => myFunction ( ) }
141+ onClose = { ( ) => myFunction ( ) }
142+ onCloseButtonClick = { ( ) => myFunction ( ) }
115143 />
116144 ) ,
117145 }
118146) ;
119147
148+ // Callout
120149figma . connect (
121- ToastNotification ,
122- 'https://www.figma.com/file /YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes--- Carbon-Design-System?type=design& node-id=4179-105911&mode=design&t=WhsTspVnawA9vgXk -4' ,
150+ Callout ,
151+ 'https://www.figma.com/design /YAnB1jKx0yCUL29j6uSLpg/(v11)-Carbon-Design-System?node-id=84336-36580&t=nJ89fkK549fgCUuf -4' ,
123152 {
124- variant : { Type : 'Toast' } ,
125- props : sharedNotificationProps ,
126- example : ( { title, kind, subtitle, caption, lowContrast } ) => (
127- < ToastNotification
128- kind = { kind }
153+ props : {
154+ title : figma . boolean ( 'Title' , {
155+ true : figma . string ( 'Title text' ) ,
156+ false : '' ,
157+ } ) ,
158+ subtitle : figma . string ( 'Message text' ) ,
159+ kind : figma . enum ( 'Status' , {
160+ Info : 'info' ,
161+ Warning : 'warning' ,
162+ } ) ,
163+ lowContrast : figma . boolean ( 'High contrast' , {
164+ true : false ,
165+ false : true ,
166+ } ) ,
167+ } ,
168+ example : ( { title, kind, subtitle, lowContrast } ) => (
169+ < Callout
129170 title = { title }
171+ kind = { kind }
130172 subtitle = { subtitle }
131- caption = { caption }
132173 lowContrast = { lowContrast }
133174 />
134175 ) ,
0 commit comments