@ngbase/adk 0.1.16 → 0.1.18

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 (203) hide show
  1. package/fesm2022/ngbase-adk-a11y.mjs +42 -42
  2. package/fesm2022/ngbase-adk-a11y.mjs.map +1 -1
  3. package/fesm2022/ngbase-adk-accordion.mjs +20 -26
  4. package/fesm2022/ngbase-adk-accordion.mjs.map +1 -1
  5. package/fesm2022/ngbase-adk-autocomplete.mjs +11 -11
  6. package/fesm2022/ngbase-adk-autocomplete.mjs.map +1 -1
  7. package/fesm2022/ngbase-adk-avatar.mjs +13 -13
  8. package/fesm2022/ngbase-adk-avatar.mjs.map +1 -1
  9. package/fesm2022/ngbase-adk-bidi.mjs +3 -3
  10. package/fesm2022/ngbase-adk-bidi.mjs.map +1 -1
  11. package/fesm2022/ngbase-adk-breadcrumb.mjs +14 -14
  12. package/fesm2022/ngbase-adk-breadcrumb.mjs.map +1 -1
  13. package/fesm2022/ngbase-adk-cache.mjs +3 -3
  14. package/fesm2022/ngbase-adk-cache.mjs.map +1 -1
  15. package/fesm2022/ngbase-adk-carousel.mjs +18 -18
  16. package/fesm2022/ngbase-adk-carousel.mjs.map +1 -1
  17. package/fesm2022/ngbase-adk-checkbox.mjs +15 -21
  18. package/fesm2022/ngbase-adk-checkbox.mjs.map +1 -1
  19. package/fesm2022/ngbase-adk-chip.mjs +12 -12
  20. package/fesm2022/ngbase-adk-chip.mjs.map +1 -1
  21. package/fesm2022/ngbase-adk-clipboard.mjs +7 -5
  22. package/fesm2022/ngbase-adk-clipboard.mjs.map +1 -1
  23. package/fesm2022/ngbase-adk-collections.mjs.map +1 -1
  24. package/fesm2022/ngbase-adk-color-picker.mjs +44 -53
  25. package/fesm2022/ngbase-adk-color-picker.mjs.map +1 -1
  26. package/fesm2022/ngbase-adk-cookies.mjs +3 -3
  27. package/fesm2022/ngbase-adk-cookies.mjs.map +1 -1
  28. package/fesm2022/ngbase-adk-datepicker.mjs +70 -89
  29. package/fesm2022/ngbase-adk-datepicker.mjs.map +1 -1
  30. package/fesm2022/ngbase-adk-dialog.mjs +17 -39
  31. package/fesm2022/ngbase-adk-dialog.mjs.map +1 -1
  32. package/fesm2022/ngbase-adk-drag.mjs +20 -20
  33. package/fesm2022/ngbase-adk-drag.mjs.map +1 -1
  34. package/fesm2022/ngbase-adk-form-field.mjs +65 -118
  35. package/fesm2022/ngbase-adk-form-field.mjs.map +1 -1
  36. package/fesm2022/ngbase-adk-hover-card.mjs +5 -5
  37. package/fesm2022/ngbase-adk-hover-card.mjs.map +1 -1
  38. package/fesm2022/ngbase-adk-icon.mjs +9 -11
  39. package/fesm2022/ngbase-adk-icon.mjs.map +1 -1
  40. package/fesm2022/ngbase-adk-inline-edit.mjs +27 -35
  41. package/fesm2022/ngbase-adk-inline-edit.mjs.map +1 -1
  42. package/fesm2022/ngbase-adk-jwt.mjs +319 -41
  43. package/fesm2022/ngbase-adk-jwt.mjs.map +1 -1
  44. package/fesm2022/ngbase-adk-keys.mjs +6 -6
  45. package/fesm2022/ngbase-adk-keys.mjs.map +1 -1
  46. package/fesm2022/ngbase-adk-layout.mjs.map +1 -1
  47. package/fesm2022/ngbase-adk-list.mjs +10 -10
  48. package/fesm2022/ngbase-adk-list.mjs.map +1 -1
  49. package/fesm2022/ngbase-adk-mask.mjs +8 -8
  50. package/fesm2022/ngbase-adk-mask.mjs.map +1 -1
  51. package/fesm2022/ngbase-adk-menu.mjs +69 -79
  52. package/fesm2022/ngbase-adk-menu.mjs.map +1 -1
  53. package/fesm2022/ngbase-adk-network.mjs +3 -3
  54. package/fesm2022/ngbase-adk-network.mjs.map +1 -1
  55. package/fesm2022/ngbase-adk-otp.mjs +24 -45
  56. package/fesm2022/ngbase-adk-otp.mjs.map +1 -1
  57. package/fesm2022/ngbase-adk-pagination.mjs +9 -9
  58. package/fesm2022/ngbase-adk-pagination.mjs.map +1 -1
  59. package/fesm2022/ngbase-adk-popover.mjs +120 -89
  60. package/fesm2022/ngbase-adk-popover.mjs.map +1 -1
  61. package/fesm2022/ngbase-adk-portal.mjs +134 -47
  62. package/fesm2022/ngbase-adk-portal.mjs.map +1 -1
  63. package/fesm2022/ngbase-adk-progress.mjs +7 -7
  64. package/fesm2022/ngbase-adk-progress.mjs.map +1 -1
  65. package/fesm2022/ngbase-adk-radio.mjs +20 -27
  66. package/fesm2022/ngbase-adk-radio.mjs.map +1 -1
  67. package/fesm2022/ngbase-adk-resizable.mjs +138 -48
  68. package/fesm2022/ngbase-adk-resizable.mjs.map +1 -1
  69. package/fesm2022/ngbase-adk-scroll-area.mjs +28 -20
  70. package/fesm2022/ngbase-adk-scroll-area.mjs.map +1 -1
  71. package/fesm2022/ngbase-adk-select.mjs +58 -80
  72. package/fesm2022/ngbase-adk-select.mjs.map +1 -1
  73. package/fesm2022/ngbase-adk-selectable.mjs +19 -30
  74. package/fesm2022/ngbase-adk-selectable.mjs.map +1 -1
  75. package/fesm2022/ngbase-adk-sheet.mjs +6 -20
  76. package/fesm2022/ngbase-adk-sheet.mjs.map +1 -1
  77. package/fesm2022/ngbase-adk-sidenav.mjs +65 -46
  78. package/fesm2022/ngbase-adk-sidenav.mjs.map +1 -1
  79. package/fesm2022/ngbase-adk-slider.mjs +40 -53
  80. package/fesm2022/ngbase-adk-slider.mjs.map +1 -1
  81. package/fesm2022/ngbase-adk-sonner.mjs +12 -19
  82. package/fesm2022/ngbase-adk-sonner.mjs.map +1 -1
  83. package/fesm2022/ngbase-adk-stepper.mjs +17 -25
  84. package/fesm2022/ngbase-adk-stepper.mjs.map +1 -1
  85. package/fesm2022/ngbase-adk-switch.mjs +25 -32
  86. package/fesm2022/ngbase-adk-switch.mjs.map +1 -1
  87. package/fesm2022/ngbase-adk-table.mjs +581 -83
  88. package/fesm2022/ngbase-adk-table.mjs.map +1 -1
  89. package/fesm2022/ngbase-adk-tabs.mjs +37 -35
  90. package/fesm2022/ngbase-adk-tabs.mjs.map +1 -1
  91. package/fesm2022/ngbase-adk-test.mjs.map +1 -1
  92. package/fesm2022/ngbase-adk-toggle-group.mjs +20 -34
  93. package/fesm2022/ngbase-adk-toggle-group.mjs.map +1 -1
  94. package/fesm2022/ngbase-adk-toggle.mjs +14 -19
  95. package/fesm2022/ngbase-adk-toggle.mjs.map +1 -1
  96. package/fesm2022/ngbase-adk-tooltip.mjs +12 -19
  97. package/fesm2022/ngbase-adk-tooltip.mjs.map +1 -1
  98. package/fesm2022/ngbase-adk-tour.mjs +52 -52
  99. package/fesm2022/ngbase-adk-tour.mjs.map +1 -1
  100. package/fesm2022/ngbase-adk-translate.mjs +8 -10
  101. package/fesm2022/ngbase-adk-translate.mjs.map +1 -1
  102. package/fesm2022/ngbase-adk-tree.mjs +20 -20
  103. package/fesm2022/ngbase-adk-tree.mjs.map +1 -1
  104. package/fesm2022/ngbase-adk-utils.mjs +30 -43
  105. package/fesm2022/ngbase-adk-utils.mjs.map +1 -1
  106. package/fesm2022/ngbase-adk-virtualizer.mjs +9 -9
  107. package/fesm2022/ngbase-adk-virtualizer.mjs.map +1 -1
  108. package/package.json +91 -91
  109. package/schematics/components/files/accordion/accordion.ts.template +9 -6
  110. package/schematics/components/files/audio/AudioPlayer.ts.template +245 -0
  111. package/schematics/components/files/audio/AudioRecorder.ts.template +377 -0
  112. package/schematics/components/files/audio/AudioVisualizer.ts.template +175 -0
  113. package/schematics/components/files/audio/index.ts.template +3 -0
  114. package/schematics/components/files/button/button-llm.md.template +3 -2
  115. package/schematics/components/files/charts/area-chart.component.ts.template +278 -0
  116. package/schematics/components/files/charts/bar-chart.component.ts.template +262 -0
  117. package/schematics/components/files/charts/chart-tooltip.component.ts.template +168 -0
  118. package/schematics/components/files/charts/index.ts.template +4 -0
  119. package/schematics/components/files/charts/line-chart.component.ts.template +238 -0
  120. package/schematics/components/files/charts/pie-chart.component.ts.template +283 -0
  121. package/schematics/components/files/checkbox/checkbox.ts.template +2 -2
  122. package/schematics/components/files/color-picker/color-picker.ts.template +2 -2
  123. package/schematics/components/files/dialog/dialog.ts.template +18 -14
  124. package/schematics/components/files/drawer/drawer.ts.template +30 -27
  125. package/schematics/components/files/form-field/form-field.ts.template +51 -23
  126. package/schematics/components/files/pagination/pagination.ts.template +4 -4
  127. package/schematics/components/files/picasa/picasa-base.component.ts.template +15 -30
  128. package/schematics/components/files/popover/popover.ts.template +15 -4
  129. package/schematics/components/files/select/list-selection.ts.template +0 -2
  130. package/schematics/components/files/select/option.ts.template +1 -1
  131. package/schematics/components/files/selectable/selectable.ts.template +2 -2
  132. package/schematics/components/files/sheet/sheet.ts.template +26 -14
  133. package/schematics/components/files/sidenav/sidenav.ts.template +7 -5
  134. package/schematics/components/files/sonner/sonner.ts.template +1 -2
  135. package/schematics/components/files/stepper/stepper.ts.template +2 -4
  136. package/schematics/components/files/switch/switch.ts.template +2 -2
  137. package/schematics/components/files/table/table.ts.template +43 -3
  138. package/schematics/components/files/tabs/tab.ts.template +3 -3
  139. package/schematics/components/files/theme/theme.service.ts.template +3 -3
  140. package/schematics/components/files/toggle/toggle.ts.template +1 -1
  141. package/schematics/components/files/toggle-group/toggle-group.ts.template +1 -1
  142. package/schematics/components/files/tooltip/tooltip.ts.template +2 -3
  143. package/schematics/components/schema.json +2 -0
  144. package/{accordion/index.d.ts → types/ngbase-adk-accordion.d.ts} +1 -3
  145. package/{autocomplete/index.d.ts → types/ngbase-adk-autocomplete.d.ts} +2 -7
  146. package/{checkbox/index.d.ts → types/ngbase-adk-checkbox.d.ts} +8 -14
  147. package/types/ngbase-adk-clipboard.d.ts +12 -0
  148. package/{color-picker/index.d.ts → types/ngbase-adk-color-picker.d.ts} +14 -26
  149. package/{datepicker/index.d.ts → types/ngbase-adk-datepicker.d.ts} +9 -18
  150. package/{dialog/index.d.ts → types/ngbase-adk-dialog.d.ts} +3 -8
  151. package/types/ngbase-adk-form-field.d.ts +88 -0
  152. package/{inline-edit/index.d.ts → types/ngbase-adk-inline-edit.d.ts} +8 -16
  153. package/types/ngbase-adk-jwt.d.ts +64 -0
  154. package/{menu/index.d.ts → types/ngbase-adk-menu.d.ts} +6 -5
  155. package/{otp/index.d.ts → types/ngbase-adk-otp.d.ts} +8 -16
  156. package/{popover/index.d.ts → types/ngbase-adk-popover.d.ts} +14 -2
  157. package/{portal/index.d.ts → types/ngbase-adk-portal.d.ts} +29 -8
  158. package/{radio/index.d.ts → types/ngbase-adk-radio.d.ts} +9 -12
  159. package/{resizable/index.d.ts → types/ngbase-adk-resizable.d.ts} +4 -4
  160. package/{scroll-area/index.d.ts → types/ngbase-adk-scroll-area.d.ts} +2 -1
  161. package/{select/index.d.ts → types/ngbase-adk-select.d.ts} +8 -22
  162. package/{selectable/index.d.ts → types/ngbase-adk-selectable.d.ts} +6 -10
  163. package/{sheet/index.d.ts → types/ngbase-adk-sheet.d.ts} +4 -3
  164. package/{sidenav/index.d.ts → types/ngbase-adk-sidenav.d.ts} +6 -6
  165. package/{slider/index.d.ts → types/ngbase-adk-slider.d.ts} +8 -17
  166. package/{sonner/index.d.ts → types/ngbase-adk-sonner.d.ts} +1 -3
  167. package/{stepper/index.d.ts → types/ngbase-adk-stepper.d.ts} +1 -4
  168. package/{switch/index.d.ts → types/ngbase-adk-switch.d.ts} +7 -14
  169. package/{table/index.d.ts → types/ngbase-adk-table.d.ts} +126 -3
  170. package/{test/index.d.ts → types/ngbase-adk-test.d.ts} +1 -1
  171. package/{toggle-group/index.d.ts → types/ngbase-adk-toggle-group.d.ts} +5 -10
  172. package/types/ngbase-adk-toggle.d.ts +14 -0
  173. package/{tooltip/index.d.ts → types/ngbase-adk-tooltip.d.ts} +9 -11
  174. package/{tour/index.d.ts → types/ngbase-adk-tour.d.ts} +4 -6
  175. package/{utils/index.d.ts → types/ngbase-adk-utils.d.ts} +15 -11
  176. package/clipboard/index.d.ts +0 -11
  177. package/form-field/index.d.ts +0 -97
  178. package/jwt/index.d.ts +0 -20
  179. package/toggle/index.d.ts +0 -16
  180. /package/{a11y/index.d.ts → types/ngbase-adk-a11y.d.ts} +0 -0
  181. /package/{avatar/index.d.ts → types/ngbase-adk-avatar.d.ts} +0 -0
  182. /package/{bidi/index.d.ts → types/ngbase-adk-bidi.d.ts} +0 -0
  183. /package/{breadcrumb/index.d.ts → types/ngbase-adk-breadcrumb.d.ts} +0 -0
  184. /package/{cache/index.d.ts → types/ngbase-adk-cache.d.ts} +0 -0
  185. /package/{carousel/index.d.ts → types/ngbase-adk-carousel.d.ts} +0 -0
  186. /package/{chip/index.d.ts → types/ngbase-adk-chip.d.ts} +0 -0
  187. /package/{collections/index.d.ts → types/ngbase-adk-collections.d.ts} +0 -0
  188. /package/{cookies/index.d.ts → types/ngbase-adk-cookies.d.ts} +0 -0
  189. /package/{drag/index.d.ts → types/ngbase-adk-drag.d.ts} +0 -0
  190. /package/{hover-card/index.d.ts → types/ngbase-adk-hover-card.d.ts} +0 -0
  191. /package/{icon/index.d.ts → types/ngbase-adk-icon.d.ts} +0 -0
  192. /package/{keys/index.d.ts → types/ngbase-adk-keys.d.ts} +0 -0
  193. /package/{layout/index.d.ts → types/ngbase-adk-layout.d.ts} +0 -0
  194. /package/{list/index.d.ts → types/ngbase-adk-list.d.ts} +0 -0
  195. /package/{mask/index.d.ts → types/ngbase-adk-mask.d.ts} +0 -0
  196. /package/{network/index.d.ts → types/ngbase-adk-network.d.ts} +0 -0
  197. /package/{pagination/index.d.ts → types/ngbase-adk-pagination.d.ts} +0 -0
  198. /package/{progress/index.d.ts → types/ngbase-adk-progress.d.ts} +0 -0
  199. /package/{tabs/index.d.ts → types/ngbase-adk-tabs.d.ts} +0 -0
  200. /package/{translate/index.d.ts → types/ngbase-adk-translate.d.ts} +0 -0
  201. /package/{tree/index.d.ts → types/ngbase-adk-tree.d.ts} +0 -0
  202. /package/{virtualizer/index.d.ts → types/ngbase-adk-virtualizer.d.ts} +0 -0
  203. /package/{index.d.ts → types/ngbase-adk.d.ts} +0 -0
