@@ -12,9 +12,61 @@ import "@carbon/web-components/es/components/text-input/index.js";
1212import "@carbon/web-components/es/components/checkbox/index.js" ;
1313
1414import { PublicConfig , MinimizeButtonIconType } from "@carbon/ai-chat" ;
15+ import Help16 from "@carbon/icons/es/help/16.js" ;
16+ import Information16 from "@carbon/icons/es/information/16.js" ;
17+ import Document16 from "@carbon/icons/es/document/16.js" ;
18+ import Chat16 from "@carbon/icons/es/chat/16.js" ;
19+ import UserAvatar16 from "@carbon/icons/es/user--avatar/16.js" ;
20+ import Settings16 from "@carbon/icons/es/settings/16.js" ;
21+ import Share16 from "@carbon/icons/es/share/16.js" ;
22+ import Download16 from "@carbon/icons/es/download/16.js" ;
1523import { css , html , LitElement } from "lit" ;
1624import { customElement , property } from "lit/decorators.js" ;
1725
26+ // Sample actions for demo
27+ const sampleActions = [
28+ {
29+ icon : Help16 ,
30+ text : "Help" ,
31+ onClick : ( ) => alert ( "Help clicked!" ) ,
32+ } ,
33+ {
34+ icon : Information16 ,
35+ text : "About" ,
36+ onClick : ( ) => alert ( "About clicked!" ) ,
37+ } ,
38+ {
39+ icon : Document16 ,
40+ text : "Documentation" ,
41+ onClick : ( ) => alert ( "Documentation clicked!" ) ,
42+ } ,
43+ {
44+ icon : Chat16 ,
45+ text : "Feedback" ,
46+ onClick : ( ) => alert ( "Feedback clicked!" ) ,
47+ } ,
48+ {
49+ icon : UserAvatar16 ,
50+ text : "Profile" ,
51+ onClick : ( ) => alert ( "Profile clicked!" ) ,
52+ } ,
53+ {
54+ icon : Settings16 ,
55+ text : "Settings" ,
56+ onClick : ( ) => alert ( "Settings clicked!" ) ,
57+ } ,
58+ {
59+ icon : Share16 ,
60+ text : "Share" ,
61+ onClick : ( ) => alert ( "Share clicked!" ) ,
62+ } ,
63+ {
64+ icon : Download16 ,
65+ text : "Export Chat" ,
66+ onClick : ( ) => alert ( "Export Chat clicked!" ) ,
67+ } ,
68+ ] ;
69+
1870@customElement ( "demo-header-switcher" )
1971export class DemoHeaderSwitcher extends LitElement {
2072 static styles = css `
@@ -136,10 +188,20 @@ export class DemoHeaderSwitcher extends LitElement {
136188 text : "Help" ,
137189 handler : ( ) => alert ( "Help clicked!" ) ,
138190 } ,
191+ {
192+ text : "Documentation" ,
193+ href : "https://chat.carbondesignsystem.com/tag/latest/docs/documents/Overview.html" ,
194+ target : "_blank" ,
195+ } ,
139196 {
140197 text : "Settings" ,
141198 handler : ( ) => alert ( "Settings clicked!" ) ,
142199 } ,
200+ {
201+ text : "Disabled Option" ,
202+ handler : ( ) => alert ( "This should not appear!" ) ,
203+ disabled : true ,
204+ } ,
143205 ] ;
144206 } else {
145207 delete header . menuOptions ;
@@ -162,6 +224,20 @@ export class DemoHeaderSwitcher extends LitElement {
162224 this . _updateConfig ( { header } ) ;
163225 } ;
164226
227+ private _onSampleActionsChanged = ( event : Event ) => {
228+ const customEvent = event as CustomEvent ;
229+ const checked = customEvent . detail . checked ;
230+ const header = { ...this . config . header } ;
231+
232+ if ( checked ) {
233+ header . actions = sampleActions ;
234+ } else {
235+ delete header . actions ;
236+ }
237+
238+ this . _updateConfig ( { header } ) ;
239+ } ;
240+
165241 private _getCurrentMinimizeButtonType ( ) : string {
166242 if ( this . config ?. header ?. hideMinimizeButton ) {
167243 return "none" ;
@@ -243,6 +319,15 @@ export class DemoHeaderSwitcher extends LitElement {
243319 Show AI label
244320 </ cds-checkbox >
245321 </ div >
322+
323+ < div class ="header-section ">
324+ < cds-checkbox
325+ ?checked =${ ( header ?. actions ?. length ?? 0 ) > 0 }
326+ @cds-checkbox-changed =${ this . _onSampleActionsChanged }
327+ >
328+ Add menu actions
329+ </ cds-checkbox >
330+ </ div >
246331 ` ;
247332 }
248333}
0 commit comments