flowbite-angular 1.0.0-beta.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +15 -15
  2. package/accordion/accordion-content.component.d.ts +21 -1
  3. package/accordion/accordion-content.theme.d.ts +2 -2
  4. package/accordion/accordion-panel.component.d.ts +10 -3
  5. package/accordion/accordion-title.component.d.ts +27 -0
  6. package/accordion/accordion.component.d.ts +10 -14
  7. package/accordion/accordion.theme.d.ts +1 -5
  8. package/accordion/index.d.ts +4 -4
  9. package/alert/alert.component.d.ts +42 -1
  10. package/alert/index.d.ts +1 -1
  11. package/badge/badge.component.d.ts +40 -0
  12. package/badge/index.d.ts +1 -1
  13. package/base-component.directive.d.ts +0 -4
  14. package/breadcrumb/breadcrumb-item.component.d.ts +19 -0
  15. package/breadcrumb/breadcrumb.component.d.ts +8 -1
  16. package/breadcrumb/index.d.ts +2 -2
  17. package/button/button.component.d.ts +100 -1
  18. package/button/index.d.ts +1 -1
  19. package/dark-theme-toggle/dark-theme-toggle.component.d.ts +12 -17
  20. package/dark-theme-toggle/index.d.ts +1 -1
  21. package/dropdown/dropdown-divider.component.d.ts +13 -2
  22. package/dropdown/dropdown-divider.theme.d.ts +2 -2
  23. package/dropdown/dropdown-header.component.d.ts +19 -2
  24. package/dropdown/dropdown-item.component.d.ts +7 -0
  25. package/dropdown/dropdown.component.d.ts +39 -13
  26. package/dropdown/index.d.ts +4 -4
  27. package/esm2022/accordion/accordion-content.component.mjs +30 -16
  28. package/esm2022/accordion/accordion-content.theme.mjs +5 -5
  29. package/esm2022/accordion/accordion-content.theme.service.mjs +2 -2
  30. package/esm2022/accordion/accordion-panel.component.mjs +18 -15
  31. package/esm2022/accordion/accordion-title.component.mjs +14 -8
  32. package/esm2022/accordion/accordion-title.theme.mjs +3 -3
  33. package/esm2022/accordion/accordion.component.mjs +29 -16
  34. package/esm2022/accordion/accordion.theme.mjs +1 -13
  35. package/esm2022/accordion/accordion.theme.service.mjs +2 -2
  36. package/esm2022/accordion/index.mjs +5 -5
  37. package/esm2022/alert/alert.component.mjs +93 -37
  38. package/esm2022/alert/index.mjs +2 -2
  39. package/esm2022/badge/badge.component.mjs +34 -9
  40. package/esm2022/badge/index.mjs +2 -2
  41. package/esm2022/base-component.directive.mjs +1 -7
  42. package/esm2022/breadcrumb/breadcrumb-item.component.mjs +14 -8
  43. package/esm2022/breadcrumb/breadcrumb.component.mjs +16 -11
  44. package/esm2022/breadcrumb/index.mjs +3 -3
  45. package/esm2022/button/button.component.mjs +72 -34
  46. package/esm2022/button/index.mjs +2 -2
  47. package/esm2022/core/flowbite.theme.init.mjs +48 -14
  48. package/esm2022/dark-theme-toggle/dark-theme-toggle.component.mjs +17 -42
  49. package/esm2022/dark-theme-toggle/index.mjs +2 -2
  50. package/esm2022/dropdown/dropdown-divider.component.mjs +10 -5
  51. package/esm2022/dropdown/dropdown-divider.theme.mjs +1 -1
  52. package/esm2022/dropdown/dropdown-header.component.mjs +13 -10
  53. package/esm2022/dropdown/dropdown-item.component.mjs +10 -5
  54. package/esm2022/dropdown/dropdown.component.mjs +51 -72
  55. package/esm2022/dropdown/dropdown.theme.mjs +6 -6
  56. package/esm2022/dropdown/index.mjs +5 -5
  57. package/esm2022/indicator/index.mjs +2 -2
  58. package/esm2022/indicator/indicators.component.mjs +64 -14
  59. package/esm2022/modal/index.mjs +5 -5
  60. package/esm2022/modal/modal-body.component.mjs +10 -5
  61. package/esm2022/modal/modal-footer.component.mjs +10 -5
  62. package/esm2022/modal/modal-header.component.mjs +16 -10
  63. package/esm2022/modal/modal.component.mjs +42 -23
  64. package/esm2022/navbar/index.mjs +7 -7
  65. package/esm2022/navbar/navbar-brand.component.mjs +10 -5
  66. package/esm2022/navbar/navbar-content.component.mjs +35 -11
  67. package/esm2022/navbar/navbar-content.theme.mjs +2 -6
  68. package/esm2022/navbar/navbar-content.theme.service.mjs +2 -2
  69. package/esm2022/navbar/navbar-icon-button.component.mjs +10 -9
  70. package/esm2022/navbar/navbar-item.component.mjs +10 -5
  71. package/esm2022/navbar/navbar-toggle.component.mjs +12 -6
  72. package/esm2022/navbar/navbar.component.mjs +41 -16
  73. package/esm2022/scroll-top/index.mjs +2 -2
  74. package/esm2022/scroll-top/scroll-top.component.mjs +22 -5
  75. package/esm2022/sidebar/index.mjs +7 -7
  76. package/esm2022/sidebar/sidebar-item-group.component.mjs +19 -14
  77. package/esm2022/sidebar/sidebar-item.component.mjs +45 -26
  78. package/esm2022/sidebar/sidebar-menu.component.mjs +10 -9
  79. package/esm2022/sidebar/sidebar-page-content.component.mjs +10 -4
  80. package/esm2022/sidebar/sidebar-toggle.component.mjs +22 -5
  81. package/esm2022/sidebar/sidebar.component.mjs +36 -19
  82. package/esm2022/theme/flowbite-angular-theme.mjs +5 -0
  83. package/esm2022/theme/flowbite-theme.directive.mjs +71 -0
  84. package/esm2022/theme/index.mjs +2 -0
  85. package/fesm2022/flowbite-angular-accordion.mjs +92 -66
  86. package/fesm2022/flowbite-angular-accordion.mjs.map +1 -1
  87. package/fesm2022/flowbite-angular-alert.mjs +93 -37
  88. package/fesm2022/flowbite-angular-alert.mjs.map +1 -1
  89. package/fesm2022/flowbite-angular-badge.mjs +34 -9
  90. package/fesm2022/flowbite-angular-badge.mjs.map +1 -1
  91. package/fesm2022/flowbite-angular-breadcrumb.mjs +28 -16
  92. package/fesm2022/flowbite-angular-breadcrumb.mjs.map +1 -1
  93. package/fesm2022/flowbite-angular-button.mjs +72 -34
  94. package/fesm2022/flowbite-angular-button.mjs.map +1 -1
  95. package/fesm2022/flowbite-angular-core.mjs +47 -13
  96. package/fesm2022/flowbite-angular-core.mjs.map +1 -1
  97. package/fesm2022/flowbite-angular-dark-theme-toggle.mjs +17 -42
  98. package/fesm2022/flowbite-angular-dark-theme-toggle.mjs.map +1 -1
  99. package/fesm2022/flowbite-angular-dropdown.mjs +83 -88
  100. package/fesm2022/flowbite-angular-dropdown.mjs.map +1 -1
  101. package/fesm2022/flowbite-angular-indicator.mjs +64 -14
  102. package/fesm2022/flowbite-angular-indicator.mjs.map +1 -1
  103. package/fesm2022/flowbite-angular-modal.mjs +72 -34
  104. package/fesm2022/flowbite-angular-modal.mjs.map +1 -1
  105. package/fesm2022/flowbite-angular-navbar.mjs +109 -43
  106. package/fesm2022/flowbite-angular-navbar.mjs.map +1 -1
  107. package/fesm2022/flowbite-angular-scroll-top.mjs +22 -5
  108. package/fesm2022/flowbite-angular-scroll-top.mjs.map +1 -1
  109. package/fesm2022/flowbite-angular-sidebar.mjs +132 -65
  110. package/fesm2022/flowbite-angular-sidebar.mjs.map +1 -1
  111. package/fesm2022/flowbite-angular-theme.mjs +78 -0
  112. package/fesm2022/flowbite-angular-theme.mjs.map +1 -0
  113. package/fesm2022/flowbite-angular.mjs +0 -6
  114. package/fesm2022/flowbite-angular.mjs.map +1 -1
  115. package/indicator/index.d.ts +1 -1
  116. package/indicator/indicators.component.d.ts +81 -0
  117. package/modal/index.d.ts +4 -4
  118. package/modal/modal-body.component.d.ts +7 -0
  119. package/modal/modal-footer.component.d.ts +7 -0
  120. package/modal/modal-header.component.d.ts +13 -0
  121. package/modal/modal.component.d.ts +40 -2
  122. package/navbar/index.d.ts +6 -6
  123. package/navbar/navbar-brand.component.d.ts +7 -0
  124. package/navbar/navbar-content.component.d.ts +13 -4
  125. package/navbar/navbar-content.theme.d.ts +1 -3
  126. package/navbar/navbar-icon-button.component.d.ts +12 -1
  127. package/navbar/navbar-item.component.d.ts +12 -0
  128. package/navbar/navbar-toggle.component.d.ts +7 -0
  129. package/navbar/navbar.component.d.ts +30 -2
  130. package/package.json +7 -2
  131. package/scroll-top/index.d.ts +1 -1
  132. package/scroll-top/scroll-top.component.d.ts +31 -0
  133. package/sidebar/index.d.ts +6 -6
  134. package/sidebar/sidebar-item-group.component.d.ts +19 -1
  135. package/sidebar/sidebar-item.component.d.ts +21 -1
  136. package/sidebar/sidebar-menu.component.d.ts +25 -1
  137. package/sidebar/sidebar-page-content.component.d.ts +12 -0
  138. package/sidebar/sidebar-toggle.component.d.ts +22 -0
  139. package/sidebar/sidebar.component.d.ts +17 -3
  140. package/theme/README.md +4 -0
  141. package/theme/flowbite-theme.directive.d.ts +36 -0
  142. package/theme/index.d.ts +1 -0
@@ -1,10 +1,10 @@
1
1
  import { mergeTheme, SUN_SVG_ICON, MOON_SVG_ICON, createTheme } from 'flowbite-angular/utils';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, Injectable, model, afterNextRender, Component, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
3
+ import { InjectionToken, inject, Injectable, makeEnvironmentProviders, model, Component, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { BaseComponent } from 'flowbite-angular';
6
6
  import { IconRegistry, IconComponent } from 'flowbite-angular/icon';
7
- import { NgIf, NgClass } from '@angular/common';
7
+ import { FlowbiteThemeDirective } from 'flowbite-angular/theme';
8
8
  import { DomSanitizer } from '@angular/platform-browser';
9
9
 
10
10
  /**
@@ -37,6 +37,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
37
37
  }]
38
38
  }] });
39
39
 
40
+ const FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE = new InjectionToken('FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE');
41
+ const darkThemeToggleDefaultValueProvider = makeEnvironmentProviders([
42
+ {
43
+ provide: FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE,
44
+ useValue: {},
45
+ },
46
+ ]);
40
47
  /**
41
48
  * Use to toggle light/dark mode accross the site
42
49
  */
@@ -55,11 +62,15 @@ class DarkThemeToggleComponent extends BaseComponent {
55
62
  * `DomSanitizer` service
56
63
  */
57
64
  this.domSanitizer = inject(DomSanitizer);
65
+ /**
66
+ * `FlowbiteThemeDirective` directive
67
+ */
68
+ this.themeDirective = inject(FlowbiteThemeDirective);
58
69
  //#region properties
59
70
  /**
60
71
  * Set the custom style for this dark-theme-toggle
61
72
  */
62
- this.customStyle = model({});
73
+ this.customStyle = model(inject(FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE));
63
74
  }
64
75
  //#endregion
65
76
  //#region BaseComponent implementation
@@ -69,9 +80,6 @@ class DarkThemeToggleComponent extends BaseComponent {
69
80
  });
70
81
  }
71
82
  init() {
72
- afterNextRender(() => {
73
- this.toggleTheme(this.getTheme());
74
- }, { injector: this.injector });
75
83
  this.iconRegistry.addRawSvgIconInNamepsace('flowbite-angular', 'sun', this.domSanitizer.bypassSecurityTrustHtml(SUN_SVG_ICON));
76
84
  this.iconRegistry.addRawSvgIconInNamepsace('flowbite-angular', 'moon', this.domSanitizer.bypassSecurityTrustHtml(MOON_SVG_ICON));
77
85
  }
@@ -80,40 +88,7 @@ class DarkThemeToggleComponent extends BaseComponent {
80
88
  * Toggle between dark and light mode
81
89
  */
82
90
  onClick() {
83
- this.toggleTheme();
84
- }
85
- /**
86
- * Get theme from the `localStorage`
87
- * @returns The current theme saved in the `localStorage` with the key `color-theme`
88
- */
89
- getTheme() {
90
- return localStorage.getItem('color-theme') === 'dark' ? 'dark' : 'light';
91
- }
92
- /**
93
- * Toggle the theme saced in the `localStorage`
94
- *
95
- * @param theme If provided, force the theme instead of toggling it between light and dark mode
96
- */
97
- toggleTheme(theme) {
98
- if (!theme) {
99
- const tmpTheme = this.getTheme();
100
- if (tmpTheme === 'dark')
101
- theme = 'light';
102
- else
103
- theme = 'dark';
104
- }
105
- this.setTheme(theme);
106
- }
107
- /**
108
- * Set the theme inside the page
109
- *
110
- * @param theme Theme to apply
111
- */
112
- setTheme(theme) {
113
- localStorage.setItem('color-theme', theme);
114
- theme === 'dark'
115
- ? document.documentElement.classList.add('dark')
116
- : document.documentElement.classList.remove('dark');
91
+ this.themeDirective.toggleTheme();
117
92
  }
118
93
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: DarkThemeToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
119
94
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.0.0", type: DarkThemeToggleComponent, isStandalone: true, selector: "flowbite-dark-theme-toggle", inputs: { customStyle: { classPropertyName: "customStyle", publicName: "customStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { customStyle: "customStyleChange" }, host: { listeners: { "click": "onClick()" } }, usesInheritance: true, ngImport: i0, template: `
@@ -129,7 +104,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
129
104
  type: Component,
130
105
  args: [{
131
106
  standalone: true,
132
- imports: [NgIf, NgClass, IconComponent],
107
+ imports: [IconComponent],
133
108
  selector: 'flowbite-dark-theme-toggle',
134
109
  template: `
135
110
  <flowbite-icon
@@ -160,5 +135,5 @@ const darkThemeToggleTheme = createTheme({
160
135
  * Generated bundle index. Do not edit.
161
136
  */
162
137
 
163
- export { DarkThemeToggleComponent, DarkThemeToggleThemeService, FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN, darkThemeToggleTheme };
138
+ export { DarkThemeToggleComponent, DarkThemeToggleThemeService, FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE, FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN, darkThemeToggleDefaultValueProvider, darkThemeToggleTheme };
164
139
  //# sourceMappingURL=flowbite-angular-dark-theme-toggle.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowbite-angular-dark-theme-toggle.mjs","sources":["../../../../libs/flowbite-angular/dark-theme-toggle/dark-theme-toggle.theme.service.ts","../../../../libs/flowbite-angular/dark-theme-toggle/dark-theme-toggle.component.ts","../../../../libs/flowbite-angular/dark-theme-toggle/dark-theme-toggle.theme.ts","../../../../libs/flowbite-angular/dark-theme-toggle/flowbite-angular-dark-theme-toggle.ts"],"sourcesContent":["import type {\n DarkThemeToggleClass,\n DarkThemeToggleProperties,\n DarkThemeToggleTheme,\n} from './dark-theme-toggle.theme';\n\nimport type { FlowbiteThemeService } from 'flowbite-angular';\nimport { mergeTheme } from 'flowbite-angular/utils';\n\nimport { inject, Injectable, InjectionToken } from '@angular/core';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * `InjectionToken` used to import `DarkThemeToggleTheme` value\n *\n * @example\n * ```\n * var theme = inject(FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN)\n * ```\n */\nexport const FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN = new InjectionToken<DarkThemeToggleTheme>(\n 'FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN'\n);\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DarkThemeToggleThemeService\n implements FlowbiteThemeService<DarkThemeToggleProperties>\n{\n private readonly baseTheme = inject(FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN);\n\n public getClasses(properties: DarkThemeToggleProperties): DarkThemeToggleClass {\n const theme: DarkThemeToggleTheme = mergeTheme(this.baseTheme, properties.customStyle);\n\n const output: DarkThemeToggleClass = {\n rootClass: twMerge(theme.root.base),\n };\n\n return output;\n }\n}\n","import type { DarkThemeToggleClass, DarkThemeToggleTheme } from './dark-theme-toggle.theme';\nimport { DarkThemeToggleThemeService } from './dark-theme-toggle.theme.service';\n\nimport type { DeepPartial, FlowbiteTheme } from 'flowbite-angular';\nimport { BaseComponent } from 'flowbite-angular';\nimport { IconComponent, IconRegistry } from 'flowbite-angular/icon';\nimport { MOON_SVG_ICON, SUN_SVG_ICON } from 'flowbite-angular/utils';\n\nimport { NgClass, NgIf } from '@angular/common';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n inject,\n model,\n ViewEncapsulation,\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\n\n/**\n * Use to toggle light/dark mode accross the site\n */\n@Component({\n standalone: true,\n imports: [NgIf, NgClass, IconComponent],\n selector: 'flowbite-dark-theme-toggle',\n template: `\n <flowbite-icon\n svgIcon=\"flowbite-angular:moon\"\n class=\"h-5 w-5 block dark:hidden\" />\n <flowbite-icon\n svgIcon=\"flowbite-angular:sun\"\n class=\"h-5 w-5 hidden dark:block\" />\n `,\n host: {\n '(click)': 'onClick()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DarkThemeToggleComponent extends BaseComponent<DarkThemeToggleClass> {\n /**\n * Service injected used to generate class\n */\n public readonly themeService = inject(DarkThemeToggleThemeService);\n /**\n * `IconRegistry` service\n */\n public readonly iconRegistry = inject(IconRegistry);\n /**\n * `DomSanitizer` service\n */\n public readonly domSanitizer = inject(DomSanitizer);\n\n //#region properties\n /**\n * Set the custom style for this dark-theme-toggle\n */\n public customStyle = model<DeepPartial<DarkThemeToggleTheme>>({});\n //#endregion\n\n //#region BaseComponent implementation\n public override fetchClass(): DarkThemeToggleClass {\n return this.themeService.getClasses({\n customStyle: this.customStyle(),\n });\n }\n\n public override init(): void {\n afterNextRender(\n () => {\n this.toggleTheme(this.getTheme());\n },\n { injector: this.injector }\n );\n\n this.iconRegistry.addRawSvgIconInNamepsace(\n 'flowbite-angular',\n 'sun',\n this.domSanitizer.bypassSecurityTrustHtml(SUN_SVG_ICON)\n );\n this.iconRegistry.addRawSvgIconInNamepsace(\n 'flowbite-angular',\n 'moon',\n this.domSanitizer.bypassSecurityTrustHtml(MOON_SVG_ICON)\n );\n }\n //#endregion\n\n /**\n * Toggle between dark and light mode\n */\n public onClick() {\n this.toggleTheme();\n }\n\n /**\n * Get theme from the `localStorage`\n * @returns The current theme saved in the `localStorage` with the key `color-theme`\n */\n private getTheme(): FlowbiteTheme {\n return localStorage.getItem('color-theme') === 'dark' ? 'dark' : 'light';\n }\n\n /**\n * Toggle the theme saced in the `localStorage`\n *\n * @param theme If provided, force the theme instead of toggling it between light and dark mode\n */\n private toggleTheme(theme?: FlowbiteTheme): void {\n if (!theme) {\n const tmpTheme = this.getTheme();\n\n if (tmpTheme === 'dark') theme = 'light';\n else theme = 'dark';\n }\n\n this.setTheme(theme);\n }\n\n /**\n * Set the theme inside the page\n *\n * @param theme Theme to apply\n */\n private setTheme(theme: FlowbiteTheme): void {\n localStorage.setItem('color-theme', theme);\n\n theme === 'dark'\n ? document.documentElement.classList.add('dark')\n : document.documentElement.classList.remove('dark');\n }\n}\n","import type { DeepPartial, FlowbiteClass } from 'flowbite-angular';\nimport { createTheme } from 'flowbite-angular/utils';\n\n/**\n * Required properties for the class generation of `DarkThemeToggleComponent`\n */\nexport interface DarkThemeToggleProperties {\n customStyle: DeepPartial<DarkThemeToggleTheme>;\n}\n\n/**\n * Theme definition for `DarkThemeToggleComponent`\n */\nexport interface DarkThemeToggleTheme {\n root: {\n base: string;\n };\n}\n\n/**\n * Default theme for `DarkThemeToggleComponent`\n */\nexport const darkThemeToggleTheme: DarkThemeToggleTheme = createTheme({\n root: {\n base: 'cursor-pointer rounded-lg p-2.5 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-700',\n },\n});\n\n/**\n * Generated class definition for `DarkThemeToggleComponent`\n */\nexport type DarkThemeToggleClass = FlowbiteClass;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAYA;;;;;;;AAOG;MACU,sCAAsC,GAAG,IAAI,cAAc,CACtE,wCAAwC,EACxC;MAKW,2BAA2B,CAAA;AAHxC,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,sCAAsC,CAAC,CAAC;AAW7E,KAAA;AATQ,IAAA,UAAU,CAAC,UAAqC,EAAA;AACrD,QAAA,MAAM,KAAK,GAAyB,UAAU,CAAC,IAAI,CAAC,SAAS,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QAAQ,EAAE,4BAA4B;AACtC,oBAAA,QAAQ,EAAE,CAAA;;;;;;;AAOT,EAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,WAAW;AACvB,qBAAA;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAChD,iBAAA,CAAA;;;ACpBD;;AAEG;AACI,MAAM,oBAAoB,GAAyB,WAAW,CAAC;AACpE,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,gMAAgM;AACvM,KAAA;AACF,CAAA;;AC1BD;;AAEG;;;;"}
1
+ {"version":3,"file":"flowbite-angular-dark-theme-toggle.mjs","sources":["../../../../libs/flowbite-angular/dark-theme-toggle/dark-theme-toggle.theme.service.ts","../../../../libs/flowbite-angular/dark-theme-toggle/dark-theme-toggle.component.ts","../../../../libs/flowbite-angular/dark-theme-toggle/dark-theme-toggle.theme.ts","../../../../libs/flowbite-angular/dark-theme-toggle/flowbite-angular-dark-theme-toggle.ts"],"sourcesContent":["import type {\n DarkThemeToggleClass,\n DarkThemeToggleProperties,\n DarkThemeToggleTheme,\n} from './dark-theme-toggle.theme';\n\nimport type { FlowbiteThemeService } from 'flowbite-angular';\nimport { mergeTheme } from 'flowbite-angular/utils';\n\nimport { inject, Injectable, InjectionToken } from '@angular/core';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * `InjectionToken` used to import `DarkThemeToggleTheme` value\n *\n * @example\n * ```\n * var theme = inject(FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN)\n * ```\n */\nexport const FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN = new InjectionToken<DarkThemeToggleTheme>(\n 'FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN'\n);\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DarkThemeToggleThemeService\n implements FlowbiteThemeService<DarkThemeToggleProperties>\n{\n private readonly baseTheme = inject(FLOWBITE_DARK_THEME_TOGGLE_THEME_TOKEN);\n\n public getClasses(properties: DarkThemeToggleProperties): DarkThemeToggleClass {\n const theme: DarkThemeToggleTheme = mergeTheme(this.baseTheme, properties.customStyle);\n\n const output: DarkThemeToggleClass = {\n rootClass: twMerge(theme.root.base),\n };\n\n return output;\n }\n}\n","import type { DarkThemeToggleClass, DarkThemeToggleTheme } from './dark-theme-toggle.theme';\nimport { DarkThemeToggleThemeService } from './dark-theme-toggle.theme.service';\n\nimport type { DeepPartial } from 'flowbite-angular';\nimport { BaseComponent } from 'flowbite-angular';\nimport { IconComponent, IconRegistry } from 'flowbite-angular/icon';\nimport { FlowbiteThemeDirective } from 'flowbite-angular/theme';\nimport { MOON_SVG_ICON, SUN_SVG_ICON } from 'flowbite-angular/utils';\n\nimport {\n ChangeDetectionStrategy,\n Component,\n inject,\n InjectionToken,\n makeEnvironmentProviders,\n model,\n ViewEncapsulation,\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\n\nexport const FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE = new InjectionToken<\n DeepPartial<DarkThemeToggleTheme>\n>('FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE');\n\nexport const darkThemeToggleDefaultValueProvider = makeEnvironmentProviders([\n {\n provide: FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE,\n useValue: {},\n },\n]);\n\n/**\n * Use to toggle light/dark mode accross the site\n */\n@Component({\n standalone: true,\n imports: [IconComponent],\n selector: 'flowbite-dark-theme-toggle',\n template: `\n <flowbite-icon\n svgIcon=\"flowbite-angular:moon\"\n class=\"h-5 w-5 block dark:hidden\" />\n <flowbite-icon\n svgIcon=\"flowbite-angular:sun\"\n class=\"h-5 w-5 hidden dark:block\" />\n `,\n host: {\n '(click)': 'onClick()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DarkThemeToggleComponent extends BaseComponent<DarkThemeToggleClass> {\n /**\n * Service injected used to generate class\n */\n public readonly themeService = inject(DarkThemeToggleThemeService);\n /**\n * `IconRegistry` service\n */\n public readonly iconRegistry = inject(IconRegistry);\n /**\n * `DomSanitizer` service\n */\n public readonly domSanitizer = inject(DomSanitizer);\n /**\n * `FlowbiteThemeDirective` directive\n */\n public readonly themeDirective = inject(FlowbiteThemeDirective);\n\n //#region properties\n /**\n * Set the custom style for this dark-theme-toggle\n */\n public customStyle = model(inject(FLOWBITE_DARK_THEME_TOGGLE_CUSTOM_STYLE_DEFAULT_VALUE));\n //#endregion\n\n //#region BaseComponent implementation\n public override fetchClass(): DarkThemeToggleClass {\n return this.themeService.getClasses({\n customStyle: this.customStyle(),\n });\n }\n\n public override init(): void {\n this.iconRegistry.addRawSvgIconInNamepsace(\n 'flowbite-angular',\n 'sun',\n this.domSanitizer.bypassSecurityTrustHtml(SUN_SVG_ICON)\n );\n this.iconRegistry.addRawSvgIconInNamepsace(\n 'flowbite-angular',\n 'moon',\n this.domSanitizer.bypassSecurityTrustHtml(MOON_SVG_ICON)\n );\n }\n //#endregion\n\n /**\n * Toggle between dark and light mode\n */\n public onClick() {\n this.themeDirective.toggleTheme();\n }\n}\n","import type { DeepPartial, FlowbiteClass } from 'flowbite-angular';\nimport { createTheme } from 'flowbite-angular/utils';\n\n/**\n * Required properties for the class generation of `DarkThemeToggleComponent`\n */\nexport interface DarkThemeToggleProperties {\n customStyle: DeepPartial<DarkThemeToggleTheme>;\n}\n\n/**\n * Theme definition for `DarkThemeToggleComponent`\n */\nexport interface DarkThemeToggleTheme {\n root: {\n base: string;\n };\n}\n\n/**\n * Default theme for `DarkThemeToggleComponent`\n */\nexport const darkThemeToggleTheme: DarkThemeToggleTheme = createTheme({\n root: {\n base: 'cursor-pointer rounded-lg p-2.5 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-700',\n },\n});\n\n/**\n * Generated class definition for `DarkThemeToggleComponent`\n */\nexport type DarkThemeToggleClass = FlowbiteClass;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAYA;;;;;;;AAOG;MACU,sCAAsC,GAAG,IAAI,cAAc,CACtE,wCAAwC,EACxC;MAKW,2BAA2B,CAAA;AAHxC,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,sCAAsC,CAAC,CAAC;AAW7E,KAAA;AATQ,IAAA,UAAU,CAAC,UAAqC,EAAA;AACrD,QAAA,MAAM,KAAK,GAAyB,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;AAEvF,QAAA,MAAM,MAAM,GAAyB;YACnC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;SACpC,CAAC;AAEF,QAAA,OAAO,MAAM,CAAC;KACf;8GAbU,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cAF1B,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEP,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAHvC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;MCNY,qDAAqD,GAAG,IAAI,cAAc,CAErF,uDAAuD,EAAE;AAEpD,MAAM,mCAAmC,GAAG,wBAAwB,CAAC;AAC1E,IAAA;AACE,QAAA,OAAO,EAAE,qDAAqD;AAC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,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAChD,iBAAA,CAAA;;;AChCD;;AAEG;AACI,MAAM,oBAAoB,GAAyB,WAAW,CAAC;AACpE,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,gMAAgM;AACvM,KAAA;AACF,CAAA;;AC1BD;;AAEG;;;;"}
@@ -1,12 +1,10 @@
1
1
  import { mergeTheme, CHEVRON_DOWN_SVG_ICON, createTheme } from 'flowbite-angular/utils';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, Injectable, model, Component, ViewEncapsulation, ChangeDetectionStrategy, contentChildren, ViewChild } from '@angular/core';
3
+ import { InjectionToken, inject, Injectable, makeEnvironmentProviders, model, Component, ViewEncapsulation, ChangeDetectionStrategy, viewChild, contentChildren } from '@angular/core';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { BaseComponent, booleanToFlowbiteBoolean } from 'flowbite-angular';
6
- import { NgClass } from '@angular/common';
7
6
  import { IconRegistry, IconComponent } from 'flowbite-angular/icon';
8
7
  import { DomSanitizer } from '@angular/platform-browser';
9
- import { computePosition, offset, flip, shift, autoUpdate } from '@floating-ui/dom';
10
8
 
11
9
  /**
12
10
  * `InjectionToken` used to import `DropdownDividerTheme` value
@@ -38,6 +36,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
38
36
  }]
39
37
  }] });
40
38
 
39
+ const FLOWBITE_DROPDOWN_DIVIDER_CUSTOM_STYLE_DEFAULT_VALUE = new InjectionToken('FLOWBITE_DROPDOWN_DIVIDER_CUSTOM_STYLE_DEFAULT_VALUE');
40
+ const dropdownDividerDefaultValueProvider = makeEnvironmentProviders([
41
+ {
42
+ provide: FLOWBITE_DROPDOWN_DIVIDER_CUSTOM_STYLE_DEFAULT_VALUE,
43
+ useValue: {},
44
+ },
45
+ ]);
41
46
  /**
42
47
  * @see https://flowbite.com/docs/components/dropdowns/
43
48
  */
@@ -56,7 +61,7 @@ class DropdownDividerComponent extends BaseComponent {
56
61
  /**
57
62
  * Set the custom style for this dropdown divider
58
63
  */
59
- this.customStyle = model({});
64
+ this.customStyle = model(inject(FLOWBITE_DROPDOWN_DIVIDER_CUSTOM_STYLE_DEFAULT_VALUE));
60
65
  }
61
66
  //#endregion
62
67
  //#region BaseComponent implementation
@@ -72,7 +77,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
72
77
  type: Component,
73
78
  args: [{
74
79
  standalone: true,
75
- imports: [NgClass],
76
80
  selector: 'flowbite-dropdown-divider',
77
81
  template: ``,
78
82
  encapsulation: ViewEncapsulation.None,
@@ -111,6 +115,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
111
115
  }]
112
116
  }] });