@@ -1,24 +1,25 @@
1
- import { animate, state, style, transition, trigger } from '@angular/animations';
2
1
  import {
3
2
  ChangeDetectionStrategy,
4
3
  Component,
5
4
  ViewContainerRef,
6
- afterNextRender,
5
+ computed,
7
6
  viewChild,
8
7
  } from '@angular/core';
9
8
  import { FocusTrap } from '@ngbase/adk/a11y';
10
9
  import { BaseDialog, basePortal, DialogInput, DialogOptions } from '@ngbase/adk/portal';
11
- import { createHostAnimation, fadeAnimation } from '@ngbase/adk/utils';
12
10
 
13
11
  @Component({
14
12
  selector: '<%= name %>-drawer',
15
13
  template: `
16
14
  <div class="pointer-events-none flex h-full flex-col justify-end">
17
15
  <div
18
- class="pointer-events-auto flex max-h-[90vh] flex-col overflow-hidden rounded-tl-2xl rounded-tr-2xl border-t bg-background p-4 shadow-2xl"
19
- [@bottomAnimation]
16
+ class="{{
17
+ 'bg-background pointer-events-auto flex max-h-[90vh] flex-col overflow-hidden rounded-tl-2xl rounded-tr-2xl border-t p-4 shadow-2xl' +
18
+ (closing() ? ' drawer-content-leave' : ' drawer-content')
19
+ }}"
20
+ (animationend)="onAnimationEnd($event)"
20
21
  >
21
- <button class="mx-auto h-2 w-20 rounded-full bg-muted-foreground"></button>
22
+ <button class="bg-muted-foreground mx-auto h-2 w-20 rounded-full"></button>
22
23
  @if (!isHideHeader) {
23
24
  <div class="flex h-8 items-center">
24
25
  <h2 class="flex-1 font-bold">{{ options.title }}</h2>
@@ -26,50 +27,52 @@ import { createHostAnimation, fadeAnimation } from '@ngbase/adk/utils';
26
27
  </div>
27
28
  }
28
29
  <div class="h-full overflow-auto">
29
- <ng-container #myDialog />
30
+ <ng-container #contentContainer />
30
31
  </div>
31
32
  </div>
32
33
  </div>
33
34
  @if (backdropColor) {
34
35
  <div
35
- class="absolute top-0 -z-10 h-full w-full bg-black/30"
36
- [@fadeAnimation]
37
36
  (click)="close()"
37
+ (animationend)="onAnimationEnd($event)"
38
+ class="{{
39
+ 'absolute top-0 -z-10 h-full w-full bg-black/30' +
40
+ (closing() ? ' dialog-backdrop-leave' : ' dialog-backdrop')
41
+ }}"
38
42
  ></div>
39
43
  }
40
44
  `,
41
45
  host: {
42
46
  class: 'fixed block top-0 bottom-0 left-0 right-0 overflow-hidden z-p',
43
- '[@parentAnimation]': '',
44
- '(@parentAnimation.done)': 'animationDone()',
45
47
  },
46
48
  hostDirectives: [FocusTrap],
47
49
  changeDetection: ChangeDetectionStrategy.OnPush,
48
- animations: [
49
- createHostAnimation(['@bottomAnimation', '@fadeAnimation']),
50
- trigger('bottomAnimation', [
51
- state('1', style({ transform: 'none' })),
52
- state('void', style({ transform: 'translate3d(0, 100%, 0)' })),
53
- state('0', style({ transform: 'translate3d(0, 100%, 0)' })),
54
- transition('* => *', animate('200ms ease')),
55
- ]),
56
- fadeAnimation('200ms'),
57
- ],
58
50
  })
