@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.
- package/package.json +13 -13
- package/schematics/collection.json +15 -0
- package/schematics/components/files/accordion/accordion.ts.template +53 -0
- package/schematics/components/files/accordion/index.ts.template +5 -0
- package/schematics/components/files/alert/alert.ts.template +62 -0
- package/schematics/components/files/alert/index.ts.template +1 -0
- package/schematics/components/files/autocomplete/autocomplete.ts.template +44 -0
- package/schematics/components/files/autocomplete/index.ts.template +5 -0
- package/schematics/components/files/avatar/avatar.ts.template +31 -0
- package/schematics/components/files/avatar/index.ts.template +1 -0
- package/schematics/components/files/badge/badge.ts.template +11 -0
- package/schematics/components/files/badge/index.ts.template +1 -0
- package/schematics/components/files/breadcrumb/breadcrumb.ts.template +53 -0
- package/schematics/components/files/breadcrumb/index.ts.template +1 -0
- package/schematics/components/files/button/button.ts.template +29 -0
- package/schematics/components/files/button/index.ts.template +5 -0
- package/schematics/components/files/card/card.ts.template +11 -0
- package/schematics/components/files/card/index.ts.template +5 -0
- package/schematics/components/files/carousel/carousel.ts.template +44 -0
- package/schematics/components/files/carousel/index.ts.template +1 -0
- package/schematics/components/files/checkbox/checkbox.ts.template +36 -0
- package/schematics/components/files/checkbox/focus-style.directive.ts.template +12 -0
- package/schematics/components/files/checkbox/index.ts.template +6 -0
- package/schematics/components/files/chip/chip.ts.template +38 -0
- package/schematics/components/files/chip/index.ts.template +1 -0
- package/schematics/components/files/color-picker/color-picker.ts.template +104 -0
- package/schematics/components/files/color-picker/index.ts.template +5 -0
- package/schematics/components/files/command/command.ts.template +82 -0
- package/schematics/components/files/command/index.ts.template +1 -0
- package/schematics/components/files/datepicker/calendar.ts.template +117 -0
- package/schematics/components/files/datepicker/datepicker.ts.template +59 -0
- package/schematics/components/files/datepicker/index.ts.template +2 -0
- package/schematics/components/files/datepicker/time.ts.template +54 -0
- package/schematics/components/files/dialog/dialog.ts.template +89 -0
- package/schematics/components/files/dialog/index.ts.template +5 -0
- package/schematics/components/files/drawer/drawer.ts.template +104 -0
- package/schematics/components/files/drawer/index.ts.template +5 -0
- package/schematics/components/files/form-field/form-field.ts.template +111 -0
- package/schematics/components/files/form-field/index.ts.template +6 -0
- package/schematics/components/files/form-field/input-style.directive.ts.template +11 -0
- package/schematics/components/files/hover-card/hover-card.ts.template +13 -0
- package/schematics/components/files/hover-card/index.ts.template +5 -0
- package/schematics/components/files/icon/icon.ts.template +16 -0
- package/schematics/components/files/icon/index.ts.template +1 -0
- package/schematics/components/files/inline-edit/index.ts.template +1 -0
- package/schematics/components/files/inline-edit/inline-edit.ts.template +24 -0
- package/schematics/components/files/keys/index.ts.template +5 -0
- package/schematics/components/files/keys/key.ts.template +35 -0
- package/schematics/components/files/list/index.ts.template +5 -0
- package/schematics/components/files/list/list.ts.template +28 -0
- package/schematics/components/files/mask/index.ts.template +1 -0
- package/schematics/components/files/mask/mask.ts.template +8 -0
- package/schematics/components/files/menu/context-menu.ts.template +14 -0
- package/schematics/components/files/menu/index.ts.template +8 -0
- package/schematics/components/files/menu/mention.ts.template +14 -0
- package/schematics/components/files/menu/menu.ts.template +37 -0
- package/schematics/components/files/menu/navigation-menu.ts.template +8 -0
- package/schematics/components/files/otp/index.ts.template +5 -0
- package/schematics/components/files/otp/otp.ts.template +37 -0
- package/schematics/components/files/pagination/index.ts.template +1 -0
- package/schematics/components/files/pagination/pagination.ts.template +75 -0
- package/schematics/components/files/picasa/index.ts.template +1 -0
- package/schematics/components/files/picasa/picasa-base.component.ts.template +80 -0
- package/schematics/components/files/picasa/picasa.component.ts.template +57 -0
- package/schematics/components/files/picasa/picasa.directive.ts.template +41 -0
- package/schematics/components/files/picasa/picase.service.ts.template +24 -0
- package/schematics/components/files/popover/index.ts.template +1 -0
- package/schematics/components/files/popover/popover.ts.template +64 -0
- package/schematics/components/files/progress/index.ts.template +5 -0
- package/schematics/components/files/progress/progress.ts.template +14 -0
- package/schematics/components/files/radio/index.ts.template +5 -0
- package/schematics/components/files/radio/radio.ts.template +37 -0
- package/schematics/components/files/resizable/index.ts.template +5 -0
- package/schematics/components/files/resizable/resizable.ts.template +59 -0
- package/schematics/components/files/scroll-area/index.ts.template +1 -0
- package/schematics/components/files/scroll-area/scroll-area.ts.template +40 -0
- package/schematics/components/files/select/index.ts.template +8 -0
- package/schematics/components/files/select/list-selection.ts.template +15 -0
- package/schematics/components/files/select/option.ts.template +35 -0
- package/schematics/components/files/select/select-input.ts.template +21 -0
- package/schematics/components/files/select/select.ts.template +96 -0
- package/schematics/components/files/selectable/index.ts.template +1 -0
- package/schematics/components/files/selectable/selectable.ts.template +34 -0
- package/schematics/components/files/separator/index.ts.template +5 -0
- package/schematics/components/files/separator/separator.ts.template +19 -0
- package/schematics/components/files/sheet/index.ts.template +5 -0
- package/schematics/components/files/sheet/sheet.ts.template +69 -0
- package/schematics/components/files/sidenav/index.ts.template +1 -0
- package/schematics/components/files/sidenav/sidenav.ts.template +48 -0
- package/schematics/components/files/skeleton/index.ts.template +1 -0
- package/schematics/components/files/skeleton/skeleton.ts.template +15 -0
- package/schematics/components/files/slider/index.ts.template +5 -0
- package/schematics/components/files/slider/slider.ts.template +35 -0
- package/schematics/components/files/sonner/index.ts.template +5 -0
- package/schematics/components/files/sonner/sonner.ts.template +59 -0
- package/schematics/components/files/spinner/index.ts.template +1 -0
- package/schematics/components/files/spinner/spinner.ts.template +79 -0
- package/schematics/components/files/stepper/index.ts.template +1 -0
- package/schematics/components/files/stepper/stepper.ts.template +88 -0
- package/schematics/components/files/switch/index.ts.template +5 -0
- package/schematics/components/files/switch/switch.ts.template +29 -0
- package/schematics/components/files/table/index.ts.template +27 -0
- package/schematics/components/files/table/table.ts.template +122 -0
- package/schematics/components/files/tabs/index.ts.template +5 -0
- package/schematics/components/files/tabs/tab.ts.template +92 -0
- package/schematics/components/files/theme/index.ts.template +2 -0
- package/schematics/components/files/theme/theme-button.component.ts.template +26 -0
- package/schematics/components/files/theme/theme.service.ts.template +33 -0
- package/schematics/components/files/toggle/index.ts.template +5 -0
- package/schematics/components/files/toggle/toggle.ts.template +13 -0
- package/schematics/components/files/toggle-group/index.ts.template +5 -0
- package/schematics/components/files/toggle-group/toggle-group.ts.template +25 -0
- package/schematics/components/files/tooltip/index.ts.template +5 -0
- package/schematics/components/files/tooltip/tooltip.ts.template +45 -0
- package/schematics/components/files/tour/index.ts.template +1 -0
- package/schematics/components/files/tour/tour.ts.template +19 -0
- package/schematics/components/files/tree/index.ts.template +1 -0
- package/schematics/components/files/tree/tree.ts.template +66 -0
- package/schematics/components/index.d.ts +3 -0
- package/schematics/components/index.js +23 -0
- package/schematics/components/index.js.map +1 -0
- package/schematics/components/index.ts +39 -0
- package/schematics/components/schema.d.ts +6 -0
- package/schematics/components/schema.js +3 -0
- package/schematics/components/schema.js.map +1 -0
- package/schematics/components/schema.json +142 -0
- package/schematics/components/schema.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngbase/adk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/ng-base/ngbase.git"
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"types": "./autocomplete/index.d.ts",
|
|
49
49
|
"default": "./fesm2022/ngbase-adk-autocomplete.mjs"
|
|
50
50
|
},
|
|
51
|
+
"./breadcrumb": {
|
|
52
|
+
"types": "./breadcrumb/index.d.ts",
|
|
53
|
+
"default": "./fesm2022/ngbase-adk-breadcrumb.mjs"
|
|
54
|
+
},
|
|
51
55
|
"./bidi": {
|
|
52
56
|
"types": "./bidi/index.d.ts",
|
|
53
57
|
"default": "./fesm2022/ngbase-adk-bidi.mjs"
|
|
@@ -60,10 +64,6 @@
|
|
|
60
64
|
"types": "./carousel/index.d.ts",
|
|
61
65
|
"default": "./fesm2022/ngbase-adk-carousel.mjs"
|
|
62
66
|
},
|
|
63
|
-
"./breadcrumb": {
|
|
64
|
-
"types": "./breadcrumb/index.d.ts",
|
|
65
|
-
"default": "./fesm2022/ngbase-adk-breadcrumb.mjs"
|
|
66
|
-
},
|
|
67
67
|
"./checkbox": {
|
|
68
68
|
"types": "./checkbox/index.d.ts",
|
|
69
69
|
"default": "./fesm2022/ngbase-adk-checkbox.mjs"
|
|
@@ -232,25 +232,25 @@
|
|
|
232
232
|
"types": "./tooltip/index.d.ts",
|
|
233
233
|
"default": "./fesm2022/ngbase-adk-tooltip.mjs"
|
|
234
234
|
},
|
|
235
|
-
"./tour": {
|
|
236
|
-
"types": "./tour/index.d.ts",
|
|
237
|
-
"default": "./fesm2022/ngbase-adk-tour.mjs"
|
|
238
|
-
},
|
|
239
235
|
"./translate": {
|
|
240
236
|
"types": "./translate/index.d.ts",
|
|
241
237
|
"default": "./fesm2022/ngbase-adk-translate.mjs"
|
|
242
238
|
},
|
|
239
|
+
"./tour": {
|
|
240
|
+
"types": "./tour/index.d.ts",
|
|
241
|
+
"default": "./fesm2022/ngbase-adk-tour.mjs"
|
|
242
|
+
},
|
|
243
243
|
"./tree": {
|
|
244
244
|
"types": "./tree/index.d.ts",
|
|
245
245
|
"default": "./fesm2022/ngbase-adk-tree.mjs"
|
|
246
246
|
},
|
|
247
|
-
"./utils": {
|
|
248
|
-
"types": "./utils/index.d.ts",
|
|
249
|
-
"default": "./fesm2022/ngbase-adk-utils.mjs"
|
|
250
|
-
},
|
|
251
247
|
"./virtualizer": {
|
|
252
248
|
"types": "./virtualizer/index.d.ts",
|
|
253
249
|
"default": "./fesm2022/ngbase-adk-virtualizer.mjs"
|
|
250
|
+
},
|
|
251
|
+
"./utils": {
|
|
252
|
+
"types": "./utils/index.d.ts",
|
|
253
|
+
"default": "./fesm2022/ngbase-adk-utils.mjs"
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Add my library to the project.",
|
|
6
|
+
"factory": "./ng-add/index#ngAdd",
|
|
7
|
+
"schema": "./ng-add/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"ui": {
|
|
10
|
+
"description": "Add an component to the project.",
|
|
11
|
+
"factory": "./components/index#myGenerator",
|
|
12
|
+
"schema": "./components/schema.json"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
aliasAccordion,
|
|
4
|
+
NgbAccordion,
|
|
5
|
+
NgbAccordionContent,
|
|
6
|
+
NgbAccordionGroup,
|
|
7
|
+
NgbAccordionHeader,
|
|
8
|
+
slideAnimation,
|
|
9
|
+
} from '@ngbase/adk/accordion';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: '<%= name %>-accordion-group',
|
|
13
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
14
|
+
hostDirectives: [{ directive: NgbAccordionGroup, inputs: ['multiple'] }],
|
|
15
|
+
template: `<ng-content />`,
|
|
16
|
+
host: {
|
|
17
|
+
class: 'block rounded-lg border bg-background',
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
export class AccordionGroup {}
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: '<%= name %>-accordion',
|
|
24
|
+
exportAs: '<%= name %>Accordion',
|
|
25
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
|
+
providers: [aliasAccordion(Accordion)],
|
|
27
|
+
imports: [NgbAccordionContent],
|
|
28
|
+
template: `
|
|
29
|
+
<ng-content select="[<%= name %>AccordionHeader]" />
|
|
30
|
+
@if (expanded()) {
|
|
31
|
+
<div ngbAccordionContent [@slide] class="overflow-hidden">
|
|
32
|
+
<div class="text-muted-foreground px-3 pb-4">
|
|
33
|
+
<ng-content />
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
host: {
|
|
39
|
+
class: 'block will-change-auto [&:not(:last-child)]:border-b',
|
|
40
|
+
},
|
|
41
|
+
animations: [slideAnimation],
|
|
42
|
+
})
|
|
43
|
+
export class Accordion extends NgbAccordion {}
|
|
44
|
+
|
|
45
|
+
@Directive({
|
|
46
|
+
selector: '[<%= name %>AccordionHeader]',
|
|
47
|
+
hostDirectives: [NgbAccordionHeader],
|
|
48
|
+
host: {
|
|
49
|
+
class:
|
|
50
|
+
'flex items-center w-full py-3 px-3 aria-disabled:cursor-not-allowed aria-disabled:opacity-50',
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
export class AccordionHeader {}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
|
2
|
+
import { DialogInput, DialogOptions, DialogRef } from '@ngbase/adk/portal';
|
|
3
|
+
import { Button, ButtonVariant } from '<%= basepath %>/button';
|
|
4
|
+
import { dialogPortal } from '<%= basepath %>/dialog';
|
|
5
|
+
|
|
6
|
+
export interface AlertOptions {
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
actions?: {
|
|
10
|
+
text: string;
|
|
11
|
+
type?: ButtonVariant;
|
|
12
|
+
handler: (fn: VoidFunction) => any;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function alertPortal() {
|
|
17
|
+
const base = dialogPortal();
|
|
18
|
+
|
|
19
|
+
function open<T>(opt: AlertOptions, comp?: DialogInput<T>) {
|
|
20
|
+
const options: DialogOptions = {
|
|
21
|
+
...new DialogOptions(),
|
|
22
|
+
data: opt,
|
|
23
|
+
title: opt.title,
|
|
24
|
+
width: '32rem',
|
|
25
|
+
maxWidth: '95vw',
|
|
26
|
+
disableClose: true,
|
|
27
|
+
header: true,
|
|
28
|
+
focusTrap: true,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const diaRef = base.open(comp || Alert, options);
|
|
32
|
+
|
|
33
|
+
return diaRef;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function closeAll() {
|
|
37
|
+
base.closeAll();
|
|
38
|
+
}
|
|
39
|
+
return { open, closeAll };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Component({
|
|
43
|
+
selector: '<%= name %>-alert',
|
|
44
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
45
|
+
imports: [Button],
|
|
46
|
+
template: `
|
|
47
|
+
<h4 class="mb-2 text-base font-bold">{{ data?.title }}</h4>
|
|
48
|
+
<p class="pb-3 text-muted-foreground">{{ data?.description }}</p>
|
|
49
|
+
<div class="flex justify-end gap-4 pt-1">
|
|
50
|
+
@for (action of data?.actions; track action) {
|
|
51
|
+
<button [<%= name %>Button]="action.type || 'primary'" (click)="action.handler(diaRef.close)">
|
|
52
|
+
{{ action.text }}
|
|
53
|
+
</button>
|
|
54
|
+
}
|
|
55
|
+
</div>
|
|
56
|
+
`,
|
|
57
|
+
})
|
|
58
|
+
export class Alert {
|
|
59
|
+
diaRef = inject<DialogRef<AlertOptions>>(DialogRef);
|
|
60
|
+
|
|
61
|
+
data = this.diaRef.options?.data;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './alert';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
|
|
2
|
+
import { NgbAutocomplete, NgbAutocompleteInput, aliasAutocomplete } from '@ngbase/adk/autocomplete';
|
|
3
|
+
import { NgbSelectOptionGroup } from '@ngbase/adk/select';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: '<%= name %>-autocomplete',
|
|
7
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
+
providers: [aliasAutocomplete(Autocomplete)],
|
|
9
|
+
imports: [NgbSelectOptionGroup],
|
|
10
|
+
template: `
|
|
11
|
+
<ul #container class="readonly !flex w-full flex-wrap gap-2" (click)="prevent($event)">
|
|
12
|
+
<ng-content select="<%= name %>-chip, <%= name %>-chip-group" />
|
|
13
|
+
|
|
14
|
+
<li class="flex min-w-8 flex-1 items-center" (click)="open()">
|
|
15
|
+
<ng-content select="input" />
|
|
16
|
+
</li>
|
|
17
|
+
</ul>
|
|
18
|
+
<ng-template #optionsTemplate>
|
|
19
|
+
<div #optionsGroup ngbSelectOptionGroup class="p-1">
|
|
20
|
+
<ng-content />
|
|
21
|
+
</div>
|
|
22
|
+
</ng-template>
|
|
23
|
+
`,
|
|
24
|
+
host: {
|
|
25
|
+
class: 'inline-flex',
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
export class Autocomplete<T> extends NgbAutocomplete<T> {}
|
|
29
|
+
|
|
30
|
+
@Directive({
|
|
31
|
+
selector: '[<%= name %>AutocompleteInput]',
|
|
32
|
+
exportAs: '<%= name %>AutocompleteInput',
|
|
33
|
+
hostDirectives: [
|
|
34
|
+
{
|
|
35
|
+
directive: NgbAutocompleteInput,
|
|
36
|
+
inputs: ['isChip'],
|
|
37
|
+
outputs: ['ngbAutocompleteInput: <%= name %>AutocompleteInput'],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
host: {
|
|
41
|
+
class: 'w-full bg-transparent shadow-none outline-none',
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
export class AutocompleteInput<T> {}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { NgbAvatar, NgbAvatarGroup, aliasAvatar } from '@ngbase/adk/avatar';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: '<%= name %>-avatar-group',
|
|
6
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
7
|
+
hostDirectives: [{ directive: NgbAvatarGroup, inputs: ['reverse', 'left'] }],
|
|
8
|
+
template: `<ng-content select="<%= name %>-avatar,[<%= name %>Avatar]" />`,
|
|
9
|
+
host: {
|
|
10
|
+
class: 'flex flex-row',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
export class AvatarGroup {}
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: '<%= name %>-avatar, [<%= name %>Avatar]',
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
+
providers: [aliasAvatar(Avatar)],
|
|
19
|
+
template: `
|
|
20
|
+
@if (src(); as img) {
|
|
21
|
+
<img [src]="img" alt="avatar" class="h-full max-h-full max-w-full" />
|
|
22
|
+
} @else {
|
|
23
|
+
<ng-content>{{ nameChar() }}</ng-content>
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
host: {
|
|
27
|
+
class:
|
|
28
|
+
'inline-flex aspect-square rounded-full overflow-hidden border-2 border-muted relative bg-background text-muted-foreground items-center justify-center',
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
export class Avatar extends NgbAvatar {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './avatar';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: '<%= name %>-badge, [<%= name %>Badge]',
|
|
5
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
6
|
+
template: `<ng-content />`,
|
|
7
|
+
host: {
|
|
8
|
+
class: 'inline-block bg-muted rounded-full px-2 py-1 text-xs font-semibold',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class Badge {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './badge';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
|
|
2
|
+
import { Icon } from '<%= basepath %>/icon';
|
|
3
|
+
import { provideIcons } from '@ng-icons/core';
|
|
4
|
+
import { lucideChevronRight } from '@ng-icons/lucide';
|
|
5
|
+
import {
|
|
6
|
+
aliasBreadcrumb,
|
|
7
|
+
NgbBreadcrumb,
|
|
8
|
+
NgbBreadcrumbLink,
|
|
9
|
+
NgbBreadcrumbs,
|
|
10
|
+
NgbBreadcrumbSeparator,
|
|
11
|
+
NgbBreadcrumbSeparatorAria,
|
|
12
|
+
} from '@ngbase/adk/breadcrumb';
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
selector: '<%= name %>-breadcrumbs',
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
+
hostDirectives: [NgbBreadcrumbs],
|
|
18
|
+
template: `<ng-content />`,
|
|
19
|
+
host: {
|
|
20
|
+
class: 'flex items-center gap-2',
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
export class Breadcrumbs {}
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: '<%= name %>-breadcrumb',
|
|
27
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
|
+
providers: [aliasBreadcrumb(Breadcrumb)],
|
|
29
|
+
viewProviders: [provideIcons({ lucideChevronRight })],
|
|
30
|
+
imports: [Icon, NgbBreadcrumbLink, NgbBreadcrumbSeparatorAria],
|
|
31
|
+
template: `
|
|
32
|
+
<a class='hover:text-primary aria-[current="page"]:text-primary' ngbBreadcrumbLink>
|
|
33
|
+
<ng-content />
|
|
34
|
+
</a>
|
|
35
|
+
@if (!active()) {
|
|
36
|
+
<<%= name %>-icon
|
|
37
|
+
ngbBreadcrumbSeparatorAria
|
|
38
|
+
name="lucideChevronRight"
|
|
39
|
+
class="text-muted-foreground"
|
|
40
|
+
/>
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
host: {
|
|
44
|
+
class: 'flex items-center gap-2 text-muted-foreground',
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
export class Breadcrumb extends NgbBreadcrumb {}
|
|
48
|
+
|
|
49
|
+
@Directive({
|
|
50
|
+
selector: '[<%= name %>BreadcrumbsSeparator]',
|
|
51
|
+
hostDirectives: [NgbBreadcrumbSeparator],
|
|
52
|
+
})
|
|
53
|
+
export class BreadcrumbsSeparator {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Breadcrumbs, BreadcrumbsSeparator, Breadcrumb } from './breadcrumb';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
+
import { ɵFocusStyle as FocusStyle } from '<%= basepath %>/checkbox';
|
|
3
|
+
|
|
4
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'outline' | 'icon';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: '[<%= name %>Button]',
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
hostDirectives: [FocusStyle],
|
|
10
|
+
template: `<ng-content />`,
|
|
11
|
+
host: {
|
|
12
|
+
type: 'button',
|
|
13
|
+
class:
|
|
14
|
+
'inline-flex items-center justify-center rounded-lg px-4 py-2 border disabled:opacity-50 disabled:pointer-events-none',
|
|
15
|
+
'[class]': `variant() === 'primary'
|
|
16
|
+
? 'bg-primary text-primary-foreground border-primary'
|
|
17
|
+
: variant() === 'secondary'
|
|
18
|
+
? 'bg-secondary text-secondary-foreground border-secondary hover:bg-secondary/80'
|
|
19
|
+
: variant() === 'ghost' || variant() === 'icon'
|
|
20
|
+
? 'hover:bg-accent hover:text-accent-foreground border-transparent'
|
|
21
|
+
: 'bg-background hover:bg-accent hover:text-accent-foreground'`,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
export class Button {
|
|
25
|
+
variant = input('primary', {
|
|
26
|
+
alias: '<%= name %>Button',
|
|
27
|
+
transform: (value: ButtonVariant | '') => value || 'primary',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: '<%= name %>-card, [<%= name %>Card]',
|
|
5
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
6
|
+
template: `<ng-content />`,
|
|
7
|
+
host: {
|
|
8
|
+
class: 'block rounded-lg border bg-card text-card-foreground p-4',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class Card {}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
NgbCarousel,
|
|
4
|
+
NgbCarouselButton,
|
|
5
|
+
NgbCarouselContainer,
|
|
6
|
+
NgbCarouselItem,
|
|
7
|
+
NgbCarouselSubContainer,
|
|
8
|
+
aliasCarousel,
|
|
9
|
+
} from '@ngbase/adk/carousel';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: '<%= name %>-carousel',
|
|
13
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
14
|
+
providers: [aliasCarousel(Carousel)],
|
|
15
|
+
imports: [NgbCarouselContainer, NgbCarouselSubContainer],
|
|
16
|
+
template: `
|
|
17
|
+
<div class="touch-none overflow-hidden" ngbCarouselContainer>
|
|
18
|
+
<div ngbCarouselSubContainer class="relative -ml-4 flex">
|
|
19
|
+
<ng-content select="[<%= name %>CarouselItem]" />
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<ng-content />
|
|
24
|
+
</div>
|
|
25
|
+
`,
|
|
26
|
+
host: {
|
|
27
|
+
class: 'flex flex-col gap-4 relative',
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
export class Carousel extends NgbCarousel {}
|
|
31
|
+
|
|
32
|
+
@Directive({
|
|
33
|
+
selector: '[<%= name %>CarouselItem]',
|
|
34
|
+
hostDirectives: [NgbCarouselItem],
|
|
35
|
+
})
|
|
36
|
+
export class CarouselItem {}
|
|
37
|
+
|
|
38
|
+
@Directive({
|
|
39
|
+
selector: '[<%= name %>CarouselButton]',
|
|
40
|
+
hostDirectives: [
|
|
41
|
+
{ directive: NgbCarouselButton, inputs: ['ngbCarouselButton: <%= name %>CarouselButton'] },
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
export class CarouselButton {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './carousel';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { FocusStyle } from './focus-style.directive';
|
|
4
|
+
import { CheckboxButton, NgbCheckbox, aliasCheckbox } from '@ngbase/adk/checkbox';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: '<%= name %>-checkbox',
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
providers: [aliasCheckbox(Checkbox)],
|
|
10
|
+
imports: [FormsModule, FocusStyle, CheckboxButton],
|
|
11
|
+
template: `
|
|
12
|
+
<button
|
|
13
|
+
<%= name %>FocusStyle
|
|
14
|
+
ngbCheckboxButton
|
|
15
|
+
class="custom-checkbox relative flex h-4 w-4 flex-none items-center justify-center rounded border border-primary transition-colors"
|
|
16
|
+
[class]="
|
|
17
|
+
disabled() ? '!border-muted-foreground bg-muted-foreground' : path() ? 'bg-primary' : ''
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
@if (path(); as d) {
|
|
21
|
+
<svg class="h-full w-full text-background" viewBox="0 0 24 24" aria-hidden="true">
|
|
22
|
+
<path [attr.d]="d" stroke="currentColor" stroke-width="2" fill="none" />
|
|
23
|
+
</svg>
|
|
24
|
+
}
|
|
25
|
+
</button>
|
|
26
|
+
<ng-content />
|
|
27
|
+
`,
|
|
28
|
+
host: {
|
|
29
|
+
class: 'inline-flex items-center gap-2 py-1 disabled:opacity-60 disabled:cursor-not-allowed',
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
export class Checkbox extends NgbCheckbox {
|
|
33
|
+
readonly path = computed(() =>
|
|
34
|
+
this.indeterminate() ? 'M6 12L18 12' : this.checked() ? 'M20 6L9 17L4 12' : '',
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { booleanAttribute, Directive, input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Directive({
|
|
4
|
+
selector: '[<%= name %>FocusStyle]',
|
|
5
|
+
host: {
|
|
6
|
+
class: 'outline-none',
|
|
7
|
+
'[class]': `!unfocus() ? 'focus-visible:ring-2 focus-within:ring-2 focus-within:ring-offset-2 ring-primary focus-visible:ring-offset-2 ring-offset-background data-[focus]:ring-2 data-[focus]:ring-offset-2 data-[focus]:ring-offset-background data-[focus]:ring-primary' : ''`,
|
|
8
|
+
},
|
|
9
|
+
})
|
|
10
|
+
export class FocusStyle {
|
|
11
|
+
unfocus = input(false, { transform: booleanAttribute });
|
|
12
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { NgbChip, NgbChipGroup, NgbChipRemove, aliasChip } from '@ngbase/adk/chip';
|
|
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
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: '<%= name %>-chip-group',
|
|
10
|
+
hostDirectives: [NgbChipGroup],
|
|
11
|
+
template: `<ng-content />`,
|
|
12
|
+
host: {
|
|
13
|
+
class: 'flex flex-wrap gap-2',
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
export class ChipGroup<T> {}
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
selector: '<%= name %>-chip, [<%= name %>Chip]',
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
providers: [aliasChip(Chip)],
|
|
22
|
+
viewProviders: [provideIcons({ lucideX })],
|
|
23
|
+
imports: [Button, Icon, NgbChipRemove],
|
|
24
|
+
template: `<ng-content />
|
|
25
|
+
@if (removable()) {
|
|
26
|
+
<button
|
|
27
|
+
<%= name %>Button="ghost"
|
|
28
|
+
ngbChipRemove
|
|
29
|
+
class="small -my-2 data-[dir=ltr]:-mr-4 data-[dir=rtl]:-ml-4"
|
|
30
|
+
>
|
|
31
|
+
<<%= name %>-icon name="lucideX" />
|
|
32
|
+
</button>
|
|
33
|
+
}`,
|
|
34
|
+
host: {
|
|
35
|
+
class: 'inline-flex items-center bg-muted rounded-lg px-2 py-1 text-xs font-medium',
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
export class Chip<T = any> extends NgbChip<T> {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './chip';
|