113
117
 
118
+ const FLOWBITE_DROPDOWN_HEADER_CUSTOM_STYLE_DEFAULT_VALUE = new InjectionToken('FLOWBITE_DROPDOWN_HEADER_CUSTOM_STYLE_DEFAULT_VALUE');
119
+ const dropdownHeaderDefaultValueProvider = makeEnvironmentProviders([
120
+ {
121
+ provide: FLOWBITE_DROPDOWN_HEADER_CUSTOM_STYLE_DEFAULT_VALUE,
122
+ useValue: {},
123
+ },
124
+ ]);
114
125
  /**
115
126
  * @see https://flowbite.com/docs/components/dropdowns/
116
127
  */
@@ -129,7 +140,7 @@ class DropdownHeaderComponent extends BaseComponent {
129
140
  /**
130
141
  * Set the custom style for this dropdown header
131
142
  */
132
- this.customStyle = model({});
143
+ this.customStyle = model(inject(FLOWBITE_DROPDOWN_HEADER_CUSTOM_STYLE_DEFAULT_VALUE));
133
144
  }
134
145
  //#endregion
135
146
  //#region BaseComponent implementation
@@ -140,23 +151,20 @@ class DropdownHeaderComponent extends BaseComponent {
140
151
  }
141
152
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: DropdownHeaderComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
142
153
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.0.0", type: DropdownHeaderComponent, isStandalone: true, selector: "flowbite-dropdown-header", inputs: { customStyle: { classPropertyName: "customStyle", publicName: "customStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { customStyle: "customStyleChange" }, usesInheritance: true, ngImport: i0, template: `
143
- <div [ngClass]="contentClasses().root">
154
+ <div [class]="contentClasses().root">
144
155
  <ng-content />
145
156
  </div>
146
- <div class="my-1 h-px bg-gray-100 dark:bg-gray-600"></div>
147
- `, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
157
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
148
158
  }