59
51
  export class DrawerContainer extends BaseDialog {
60
- myDialog = viewChild('myDialog', { read: ViewContainerRef });
52
+ protected override readonly hasAnimations = true;
53
+ readonly contentContainer = viewChild('contentContainer', { read: ViewContainerRef });
61
54
  backdropColor = true;
62
55
  options!: DialogOptions;
63
56
  classNames = '';
64
57
  isHideHeader = false;
65
58
 
66
- constructor() {
67
- super();
68
- afterNextRender(() => {
69
- this._afterViewSource.next(this.myDialog()!);
70
- });
59
+ onAnimationEnd(event: AnimationEvent) {
60
+ if (event.target === event.currentTarget) {
61
+ this.animationDone();
62
+ }
71
63
  }
72
64
 
65
+ readonly style = computed(() => {
66
+ return {
67
+ width: this.options.fullWindow ? '100vw' : this.options.width,
68
+ height: this.options.fullWindow ? '100vh' : this.options.height,
69
+ maxWidth: this.options.fullWindow ? '100vw' : this.options.maxWidth,
70
+ maxHeight: this.options.fullWindow ? '100vh' : this.options.maxHeight || '96vh',
71
+ minHeight: this.options.minHeight,
72
+ minWidth: this.options.minWidth,
73
+ };
74
+ });
75
+
73
76
  override setOptions(options: DialogOptions): void {
74
77
  this.options = options;
75
78
  this.classNames = this.options.classNames?.join(' ') || '';
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ChangeDetectionStrategy,
3
3
  Component,
4
+ computed,
4
5
  Directive,
5
6
  effect,
6
7
  ElementRef,
7
8
  inject,
8
- OnDestroy,
9
9
  viewChild,
10
10
  } from '@angular/core';
11
11
  import {
@@ -13,7 +13,7 @@ import {
13
13
  NgbFormField,
14
14
  NgbInputError,
15
15
  NgbLabel,
16
- toggleDiv,
16
+ NumberFormat,
17
17
  } from '@ngbase/adk/form-field';
18
18
  import { InputStyle } from './input-style.directive';
19
19
  import { NgbSelectTarget } from '@ngbase/adk/select';
@@ -26,20 +26,44 @@ import { NgbSelectTarget } from '@ngbase/adk/select';
26
26
  template: `
27
27
  <ng-content select="[<%= name %>Label]" />
28
28
  <ng-content select="[<%= name %>Description]" />
29
- <div class="flex items-center" #target <%= name %>InputStyle>
29
+ <div
30
+ class="has-[[disabled]]:bg-input/30 flex items-center"
31
+ #target
32
+ <%= name %>InputStyle
33
+ [class]="
34
+ ngbFormField.hasErrors()
35
+ ? 'border-red-500 focus-within:border-red-500 focus-within:ring-red-500/30'
36
+ : ''
37
+ "
38
+ >
30
39
  <ng-content select="[<%= name %>Prefix]" />
31
40
  <ng-content />
32
41
  <ng-content select="[<%= name %>Suffix]" />
33
42
  </div>
34
- <ng-content select="[<%= name %>Error]" />
43
+ @for (error of errors(); track error.kind) {
44
+ <div class="overflow-hidden" animate.enter="height-enter" animate.leave="height-leave">
45
+ <div class="mx-0.5 min-h-0 text-sm text-red-500">
46
+ {{ error.message }}
47
+ </div>
48
+ </div>
49
+ }
35
50
  `,
36
51
  host: {
37
52
  class: 'inline-flex flex-col font-medium gap-1',
38
53
  },
39
54
  })
40
- export class FormField {
55
+ export class MeeFormField {
56
+ readonly ngbFormField = inject(NgbFormField);
41
57
  readonly selectTarget = inject(NgbSelectTarget);
42
58
  readonly target = viewChild.required<ElementRef<HTMLDivElement>>('target');
59
+ readonly errors = computed(() => {
60
+ const control = this.ngbFormField._control();
61
+ const state = control?.state();
62
+ if (state?.touched() && state?.errors()?.length) {
63
+ return state.errors();
64
+ }
65
+ return [];
66
+ });
43
67
  private _ = effect(() => {
44
68
  this.selectTarget.target.set(this.target().nativeElement);
45
69
  });
@@ -57,6 +81,16 @@ export class MeeInput {
57
81
  readonly formField = inject(NgbFormField, { optional: true });
58
82
  }
59
83
 
84
+ @Directive({
85
+ selector: '[<%= name %>NumberInput]',
86
+ // hostDirectives: [{ directive: InputBase, inputs: ['value'], outputs: ['valueChange'] }],
87
+ host: {
88
+ class: 'outline-none w-full bg-transparent placeholder:text-gray-400',
89
+ '[class.border-red-500]': 'formField?.hasErrors()',
90
+ },
91
+ })
92
+ export class MeeNumberInput extends NumberFormat {}
93
+
60
94
  @Component({
61
95
  selector: '[<%= name %>Label]',
62
96
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -79,7 +113,7 @@ export class Description {}
79
113
  @Directive({
80
114
  selector: '[<%= name %>Prefix]',
81
115
  host: {
82
- class: 'mr-2.5',
116
+ class: 'mr-2.5 text-muted-foreground',
83
117
  },
84
118
  })
85
119
  export class InputPrefix {}
@@ -87,7 +121,7 @@ export class InputPrefix {}
87
121
  @Directive({
88
122
  selector: '[<%= name %>Suffix]',
89
123
  host: {
90
- class: 'ml-2.5',
124
+ class: 'ml-2.5 text-muted-foreground',
91
125
  },
92
126
  })
93
127
  export class InputSuffix {}
@@ -95,26 +129,20 @@ export class InputSuffix {}
95
129
  @Component({
96
130
  selector: '[<%= name %>Error]',
97
131
  hostDirectives: [{ directive: NgbInputError, inputs: ['ngbError: <%= name %>Error'] }],
98
- template: `<ng-content />`,
132
+ template: `
133
+ @if (isInvalid()) {
134
+ <div class="overflow-hidden" animate.enter="height-enter" animate.leave="height-leave">
135
+ <div class="min-h-0">
136
+ <ng-content />
137
+ </div>
138
+ </div>
139
+ }
140
+ `,
99
141
  host: {
100
142
  class: 'text-red-500 mx-0.5',
101
- '[@toggleDiv]': 'isInvalid() ? "visible" : "hidden"',
102
143
  },
103
- animations: [toggleDiv],
104
144
  })
105
- export class InputError implements OnDestroy {
145
+ export class InputError {
106
146
  readonly error = inject(NgbInputError);
107
- readonly el = inject<ElementRef<HTMLDivElement>>(ElementRef);
108
-
109
147
  readonly isInvalid = this.error.isInvalid;
110
-
111
- constructor() {
112
- this.error.animate.set(true);
113
- }
114
-
115
- ngOnDestroy() {
116
- if (!this.isInvalid()) {
117
- this.el.nativeElement.classList.add('h-0', 'opacity-0');
118
- }
119
- }
120
148
  }
@@ -10,7 +10,7 @@ import {
10
10
  lucideChevronsLeft,
11
11
  lucideChevronsRight,
12
12
  } from '@ng-icons/lucide';
13
- import { FormField } from '<%= basepath %>/form-field';
13
+ import { MeeFormField } from '<%= basepath %>/form-field';
14
14
 
15
15
  @Component({
16
16
  selector: '<%= name %>-pagination',
@@ -23,12 +23,12 @@ import { FormField } from '<%= basepath %>/form-field';
23
23
  lucideChevronsRight,
24
24
  }),
25
25
  ],
26
- imports: [Button, Icon, Select, Option, NgbPaginationBtn, FormField],
26
+ imports: [Button, Icon, Select, Option, NgbPaginationBtn, MeeFormField],
27
27
  template: `
28
28
  <div class="flex items-center gap-2">
29
29
  <div>Rows per page</div>
30
30
  <<%= name %>-form-field class="!w-auto [&>.mis]:min-h-8 [&>.mis]:py-0">
31
- <<%= name %>-select [value]="size()" (valueChange)="sizeChanged($event)">
31
+ <<%= name %>-select [value]="size()" (valueChange)="sizeChanged($any($event))">
32
32
  @for (size of sizeOptions(); track size) {
33
33
  <<%= name %>-option [value]="size">
34
34
  {{ size }}
@@ -51,7 +51,7 @@ import { FormField } from '<%= basepath %>/form-field';
51
51
  ngbPaginationBtn="page"
52
52
  [jump]="snap"
53
53
  <%= name %>Button="ghost"
54
- class="min-w-9 !p-2 ring-offset-foreground aria-[current=page]:bg-muted aria-[current=page]:text-primary"
54
+ class="ring-offset-foreground aria-[current=page]:bg-muted aria-[current=page]:text-primary min-w-9 !p-2"
55
55
  >
56
56
  {{ snap }}
57
57
  </button>
@@ -1,12 +1,5 @@
1
- import {
2
- afterNextRender,
3
- ChangeDetectionStrategy,
4
- Component,
5
- viewChild,
6
- ViewContainerRef,
7
- } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, viewChild, ViewContainerRef } from '@angular/core';
8
2
  import { BaseDialog, DialogOptions } from '@ngbase/adk/portal';
9
- import { createHostAnimation, fadeAnimation } from '@ngbase/adk/utils';
10
3
  import { Subject } from 'rxjs';
11
4
 
12
5
  @Component({
@@ -15,18 +8,20 @@ import { Subject } from 'rxjs';
15
8
  template: `
16
9
  <div class="pointer-events-none flex h-full items-center justify-center">
17
10
  <div class="pointer-events-auto">
18
- <ng-container #myDialog />
11
+ <ng-container #contentContainer />
19
12
  </div>
20
13
  <div
21
- class="backdropColor pointer-events-auto absolute top-0 -z-10 h-full w-full"
22
14
  (click)="!options.disableClose && close()"
23
- [@fadeAnimation]=""
15
+ (animationend)="onAnimationEnd($event)"
16
+ class="{{
17
+ 'backdropColor pointer-events-auto absolute top-0 -z-10 h-full w-full' +
18
+ (closing() ? ' dialog-backdrop-leave' : ' dialog-backdrop')
19
+ }}"
24
20
  ></div>
25
21
  </div>
26
22
  `,
27
23
  host: {
28
24
  class: 'fixed block top-0 bottom-0 left-0 right-0 overflow-auto pointer-events-none z-p',
29
- '[@parentAnimation]': '',
30
25
  },
31
26
  styles: `
32
27
  .backdropColor {
@@ -41,10 +36,10 @@ import { Subject } from 'rxjs';
41
36
  border-radius: 0;
42
37
  }
43
38
  `,
44
- animations: [createHostAnimation(['@fadeAnimation']), fadeAnimation('300ms')],
45
39
  })
46
40
  export class PicasaBase extends BaseDialog {
47
- myDialog = viewChild('myDialog', { read: ViewContainerRef });
41
+ protected override readonly hasAnimations = true;
42
+ readonly contentContainer = viewChild('contentContainer', { read: ViewContainerRef });
48
43
 
49
44
  backdropColor = true;
50
45
  isSidePopup = true;
@@ -54,26 +49,16 @@ export class PicasaBase extends BaseDialog {
54
49
  isHideHeader = false;
55
50
  onDone = new Subject<any>();
56
51
 
57
- constructor() {
58
- super();
59
- afterNextRender(() => {
60
- this._afterViewSource.next(this.myDialog()!);
61
-
62
- // setTimeout(() => {
63
- // this.show.set(false);
64
- // }, 2000);
65
- });
66
- // this.dialogRef.afterClosed.subscribe(() => {
67
- // setTimeout(() => {
68
- // this.animationDone();
69
- // }, 500);
70
- // });
71
- }
72
-
73
52
  override setOptions(options: DialogOptions) {
74
53
  this.options = options;
75
54
  this.classNames = this.options.classNames?.join(' ') || '';
76
55
  this.isHideHeader = this.options.header || false;
77
56
  this.backdropColor = this.options.backdropColor || true;
78
57
  }
58
+
59
+ onAnimationEnd(event: AnimationEvent) {
60
+ if (event.target === event.currentTarget) {
61
+ this.animationDone();
62
+ }
63
+ }
79
64
  }
@@ -18,11 +18,14 @@ import {
18
18
  imports: [NgbPopoverBackdrop, NgbPopoverMain, NgbPopoverArrow],
19
19
  template: ` <div
20
20
  ngbPopoverMain
21
- [@slideInOutAnimation]
22
- class="menu-container pointer-events-auto fixed z-10 flex flex-col rounded-lg border bg-popover text-popover-foreground shadow-md"
21
+ (animationend)="onAnimationEnd($event)"
22
+ class="{{
23
+ 'menu-container pointer-events-auto fixed z-10 flex flex-col rounded-lg border bg-popover text-popover-foreground shadow-md' +
24
+ (closing() ? ' popover-content-leave' : ' popover-content')
25
+ }}"
23
26
  >
24
27
  <div class="flex flex-1 flex-col overflow-auto" ngbPopoverArrow>
25
- <ng-container #myDialog />
28
+ <ng-container #contentContainer />
26
29
  </div>
27
30
  </div>
28
31
  @if (options().backdrop) {
@@ -33,7 +36,15 @@ import {
33
36
  'fixed top-0 left-0 w-full h-full pointer-events-none z-p flex items-center justify-center',
34
37
  },
35
38
  })
