@ngbase/adk 0.1.3 → 0.1.4

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 (127) hide show
  1. package/package.json +9 -9
  2. package/schematics/collection.json +15 -0
  3. package/schematics/components/files/accordion/accordion.ts.template +53 -0
  4. package/schematics/components/files/accordion/index.ts.template +5 -0
  5. package/schematics/components/files/alert/alert.ts.template +62 -0
  6. package/schematics/components/files/alert/index.ts.template +1 -0
  7. package/schematics/components/files/autocomplete/autocomplete.ts.template +44 -0
  8. package/schematics/components/files/autocomplete/index.ts.template +5 -0
  9. package/schematics/components/files/avatar/avatar.ts.template +31 -0
  10. package/schematics/components/files/avatar/index.ts.template +1 -0
  11. package/schematics/components/files/badge/badge.ts.template +11 -0
  12. package/schematics/components/files/badge/index.ts.template +1 -0
  13. package/schematics/components/files/breadcrumb/breadcrumb.ts.template +53 -0
  14. package/schematics/components/files/breadcrumb/index.ts.template +1 -0
  15. package/schematics/components/files/button/button.ts.template +29 -0
  16. package/schematics/components/files/button/index.ts.template +5 -0
  17. package/schematics/components/files/card/card.ts.template +11 -0
  18. package/schematics/components/files/card/index.ts.template +5 -0
  19. package/schematics/components/files/carousel/carousel.ts.template +44 -0
  20. package/schematics/components/files/carousel/index.ts.template +1 -0
  21. package/schematics/components/files/checkbox/checkbox.ts.template +36 -0
  22. package/schematics/components/files/checkbox/focus-style.directive.ts.template +12 -0
  23. package/schematics/components/files/checkbox/index.ts.template +6 -0
  24. package/schematics/components/files/chip/chip.ts.template +38 -0
  25. package/schematics/components/files/chip/index.ts.template +1 -0
  26. package/schematics/components/files/color-picker/color-picker.ts.template +104 -0
  27. package/schematics/components/files/color-picker/index.ts.template +5 -0
  28. package/schematics/components/files/command/command.ts.template +82 -0
  29. package/schematics/components/files/command/index.ts.template +1 -0
  30. package/schematics/components/files/datepicker/calendar.ts.template +117 -0
  31. package/schematics/components/files/datepicker/datepicker.ts.template +59 -0
  32. package/schematics/components/files/datepicker/index.ts.template +2 -0
  33. package/schematics/components/files/datepicker/time.ts.template +54 -0
  34. package/schematics/components/files/dialog/dialog.ts.template +89 -0
  35. package/schematics/components/files/dialog/index.ts.template +5 -0
  36. package/schematics/components/files/drawer/drawer.ts.template +104 -0
  37. package/schematics/components/files/drawer/index.ts.template +5 -0
  38. package/schematics/components/files/form-field/form-field.ts.template +111 -0
  39. package/schematics/components/files/form-field/index.ts.template +6 -0
  40. package/schematics/components/files/form-field/input-style.directive.ts.template +11 -0
  41. package/schematics/components/files/hover-card/hover-card.ts.template +13 -0
  42. package/schematics/components/files/hover-card/index.ts.template +5 -0
  43. package/schematics/components/files/icon/icon.ts.template +16 -0
  44. package/schematics/components/files/icon/index.ts.template +1 -0
  45. package/schematics/components/files/inline-edit/index.ts.template +1 -0
  46. package/schematics/components/files/inline-edit/inline-edit.ts.template +24 -0
  47. package/schematics/components/files/keys/index.ts.template +5 -0
  48. package/schematics/components/files/keys/key.ts.template +35 -0
  49. package/schematics/components/files/list/index.ts.template +5 -0
  50. package/schematics/components/files/list/list.ts.template +28 -0
  51. package/schematics/components/files/mask/index.ts.template +1 -0
  52. package/schematics/components/files/mask/mask.ts.template +8 -0
  53. package/schematics/components/files/menu/context-menu.ts.template +14 -0
  54. package/schematics/components/files/menu/index.ts.template +8 -0
  55. package/schematics/components/files/menu/mention.ts.template +14 -0
  56. package/schematics/components/files/menu/menu.ts.template +37 -0
  57. package/schematics/components/files/menu/navigation-menu.ts.template +8 -0
  58. package/schematics/components/files/otp/index.ts.template +5 -0
  59. package/schematics/components/files/otp/otp.ts.template +37 -0
  60. package/schematics/components/files/pagination/index.ts.template +1 -0
  61. package/schematics/components/files/pagination/pagination.ts.template +75 -0
  62. package/schematics/components/files/picasa/index.ts.template +1 -0
  63. package/schematics/components/files/picasa/picasa-base.component.ts.template +80 -0
  64. package/schematics/components/files/picasa/picasa.component.ts.template +57 -0
  65. package/schematics/components/files/picasa/picasa.directive.ts.template +41 -0
  66. package/schematics/components/files/picasa/picase.service.ts.template +24 -0
  67. package/schematics/components/files/popover/index.ts.template +1 -0
  68. package/schematics/components/files/popover/popover.ts.template +64 -0
  69. package/schematics/components/files/progress/index.ts.template +5 -0
  70. package/schematics/components/files/progress/progress.ts.template +14 -0
  71. package/schematics/components/files/radio/index.ts.template +5 -0
  72. package/schematics/components/files/radio/radio.ts.template +37 -0
  73. package/schematics/components/files/resizable/index.ts.template +5 -0
  74. package/schematics/components/files/resizable/resizable.ts.template +59 -0
  75. package/schematics/components/files/scroll-area/index.ts.template +1 -0
  76. package/schematics/components/files/scroll-area/scroll-area.ts.template +40 -0
  77. package/schematics/components/files/select/index.ts.template +8 -0
  78. package/schematics/components/files/select/list-selection.ts.template +15 -0
  79. package/schematics/components/files/select/option.ts.template +35 -0
  80. package/schematics/components/files/select/select-input.ts.template +21 -0
  81. package/schematics/components/files/select/select.ts.template +96 -0
  82. package/schematics/components/files/selectable/index.ts.template +1 -0
  83. package/schematics/components/files/selectable/selectable.ts.template +34 -0
  84. package/schematics/components/files/separator/index.ts.template +5 -0
  85. package/schematics/components/files/separator/separator.ts.template +19 -0
  86. package/schematics/components/files/sheet/index.ts.template +5 -0
  87. package/schematics/components/files/sheet/sheet.ts.template +69 -0
  88. package/schematics/components/files/sidenav/index.ts.template +1 -0
  89. package/schematics/components/files/sidenav/sidenav.ts.template +48 -0
  90. package/schematics/components/files/skeleton/index.ts.template +1 -0
  91. package/schematics/components/files/skeleton/skeleton.ts.template +15 -0
  92. package/schematics/components/files/slider/index.ts.template +5 -0
  93. package/schematics/components/files/slider/slider.ts.template +35 -0
  94. package/schematics/components/files/sonner/index.ts.template +5 -0
  95. package/schematics/components/files/sonner/sonner.ts.template +59 -0
  96. package/schematics/components/files/spinner/index.ts.template +1 -0
  97. package/schematics/components/files/spinner/spinner.ts.template +79 -0
  98. package/schematics/components/files/stepper/index.ts.template +1 -0
  99. package/schematics/components/files/stepper/stepper.ts.template +88 -0
  100. package/schematics/components/files/switch/index.ts.template +5 -0
  101. package/schematics/components/files/switch/switch.ts.template +29 -0
  102. package/schematics/components/files/table/index.ts.template +27 -0
  103. package/schematics/components/files/table/table.ts.template +122 -0
  104. package/schematics/components/files/tabs/index.ts.template +5 -0
  105. package/schematics/components/files/tabs/tab.ts.template +92 -0
  106. package/schematics/components/files/theme/index.ts.template +2 -0
  107. package/schematics/components/files/theme/theme-button.component.ts.template +26 -0
  108. package/schematics/components/files/theme/theme.service.ts.template +33 -0
  109. package/schematics/components/files/toggle/index.ts.template +5 -0
  110. package/schematics/components/files/toggle/toggle.ts.template +13 -0
  111. package/schematics/components/files/toggle-group/index.ts.template +5 -0
  112. package/schematics/components/files/toggle-group/toggle-group.ts.template +25 -0
  113. package/schematics/components/files/tooltip/index.ts.template +5 -0
  114. package/schematics/components/files/tooltip/tooltip.ts.template +45 -0
  115. package/schematics/components/files/tour/index.ts.template +1 -0
  116. package/schematics/components/files/tour/tour.ts.template +19 -0
  117. package/schematics/components/files/tree/index.ts.template +1 -0
  118. package/schematics/components/files/tree/tree.ts.template +66 -0
  119. package/schematics/components/index.d.ts +3 -0
  120. package/schematics/components/index.js +41 -0
  121. package/schematics/components/index.js.map +1 -0
  122. package/schematics/components/index.ts +59 -0
  123. package/schematics/components/schema.d.ts +6 -0
  124. package/schematics/components/schema.js +3 -0
  125. package/schematics/components/schema.js.map +1 -0
  126. package/schematics/components/schema.json +145 -0
  127. package/schematics/components/schema.ts +6 -0
@@ -0,0 +1,37 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { aliasRadio, NgbRadio, NgbRadioGroup, NgbRadioIndicator } from '@ngbase/adk/radio';
3
+ import { ɵFocusStyle as FocusStyle } from '<%= basepath %>/checkbox';
4
+
5
+ @Component({
6
+ selector: '<%= name %>-radio-group',
7
+ hostDirectives: [{ directive: NgbRadioGroup, inputs: ['value'], outputs: ['valueChange'] }],
8
+ template: `<ng-content />`,
9
+ host: {
10
+ class: 'flex gap-2',
11
+ },
12
+ })
13
+ export class RadioGroup {}
14
+
15
+ @Component({
16
+ selector: '<%= name %>-radio, [<%= name %>Radio]',
17
+ changeDetection: ChangeDetectionStrategy.OnPush,
18
+ providers: [aliasRadio(Radio)],
19
+ imports: [FocusStyle, NgbRadioIndicator],
20
+ template: `
21
+ <button
22
+ <%= name %>FocusStyle
23
+ ngbRadioIndicator
24
+ class="custom-radio relative flex h-4 w-4 flex-none items-center justify-center rounded-full border border-primary group-aria-[disabled='true']:border-muted-foreground"
25
+ >
26
+ <div
27
+ class="h-2 w-2 rounded-full bg-primary group-aria-[disabled='true']:bg-muted-foreground"
28
+ ></div>
29
+ </button>
30
+ <ng-content />
31
+ `,
32
+ host: {
33
+ class:
34
+ 'flex items-center gap-2 py-1 cursor-pointer aria-[disabled="true"]:opacity-40 aria-[disabled="true"]:cursor-not-allowed group',
35
+ },
36
+ })
37
+ export class Radio extends NgbRadio {}
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of resizable
3
+ */
4
+
5
+ export * from './resizable';
@@ -0,0 +1,59 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { Icon } from '<%= basepath %>/icon';
3
+ import { provideIcons } from '@ng-icons/core';
4
+ import { lucideGripVertical } from '@ng-icons/lucide';
5
+ import {
6
+ NgbGutter,
7
+ NgbResizable,
8
+ NgbResizableGroup,
9
+ aliasResizable,
10
+ aliasResizableGroup,
11
+ } from '@ngbase/adk/resizable';
12
+
13
+ @Component({
14
+ selector: '<%= name %>-resizable-group',
15
+ exportAs: '<%= name %>ResizableGroup',
16
+ changeDetection: ChangeDetectionStrategy.OnPush,
17
+ providers: [aliasResizableGroup(ResizableGroup)],
18
+ template: `<ng-content select="<%= name %>-resizable" />`,
19
+ host: {
20
+ class: 'flex w-full',
21
+ '[class.flex-col]': "direction() === 'vertical'",
22
+ '[attr.id]': 'id',
23
+ },
24
+ })
25
+ export class ResizableGroup extends NgbResizableGroup {}
26
+
27
+ @Component({
28
+ selector: '<%= name %>-resizable',
29
+ exportAs: '<%= name %>Resizable',
30
+ changeDetection: ChangeDetectionStrategy.OnPush,
31
+ providers: [aliasResizable(Resizable)],
32
+ viewProviders: [provideIcons({ lucideGripVertical })],
33
+ imports: [Icon, NgbGutter],
34
+ template: `<ng-content />
35
+ <ng-template #dragElement>
36
+ @if (draggable()) {
37
+ <div
38
+ ngbGutter
39
+ class="{{
40
+ 'dragElement relative flex cursor-ew-resize items-center justify-center after:absolute after:top-0' +
41
+ (resizable.direction() === 'vertical'
42
+ ? ' bottom-0 left-0 h-0 w-full cursor-ns-resize border-b after:-mt-1 after:h-2 after:w-full'
43
+ : ' right-0 top-0 w-0 cursor-ew-resize border-l after:h-full after:w-2')
44
+ }}"
45
+ >
46
+ <<%= name %>-icon
47
+ name="lucideGripVertical"
48
+ class="z-30 rounded-lg border bg-muted py-0.5"
49
+ size=".75rem"
50
+ [class]="resizable.direction() === 'vertical' ? 'rotate-90' : ''"
51
+ />
52
+ </div>
53
+ }
54
+ </ng-template>`,
55
+ host: {
56
+ class: 'relative overflow-hidden block flex-none',
57
+ },
58
+ })
59
+ export class Resizable extends NgbResizable {}
@@ -0,0 +1 @@
1
+ export * from './scroll-area';
@@ -0,0 +1,40 @@
1
+ import { Component, ChangeDetectionStrategy, input } from '@angular/core';
2
+ import { NgbScrollArea, NgbScrollBar, ScrollBarOrientation } from '@ngbase/adk/scroll-area';
3
+
4
+ @Component({
5
+ selector: '<%= name %>-scroll-area',
6
+ changeDetection: ChangeDetectionStrategy.OnPush,
7
+ imports: [NgbScrollBar, NgbScrollArea],
8
+ template: `
9
+ <div
10
+ ngbScrollArea
11
+ [alwaysShow]="alwaysShow()"
12
+ [orientation]="orientation()"
13
+ [hideDelay]="hideDelay()"
14
+ class="flex-1"
15
+ >
16
+ <ng-content></ng-content>
17
+
18
+ <div
19
+ ngbScrollBar="vertical"
20
+ class="!right-0.5 rounded bg-black/10 opacity-0 transition-colors duration-150 hover:bg-black/50 data-[active=true]:bg-black/50 data-[visible=true]:opacity-100"
21
+ ></div>
22
+
23
+ <div
24
+ ngbScrollBar="horizontal"
25
+ class="!bottom-0.5 rounded bg-black/10 opacity-0 transition-colors duration-150 hover:bg-black/50 data-[active=true]:bg-black/50 data-[visible=true]:opacity-100"
26
+ ></div>
27
+
28
+ <!-- Corner piece when both scrollbars are visible -->
29
+ <div class="scroll-area-corner absolute bottom-0 right-0 h-2 w-2 rounded bg-black/10"></div>
30
+ </div>
31
+ `,
32
+ host: {
33
+ class: 'flex flex-col w-full',
34
+ },
35
+ })
36
+ export class ScrollArea {
37
+ readonly alwaysShow = input<boolean>(false);
38
+ readonly orientation = input<ScrollBarOrientation>('both');
39
+ readonly hideDelay = input(1000);
40
+ }
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Public API Surface of select
3
+ */
4
+
5
+ export * from './select';
6
+ export * from './option';
7
+ export * from './select-input';
8
+ export * from './list-selection';
@@ -0,0 +1,15 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { provideValueAccessor } from '@ngbase/adk/utils';
3
+ import { SelectBase } from '@ngbase/adk/select';
4
+
5
+ @Component({
6
+ selector: '<%= name %>-list-selection',
7
+ changeDetection: ChangeDetectionStrategy.OnPush,
8
+ template: `<ng-content />`,
9
+ providers: [provideValueAccessor(ListSelection)],
10
+ })
11
+ export class ListSelection<T> extends SelectBase<T> {
12
+ constructor() {
13
+ super(true);
14
+ }
15
+ }
@@ -0,0 +1,35 @@
1
+ import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
2
+ import { NgbOption, NgbOptionGroup } from '@ngbase/adk/select';
3
+ import { Checkbox } from '<%= basepath %>/checkbox';
4
+ import { ListStyle } from '<%= basepath %>/list';
5
+
6
+ @Component({
7
+ selector: '<%= name %>-option, [<%= name %>Option]',
8
+ changeDetection: ChangeDetectionStrategy.OnPush,
9
+ hostDirectives: [ListStyle, { directive: NgbOption, inputs: ['value', 'disabled', 'ayId'] }],
10
+ imports: [Checkbox],
11
+ template: ` @if (option.multiple()) {
12
+ <<%= name %>-checkbox [checked]="option.checked()" class="!py-0" />
13
+ }
14
+ <ng-content />`,
15
+ host: {
16
+ class: 'outline-none',
17
+ '[class.bg-muted]': 'option.active() || option.checked()',
18
+ },
19
+ })
20
+ export class Option<T> {
21
+ readonly option = inject(NgbOption<T>);
22
+ }
23
+
24
+ @Component({
25
+ selector: '<%= name %>-option-group, [<%= name %>OptionGroup]',
26
+ changeDetection: ChangeDetectionStrategy.OnPush,
27
+ template: `<div class="text-muted-foreground bg-popover sticky -top-1 z-10 px-2 py-1.5 text-sm">
28
+ {{ label() }}
29
+ </div>
30
+ <ng-content />`,
31
+ host: {
32
+ class: 'block',
33
+ },
34
+ })
35
+ export class OptionGroup extends NgbOptionGroup {}
@@ -0,0 +1,21 @@
1
+ import { Directive } from '@angular/core';
2
+ import { NgbSelectInput, NgbSelectTrigger } from '@ngbase/adk/select';
3
+ import { InputStyle } from '<%= basepath %>/form-field';
4
+
5
+ @Directive({
6
+ selector: '[<%= name %>SelectInput]',
7
+ hostDirectives: [
8
+ { directive: NgbSelectInput, inputs: ['placeholder', 'options', 'filterFn'] },
9
+ InputStyle,
10
+ ],
11
+ host: {
12
+ class: 'w-full !m-0 mb-1 !ring-0 !border-0 !border-b rounded-none px-3 z-10',
13
+ },
14
+ })
15
+ export class SelectInput<T> {}
16
+
17
+ @Directive({
18
+ selector: '[<%= name %>SelectTrigger]',
19
+ hostDirectives: [NgbSelectTrigger],
20
+ })
21
+ export class SelectTrigger {}
@@ -0,0 +1,96 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
3
+ import { FormsModule } from '@angular/forms';
4
+ import { Icon } from '<%= basepath %>/icon';
5
+ import { provideIcons } from '@ng-icons/core';
6
+ import { lucideChevronsUpDown } from '@ng-icons/lucide';
7
+ import {
8
+ aliasSelect,
9
+ NgbSelect,
10
+ NgbSelectOption,
11
+ NgbSelectOptionGroup,
12
+ SelectValue,
13
+ } from '@ngbase/adk/select';
14
+ import { Option } from './option';
15
+ import { SelectInput } from './select-input';
16
+
17
+ @Directive({
18
+ selector: '[<%= name %>SelectOption]',
19
+ hostDirectives: [NgbSelectOption],
20
+ })
21
+ export class SelectOption<T> {}
22
+
23
+ @Component({
24
+ selector: '<%= name %>-select',
25
+ changeDetection: ChangeDetectionStrategy.OnPush,
26
+ viewProviders: [provideIcons({ lucideChevronsUpDown })],
27
+ providers: [aliasSelect(Select)],
28
+ imports: [
29
+ Icon,
30
+ FormsModule,
31
+ SelectInput,
32
+ Option,
33
+ NgTemplateOutlet,
34
+ SelectValue,
35
+ NgbSelectOptionGroup,
36
+ ],
37
+ template: `
38
+ <button
39
+ ngbSelectValue
40
+ [class.opacity-50]="disabled()"
41
+ class="flex min-h-5 w-full items-center gap-1 whitespace-nowrap text-left outline-none"
42
+ >
43
+ <!-- Prefix template -->
44
+ <ng-content select=".select-prefix" />
45
+
46
+ <span class="flex-1 truncate" [class.text-muted-foreground]="!cValue()">
47
+ <ng-content select="[<%= name %>SelectTrigger]">
48
+ {{ cValue() || placeholder() }}
49
+ </ng-content>
50
+ </span>
51
+ <<%= name %>-icon name="lucideChevronsUpDown" class="ml-0.5 text-muted-foreground" />
52
+ </button>
53
+
54
+ <!-- Options template -->
55
+ <ng-template #optionsTemplate>
56
+ <div class="flex flex-col overflow-hidden">
57
+ <ng-content select="[<%= name %>SelectInput]">
58
+ @if (options().length) {
59
+ <input
60
+ <%= name %>SelectInput
61
+ placeholder="Search options"
62
+ [(ngModel)]="optionsFilter.search"
63
+ [ngModelOptions]="{ standalone: true }"
64
+ />
65
+ }
66
+ </ng-content>
67
+ <div #optionsGroup ngbSelectOptionGroup class="overflow-auto p-1">
68
+ <div class="h-full" role="listbox" aria-label="Suggestions">
69
+ <ng-content>
70
+ @for (option of optionsFilter.filteredList(); track option; let i = $index) {
71
+ <<%= name %>-option [value]="option" [ayId]="ayId">
72
+ @if (optionTemplate(); as ot) {
73
+ <ng-template
74
+ [ngTemplateOutlet]="ot.template"
75
+ [ngTemplateOutletContext]="{ $implicit: option, index: i }"
76
+ />
77
+ } @else {
78
+ {{ option }}
79
+ }
80
+ </<%= name %>-option>
81
+ }
82
+ </ng-content>
83
+ </div>
84
+ </div>
85
+ <ng-content select=".select-footer" />
86
+ </div>
87
+ </ng-template>
88
+ `,
89
+ host: {
90
+ class: 'flex cursor-pointer font-medium outline-none w-full',
91
+ '[class.pointer-events-none]': 'disabled()',
92
+ },
93
+ })
94
+ export class Select<T> extends NgbSelect<T> {
95
+ override sideOffset = 16;
96
+ }
@@ -0,0 +1 @@
1
+ export * from './selectable';
@@ -0,0 +1,34 @@
1
+ import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
2
+ import { NgbSelectable, NgbSelectableItem } from '@ngbase/adk/selectable';
3
+
4
+ @Component({
5
+ selector: '<%= name %>-selectable-item, [<%= name %>SelectableItem]',
6
+ changeDetection: ChangeDetectionStrategy.OnPush,
7
+ hostDirectives: [{ directive: NgbSelectableItem, inputs: ['value'] }],
8
+ template: `<ng-content />`,
9
+ host: {
10
+ class:
11
+ 'flex-1 flex items-center font-medium justify-center px-3 py-1.5 cursor-pointer transition-colors rounded-md whitespace-nowrap focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary',
12
+ '[class]': `selectable.selected() ? 'bg-background text-primary shadow-md ring-1 ring-border' : 'opacity-60'`,
13
+ },
14
+ })
15
+ export class SelectableItem<T> {
16
+ readonly selectable = inject(NgbSelectableItem);
17
+ }
18
+
19
+ @Component({
20
+ selector: '<%= name %>-selectable',
21
+ changeDetection: ChangeDetectionStrategy.OnPush,
22
+ hostDirectives: [
23
+ {
24
+ directive: NgbSelectable,
25
+ inputs: ['activeIndex'],
26
+ outputs: ['activeIndexChange', 'valueChanged'],
27
+ },
28
+ ],
29
+ template: `<ng-content />`,
30
+ host: {
31
+ class: 'inline-flex relative bg-muted text-muted-foreground rounded-md p-0.5',
32
+ },
33
+ })
34
+ export class Selectable<T> {}
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of separator
3
+ */
4
+
5
+ export * from './separator';
@@ -0,0 +1,19 @@
1
+ import { booleanAttribute, ChangeDetectionStrategy, Component, input } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: '<%= name %>-separator',
5
+ changeDetection: ChangeDetectionStrategy.OnPush,
6
+ template: ``,
7
+ host: {
8
+ class: 'bg-border block flex-none',
9
+ '[class]': `vertical() ? 'w-[1px]' : 'h-[1px] w-full'`,
10
+ // '[class.my-1]': `menu`,
11
+ },
12
+ })
13
+ export class Separator {
14
+ vertical = input(false, { transform: booleanAttribute });
15
+
16
+ constructor() {
17
+ // console.log('Separator', this.menu);
18
+ }
19
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of sheet
3
+ */
4
+
5
+ export * from './sheet';
@@ -0,0 +1,69 @@
1
+ import { NgStyle } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { Button } from '<%= basepath %>/button';
4
+ import { Icon } from '<%= basepath %>/icon';
5
+ import { provideIcons } from '@ng-icons/core';
6
+ import { lucideX } from '@ng-icons/lucide';
7
+ import { sideAnimation } from '@ngbase/adk/dialog';
8
+ import { NgbSheet, NgbSheetContainer, ngbSheetPortal } from '@ngbase/adk/sheet';
9
+ import { aliasSheet } from '@ngbase/adk/sheet';
10
+ import { createHostAnimation, fadeAnimation } from '@ngbase/adk/utils';
11
+
12
+ @Component({
13
+ selector: '<%= name %>-sheet',
14
+ changeDetection: ChangeDetectionStrategy.OnPush,
15
+ providers: [aliasSheet(SheetContainer)],
16
+ viewProviders: [provideIcons({ lucideX })],
17
+ imports: [NgStyle, Button, Icon],
18
+ template: `
19
+ <div
20
+ class="pointer-events-none flex h-full"
21
+ [class]="options.position === 'left' ? 'justify-start' : 'justify-end'"
22
+ >
23
+ <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()"
26
+ [ngStyle]="{
27
+ width: options.width,
28
+ minWidth: options.minWidth,
29
+ maxWidth: options.maxWidth,
30
+ }"
31
+ >
32
+ @if (!isHideHeader) {
33
+ <div class="flex items-center border-b px-4 py-2">
34
+ <h2 class="flex-1 font-bold">{{ options.title }}</h2>
35
+ <button <%= name %>Button="ghost" class="-mr-2 !p-2" (click)="close()">
36
+ <<%= name %>-icon name="lucideX" />
37
+ </button>
38
+ </div>
39
+ }
40
+ <div class="h-full overflow-auto p-4">
41
+ <ng-container #myDialog />
42
+ </div>
43
+ </div>
44
+ </div>
45
+ @if (backdropColor) {
46
+ <div
47
+ class="absolute top-0 -z-10 h-full w-full bg-black bg-opacity-30 will-change-transform"
48
+ [@fadeAnimation]
49
+ (click)="close()"
50
+ ></div>
51
+ <!-- [class]="status() ? 'pointer-events-auto' : 'pointer-events-none'" -->
52
+ }
53
+ `,
54
+ host: {
55
+ class: 'fixed block top-0 bottom-0 left-0 right-0 z-p',
56
+ },
57
+ animations: [
58
+ createHostAnimation(['@fadeAnimation', '@sideAnimation']),
59
+ fadeAnimation('300ms'),
60
+ sideAnimation,
61
+ ],
62
+ })
63
+ export class SheetContainer extends NgbSheetContainer {}
64
+
65
+ export function sheetPortal() {
66
+ return ngbSheetPortal(SheetContainer);
67
+ }
68
+
69
+ export type Sheet = NgbSheet;
@@ -0,0 +1 @@
1
+ export * from './sidenav';
@@ -0,0 +1,48 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import {
3
+ NgbSidenav,
4
+ NgbSidenavHeader,
5
+ NgbSidenavHeaderContent,
6
+ NgbSidenavHeaderTrack,
7
+ NgbSidenavOverlay,
8
+ SidenavType,
9
+ aliasSidenav,
10
+ slideAnimation,
11
+ } from '@ngbase/adk/sidenav';
12
+
13
+ export type { SidenavType };
14
+
15
+ @Component({
16
+ selector: '<%= name %>-sidenav',
17
+ changeDetection: ChangeDetectionStrategy.OnPush,
18
+ providers: [aliasSidenav(Sidenav)],
19
+ imports: [NgbSidenavOverlay, NgbSidenavHeaderTrack],
20
+ template: `
21
+ @if (showOverlay()) {
22
+ <div ngbSidenavOverlay class="z-p bg-black/70"></div>
23
+ }
24
+ <div ngbSidenavHeaderTrack class="transition-[width] duration-500"></div>
25
+ <ng-content select="<%= name %>-sidenav-header" />
26
+ <ng-content />
27
+ `,
28
+ host: {
29
+ class: 'flex w-full overflow-hidden relative top-0 left-0 h-full',
30
+ },
31
+ })
32
+ export class Sidenav extends NgbSidenav {}
33
+
34
+ @Component({
35
+ selector: '<%= name %>-sidenav-header',
36
+ changeDetection: ChangeDetectionStrategy.OnPush,
37
+ imports: [NgbSidenavHeaderContent],
38
+ template: `
39
+ <div ngbSidenavHeaderContent class="h-full overflow-auto">
40
+ <ng-content />
41
+ </div>
42
+ `,
43
+ host: {
44
+ class: 'block h-full bg-background z-p transition-[width] duration-500',
45
+ },
46
+ animations: [slideAnimation('500ms cubic-bezier(0.4, 0, 0.2, 1)')],
47
+ })
48
+ export class SidenavHeader extends NgbSidenavHeader {}
@@ -0,0 +1 @@
1
+ export * from './skeleton';
@@ -0,0 +1,15 @@
1
+ import { Component, input } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: '<%= name %>-skeleton',
5
+ template: ``,
6
+ host: {
7
+ class: 'block animate-pulse bg-muted',
8
+ '[class]': `shape() === 'circle' ? 'rounded-full' : 'rounded-md'`,
9
+ },
10
+ })
11
+ export class Skeleton {
12
+ readonly shape = input<'circle' | 'rectangle'>('rectangle');
13
+ readonly width = input<string>('100%');
14
+ readonly height = input<string>('20px');
15
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of slider
3
+ */
4
+
5
+ export * from './slider';
@@ -0,0 +1,35 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { NgbSlider, SliderRange, SliderThumb, SliderTrack, aliasSlider } from '@ngbase/adk/slider';
3
+ import { ɵFocusStyle as FocusStyle } from '<%= basepath %>/checkbox';
4
+
5
+ @Component({
6
+ selector: '<%= name %>-slider',
7
+ exportAs: '<%= name %>Slider',
8
+ changeDetection: ChangeDetectionStrategy.OnPush,
9
+ providers: [aliasSlider(Slider)],
10
+ imports: [FocusStyle, SliderTrack, SliderRange, SliderThumb],
11
+ template: `
12
+ <div
13
+ ngbSliderTrack
14
+ class="h-full overflow-hidden rounded-full bg-muted aria-[disabled=true]:bg-opacity-30"
15
+ >
16
+ <div ngbSliderRange class="bg-primary aria-[disabled=true]:bg-muted"></div>
17
+ </div>
18
+ @for (thumb of noOfThumbs(); track thumb) {
19
+ <button
20
+ ngbSliderThumb
21
+ <%= name %>FocusStyle
22
+ class="{{
23
+ 'inline-block h-5 w-5 rounded-full border-2 bg-background shadow-md aria-[disabled=false]:border-primary aria-[disabled=true]:bg-muted ' +
24
+ (orientation() === 'vertical'
25
+ ? '-left-1.5 -translate-y-1/2'
26
+ : '-top-1.5 -translate-x-1/2')
27
+ }}"
28
+ ></button>
29
+ }
30
+ `,
31
+ host: {
32
+ class: 'block relative my-2 aria-[orientation=vertical]:w-2 aria-[orientation=horizontal]:h-2',
33
+ },
34
+ })
35
+ export class Slider extends NgbSlider {}
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of sonner
3
+ */
4
+
5
+ export { sonnerPortal } from './sonner';
@@ -0,0 +1,59 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { NgbSonner, ngbSonnerPortal, sonnerAnimation, SonnerBase } from '@ngbase/adk/sonner';
3
+ import { Icon } from '<%= basepath %>/icon';
4
+ import { provideIcons } from '@ng-icons/core';
5
+ import {
6
+ lucideCircleAlert,
7
+ lucideCircleCheck,
8
+ lucideInfo,
9
+ lucideTriangleAlert,
10
+ } from '@ng-icons/lucide';
11
+
12
+ @Component({
13
+ selector: '<%= name %>-sonner',
14
+ changeDetection: ChangeDetectionStrategy.OnPush,
15
+ providers: [
16
+ provideIcons({ lucideCircleCheck, lucideInfo, lucideTriangleAlert, lucideCircleAlert }),
17
+ ],
18
+ imports: [Icon, SonnerBase],
19
+ template: `
20
+ <ul class="fixed bottom-0 right-0 z-p flex flex-col gap-1">
21
+ @for (msg of messages(); track msg.id) {
22
+ <li
23
+ [ngbSonnerBase]="$index"
24
+ class="{{
25
+ 'm-4 w-96 rounded-lg border bg-background p-4 shadow-lg transition-all duration-300' +
26
+ (msg.type === 'success' ? ' bg-green-50 text-green-600' : '') +
27
+ (msg.type === 'error' ? ' bg-red-50 text-red-600' : '') +
28
+ (msg.type === 'warning' ? ' bg-yellow-50 text-yellow-600' : '')
29
+ }}"
30
+ >
31
+ <h4 class="flex items-center gap-2 font-semibold">
32
+ @if (msg.type && icons[msg.type]; as iconName) {
33
+ <<%= name %>-icon [name]="iconName" />
34
+ }
35
+ {{ msg.message }}
36
+ </h4>
37
+ @if (msg.data?.description) {
38
+ <p class="text-muted-foreground">{{ msg.data?.description }}</p>
39
+ }
40
+ </li>
41
+ }
42
+ </ul>
43
+ `,
44
+ animations: [sonnerAnimation],
45
+ })
46
+ export class Sonner extends NgbSonner {
47
+ readonly icons = {
48
+ success: 'lucideCircleCheck',
49
+ error: 'lucideCircleAlert',
50
+ info: 'lucideInfo',
51
+ warning: 'lucideTriangleAlert',
52
+ default: '',
53
+ };
54
+ }
55
+
56
+ export function sonnerPortal() {
57
+ const portal = ngbSonnerPortal(Sonner);
58
+ return portal;
59
+ }
@@ -0,0 +1 @@
1
+ export * from './spinner';