@ngbase/adk 0.1.0 → 0.1.1
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/README.md +1 -1
- package/fesm2022/ngbase-adk-autocomplete.mjs +2 -2
- package/fesm2022/ngbase-adk-autocomplete.mjs.map +1 -1
- package/fesm2022/ngbase-adk-datepicker.mjs +18 -18
- package/fesm2022/ngbase-adk-datepicker.mjs.map +1 -1
- package/fesm2022/ngbase-adk-dialog.mjs +6 -6
- package/fesm2022/ngbase-adk-dialog.mjs.map +1 -1
- package/fesm2022/ngbase-adk-pagination.mjs +18 -18
- package/fesm2022/ngbase-adk-pagination.mjs.map +1 -1
- package/fesm2022/ngbase-adk-popover.mjs +2 -2
- package/fesm2022/ngbase-adk-popover.mjs.map +1 -1
- package/fesm2022/ngbase-adk-radio.mjs +2 -2
- package/fesm2022/ngbase-adk-radio.mjs.map +1 -1
- package/fesm2022/ngbase-adk-resizable.mjs +4 -4
- package/fesm2022/ngbase-adk-resizable.mjs.map +1 -1
- package/fesm2022/ngbase-adk-select.mjs +4 -4
- package/fesm2022/ngbase-adk-select.mjs.map +1 -1
- package/fesm2022/ngbase-adk-sonner.mjs +4 -4
- package/fesm2022/ngbase-adk-sonner.mjs.map +1 -1
- package/fesm2022/ngbase-adk-stepper.mjs +2 -2
- package/fesm2022/ngbase-adk-stepper.mjs.map +1 -1
- package/package.json +26 -25
- package/schematics/collection.json +15 -0
- package/schematics/components/files/accordion/accordion.ts.template +55 -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 +48 -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 +49 -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 +46 -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 +36 -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-trigger.ts.template +27 -0
- package/schematics/components/files/datepicker/datepicker.ts.template +28 -0
- package/schematics/components/files/datepicker/index.ts.template +3 -0
- package/schematics/components/files/datepicker/time.ts.template +46 -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/index.ts.template +7 -0
- package/schematics/components/files/form-field/input-style.directive.ts.template +11 -0
- package/schematics/components/files/form-field/input.ts.template +100 -0
- package/schematics/components/files/form-field/otp.ts.template +37 -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/pagination/index.ts.template +1 -0
- package/schematics/components/files/pagination/pagination.ts.template +71 -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 +87 -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 +40 -0
- package/schematics/components/files/resizable/index.ts.template +5 -0
- package/schematics/components/files/resizable/resizable.ts.template +56 -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 +34 -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 +134 -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 +42 -0
- package/schematics/components/files/sonner/index.ts.template +5 -0
- package/schematics/components/files/sonner/sonner.ts.template +58 -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/body-cell.ts.template +19 -0
- package/schematics/components/files/table/body-row.ts.template +21 -0
- package/schematics/components/files/table/column.ts.template +8 -0
- package/schematics/components/files/table/head-cell.ts.template +19 -0
- package/schematics/components/files/table/head-row.ts.template +27 -0
- package/schematics/components/files/table/index.ts.template +26 -0
- package/schematics/components/files/table/table.ts.template +20 -0
- package/schematics/components/files/tabs/index.ts.template +5 -0
- package/schematics/components/files/tabs/tab.ts.template +89 -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.component.ts.template +165 -0
- package/schematics/components/files/theme/theme.service.ts.template +44 -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 +40 -0
- package/schematics/components/files/tour/index.ts.template +3 -0
- package/schematics/components/files/tour/tour-step.ts.template +8 -0
- package/schematics/components/files/tour/tour.service.ts.template +7 -0
- package/schematics/components/files/tour/tour.ts.template +8 -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 +17 -0
- package/schematics/components/index.js.map +1 -0
- package/schematics/components/index.ts +29 -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 +137 -0
- package/schematics/components/schema.ts +6 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
|
+
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { Button } from '<%= basepath %>/button';
|
|
4
|
+
import { ColorInput } from '<%= basepath %>/color-picker';
|
|
5
|
+
import { Input } from '<%= basepath %>/form-field';
|
|
6
|
+
|
|
7
|
+
interface ThemeData {
|
|
8
|
+
name: string;
|
|
9
|
+
radius: string;
|
|
10
|
+
space: string;
|
|
11
|
+
background: string;
|
|
12
|
+
foreground: string;
|
|
13
|
+
primary: string;
|
|
14
|
+
muted: string;
|
|
15
|
+
border: string;
|
|
16
|
+
text: string;
|
|
17
|
+
input: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: '<%= name %>-theme',
|
|
22
|
+
imports: [Input, ReactiveFormsModule, Button, ColorInput],
|
|
23
|
+
template: `
|
|
24
|
+
<div class="mb-4 flex gap-4">
|
|
25
|
+
@for (theme of themes; track theme) {
|
|
26
|
+
<button <%= name %>Button="outline" (click)="changeTheme(theme)">
|
|
27
|
+
{{ theme.name }}
|
|
28
|
+
</button>
|
|
29
|
+
}
|
|
30
|
+
</div>
|
|
31
|
+
<form [formGroup]="form">
|
|
32
|
+
<table>
|
|
33
|
+
<tr>
|
|
34
|
+
<td>Radius:</td>
|
|
35
|
+
<td><input class="w-48" <%= name %>Input formControlName="radius" /></td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<td>Space:</td>
|
|
39
|
+
<td><input class="w-48" <%= name %>Input formControlName="space" /></td>
|
|
40
|
+
</tr>
|
|
41
|
+
<tr>
|
|
42
|
+
<td>Background:</td>
|
|
43
|
+
<td><<%= name %>-color-input class="w-48" formControlName="background" /></td>
|
|
44
|
+
</tr>
|
|
45
|
+
<tr>
|
|
46
|
+
<td>Foreground:</td>
|
|
47
|
+
<td><<%= name %>-color-input class="w-48" formControlName="foreground" /></td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<td>Primary:</td>
|
|
51
|
+
<td><<%= name %>-color-input class="w-48" formControlName="primary" /></td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td>Muted:</td>
|
|
55
|
+
<td><<%= name %>-color-input class="w-48" formControlName="muted" /></td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td>Border:</td>
|
|
59
|
+
<td><<%= name %>-color-input class="w-48" formControlName="border" /></td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<td>Text:</td>
|
|
63
|
+
<td><<%= name %>-color-input class="w-48" formControlName="text" /></td>
|
|
64
|
+
</tr>
|
|
65
|
+
</table>
|
|
66
|
+
</form>
|
|
67
|
+
`,
|
|
68
|
+
})
|
|
69
|
+
export class ThemeComponent {
|
|
70
|
+
fb = inject(FormBuilder);
|
|
71
|
+
|
|
72
|
+
form = this.fb.nonNullable.group({
|
|
73
|
+
radius: ['0.5rem'],
|
|
74
|
+
space: ['1rem'],
|
|
75
|
+
background: ['#ffffff'],
|
|
76
|
+
foreground: ['#000000'],
|
|
77
|
+
primary: ['#000000'],
|
|
78
|
+
muted: ['#71717a'],
|
|
79
|
+
border: ['#000000'],
|
|
80
|
+
text: ['#000000'],
|
|
81
|
+
input: ['#000000'],
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
themes: ThemeData[] = [
|
|
85
|
+
{
|
|
86
|
+
name: 'Light',
|
|
87
|
+
radius: '0.5rem',
|
|
88
|
+
space: '0.25rem',
|
|
89
|
+
background: '#f4f4f5',
|
|
90
|
+
foreground: '#ffffff',
|
|
91
|
+
primary: '#000000',
|
|
92
|
+
muted: '#71717a',
|
|
93
|
+
border: '#e4e4e7',
|
|
94
|
+
text: '#000000',
|
|
95
|
+
input: '#f3f4f6',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'Dark',
|
|
99
|
+
radius: '0.5rem',
|
|
100
|
+
space: '1rem',
|
|
101
|
+
background: '#000000',
|
|
102
|
+
foreground: '#191b23',
|
|
103
|
+
primary: '#000000',
|
|
104
|
+
muted: '#a1a1aa',
|
|
105
|
+
border: '#27272a',
|
|
106
|
+
text: '#ffffff',
|
|
107
|
+
input: '#27272a',
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
constructor() {
|
|
112
|
+
this.form.patchValue(this.themes[0]);
|
|
113
|
+
this.form.valueChanges.subscribe(value => {
|
|
114
|
+
const style = document.documentElement.style;
|
|
115
|
+
style.setProperty('--radius', value.radius!);
|
|
116
|
+
style.setProperty('--spacing-base', value.space!);
|
|
117
|
+
style.setProperty('---color-background', this.colorRGB(value.background!));
|
|
118
|
+
style.setProperty('---color-foreground', this.colorRGB(value.foreground!));
|
|
119
|
+
style.setProperty('--color-primary', this.colorRGB(value.primary!));
|
|
120
|
+
style.setProperty('---color-muted', this.colorRGB(value.muted!));
|
|
121
|
+
style.setProperty('---color-border', this.colorRGB(value.border!));
|
|
122
|
+
style.setProperty('---color-text', this.colorRGB(value.text!));
|
|
123
|
+
style.setProperty('---color-input', this.colorRGB(value.input!));
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
console.log(this.colorRGB('#ffffff'));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
colorRGB(color: string): string {
|
|
130
|
+
if (this.isHex(color)) {
|
|
131
|
+
color = this.hexToRgb(color);
|
|
132
|
+
}
|
|
133
|
+
const rgb = this.rgbToVariable(color);
|
|
134
|
+
return `${rgb.r}, ${rgb.g}, ${rgb.b}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
changeTheme(theme: ThemeData) {
|
|
138
|
+
this.form.patchValue(theme);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
isHex(hex: string) {
|
|
142
|
+
return /^#[0-9A-F]{6}$/i.test(hex);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
hexToRgb(hex: string): string {
|
|
146
|
+
const rgb = hex
|
|
147
|
+
.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => r + r + g + g + b + b)
|
|
148
|
+
.substring(1)
|
|
149
|
+
.match(/.{2}/g)
|
|
150
|
+
?.map(x => parseInt(x, 16));
|
|
151
|
+
return rgb ? `rgb(${rgb.join(', ')})` : '';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
rgbToHex(r: number, g: number, b: number) {
|
|
155
|
+
return `#${r.toString(16)}${g.toString(16)}${b.toString(16)}`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
rgbToVariable(rgb: string): { r: number; g: number; b: number } {
|
|
159
|
+
const [r, g, b] = rgb
|
|
160
|
+
.substring(4, rgb.length - 1)
|
|
161
|
+
.split(', ')
|
|
162
|
+
.map(x => parseInt(x));
|
|
163
|
+
return { r, g, b };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { inject, Injectable, signal } from '@angular/core';
|
|
2
|
+
import { isClient } from '@ngbase/adk/utils';
|
|
3
|
+
import { dialogPortal } from '<%= basepath %>/dialog';
|
|
4
|
+
import { ThemeComponent } from './theme.component';
|
|
5
|
+
|
|
6
|
+
@Injectable({ providedIn: 'root' })
|
|
7
|
+
export class ThemeService {
|
|
8
|
+
dialog = dialogPortal();
|
|
9
|
+
mode = signal<'light' | 'dark' | ''>('light');
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
if (isClient()) {
|
|
13
|
+
const theme = localStorage.getItem('theme');
|
|
14
|
+
this._update((theme as 'light' | 'dark') || 'light');
|
|
15
|
+
|
|
16
|
+
// registerShortcut('ctrl+h', () => this.open());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
toggle() {
|
|
21
|
+
this._update(this.mode() === 'dark' ? 'light' : 'dark');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private _update(mode: 'light' | 'dark' = 'light') {
|
|
25
|
+
const body = document.body;
|
|
26
|
+
if (mode === 'dark') {
|
|
27
|
+
body.classList.add('dark');
|
|
28
|
+
} else {
|
|
29
|
+
body.classList.remove('dark');
|
|
30
|
+
}
|
|
31
|
+
localStorage.setItem('theme', mode);
|
|
32
|
+
this.mode.set(mode);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
open() {
|
|
36
|
+
this.dialog.open(ThemeComponent, {
|
|
37
|
+
title: 'Theme',
|
|
38
|
+
backdrop: false,
|
|
39
|
+
width: '20rem',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const injectTheme = () => inject(ThemeService);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { NgbToggle } from '@ngbase/adk/toggle';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'button[<%= name %>Toggle]',
|
|
6
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
7
|
+
hostDirectives: [{ directive: NgbToggle, inputs: ['value'], outputs: ['valueChange'] }],
|
|
8
|
+
template: `<ng-content />`,
|
|
9
|
+
host: {
|
|
10
|
+
class: 'block w-9 h-9 rounded relative aria-[pressed=true]:bg-background',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
export class Toggle {}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
|
|
2
|
+
import { NgbToggleGroup, NgbToggleItem } from '@ngbase/adk/toggle-group';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: '<%= name %>-toggle-group',
|
|
6
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
7
|
+
hostDirectives: [
|
|
8
|
+
{ directive: NgbToggleGroup, inputs: ['value', 'multiple'], outputs: ['valueChange'] },
|
|
9
|
+
],
|
|
10
|
+
template: ` <ng-content select="[<%= name %>ToggleItem]" /> `,
|
|
11
|
+
host: {
|
|
12
|
+
class: 'flex gap-1',
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
export class ToggleGroup<T> {}
|
|
16
|
+
|
|
17
|
+
@Directive({
|
|
18
|
+
selector: 'button[<%= name %>ToggleItem]',
|
|
19
|
+
hostDirectives: [{ directive: NgbToggleItem, inputs: ['disabled', 'value'] }],
|
|
20
|
+
host: {
|
|
21
|
+
class:
|
|
22
|
+
'inline-block rounded h-9 px-3 hover:bg-opacity-80 active:bg-opacity-70 aria-[selected=true]:bg-background',
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
export class ToggleItem<T> {}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
NgbTooltipTemplate,
|
|
4
|
+
provideNgbTooltipOptions,
|
|
5
|
+
TooltipOptions,
|
|
6
|
+
NgbTooltip,
|
|
7
|
+
} from '@ngbase/adk/tooltip';
|
|
8
|
+
import { injectTheme } from '<%= basepath %>/theme';
|
|
9
|
+
|
|
10
|
+
@Directive({
|
|
11
|
+
selector: '[<%= name %>Tooltip]',
|
|
12
|
+
hostDirectives: [
|
|
13
|
+
{
|
|
14
|
+
directive: NgbTooltip,
|
|
15
|
+
inputs: [
|
|
16
|
+
'ngbTooltip: <%= name %>Tooltip',
|
|
17
|
+
'ngbTooltipPosition: <%= name %>TooltipPosition',
|
|
18
|
+
'delay',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
})
|
|
23
|
+
export class Tooltip {}
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: '<%= name %>-tooltip',
|
|
27
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
|
+
template: `{{ content() }}`,
|
|
29
|
+
host: {
|
|
30
|
+
class:
|
|
31
|
+
'fixed inline-block rounded-lg bg-foreground px-3 py-1 border shadow-md z-p whitespace-pre-line max-w-[15rem] text-text',
|
|
32
|
+
'[class]': `theme.mode() === 'dark' ? 'light' : 'dark'`,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
export class TooltipComponent extends NgbTooltipTemplate {
|
|
36
|
+
readonly theme = injectTheme();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const provideTooltipOptions = (options: TooltipOptions) =>
|
|
40
|
+
provideNgbTooltipOptions({ ...options, component: TooltipComponent });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { NgbTourStep } from '@ngbase/adk/tour';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[<%= name %>TourStep]',
|
|
6
|
+
hostDirectives: [{ directive: NgbTourStep, inputs: ['ngbTourStep: <%= name %>TourStep'] }],
|
|
7
|
+
})
|
|
8
|
+
export class TourStep {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tree';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Directive, signal } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
NgbTree,
|
|
4
|
+
NgbTreeNode,
|
|
5
|
+
NgbTreeNodeContent,
|
|
6
|
+
NgbTreeNodeDef,
|
|
7
|
+
NgbTreeNodeToggle,
|
|
8
|
+
provideTree,
|
|
9
|
+
provideTreeNode,
|
|
10
|
+
} from '@ngbase/adk/tree';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: '<%= name %>-tree',
|
|
14
|
+
exportAs: '<%= name %>Tree',
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
template: `<ng-container #container />`,
|
|
17
|
+
providers: [provideTree(Tree)],
|
|
18
|
+
host: {
|
|
19
|
+
class: 'block',
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
export class Tree<T> extends NgbTree<T> {}
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: '<%= name %>-tree-node',
|
|
26
|
+
exportAs: '<%= name %>TreeNode',
|
|
27
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
|
+
template: `
|
|
29
|
+
<div class="flex items-start">
|
|
30
|
+
<ng-content />
|
|
31
|
+
</div>
|
|
32
|
+
<ng-content select="[<%= name %>TreeNodeContent]" />
|
|
33
|
+
<ng-container #container />
|
|
34
|
+
`,
|
|
35
|
+
providers: [provideTreeNode(TreeNode)],
|
|
36
|
+
host: {
|
|
37
|
+
class: 'block w-full cursor-pointer',
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
export class TreeNode<T> extends NgbTreeNode<T> {
|
|
41
|
+
override size = signal(16);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Directive({
|
|
45
|
+
selector: '[<%= name %>TreeNodeToggle]',
|
|
46
|
+
hostDirectives: [NgbTreeNodeToggle],
|
|
47
|
+
host: {
|
|
48
|
+
class: `aria-[hidden="true"]:invisible`,
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
export class TreeNodeToggle {}
|
|
52
|
+
|
|
53
|
+
@Directive({
|
|
54
|
+
selector: '[<%= name %>TreeNodeDef]',
|
|
55
|
+
hostDirectives: [NgbTreeNodeDef],
|
|
56
|
+
})
|
|
57
|
+
export class TreeNodeDef<T> {}
|
|
58
|
+
|
|
59
|
+
@Directive({
|
|
60
|
+
selector: '[<%= name %>TreeNodeContent]',
|
|
61
|
+
hostDirectives: [NgbTreeNodeContent],
|
|
62
|
+
host: {
|
|
63
|
+
class: 'ml-8',
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
export class TreeNodeContent {}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.myGenerator = myGenerator;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const core_1 = require("@angular-devkit/core");
|
|
6
|
+
function myGenerator(options) {
|
|
7
|
+
return () => {
|
|
8
|
+
const sourceTemplates = (0, schematics_1.url)(`./files/${options.component}`);
|
|
9
|
+
const targetPath = options.path || '';
|
|
10
|
+
const sourceParametrizedTemplates = (0, schematics_1.apply)(sourceTemplates, [
|
|
11
|
+
(0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
12
|
+
(0, schematics_1.move)((0, core_1.normalize)(`/${targetPath}/${options.component}`)),
|
|
13
|
+
]);
|
|
14
|
+
return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(sourceParametrizedTemplates)]);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/adk/schematics/components/index.ts"],"names":[],"mappings":";;AAYA,kCAgBC;AA5BD,2DAQoC;AACpC,+CAA0D;AAG1D,SAAgB,WAAW,CAAC,OAA0B;IACpD,OAAO,GAAG,EAAE;QACV,MAAM,eAAe,GAAG,IAAA,gBAAG,EAAC,WAAW,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QAE5D,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;QAEtC,MAAM,2BAA2B,GAAG,IAAA,kBAAK,EAAC,eAAe,EAAE;YACzD,IAAA,2BAAc,kCACT,cAAO,GACP,OAAO,EACV;YACF,IAAA,iBAAI,EAAC,IAAA,gBAAS,EAAC,IAAI,UAAU,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;SACvD,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,sBAAS,EAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Rule,
|
|
3
|
+
apply,
|
|
4
|
+
mergeWith,
|
|
5
|
+
move,
|
|
6
|
+
applyTemplates,
|
|
7
|
+
url,
|
|
8
|
+
chain,
|
|
9
|
+
} from '@angular-devkit/schematics';
|
|
10
|
+
import { strings, normalize } from '@angular-devkit/core';
|
|
11
|
+
import { MyGeneratorSchema } from './schema';
|
|
12
|
+
|
|
13
|
+
export function myGenerator(options: MyGeneratorSchema): Rule {
|
|
14
|
+
return () => {
|
|
15
|
+
const sourceTemplates = url(`./files/${options.component}`);
|
|
16
|
+
|
|
17
|
+
const targetPath = options.path || '';
|
|
18
|
+
|
|
19
|
+
const sourceParametrizedTemplates = apply(sourceTemplates, [
|
|
20
|
+
applyTemplates({
|
|
21
|
+
...strings,
|
|
22
|
+
...options,
|
|
23
|
+
}),
|
|
24
|
+
move(normalize(`/${targetPath}/${options.component}`)),
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
return chain([mergeWith(sourceParametrizedTemplates)]);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../projects/adk/schematics/components/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsAccordion",
|
|
4
|
+
"title": "Accordion Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"description": "The name of the component prefix.",
|
|
9
|
+
"x-prompt": "What is the name of the component prefix?",
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"path": {
|
|
13
|
+
"description": "Where should be created the file",
|
|
14
|
+
"type": "string",
|
|
15
|
+
"format": "path",
|
|
16
|
+
"x-prompt": "Where should be created the file?",
|
|
17
|
+
"default": "src/app"
|
|
18
|
+
},
|
|
19
|
+
"basepath": {
|
|
20
|
+
"description": "The base path of the UI library.",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"format": "path",
|
|
23
|
+
"x-prompt": "What is the base path of the UI library?",
|
|
24
|
+
"default": "@"
|
|
25
|
+
},
|
|
26
|
+
"component": {
|
|
27
|
+
"description": "The file extension or preprocessor to use for style files.",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"default": "accordion",
|
|
30
|
+
"enum": [
|
|
31
|
+
"accordion",
|
|
32
|
+
"alert",
|
|
33
|
+
"autocomplete",
|
|
34
|
+
"avatar",
|
|
35
|
+
"badge",
|
|
36
|
+
"breadcrumb",
|
|
37
|
+
"button",
|
|
38
|
+
"card",
|
|
39
|
+
"carousel",
|
|
40
|
+
"checkbox",
|
|
41
|
+
"chip",
|
|
42
|
+
"color-picker",
|
|
43
|
+
"command",
|
|
44
|
+
"datepicker",
|
|
45
|
+
"dialog",
|
|
46
|
+
"drawer",
|
|
47
|
+
"form-field",
|
|
48
|
+
"hover-card",
|
|
49
|
+
"icon",
|
|
50
|
+
"inline-edit",
|
|
51
|
+
"keys",
|
|
52
|
+
"list",
|
|
53
|
+
"mask",
|
|
54
|
+
"menu",
|
|
55
|
+
"pagination",
|
|
56
|
+
"popover",
|
|
57
|
+
"progress",
|
|
58
|
+
"radio",
|
|
59
|
+
"resizable",
|
|
60
|
+
"select",
|
|
61
|
+
"separator",
|
|
62
|
+
"sheet",
|
|
63
|
+
"sidenav",
|
|
64
|
+
"skeleton",
|
|
65
|
+
"slider",
|
|
66
|
+
"sonner",
|
|
67
|
+
"spinner",
|
|
68
|
+
"stepper",
|
|
69
|
+
"switch",
|
|
70
|
+
"table",
|
|
71
|
+
"toggle",
|
|
72
|
+
"toggle-group",
|
|
73
|
+
"tooltip",
|
|
74
|
+
"tour",
|
|
75
|
+
"tree"
|
|
76
|
+
],
|
|
77
|
+
"x-prompt": {
|
|
78
|
+
"message": "Which component would you like to create?",
|
|
79
|
+
"type": "list",
|
|
80
|
+
"items": [
|
|
81
|
+
{ "value": "accordion", "label": "Accordion" },
|
|
82
|
+
{ "value": "alert", "label": "Alert" },
|
|
83
|
+
{ "value": "autocomplete", "label": "Autocomplete" },
|
|
84
|
+
{ "value": "avatar", "label": "Avatar" },
|
|
85
|
+
{ "value": "badge", "label": "Badge" },
|
|
86
|
+
{ "value": "breadcrumb", "label": "Breadcrumb" },
|
|
87
|
+
{ "value": "button", "label": "Button" },
|
|
88
|
+
{ "value": "card", "label": "Card" },
|
|
89
|
+
{ "value": "carousel", "label": "Carousel" },
|
|
90
|
+
{ "value": "checkbox", "label": "Checkbox" },
|
|
91
|
+
{ "value": "chip", "label": "Chip" },
|
|
92
|
+
{ "value": "color-picker", "label": "Color Picker" },
|
|
93
|
+
{ "value": "command", "label": "Command" },
|
|
94
|
+
{ "value": "datepicker", "label": "Datepicker" },
|
|
95
|
+
{ "value": "dialog", "label": "Dialog" },
|
|
96
|
+
{ "value": "drawer", "label": "Drawer" },
|
|
97
|
+
{ "value": "form-field", "label": "Form Field" },
|
|
98
|
+
{ "value": "hover-card", "label": "Hover Card" },
|
|
99
|
+
{ "value": "icon", "label": "Icon" },
|
|
100
|
+
{ "value": "inline-edit", "label": "Inline Edit" },
|
|
101
|
+
{ "value": "keys", "label": "Keys" },
|
|
102
|
+
{ "value": "list", "label": "List" },
|
|
103
|
+
{ "value": "mask", "label": "Mask" },
|
|
104
|
+
{ "value": "menu", "label": "Menu" },
|
|
105
|
+
{ "value": "pagination", "label": "Pagination" },
|
|
106
|
+
{ "value": "popover", "label": "Popover" },
|
|
107
|
+
{ "value": "progress", "label": "Progress" },
|
|
108
|
+
{ "value": "radio", "label": "Radio" },
|
|
109
|
+
{ "value": "resizable", "label": "Resizable" },
|
|
110
|
+
{ "value": "select", "label": "Select" },
|
|
111
|
+
{ "value": "separator", "label": "Separator" },
|
|
112
|
+
{ "value": "sheet", "label": "Sheet" },
|
|
113
|
+
{ "value": "sidenav", "label": "Sidenav" },
|
|
114
|
+
{ "value": "skeleton", "label": "Skeleton" },
|
|
115
|
+
{ "value": "slider", "label": "Slider" },
|
|
116
|
+
{ "value": "sonner", "label": "Sonner" },
|
|
117
|
+
{ "value": "spinner", "label": "Spinner" },
|
|
118
|
+
{ "value": "stepper", "label": "Stepper" },
|
|
119
|
+
{ "value": "switch", "label": "Switch" },
|
|
120
|
+
{ "value": "table", "label": "Table" },
|
|
121
|
+
{ "value": "toggle", "label": "Toggle" },
|
|
122
|
+
{ "value": "toggle-group", "label": "Toggle Group" },
|
|
123
|
+
{ "value": "tooltip", "label": "Tooltip" },
|
|
124
|
+
{ "value": "tour", "label": "Tour" },
|
|
125
|
+
{ "value": "tree", "label": "Tree" }
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"project": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"description": "The name of the project.",
|
|
131
|
+
"$default": {
|
|
132
|
+
"$source": "projectName"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|