36
- class Popover extends NgbPopover {}
39
+ class Popover extends NgbPopover {
40
+ protected override readonly hasAnimations = true;
41
+
42
+ onAnimationEnd(event: AnimationEvent) {
43
+ if (event.target === event.currentTarget) {
44
+ this.animationDone();
45
+ }
46
+ }
47
+ }
37
48
 
38
49
  export function registerPopover() {
39
50
  return registerNgbPopover(Popover);
@@ -1,12 +1,10 @@
1
1
  import { ChangeDetectionStrategy, Component } from '@angular/core';
2
- import { provideValueAccessor } from '@ngbase/adk/utils';
3
2
  import { SelectBase } from '@ngbase/adk/select';
4
3
 
5
4
  @Component({
6
5
  selector: '<%= name %>-list-selection',
7
6
  changeDetection: ChangeDetectionStrategy.OnPush,
8
7
  template: `<ng-content />`,
9
- providers: [provideValueAccessor(ListSelection)],
10
8
  })
11
9
  export class ListSelection<T> extends SelectBase<T> {
12
10
  constructor() {
@@ -24,7 +24,7 @@ export class Option<T> {
24
24
  @Component({
25
25
  selector: '<%= name %>-option-group, [<%= name %>OptionGroup]',
26
26
  changeDetection: ChangeDetectionStrategy.OnPush,
27
- template: `<div class="sticky -top-1 z-10 bg-popover px-2 py-1.5 text-sm text-muted-foreground">
27
+ template: `<div class="bg-popover text-muted-foreground sticky -top-1 z-10 px-2 py-1.5 text-sm">
28
28
  {{ label() }}
29
29
  </div>
30
30
  <ng-content />`,
@@ -23,8 +23,8 @@ export class SelectableItem<T> {
23
23
  hostDirectives: [
24
24
  {
25
25
  directive: NgbSelectable,
26
- inputs: ['activeIndex'],
27
- outputs: ['activeIndexChange', 'valueChanged'],
26
+ inputs: ['value'],
27
+ outputs: ['valueChange', 'valueChanged'],
28
28
  },
29
29
  ],
30
30
  template: `<ng-content />`,
@@ -4,10 +4,8 @@ import { Button } from '<%= basepath %>/button';
4
4
  import { Icon } from '<%= basepath %>/icon';
5
5
  import { provideIcons } from '@ng-icons/core';
6
6
  import { lucideX } from '@ng-icons/lucide';
7
- import { sideAnimation } from '@ngbase/adk/dialog';
8
7
  import { NgbSheet, NgbSheetContainer, ngbSheetPortal } from '@ngbase/adk/sheet';
9
8
  import { aliasSheet } from '@ngbase/adk/sheet';
10
- import { createHostAnimation, fadeAnimation } from '@ngbase/adk/utils';
11
9
 
12
10
  @Component({
13
11
  selector: '<%= name %>-sheet',
@@ -21,13 +19,22 @@ import { createHostAnimation, fadeAnimation } from '@ngbase/adk/utils';
21
19
  [class]="options.position === 'left' ? 'justify-start' : 'justify-end'"
22
20
  >
23
21
  <div
24
- class="pointer-events-auto m-2 flex flex-col overflow-hidden rounded-lg border-l bg-background shadow-2xl will-change-transform"
25
- [@sideAnimation]="position()"
22
+ class="{{
23
+ 'pointer-events-auto m-2 flex flex-col overflow-hidden rounded-lg border-l bg-background shadow-2xl will-change-transform' +
24
+ (closing()
25
+ ? options.position === 'left'
26
+ ? ' sheet-content-left-leave'
27
+ : ' sheet-content-right-leave'
28
+ : options.position === 'left'
29
+ ? ' sheet-content-left'
30
+ : ' sheet-content-right')
31
+ }}"
26
32
  [ngStyle]="{
27
33
  width: options.width,
28
34
  minWidth: options.minWidth,
29
35
  maxWidth: options.maxWidth,
30
36
  }"
37
+ (animationend)="onAnimationEnd($event)"
31
38
  >
32
39
  @if (!isHideHeader) {
33
40
  <div class="flex items-center border-b px-4 py-2">
@@ -38,29 +45,34 @@ import { createHostAnimation, fadeAnimation } from '@ngbase/adk/utils';
38
45
  </div>
39
46
  }
40
47
  <div class="h-full overflow-auto p-4">
41
- <ng-container #myDialog />
48
+ <ng-container #contentContainer />
42
49
  </div>
43
50
  </div>
44
51
  </div>
45
52
  @if (backdropColor) {
46
53
  <div
47
- class="absolute top-0 -z-10 h-full w-full bg-black/30"
48
- [@fadeAnimation]
49
54
  (click)="close()"
55
+ (animationend)="onAnimationEnd($event)"
56
+ class="{{
57
+ 'absolute top-0 -z-10 h-full w-full bg-black/30' +
58
+ (closing() ? ' dialog-backdrop-leave' : ' dialog-backdrop')
59
+ }}"
50
60
  ></div>
51
- <!-- [class]="status() ? 'pointer-events-auto' : 'pointer-events-none'" -->
52
61
  }
53
62
  `,
54
63
  host: {
55
64
  class: 'fixed block top-0 bottom-0 left-0 right-0 z-p',
56
65
  },
57
- animations: [
58
- createHostAnimation(['@fadeAnimation', '@sideAnimation']),
59
- fadeAnimation('300ms'),
60
- sideAnimation,
61
- ],
62
66
  })
63
- export class SheetContainer extends NgbSheetContainer {}
67
+ export class SheetContainer extends NgbSheetContainer {
68
+ protected override readonly hasAnimations = true;
69
+
70
+ onAnimationEnd(event: AnimationEvent) {
71
+ if (event.target === event.currentTarget) {
72
+ this.animationDone();
73
+ }
74
+ }
75
+ }
64
76
 
65
77
  export function sheetPortal() {
66
78
  return ngbSheetPortal(SheetContainer);
@@ -7,7 +7,6 @@ import {
7
7
  NgbSidenavOverlay,
8
8
  SidenavType,
9
9
  aliasSidenav,
10
- slideAnimation,
11
10
  } from '@ngbase/adk/sidenav';
12
11
 
13
12
  export type { SidenavType };
@@ -19,9 +18,13 @@ export type { SidenavType };
19
18
  imports: [NgbSidenavOverlay, NgbSidenavHeaderTrack],
20
19
  template: `
21
20
  @if (showOverlay()) {
22
- <div ngbSidenavOverlay class="z-p bg-black/70"></div>
21
+ <div
22
+ ngbSidenavOverlay
23
+ class="z-p bg-black/70"
24
+ animate.enter="dialog-backdrop"
25
+ ></div>
23
26
  }
24
- <div ngbSidenavHeaderTrack class="transition-[width] duration-500"></div>
27
+ <div ngbSidenavHeaderTrack class="sidenav-track"></div>
25
28
  <ng-content select="<%= name %>-sidenav-header" />
26
29
  <ng-content />
27
30
  `,
@@ -41,8 +44,7 @@ export class Sidenav extends NgbSidenav {}
41
44
  </div>
42
45
  `,
43
46
  host: {
44
- class: 'block h-full bg-background z-p transition-[width] duration-500',
47
+ class: 'block h-full bg-background z-p sidenav-header',
45
48
  },
46
- animations: [slideAnimation('500ms cubic-bezier(0.4, 0, 0.2, 1)')],
47
49
  })
48
50
  export class SidenavHeader extends NgbSidenavHeader {}
@@ -1,5 +1,5 @@
1
1
  import { ChangeDetectionStrategy, Component } from '@angular/core';
2
- import { NgbSonner, ngbSonnerPortal, sonnerAnimation, SonnerBase } from '@ngbase/adk/sonner';
2
+ import { NgbSonner, ngbSonnerPortal, SonnerBase } from '@ngbase/adk/sonner';
3
3
  import { Icon } from '<%= basepath %>/icon';
4
4
  import { provideIcons } from '@ng-icons/core';
5
5
  import {
@@ -41,7 +41,6 @@ import {
41
41
  }
42
42
  </ul>
43
43
  `,
44
- animations: [sonnerAnimation],
45
44
  })
46
45
  export class Sonner extends NgbSonner {
47
46
  readonly icons = {
@@ -7,7 +7,6 @@ import {
7
7
  NgbStepper,
8
8
  NgbStepperStep,
9
9
  provideStep,
10
- stepperAnimation,
11
10
  } from '@ngbase/adk/stepper';
12
11
 
13
12
  @Component({
@@ -46,8 +45,8 @@ import {
46
45
  }
47
46
  </div>
48
47
  @if (step.verticalTemplate(); as template) {
49
- <div class="ml-12" [@slide]>
50
- <div class="pt-4">
48
+ <div class="stepper-content ml-12">
49
+ <div class="min-h-0 pt-4">
51
50
  <ng-container *ngTemplateOutlet="template" />
52
51
  </div>
53
52
  </div>
@@ -57,7 +56,6 @@ import {
57
56
  </div>
58
57
  <ng-content />
59
58
  `,
60
- animations: [stepperAnimation],
61
59
  })
62
60
  export class Stepper extends NgbStepper {}
63
61
 
@@ -11,13 +11,13 @@ import { NgbSwitch, NgbSwitchLabel, NgbSwitchThumb, NgbSwitchTrack } from '@ngba
11
11
  template: `
12
12
  <button
13
13
  ngbSwitchTrack
14
- class="relative w-9 rounded-full border-2 border-transparent bg-muted transition-colors aria-[checked=true]:bg-primary"
14
+ class="bg-muted aria-[checked=true]:bg-primary relative w-9 rounded-full border-2 border-transparent transition-colors"
15
15
  >
16
16
  <span
17
17
  #thumb="ngbSwitchThumb"
18
18
  ngbSwitchThumb
19
19
  [class]="thumb.checked() ? (thumb.rtl() ? '-translate-x-full' : 'translate-x-full') : ''"
20
- class="block h-4 w-4 rounded-full bg-background shadow-sm transition-transform"
20
+ class="bg-background block h-4 w-4 rounded-full shadow-sm transition-transform"
21
21
  ></span>
22
22
  </button>
23
23
  <label ngbSwitchLabel><ng-content /></label>