| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  | import { | 
					
						
							|  |  |  |   customElement, | 
					
						
							|  |  |  |   html, | 
					
						
							|  |  |  |   DeesElement, | 
					
						
							|  |  |  |   property, | 
					
						
							| 
									
										
										
										
											2023-08-07 20:02:18 +02:00
										 |  |  |   type TemplateResult, | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |   cssManager, | 
					
						
							|  |  |  |   css, | 
					
						
							| 
									
										
										
										
											2023-08-08 01:10:02 +02:00
										 |  |  |   type CSSResult, | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |   unsafeCSS, | 
					
						
							| 
									
										
										
										
											2023-08-07 19:13:29 +02:00
										 |  |  | } from '@design.estate/dees-element'; | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 19:13:29 +02:00
										 |  |  | import * as domtools from '@design.estate/dees-domtools'; | 
					
						
							| 
									
										
										
										
											2025-06-27 17:14:26 +00:00
										 |  |  | import { demoFunc } from './dees-button.demo.js'; | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-13 21:52:36 +00:00
										 |  |  | declare global { | 
					
						
							|  |  |  |   interface HTMLElementTagNameMap { | 
					
						
							|  |  |  |     'dees-button': DeesButton; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  | @customElement('dees-button') | 
					
						
							| 
									
										
										
										
											2020-12-09 14:06:24 +00:00
										 |  |  | export class DeesButton extends DeesElement { | 
					
						
							| 
									
										
										
										
											2023-09-13 01:37:02 +02:00
										 |  |  |   public static demo = demoFunc; | 
					
						
							| 
									
										
										
										
											2020-12-09 14:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-17 16:52:13 +01:00
										 |  |  |   @property({ | 
					
						
							|  |  |  |     reflect: true, | 
					
						
							|  |  |  |     hasChanged() { | 
					
						
							|  |  |  |       return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }) | 
					
						
							| 
									
										
										
										
											2021-08-25 13:51:55 +02:00
										 |  |  |   public text: string; | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   @property() | 
					
						
							| 
									
										
										
										
											2021-08-25 13:51:55 +02:00
										 |  |  |   public eventDetailData: string; | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 12:41:01 +02:00
										 |  |  |   @property({ | 
					
						
							| 
									
										
										
										
											2024-10-06 01:12:00 +02:00
										 |  |  |     type: Boolean, | 
					
						
							|  |  |  |     reflect: true, | 
					
						
							| 
									
										
										
										
											2021-08-24 12:41:01 +02:00
										 |  |  |   }) | 
					
						
							| 
									
										
										
										
											2021-08-25 13:51:55 +02:00
										 |  |  |   public disabled = false; | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |   @property({ | 
					
						
							|  |  |  |     type: Boolean | 
					
						
							|  |  |  |   }) | 
					
						
							| 
									
										
										
										
											2021-08-25 13:51:55 +02:00
										 |  |  |   public isHidden = false; | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |   @property({ | 
					
						
							|  |  |  |     type: String | 
					
						
							|  |  |  |   }) | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |   public type: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' | 'normal' | 'highlighted' | 'discreet' | 'big' = 'default'; | 
					
						
							|  |  |  |    | 
					
						
							|  |  |  |   @property({ | 
					
						
							|  |  |  |     type: String | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  |   public size: 'default' | 'sm' | 'lg' | 'icon' = 'default'; | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |   @property({ | 
					
						
							|  |  |  |     type: String | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  |   public status: 'normal' | 'pending' | 'success' | 'error' = 'normal'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-22 20:32:59 +00:00
										 |  |  |   @property({ | 
					
						
							|  |  |  |     type: Boolean, | 
					
						
							|  |  |  |     reflect: true | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  |   public insideForm: boolean = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  |   constructor() { | 
					
						
							|  |  |  |     super(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-22 20:32:59 +00:00
										 |  |  |   public async connectedCallback() { | 
					
						
							|  |  |  |     await super.connectedCallback(); | 
					
						
							|  |  |  |     // Auto-detect if inside a form
 | 
					
						
							|  |  |  |     if (!this.insideForm && this.closest('dees-form')) { | 
					
						
							|  |  |  |       this.insideForm = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |   public static styles = [ | 
					
						
							|  |  |  |     cssManager.defaultStyles, | 
					
						
							|  |  |  |     css`
 | 
					
						
							|  |  |  |       :host { | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         display: inline-block; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |         box-sizing: border-box; | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         font-family: inherit; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       :host([hidden]) { | 
					
						
							|  |  |  |         display: none; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-22 20:32:59 +00:00
										 |  |  |       /* Form spacing styles */ | 
					
						
							|  |  |  |       :host([inside-form]) { | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         margin-bottom: 16px; | 
					
						
							| 
									
										
										
										
											2025-06-22 20:32:59 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       :host([inside-form]:last-child) { | 
					
						
							|  |  |  |         margin-bottom: 0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       dees-form[horizontal-layout] :host([inside-form]) { | 
					
						
							|  |  |  |         display: inline-block; | 
					
						
							|  |  |  |         margin-right: 16px; | 
					
						
							|  |  |  |         margin-bottom: 0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       dees-form[horizontal-layout] :host([inside-form]:last-child) { | 
					
						
							|  |  |  |         margin-right: 0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       .button { | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |         position: relative; | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         display: inline-flex; | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |         align-items: center; | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         justify-content: center; | 
					
						
							|  |  |  |         white-space: nowrap; | 
					
						
							|  |  |  |         border-radius: 6px; | 
					
						
							|  |  |  |         font-weight: 500; | 
					
						
							|  |  |  |         transition: all 0.15s ease; | 
					
						
							|  |  |  |         cursor: pointer; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |         user-select: none; | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         outline: none; | 
					
						
							|  |  |  |         letter-spacing: -0.01em; | 
					
						
							|  |  |  |         gap: 8px; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       /* Size variants */ | 
					
						
							|  |  |  |       .button.size-default { | 
					
						
							|  |  |  |         height: 36px; | 
					
						
							|  |  |  |         padding: 0 16px; | 
					
						
							|  |  |  |         font-size: 14px; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       .button.size-sm { | 
					
						
							|  |  |  |         height: 32px; | 
					
						
							|  |  |  |         padding: 0 12px; | 
					
						
							|  |  |  |         font-size: 13px; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       .button.size-lg { | 
					
						
							|  |  |  |         height: 44px; | 
					
						
							|  |  |  |         padding: 0 24px; | 
					
						
							|  |  |  |         font-size: 16px; | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       .button.size-icon { | 
					
						
							|  |  |  |         height: 36px; | 
					
						
							|  |  |  |         width: 36px; | 
					
						
							|  |  |  |         padding: 0; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       /* Default variant */ | 
					
						
							|  |  |  |       .button.default { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(0 0% 100%)', 'hsl(215 20.2% 11.8%)')}; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('hsl(215.3 25% 8.8%)', 'hsl(210 40% 98%)')}; | 
					
						
							|  |  |  |         border: 1px solid ${cssManager.bdTheme('hsl(214.3 31.8% 91.4%)', 'hsl(215 20.2% 16.8%)')}; | 
					
						
							|  |  |  |         box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       .button.default:hover:not(.disabled) { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(210 40% 96.1%)', 'hsl(215 20.2% 10.2%)')}; | 
					
						
							|  |  |  |         border-color: ${cssManager.bdTheme('hsl(214.3 31.8% 85%)', 'hsl(215 20.2% 20%)')}; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-10-06 01:18:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       .button.default:active:not(.disabled) { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(214.3 31.8% 91.4%)', 'hsl(215 20.2% 9%)')}; | 
					
						
							| 
									
										
										
										
											2024-10-06 01:18:13 +02:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       /* Destructive variant */ | 
					
						
							|  |  |  |       .button.destructive { | 
					
						
							|  |  |  |         background: hsl(0 84.2% 60.2%); | 
					
						
							|  |  |  |         color: hsl(0 0% 98%); | 
					
						
							|  |  |  |         border: 1px solid transparent; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       .button.destructive:hover:not(.disabled) { | 
					
						
							|  |  |  |         background: hsl(0 84.2% 56.2%); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.destructive:active:not(.disabled) { | 
					
						
							|  |  |  |         background: hsl(0 84.2% 52.2%); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Outline variant */ | 
					
						
							|  |  |  |       .button.outline { | 
					
						
							|  |  |  |         background: transparent; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('hsl(215.3 25% 8.8%)', 'hsl(210 40% 98%)')}; | 
					
						
							|  |  |  |         border: 1px solid ${cssManager.bdTheme('hsl(214.3 31.8% 91.4%)', 'hsl(215 20.2% 21.8%)')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.outline:hover:not(.disabled) { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(210 40% 96.1%)', 'hsl(215 20.2% 16.8%)')}; | 
					
						
							|  |  |  |         border-color: ${cssManager.bdTheme('hsl(214.3 31.8% 85%)', 'hsl(215 20.2% 26.8%)')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.outline:active:not(.disabled) { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(214.3 31.8% 91.4%)', 'hsl(215 20.2% 13.8%)')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Secondary variant */ | 
					
						
							|  |  |  |       .button.secondary { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(210 40% 96.1%)', 'hsl(215 20.2% 16.8%)')}; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('hsl(215.3 25% 8.8%)', 'hsl(210 40% 98%)')}; | 
					
						
							|  |  |  |         border: 1px solid transparent; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.secondary:hover:not(.disabled) { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(214.3 31.8% 91.4%)', 'hsl(215 20.2% 13.8%)')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.secondary:active:not(.disabled) { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(214.3 31.8% 85%)', 'hsl(215 20.2% 11.8%)')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Ghost variant */ | 
					
						
							|  |  |  |       .button.ghost { | 
					
						
							|  |  |  |         background: transparent; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('hsl(215.3 25% 8.8%)', 'hsl(210 40% 98%)')}; | 
					
						
							|  |  |  |         border: 1px solid transparent; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.ghost:hover:not(.disabled) { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(210 40% 96.1%)', 'hsl(215 20.2% 16.8%)')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.ghost:active:not(.disabled) { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('hsl(214.3 31.8% 91.4%)', 'hsl(215 20.2% 13.8%)')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Link variant */ | 
					
						
							|  |  |  |       .button.link { | 
					
						
							|  |  |  |         background: transparent; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('hsl(222.2 47.4% 51.2%)', 'hsl(213.1 93.9% 67.8%)')}; | 
					
						
							|  |  |  |         border: none; | 
					
						
							|  |  |  |         text-decoration: underline; | 
					
						
							|  |  |  |         text-decoration-color: transparent; | 
					
						
							|  |  |  |         height: auto; | 
					
						
							|  |  |  |         padding: 0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.link:hover:not(.disabled) { | 
					
						
							|  |  |  |         text-decoration-color: currentColor; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Status states */ | 
					
						
							|  |  |  |       .button.pending, | 
					
						
							|  |  |  |       .button.success, | 
					
						
							|  |  |  |       .button.error { | 
					
						
							|  |  |  |         pointer-events: none; | 
					
						
							|  |  |  |         padding-left: 36px; /* Space for spinner */ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       .button.size-sm.pending, | 
					
						
							|  |  |  |       .button.size-sm.success, | 
					
						
							|  |  |  |       .button.size-sm.error { | 
					
						
							|  |  |  |         padding-left: 32px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       .button.size-lg.pending, | 
					
						
							|  |  |  |       .button.size-lg.success, | 
					
						
							|  |  |  |       .button.size-lg.error { | 
					
						
							|  |  |  |         padding-left: 44px; | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       .button.pending { | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         background: ${cssManager.bdTheme('hsl(222.2 47.4% 51.2%)', 'hsl(213.1 93.9% 67.8% / 0.2)')}; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('hsl(0 0% 100%)', 'hsl(213.1 93.9% 67.8%)')}; | 
					
						
							|  |  |  |         border: 1px solid transparent; | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.success { | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         background: ${cssManager.bdTheme('hsl(142.1 76.2% 36.3%)', 'hsl(142.1 70.6% 45.3% / 0.2)')}; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('hsl(0 0% 100%)', 'hsl(142.1 70.6% 45.3%)')}; | 
					
						
							|  |  |  |         border: 1px solid transparent; | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .button.error { | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         background: ${cssManager.bdTheme('hsl(0 84.2% 60.2%)', 'hsl(0 62.8% 70.6% / 0.2)')}; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('hsl(0 0% 100%)', 'hsl(0 62.8% 70.6%)')}; | 
					
						
							|  |  |  |         border: 1px solid transparent; | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |       /* Disabled state */ | 
					
						
							|  |  |  |       .button.disabled { | 
					
						
							|  |  |  |         opacity: 0.5; | 
					
						
							|  |  |  |         cursor: not-allowed; | 
					
						
							|  |  |  |         pointer-events: none; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Hidden state */ | 
					
						
							|  |  |  |       .button.hidden { | 
					
						
							|  |  |  |         display: none; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Focus state */ | 
					
						
							|  |  |  |       .button:focus-visible { | 
					
						
							|  |  |  |         outline: 2px solid ${cssManager.bdTheme('hsl(222.2 47.4% 51.2%)', 'hsl(213.1 93.9% 67.8%)')}; | 
					
						
							|  |  |  |         outline-offset: 2px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Loading spinner */ | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |       dees-spinner { | 
					
						
							|  |  |  |         position: absolute; | 
					
						
							|  |  |  |         left: 10px; | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         width: 16px; | 
					
						
							|  |  |  |         height: 16px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       .button.size-sm dees-spinner { | 
					
						
							|  |  |  |         left: 8px; | 
					
						
							|  |  |  |         width: 14px; | 
					
						
							|  |  |  |         height: 14px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       .button.size-lg dees-spinner { | 
					
						
							|  |  |  |         left: 14px; | 
					
						
							|  |  |  |         width: 18px; | 
					
						
							|  |  |  |         height: 18px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       /* Icon sizing within buttons */ | 
					
						
							|  |  |  |       .button dees-icon { | 
					
						
							|  |  |  |         width: 16px; | 
					
						
							|  |  |  |         height: 16px; | 
					
						
							|  |  |  |         flex-shrink: 0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       .button.size-sm dees-icon { | 
					
						
							|  |  |  |         width: 14px; | 
					
						
							|  |  |  |         height: 14px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       .button.size-lg dees-icon { | 
					
						
							|  |  |  |         width: 18px; | 
					
						
							|  |  |  |         height: 18px; | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |     `,
 | 
					
						
							|  |  |  |   ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  |   public render(): TemplateResult { | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |     // Map old types to new types for backward compatibility
 | 
					
						
							|  |  |  |     const typeMap: {[key: string]: string} = { | 
					
						
							|  |  |  |       'normal': 'default', | 
					
						
							|  |  |  |       'highlighted': 'destructive', | 
					
						
							|  |  |  |       'discreet': 'outline', | 
					
						
							|  |  |  |       'big': 'default' // Will use size instead
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     const actualType = typeMap[this.type] || this.type; | 
					
						
							|  |  |  |     const actualSize = this.type === 'big' ? 'lg' : this.size; | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  |     return html`
 | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |       <div | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |         class="button ${this.isHidden ? 'hidden' : ''} ${actualType} size-${actualSize} ${this.status} ${this.disabled | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |           ? 'disabled' | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |           : ''}" | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |         @click="${this.dispatchClick}" | 
					
						
							|  |  |  |       > | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |         ${this.status === 'normal' ? html``: html`
 | 
					
						
							| 
									
										
										
										
											2025-06-27 11:50:07 +00:00
										 |  |  |           <dees-spinner  | 
					
						
							|  |  |  |             .bnw=${true}  | 
					
						
							|  |  |  |             status="${this.status}" | 
					
						
							|  |  |  |             size="${actualSize === 'sm' ? 14 : actualSize === 'lg' ? 18 : 16}" | 
					
						
							|  |  |  |           ></dees-spinner> | 
					
						
							| 
									
										
										
										
											2021-08-27 13:38:08 +02:00
										 |  |  |         `}
 | 
					
						
							| 
									
										
										
										
											2025-06-19 12:42:50 +00:00
										 |  |  |         <div class="textbox">${this.text || html`<slot>Button</slot>`}</div> | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  |       </div> | 
					
						
							|  |  |  |     `;
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public async dispatchClick() { | 
					
						
							|  |  |  |     if (this.disabled) { | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |     this.dispatchEvent( | 
					
						
							|  |  |  |       new CustomEvent('clicked', { | 
					
						
							|  |  |  |         detail: { | 
					
						
							|  |  |  |           data: this.eventDetailData, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         bubbles: true, | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-05 20:55:49 +00:00
										 |  |  |   public async firstUpdated() { | 
					
						
							| 
									
										
										
										
											2025-06-19 12:42:50 +00:00
										 |  |  |     // Don't set default text here as it interferes with slotted content
 | 
					
						
							| 
									
										
										
										
											2020-09-13 16:24:48 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | } |