@ngbase/adk 0.1.3 → 0.1.5

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 +13 -13
  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 +23 -0
  121. package/schematics/components/index.js.map +1 -0
  122. package/schematics/components/index.ts +39 -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 +142 -0
  127. package/schematics/components/schema.ts +6 -0
@@ -0,0 +1,41 @@
1
+ import { Directive, ElementRef, contentChildren, inject, input } from '@angular/core';
2
+ import { PicasaContainer } from './picasa.component';
3
+ import { picasaPortal } from './picase.service';
4
+
5
+ @Directive({
6
+ selector: '[<%= name %>Picasa]',
7
+ })
8
+ export class Picasa {
9
+ dialog = picasaPortal();
10
+ items = contentChildren(PicasaItem);
11
+
12
+ open(src: string, id: string, target: HTMLElement) {
13
+ this.dialog.open(PicasaContainer, {
14
+ data: { src, id, target },
15
+ classNames: ['bg-transparent', 'border-0', 'shadow-none'],
16
+ height: '100vh',
17
+ });
18
+ }
19
+ }
20
+
21
+ @Directive({
22
+ selector: 'img[<%= name %>PicasaItem]',
23
+ host: {
24
+ '(click)': 'open()',
25
+ '[style.viewTransitionName]': 'id',
26
+ },
27
+ })
28
+ export class PicasaItem {
29
+ picasa = inject(Picasa);
30
+ src = input.required<string>();
31
+ el = inject<ElementRef<HTMLElement>>(ElementRef);
32
+ id = 'generateId()';
33
+
34
+ constructor() {
35
+ (this.el.nativeElement.style as any).viewTransitionName = this.id;
36
+ }
37
+
38
+ open() {
39
+ this.picasa.open(this.src(), this.id, this.el.nativeElement);
40
+ }
41
+ }
@@ -0,0 +1,24 @@
1
+ import { basePortal, DialogInput, DialogOptions } from '@ngbase/adk/portal';
2
+ import { PicasaBase } from './picasa-base.component';
3
+
4
+ export function picasaPortal() {
5
+ const NAME = 'picasa';
6
+ const base = basePortal(NAME, PicasaBase);
7
+
8
+ function open<T>(component: DialogInput, opt?: DialogOptions) {
9
+ const { diaRef } = base.open(
10
+ component,
11
+ (comp, options) => {
12
+ comp.instance.setOptions(options);
13
+ },
14
+ opt,
15
+ );
16
+
17
+ return diaRef;
18
+ }
19
+
20
+ function closeAll() {
21
+ base.closeAll();
22
+ }
23
+ return { open, closeAll };
24
+ }
@@ -0,0 +1 @@
1
+ export * from './popover';
@@ -0,0 +1,64 @@
1
+ import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
2
+ import {
3
+ aliasPopover,
4
+ NgbPopover,
5
+ NgbPopoverArrow,
6
+ NgbPopoverBackdrop,
7
+ NgbPopoverClose,
8
+ NgbPopoverMain,
9
+ ngbPopoverPortal,
10
+ NgbPopoverTrigger,
11
+ registerNgbPopover,
12
+ } from '@ngbase/adk/popover';
13
+
14
+ @Component({
15
+ selector: '<%= name %>-popover',
16
+ changeDetection: ChangeDetectionStrategy.OnPush,
17
+ providers: [aliasPopover(Popover)],
18
+ imports: [NgbPopoverBackdrop, NgbPopoverMain, NgbPopoverArrow],
19
+ template: ` <div
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"
23
+ >
24
+ <div class="flex flex-1 flex-col overflow-auto" ngbPopoverArrow>
25
+ <ng-container #myDialog />
26
+ </div>
27
+ </div>
28
+ @if (options().backdrop) {
29
+ <div ngbPopoverBackdrop class="pointer-events-auto fixed top-0 h-full w-full"></div>
30
+ }`,
31
+ host: {
32
+ class:
33
+ 'fixed top-0 left-0 w-full h-full pointer-events-none z-p flex items-center justify-center',
34
+ },
35
+ })
36
+ class Popover extends NgbPopover {}
37
+
38
+ export function registerPopover() {
39
+ return registerNgbPopover(Popover);
40
+ }
41
+
42
+ export const popoverPortal = ngbPopoverPortal;
43
+
44
+ @Directive({
45
+ selector: '[<%= name %>PopoverTrigger]',
46
+ hostDirectives: [
47
+ {
48
+ directive: NgbPopoverTrigger,
49
+ inputs: [
50
+ 'ngbPopoverTrigger: <%= name %>PopoverTrigger',
51
+ 'ngbPopoverTriggerData: <%= name %>PopoverTriggerData',
52
+ 'options',
53
+ ],
54
+ },
55
+ ],
56
+ providers: [registerPopover()],
57
+ })
58
+ export class PopoverTrigger {}
59
+
60
+ @Directive({
61
+ selector: '[<%= name %>PopoverClose]',
62
+ hostDirectives: [{ directive: NgbPopoverClose, inputs: ['ngbPopoverClose: <%= name %>PopoverClose'] }],
63
+ })
64
+ export class PopoverClose {}
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of progress
3
+ */
4
+
5
+ export * from './progress';
@@ -0,0 +1,14 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { NgbProgress, NgbProgressBar } from '@ngbase/adk/progress';
3
+
4
+ @Component({
5
+ selector: '<%= name %>-progress',
6
+ changeDetection: ChangeDetectionStrategy.OnPush,
7
+ hostDirectives: [{ directive: NgbProgress, inputs: ['value'] }],
8
+ imports: [NgbProgressBar],
9
+ template: `<div class="h-full bg-primary transition" ngbProgressBar></div>`,
10
+ host: {
11
+ class: 'block h-2 my-1 bg-muted rounded-full',
12
+ },
13
+ })
14
+ export class Progress {}
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of radio
3
+ */
4
+
5
+ export * from './radio';
@@ -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';