| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  | import * as interfaces from './interfaces/index.js'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import { | 
					
						
							|  |  |  |   DeesElement, | 
					
						
							|  |  |  |   type TemplateResult, | 
					
						
							|  |  |  |   property, | 
					
						
							|  |  |  |   customElement, | 
					
						
							|  |  |  |   html, | 
					
						
							|  |  |  |   css, | 
					
						
							|  |  |  |   cssManager, | 
					
						
							|  |  |  | } from '@design.estate/dees-element'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import * as domtools from '@design.estate/dees-domtools'; | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  | import './dees-appui-tabs.js'; | 
					
						
							|  |  |  | import type { DeesAppuiTabs } from './dees-appui-tabs.js'; | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | @customElement('dees-appui-maincontent') | 
					
						
							|  |  |  | export class DeesAppuiMaincontent extends DeesElement { | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |   public static demo = () => html`
 | 
					
						
							|  |  |  |     <dees-appui-maincontent | 
					
						
							|  |  |  |       .tabs=${[ | 
					
						
							| 
									
										
										
										
											2025-06-27 22:55:20 +00:00
										 |  |  |         { key: 'Overview', iconName: 'lucide:home', action: () => console.log('Overview') }, | 
					
						
							|  |  |  |         { key: 'Details', iconName: 'lucide:file', action: () => console.log('Details') }, | 
					
						
							|  |  |  |         { key: 'Settings', iconName: 'lucide:settings', action: () => console.log('Settings') }, | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |       ]} | 
					
						
							|  |  |  |     > | 
					
						
							|  |  |  |       <div slot="content" style="padding: 40px; color: #ccc;"> | 
					
						
							|  |  |  |         <h1>Main Content Area</h1> | 
					
						
							|  |  |  |         <p>This is where your application content goes.</p> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |     </dees-appui-maincontent> | 
					
						
							|  |  |  |   `;
 | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // INSTANCE
 | 
					
						
							|  |  |  |   @property({ | 
					
						
							|  |  |  |     type: Array, | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  |   public tabs: interfaces.ITab[] = [ | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |     { key: '⚠️ Please set tabs', action: () => console.warn('No tabs configured for maincontent') }, | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  |   ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |   @property({ type: Object }) | 
					
						
							|  |  |  |   public selectedTab: interfaces.ITab | null = null; | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   public static styles = [ | 
					
						
							|  |  |  |     cssManager.defaultStyles, | 
					
						
							|  |  |  |     css`
 | 
					
						
							|  |  |  |       :host { | 
					
						
							| 
									
										
										
										
											2025-06-17 08:58:47 +00:00
										 |  |  |         color: ${cssManager.bdTheme('#333', '#fff')}; | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  |         display: block; | 
					
						
							|  |  |  |         width: 100%; | 
					
						
							|  |  |  |         height: 100%; | 
					
						
							|  |  |  |         position: relative; | 
					
						
							| 
									
										
										
										
											2025-06-17 08:58:47 +00:00
										 |  |  |         background: ${cssManager.bdTheme('#ffffff', '#161616')}; | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  |       } | 
					
						
							|  |  |  |       .maincontainer { | 
					
						
							|  |  |  |         position: absolute; | 
					
						
							|  |  |  |         height: 100%; | 
					
						
							|  |  |  |         right: 0px; | 
					
						
							|  |  |  |         top: 0px; | 
					
						
							|  |  |  |         width: 100%; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .topbar { | 
					
						
							|  |  |  |         position: absolute; | 
					
						
							|  |  |  |         width: 100%; | 
					
						
							|  |  |  |         user-select: none; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |       .content-area { | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  |         position: absolute; | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |         top: 60px; | 
					
						
							|  |  |  |         left: 0; | 
					
						
							|  |  |  |         right: 0; | 
					
						
							|  |  |  |         bottom: 0; | 
					
						
							|  |  |  |         overflow: auto; | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  |       } | 
					
						
							|  |  |  |     `,
 | 
					
						
							|  |  |  |   ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public render(): TemplateResult { | 
					
						
							|  |  |  |     return html`
 | 
					
						
							|  |  |  |       <div class="maincontainer"> | 
					
						
							|  |  |  |         <div class="topbar"> | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |           <dees-appui-tabs | 
					
						
							|  |  |  |             .tabs=${this.tabs} | 
					
						
							|  |  |  |             .selectedTab=${this.selectedTab} | 
					
						
							|  |  |  |             .showTabIndicator=${true} | 
					
						
							|  |  |  |             .tabStyle=${'horizontal'} | 
					
						
							|  |  |  |             @tab-select=${(e: CustomEvent) => this.handleTabSelect(e)} | 
					
						
							|  |  |  |           ></dees-appui-tabs> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |         <div class="content-area"> | 
					
						
							|  |  |  |           <slot></slot> | 
					
						
							|  |  |  |           <slot name="content"></slot> | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  |         </div> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |     `;
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |   private handleTabSelect(e: CustomEvent) { | 
					
						
							|  |  |  |     this.selectedTab = e.detail.tab; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     // Re-emit the event
 | 
					
						
							|  |  |  |     this.dispatchEvent(new CustomEvent('tab-select', { | 
					
						
							|  |  |  |       detail: e.detail, | 
					
						
							|  |  |  |       bubbles: true, | 
					
						
							|  |  |  |       composed: true | 
					
						
							|  |  |  |     })); | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-17 08:41:36 +00:00
										 |  |  |   async firstUpdated(_changedProperties: Map<string | number | symbol, unknown>) { | 
					
						
							|  |  |  |     await super.firstUpdated(_changedProperties); | 
					
						
							|  |  |  |     // Tab selection is now handled by the dees-appui-tabs component
 | 
					
						
							|  |  |  |     // But we need to ensure the tabs component is ready
 | 
					
						
							|  |  |  |     const tabsComponent = this.shadowRoot.querySelector('dees-appui-tabs') as DeesAppuiTabs; | 
					
						
							|  |  |  |     if (tabsComponent) { | 
					
						
							|  |  |  |       await tabsComponent.updateComplete; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-01-24 12:18:37 +01:00
										 |  |  |   } | 
					
						
							|  |  |  | } |