149
159
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: DropdownHeaderComponent, decorators: [{
150
160
  type: Component,
151
161
  args: [{
152
162
  standalone: true,
153
- imports: [NgClass],
154
163
  selector: 'flowbite-dropdown-header',
155
164
  template: `
156
- <div [ngClass]="contentClasses().root">
165
+ <div [class]="contentClasses().root">
157
166
  <ng-content />
158
167
  </div>
159
- <div class="my-1 h-px bg-gray-100 dark:bg-gray-600"></div>
160
168
  `,
161
169
  encapsulation: ViewEncapsulation.None,
162
170
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -193,6 +201,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
193
201
  }]
194
202
  }] });
195
203
 
204
+ const FLOWBITE_DROPDOWN_ITEM_CUSTOM_STYLE_DEFAULT_VALUE = new InjectionToken('FLOWBITE_DROPDOWN_ITEM_CUSTOM_STYLE_DEFAULT_VALUE');
205
+ const dropdownItemDefaultValueProvider = makeEnvironmentProviders([
206
+ {
207
+ provide: FLOWBITE_DROPDOWN_ITEM_CUSTOM_STYLE_DEFAULT_VALUE,
208
+ useValue: {},
209
+ },
210
+ ]);
196
211
  /**
197
212
  * @see https://flowbite.com/docs/components/dropdowns/
198
213
  */
@@ -211,7 +226,7 @@ class DropdownItemComponent extends BaseComponent {
211
226
  /**
212
227
  * Set the custom style for this dropdown item
213
228
  */
214
- this.customStyle = model({});
229
+ this.customStyle = model(inject(FLOWBITE_DROPDOWN_ITEM_CUSTOM_STYLE_DEFAULT_VALUE));
215
230
  }
216
231
  //#endregion
217
232
  //#region BaseComponent implementation
@@ -227,7 +242,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
227
242
  type: Component,
228
243
  args: [{
229
244
  standalone: true,
230
- imports: [NgClass],
231
245
  selector: 'flowbite-dropdown-item',
232
246
  template: `<ng-content />`,
233
247
  encapsulation: ViewEncapsulation.None,
@@ -270,12 +284,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
270
284
  }]
271
285
  }] });
272
286
 
287
+ const FLOWBITE_DROPDOWN_LABEL_DEFAULT_VALUE = new InjectionToken('FLOWBITE_DROPDOWN_LABEL_DEFAULT_VALUE');
288
+ const FLOWBITE_DROPDOWN_IS_OPEN_DEFAULT_VALUE = new InjectionToken('FLOWBITE_DROPDOWN_IS_OPEN_DEFAULT_VALUE');
289
+ const FLOWBITE_DROPDOWN_POSITION_DEFAULT_VALUE = new InjectionToken('FLOWBITE_DROPDOWN_POSITION_DEFAULT_VALUE');
290
+ const FLOWBITE_DROPDOWN_CUSTOM_STYLE_DEFAULT_VALUE = new InjectionToken('FLOWBITE_DROPDOWN_CUSTOM_STYLE_DEFAULT_VALUE');
291
+ const dropdownDefaultValueProvider = makeEnvironmentProviders([
292
+ {
293
+ provide: FLOWBITE_DROPDOWN_LABEL_DEFAULT_VALUE,
294
+ useValue: 'Dropdown',
295
+ },
296
+ {
297
+ provide: FLOWBITE_DROPDOWN_IS_OPEN_DEFAULT_VALUE,
298
+ useValue: false,
299
+ },
300
+ {
301
+ provide: FLOWBITE_DROPDOWN_POSITION_DEFAULT_VALUE,
302
+ useValue: 'bottom-center',
303
+ },
304
+ {
305
+ provide: FLOWBITE_DROPDOWN_CUSTOM_STYLE_DEFAULT_VALUE,
306
+ useValue: {},
307
+ },
308
+ ]);
273
309
  /**
274
310
  * @see https://flowbite.com/docs/components/dropdowns/
275
311
  */
276
312
  class DropdownComponent extends BaseComponent {
277
313
  constructor() {
278
314
  super(...arguments);
315
+ this.dropdown = viewChild.required('dropdown');
316
+ this.button = viewChild.required('button');
279
317
  /**
280
318
  * Service injected used to generate class
281
319
  */
@@ -306,27 +344,23 @@ class DropdownComponent extends BaseComponent {
306
344
  *
307
345
  * @default Dropdown
308
346
  */
309
- this.label = model('Dropdown');
347
+ this.label = model(inject(FLOWBITE_DROPDOWN_LABEL_DEFAULT_VALUE));
310
348
  /**
311
349
  * Set if the dropdown is open
312
350
  *
313
351
  * @default false
314
352
  */
315
- this.isOpen = model(false);
353
+ this.isOpen = model(inject(FLOWBITE_DROPDOWN_IS_OPEN_DEFAULT_VALUE));
316
354
  /**
317
355
  * Set the dropdown position
318
356
  *
319
357
  * @default bottom-center
320
358
  */
321
- this.position = model('bottom-center');
359
+ this.position = model(inject(FLOWBITE_DROPDOWN_POSITION_DEFAULT_VALUE));
322
360
  /**
323
361
  * Set the custom style for this dropdown
324
362
  */
325
- this.customStyle = model({});
326
- //#endregion
327
- this.x = 0;
328
- this.y = 0;
329
- this.width = 0;
363
+ this.customStyle = model(inject(FLOWBITE_DROPDOWN_CUSTOM_STYLE_DEFAULT_VALUE));
330
364
  }
331
365
  //#endregion
332
366
  //#region BaseComponent implementation
@@ -341,64 +375,29 @@ class DropdownComponent extends BaseComponent {
341
375
  init() {
342
376
  this.iconRegistry.addRawSvgIconInNamepsace('flowbite-angular', 'chevron-down', this.domSanitizer.bypassSecurityTrustHtml(CHEVRON_DOWN_SVG_ICON));
343
377
  }
344
- verify() {
345
- if (this.dropdownItemChildren().length === 0) {
346
- throw new Error('No DropdownItemComponent available');
347
- }
348
- }
378
+ //#endregion
349
379
  /**
350
380
  * Toggle dropdown isOpen
351
381
  */
352
382
  toggle() {
353
383
  this.isOpen.set(!this.isOpen());
354
384
  }
355
- calculatePosition() {
356
- computePosition(this.button.nativeElement, this.dropdown.nativeElement, {
357
- placement: this.convertPosition(this.position()),
358
- middleware: [offset(8), flip(), shift()],
359
- }).then(({ x, y }) => {
360
- this.dropdown.nativeElement.style.left = x + 'px';
361
- this.dropdown.nativeElement.style.top = y + 'px';
362
- this.width = this.button.nativeElement.offsetWidth;
363
- });
364
- }
365
- ngAfterViewInit() {
366
- // todo : Fix ERROR ReferenceError: ResizeObserver is not defined
367
- // Append when runing command 'pnpm lib:build'
368
- autoUpdate(this.button.nativeElement, this.dropdown.nativeElement, () => {
369
- if (!this.isOpen())
370
- return;
371
- this.calculatePosition();
372
- });
373
- }
374
385
  // Onclick outside the dropdown, close it
375
386
  clickout(event) {
376
- if (!this.dropdown.nativeElement.contains(event.target) &&
387
+ if (!this.dropdown().nativeElement.contains(event.target) &&
377
388
  this.isOpen() &&
378
- !this.button.nativeElement.contains(event.target)) {
389
+ !this.button().nativeElement.contains(event.target)) {
379
390
  this.isOpen.set(false);
380
391
  }
381
392
  }
382
- convertPosition(pos) {
383
- switch (pos) {
384
- case 'top-center':
385
- return 'top';
386
- case 'bottom-center':
387
- return 'bottom';
388
- case 'left-center':
389
- return 'left';
390
- case 'right-center':
391
- return 'right';
392
- }
393
- }
394
393
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
395
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.0.0", type: DropdownComponent, isStandalone: true, selector: "flowbite-dropdown", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, customStyle: { classPropertyName: "customStyle", publicName: "customStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { label: "labelChange", isOpen: "isOpenChange", position: "positionChange", customStyle: "customStyleChange" }, host: { listeners: { "document:click": "clickout($event)" } }, queries: [{ propertyName: "dropdownItemChildren", predicate: DropdownItemComponent, isSignal: true }, { propertyName: "dropdownHeaderChildren", predicate: DropdownHeaderComponent, isSignal: true }, { propertyName: "dropdownDividerChildren", predicate: DropdownDividerComponent, isSignal: true }], viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true }, { propertyName: "button", first: true, predicate: ["button"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
394
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.0.0", type: DropdownComponent, isStandalone: true, selector: "flowbite-dropdown", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, customStyle: { classPropertyName: "customStyle", publicName: "customStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { label: "labelChange", isOpen: "isOpenChange", position: "positionChange", customStyle: "customStyleChange" }, host: { listeners: { "document:click": "clickout($event)" } }, queries: [{ propertyName: "dropdownItemChildren", predicate: DropdownItemComponent, isSignal: true }, { propertyName: "dropdownHeaderChildren", predicate: DropdownHeaderComponent, isSignal: true }, { propertyName: "dropdownDividerChildren", predicate: DropdownDividerComponent, isSignal: true }], viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true, isSignal: true }, { propertyName: "button", first: true, predicate: ["button"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
396
395
  <button
397
396
  type="button"
398
- [ngClass]="contentClasses().dropdownClass"
397
+ [class]="contentClasses().dropdownClass"
399
398
  (click)="toggle()"
400
399
  #button>
401
- <span [ngClass]="contentClasses().spanClass">
400
+ <span [class]="contentClasses().spanClass">
402
401
  {{ label() }}
403
402
  <flowbite-icon
404
403
  svgIcon="flowbite-angular:chevron-down"
@@ -406,30 +405,31 @@ class DropdownComponent extends BaseComponent {
406
405
  </span>
407
406
  </button>
408
407
  <div
409
- [ngClass]="contentClasses().containerClass"
408
+ [class]="contentClasses().containerClass"
410
409
  #dropdown
411
- [style.display]="isOpen() ? 'block' : 'none'">
412
- <div [ngClass]="contentClasses().contentClass">
413
- <ul [ngClass]="contentClasses().subContentClass">
410
+ [style.display]="isOpen() ? 'block' : 'none'"
411
+ [style.minWidth.px]="button.clientWidth">
412
+ <div [class]="contentClasses().contentClass">
413
+ <ul [class]="contentClasses().subContentClass">
414
414
  <ng-content />
415
415
  </ul>
416
416
  </div>
417
417
  </div>
418
- `, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconComponent, selector: "flowbite-icon", inputs: ["svgIcon"], outputs: ["svgIconChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
418
+ `, isInline: true, dependencies: [{ kind: "component", type: IconComponent, selector: "flowbite-icon", inputs: ["svgIcon"], outputs: ["svgIconChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
419
419
  }
420
420
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: DropdownComponent, decorators: [{
421
421
  type: Component,
422
422
  args: [{
423
423
  standalone: true,
424
- imports: [NgClass, IconComponent],
424
+ imports: [IconComponent],
425
425
  selector: 'flowbite-dropdown',
426
426
  template: `
427
427
  <button
428
428
  type="button"
429
- [ngClass]="contentClasses().dropdownClass"
429
+ [class]="contentClasses().dropdownClass"
430
430
  (click)="toggle()"
431
431
  #button>
432
- <span [ngClass]="contentClasses().spanClass">
432
+ <span [class]="contentClasses().spanClass">
433
433
  {{ label() }}
434
434
  <flowbite-icon
435
435
  svgIcon="flowbite-angular:chevron-down"
@@ -437,11 +437,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
437
437
  </span>
438
438
  </button>
439
439
  <div
440
- [ngClass]="contentClasses().containerClass"
440
+ [class]="contentClasses().containerClass"
441
441
  #dropdown
442
- [style.display]="isOpen() ? 'block' : 'none'">
443
- <div [ngClass]="contentClasses().contentClass">
444
- <ul [ngClass]="contentClasses().subContentClass">
442
+ [style.display]="isOpen() ? 'block' : 'none'"
443
+ [style.minWidth.px]="button.clientWidth">
444
+ <div [class]="contentClasses().contentClass">
445
+ <ul [class]="contentClasses().subContentClass">
445
446
  <ng-content />
446
447
  </ul>
447
448
  </div>
@@ -453,20 +454,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
453
454
  encapsulation: ViewEncapsulation.None,
454
455
  changeDetection: ChangeDetectionStrategy.OnPush,
455
456
  }]
456
- }], propDecorators: { dropdown: [{
457
- type: ViewChild,
458
- args: ['dropdown']
459
- }], button: [{
460
- type: ViewChild,
461
- args: ['button']
462
- }] } });
457
+ }] });
463
458
 
464
459
  /**
465
460
  * Default theme for `DropdownComponent`
466
461
  */
467
462
  const dropdownTheme = createTheme({
468
463
  root: {
469
- base: '',
464
+ base: 'relative inline w-fit',
470
465
  },
471
466
  dropdown: {
472
467
  base: 'text-white bg-blue-700 border border-transparent hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 disabled:hover:bg-blue-700 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 dark:disabled:hover:bg-blue-600 group flex h-min items-center justify-center p-0.5 text-center font-medium focus:z-10 rounded-lg',
@@ -481,10 +476,10 @@ const dropdownTheme = createTheme({
481
476
  disabled: 'hidden',
482
477
  },
483
478
  placement: {
484
- 'top-center': '',
485
- 'bottom-center': '',
486
- 'left-center': '',
487
- 'right-center': '',
479
+ 'top-center': 'bottom-full mb-2.5 left-1/2 -translate-x-1/2',
480
+ 'bottom-center': 'top-full mt-2.5 left-1/2 -translate-x-1/2',
481
+ 'left-center': 'left-full ml-2.5 top-1/2 -translate-y-1/2',
482
+ 'right-center': 'right-full mr-2.5 top-1/2 -translate-y-1/2',
488
483
  },
489
484
  },
490
485
  content: {
@@ -529,5 +524,5 @@ const dropdownHeaderTheme = createTheme({
529
524
  * Generated bundle index. Do not edit.
530
525
  */
531
526
 
532
- export { DropdownComponent, DropdownDividerComponent, DropdownDividerThemeService, DropdownHeaderComponent, DropdownHeaderThemeService, DropdownItemComponent, DropdownItemThemeService, DropdownThemeService, FLOWBITE_DROPDOWN_DIVIDER_THEME_TOKEN, FLOWBITE_DROPDOWN_HEADER_THEME_TOKEN, FLOWBITE_DROPDOWN_ITEM_THEME_TOKEN, FLOWBITE_DROPDOWN_THEME_TOKEN, dropdownDividerTheme, dropdownHeaderTheme, dropdownItemTheme, dropdownTheme };
527
+ export { DropdownComponent, DropdownDividerComponent, DropdownDividerThemeService, DropdownHeaderComponent, DropdownHeaderThemeService, DropdownItemComponent, DropdownItemThemeService, DropdownThemeService, FLOWBITE_DROPDOWN_CUSTOM_STYLE_DEFAULT_VALUE, FLOWBITE_DROPDOWN_DIVIDER_CUSTOM_STYLE_DEFAULT_VALUE, FLOWBITE_DROPDOWN_DIVIDER_THEME_TOKEN, FLOWBITE_DROPDOWN_HEADER_CUSTOM_STYLE_DEFAULT_VALUE, FLOWBITE_DROPDOWN_HEADER_THEME_TOKEN, FLOWBITE_DROPDOWN_IS_OPEN_DEFAULT_VALUE, FLOWBITE_DROPDOWN_ITEM_CUSTOM_STYLE_DEFAULT_VALUE, FLOWBITE_DROPDOWN_ITEM_THEME_TOKEN, FLOWBITE_DROPDOWN_LABEL_DEFAULT_VALUE, FLOWBITE_DROPDOWN_POSITION_DEFAULT_VALUE, FLOWBITE_DROPDOWN_THEME_TOKEN, dropdownDefaultValueProvider, dropdownDividerDefaultValueProvider, dropdownDividerTheme, dropdownHeaderDefaultValueProvider, dropdownHeaderTheme, dropdownItemDefaultValueProvider, dropdownItemTheme, dropdownTheme };
533
528
  //# sourceMappingURL=flowbite-angular-dropdown.mjs.map