@ngbase/adk 0.1.14 → 0.1.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngbase/adk",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ng-base/ngbase.git"
@@ -36,25 +36,25 @@
36
36
  "types": "./a11y/index.d.ts",
37
37
  "default": "./fesm2022/ngbase-adk-a11y.mjs"
38
38
  },
39
- "./avatar": {
40
- "types": "./avatar/index.d.ts",
41
- "default": "./fesm2022/ngbase-adk-avatar.mjs"
42
- },
43
- "./autocomplete": {
44
- "types": "./autocomplete/index.d.ts",
45
- "default": "./fesm2022/ngbase-adk-autocomplete.mjs"
46
- },
47
39
  "./accordion": {
48
40
  "types": "./accordion/index.d.ts",
49
41
  "default": "./fesm2022/ngbase-adk-accordion.mjs"
50
42
  },
43
+ "./bidi": {
44
+ "types": "./bidi/index.d.ts",
45
+ "default": "./fesm2022/ngbase-adk-bidi.mjs"
46
+ },
51
47
  "./breadcrumb": {
52
48
  "types": "./breadcrumb/index.d.ts",
53
49
  "default": "./fesm2022/ngbase-adk-breadcrumb.mjs"
54
50
  },
55
- "./bidi": {
56
- "types": "./bidi/index.d.ts",
57
- "default": "./fesm2022/ngbase-adk-bidi.mjs"
51
+ "./avatar": {
52
+ "types": "./avatar/index.d.ts",
53
+ "default": "./fesm2022/ngbase-adk-avatar.mjs"
54
+ },
55
+ "./autocomplete": {
56
+ "types": "./autocomplete/index.d.ts",
57
+ "default": "./fesm2022/ngbase-adk-autocomplete.mjs"
58
58
  },
59
59
  "./cache": {
60
60
  "types": "./cache/index.d.ts",
@@ -64,10 +64,6 @@
64
64
  "types": "./carousel/index.d.ts",
65
65
  "default": "./fesm2022/ngbase-adk-carousel.mjs"
66
66
  },
67
- "./checkbox": {
68
- "types": "./checkbox/index.d.ts",
69
- "default": "./fesm2022/ngbase-adk-checkbox.mjs"
70
- },
71
67
  "./chip": {
72
68
  "types": "./chip/index.d.ts",
73
69
  "default": "./fesm2022/ngbase-adk-chip.mjs"
@@ -76,10 +72,6 @@
76
72
  "types": "./collections/index.d.ts",
77
73
  "default": "./fesm2022/ngbase-adk-collections.mjs"
78
74
  },
79
- "./clipboard": {
80
- "types": "./clipboard/index.d.ts",
81
- "default": "./fesm2022/ngbase-adk-clipboard.mjs"
82
- },
83
75
  "./color-picker": {
84
76
  "types": "./color-picker/index.d.ts",
85
77
  "default": "./fesm2022/ngbase-adk-color-picker.mjs"
@@ -88,50 +80,58 @@
88
80
  "types": "./cookies/index.d.ts",
89
81
  "default": "./fesm2022/ngbase-adk-cookies.mjs"
90
82
  },
83
+ "./datepicker": {
84
+ "types": "./datepicker/index.d.ts",
85
+ "default": "./fesm2022/ngbase-adk-datepicker.mjs"
86
+ },
87
+ "./clipboard": {
88
+ "types": "./clipboard/index.d.ts",
89
+ "default": "./fesm2022/ngbase-adk-clipboard.mjs"
90
+ },
91
91
  "./dialog": {
92
92
  "types": "./dialog/index.d.ts",
93
93
  "default": "./fesm2022/ngbase-adk-dialog.mjs"
94
94
  },
95
+ "./checkbox": {
96
+ "types": "./checkbox/index.d.ts",
97
+ "default": "./fesm2022/ngbase-adk-checkbox.mjs"
98
+ },
95
99
  "./drag": {
96
100
  "types": "./drag/index.d.ts",
97
101
  "default": "./fesm2022/ngbase-adk-drag.mjs"
98
102
  },
99
- "./datepicker": {
100
- "types": "./datepicker/index.d.ts",
101
- "default": "./fesm2022/ngbase-adk-datepicker.mjs"
102
- },
103
- "./form-field": {
104
- "types": "./form-field/index.d.ts",
105
- "default": "./fesm2022/ngbase-adk-form-field.mjs"
106
- },
107
103
  "./hover-card": {
108
104
  "types": "./hover-card/index.d.ts",
109
105
  "default": "./fesm2022/ngbase-adk-hover-card.mjs"
110
106
  },
111
- "./icon": {
112
- "types": "./icon/index.d.ts",
113
- "default": "./fesm2022/ngbase-adk-icon.mjs"
107
+ "./jwt": {
108
+ "types": "./jwt/index.d.ts",
109
+ "default": "./fesm2022/ngbase-adk-jwt.mjs"
114
110
  },
115
111
  "./inline-edit": {
116
112
  "types": "./inline-edit/index.d.ts",
117
113
  "default": "./fesm2022/ngbase-adk-inline-edit.mjs"
118
114
  },
115
+ "./form-field": {
116
+ "types": "./form-field/index.d.ts",
117
+ "default": "./fesm2022/ngbase-adk-form-field.mjs"
118
+ },
119
+ "./keys": {
120
+ "types": "./keys/index.d.ts",
121
+ "default": "./fesm2022/ngbase-adk-keys.mjs"
122
+ },
119
123
  "./layout": {
120
124
  "types": "./layout/index.d.ts",
121
125
  "default": "./fesm2022/ngbase-adk-layout.mjs"
122
126
  },
123
- "./jwt": {
124
- "types": "./jwt/index.d.ts",
125
- "default": "./fesm2022/ngbase-adk-jwt.mjs"
127
+ "./icon": {
128
+ "types": "./icon/index.d.ts",
129
+ "default": "./fesm2022/ngbase-adk-icon.mjs"
126
130
  },
127
131
  "./list": {
128
132
  "types": "./list/index.d.ts",
129
133
  "default": "./fesm2022/ngbase-adk-list.mjs"
130
134
  },
131
- "./keys": {
132
- "types": "./keys/index.d.ts",
133
- "default": "./fesm2022/ngbase-adk-keys.mjs"
134
- },
135
135
  "./mask": {
136
136
  "types": "./mask/index.d.ts",
137
137
  "default": "./fesm2022/ngbase-adk-mask.mjs"
@@ -140,33 +140,29 @@
140
140
  "types": "./menu/index.d.ts",
141
141
  "default": "./fesm2022/ngbase-adk-menu.mjs"
142
142
  },
143
- "./network": {
144
- "types": "./network/index.d.ts",
145
- "default": "./fesm2022/ngbase-adk-network.mjs"
143
+ "./pagination": {
144
+ "types": "./pagination/index.d.ts",
145
+ "default": "./fesm2022/ngbase-adk-pagination.mjs"
146
146
  },
147
147
  "./otp": {
148
148
  "types": "./otp/index.d.ts",
149
149
  "default": "./fesm2022/ngbase-adk-otp.mjs"
150
150
  },
151
+ "./network": {
152
+ "types": "./network/index.d.ts",
153
+ "default": "./fesm2022/ngbase-adk-network.mjs"
154
+ },
151
155
  "./popover": {
152
156
  "types": "./popover/index.d.ts",
153
157
  "default": "./fesm2022/ngbase-adk-popover.mjs"
154
158
  },
155
- "./portal": {
156
- "types": "./portal/index.d.ts",
157
- "default": "./fesm2022/ngbase-adk-portal.mjs"
158
- },
159
159
  "./progress": {
160
160
  "types": "./progress/index.d.ts",
161
161
  "default": "./fesm2022/ngbase-adk-progress.mjs"
162
162
  },
163
- "./pagination": {
164
- "types": "./pagination/index.d.ts",
165
- "default": "./fesm2022/ngbase-adk-pagination.mjs"
166
- },
167
- "./radio": {
168
- "types": "./radio/index.d.ts",
169
- "default": "./fesm2022/ngbase-adk-radio.mjs"
163
+ "./portal": {
164
+ "types": "./portal/index.d.ts",
165
+ "default": "./fesm2022/ngbase-adk-portal.mjs"
170
166
  },
171
167
  "./resizable": {
172
168
  "types": "./resizable/index.d.ts",
@@ -180,6 +176,10 @@
180
176
  "types": "./select/index.d.ts",
181
177
  "default": "./fesm2022/ngbase-adk-select.mjs"
182
178
  },
179
+ "./radio": {
180
+ "types": "./radio/index.d.ts",
181
+ "default": "./fesm2022/ngbase-adk-radio.mjs"
182
+ },
183
183
  "./sheet": {
184
184
  "types": "./sheet/index.d.ts",
185
185
  "default": "./fesm2022/ngbase-adk-sheet.mjs"
@@ -188,25 +188,29 @@
188
188
  "types": "./selectable/index.d.ts",
189
189
  "default": "./fesm2022/ngbase-adk-selectable.mjs"
190
190
  },
191
- "./sidenav": {
192
- "types": "./sidenav/index.d.ts",
193
- "default": "./fesm2022/ngbase-adk-sidenav.mjs"
194
- },
195
191
  "./slider": {
196
192
  "types": "./slider/index.d.ts",
197
193
  "default": "./fesm2022/ngbase-adk-slider.mjs"
198
194
  },
195
+ "./sidenav": {
196
+ "types": "./sidenav/index.d.ts",
197
+ "default": "./fesm2022/ngbase-adk-sidenav.mjs"
198
+ },
199
199
  "./sonner": {
200
200
  "types": "./sonner/index.d.ts",
201
201
  "default": "./fesm2022/ngbase-adk-sonner.mjs"
202
202
  },
203
+ "./switch": {
204
+ "types": "./switch/index.d.ts",
205
+ "default": "./fesm2022/ngbase-adk-switch.mjs"
206
+ },
203
207
  "./stepper": {
204
208
  "types": "./stepper/index.d.ts",
205
209
  "default": "./fesm2022/ngbase-adk-stepper.mjs"
206
210
  },
207
- "./switch": {
208
- "types": "./switch/index.d.ts",
209
- "default": "./fesm2022/ngbase-adk-switch.mjs"
211
+ "./table": {
212
+ "types": "./table/index.d.ts",
213
+ "default": "./fesm2022/ngbase-adk-table.mjs"
210
214
  },
211
215
  "./test": {
212
216
  "types": "./test/index.d.ts",
@@ -216,10 +220,6 @@
216
220
  "types": "./tabs/index.d.ts",
217
221
  "default": "./fesm2022/ngbase-adk-tabs.mjs"
218
222
  },
219
- "./table": {
220
- "types": "./table/index.d.ts",
221
- "default": "./fesm2022/ngbase-adk-table.mjs"
222
- },
223
223
  "./toggle": {
224
224
  "types": "./toggle/index.d.ts",
225
225
  "default": "./fesm2022/ngbase-adk-toggle.mjs"
@@ -228,22 +228,22 @@
228
228
  "types": "./toggle-group/index.d.ts",
229
229
  "default": "./fesm2022/ngbase-adk-toggle-group.mjs"
230
230
  },
231
- "./tour": {
232
- "types": "./tour/index.d.ts",
233
- "default": "./fesm2022/ngbase-adk-tour.mjs"
234
- },
235
231
  "./tooltip": {
236
232
  "types": "./tooltip/index.d.ts",
237
233
  "default": "./fesm2022/ngbase-adk-tooltip.mjs"
238
234
  },
239
- "./translate": {
240
- "types": "./translate/index.d.ts",
241
- "default": "./fesm2022/ngbase-adk-translate.mjs"
242
- },
243
235
  "./tree": {
244
236
  "types": "./tree/index.d.ts",
245
237
  "default": "./fesm2022/ngbase-adk-tree.mjs"
246
238
  },
239
+ "./tour": {
240
+ "types": "./tour/index.d.ts",
241
+ "default": "./fesm2022/ngbase-adk-tour.mjs"
242
+ },
243
+ "./translate": {
244
+ "types": "./translate/index.d.ts",
245
+ "default": "./fesm2022/ngbase-adk-translate.mjs"
246
+ },
247
247
  "./utils": {
248
248
  "types": "./utils/index.d.ts",
249
249
  "default": "./fesm2022/ngbase-adk-utils.mjs"
@@ -253,4 +253,4 @@
253
253
  "default": "./fesm2022/ngbase-adk-virtualizer.mjs"
254
254
  }
255
255
  }
256
- }
256
+ }
@@ -1,34 +1,22 @@
1
1
  # MEE Alert
2
2
 
3
3
  ```typescript
4
- import { alertPortal } from '@/ui/alert';
4
+ import { Alert } from '@/ui/alert';
5
5
  ```
6
6
 
7
- ## Usage
7
+ ## Components
8
+
9
+ ### `<<%= name %>-alert>`
8
10
 
9
- ```ts
10
- const alert = alertPortal();
11
- alert.open({
12
- title: 'Alert',
13
- description: 'This is an alert',
14
- actions: [
15
- {
16
- text: 'Cancel',
17
- type: 'secondary', // ButtonVariant
18
- handler: close => close(),
19
- },
20
- {
21
- text: 'OK',
22
- type: 'primary', // ButtonVariant
23
- handler: close => {
24
- okHandler();
25
- close();
26
- },
27
- },
28
- ],
29
- });
11
+ - **Inputs:**
12
+ - `variant`: 'error' | 'default' | 'success' | 'info' = 'default' - The variant of the alert
13
+
14
+ ## Usage
30
15
 
31
- function okHandler() {
32
- console.log('OK');
33
- }
16
+ ```html
17
+ <<%= name %>-alert variant="info">
18
+ <ng-container class="a-title">Info</ng-container>
19
+ This is an info alert
20
+ </<%= name %>-alert>
21
+ <<%= name %>-alert variant="success"> This is a success alert </<%= name %>-alert>
34
22
  ```
@@ -1,62 +0,0 @@
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: (v?: any) => any) => 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="text-muted-foreground pb-3">{{ 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,34 @@
1
+ # MEE Confirmation
2
+
3
+ ```typescript
4
+ import { confirmationPortal } from '@/ui/confirmation';
5
+ ```
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ const confirmation = confirmationPortal();
11
+ confirmation.open({
12
+ title: 'Confirmation',
13
+ description: 'This is a confirmation dialog.',
14
+ actions: [
15
+ {
16
+ text: 'Cancel',
17
+ type: 'secondary', // ButtonVariant
18
+ handler: close => close(),
19
+ },
20
+ {
21
+ text: 'OK',
22
+ type: 'primary', // ButtonVariant
23
+ handler: close => {
24
+ okHandler();
25
+ close();
26
+ },
27
+ },
28
+ ],
29
+ });
30
+
31
+ function okHandler() {
32
+ console.log('OK');
33
+ }
34
+ ```
@@ -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 ConfirmationOptions {
7
+ title?: string;
8
+ description?: string;
9
+ actions?: {
10
+ text: string;
11
+ type?: ButtonVariant;
12
+ handler: (fn: (v?: any) => any) => any;
13
+ }[];
14
+ }
15
+
16
+ export function ConfirmationPortal() {
17
+ const base = dialogPortal();
18
+
19
+ function open<T>(opt: ConfirmationOptions, 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 || Confirmation, 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 %>-confirmation',
44
+ changeDetection: ChangeDetectionStrategy.OnPush,
45
+ imports: [Button],
46
+ template: `
47
+ <!-- <h4 class="mb-2 text-base font-bold">{{ data?.title }}</h4> -->
48
+ <p class="text-muted-foreground pb-3">{{ 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 Confirmation {
59
+ diaRef = inject<DialogRef<ConfirmationOptions>>(DialogRef);
60
+
61
+ data = this.diaRef.options?.data;
62
+ }
@@ -0,0 +1 @@
1
+ export * from './confirmation';
@@ -40,7 +40,8 @@ export class DatePicker<D> extends NgbDatePicker<D> {}
40
40
  exportAs: '<%= name %>DatepickerTrigger',
41
41
  providers: [registerDatePicker(DatePicker), aliasDatePickerTrigger(DatepickerTrigger)],
42
42
  host: {
43
- class: 'cursor-pointer hover:bg-muted outline-none w-full bg-transparent',
43
+ class:
44
+ 'cursor-pointer hover:bg-muted outline-none w-full bg-transparent placeholder:text-gray-400',
44
45
  },
45
46
  })
46
47
  export class DatepickerTrigger<D> extends NgbDatepickerTrigger<D> {}
@@ -49,7 +49,7 @@ export class FormField {
49
49
  selector: '[<%= name %>Input]',
50
50
  hostDirectives: [{ directive: InputBase, inputs: ['value'], outputs: ['valueChange'] }],
51
51
  host: {
52
- class: 'outline-none w-full bg-transparent',
52
+ class: 'outline-none w-full bg-transparent placeholder:text-gray-400',
53
53
  '[class.border-red-500]': 'formField?.hasErrors()',
54
54
  },
55
55
  })
@@ -5,12 +5,13 @@ import { IconType, NgIconComponent } from '@ng-icons/core';
5
5
  selector: '<%= name %>-icon',
6
6
  imports: [NgIconComponent],
7
7
  changeDetection: ChangeDetectionStrategy.OnPush,
8
- template: `<ng-icon [name]="name()" [size]="size()"></ng-icon>`,
8
+ template: `<ng-icon [name]="name()" [svg]="svg()" [size]="size()"></ng-icon>`,
9
9
  host: {
10
10
  class: 'inline-flex items-center justify-center',
11
11
  },
12
12
  })
13
13
  export class Icon {
14
- readonly name = input.required<IconType>();
14
+ readonly name = input<IconType>();
15
15
  readonly size = input<string>('1rem');
16
+ readonly svg = input<string>();
16
17
  }
@@ -1,4 +1,4 @@
1
- import { Component, input } from '@angular/core';
1
+ import { Component, input, numberAttribute } from '@angular/core';
2
2
 
3
3
  @Component({
4
4
  selector: '<%= name %>-spinner',
@@ -45,7 +45,7 @@ import { Component, input } from '@angular/core';
45
45
  })
46
46
  export class Spinner {
47
47
  readonly mode = input<'light' | 'dark' | ''>('light');
48
- readonly diameter = input<number>(35);
49
- readonly strokeWidth = input<any>(3);
48
+ readonly diameter = input(35, { transform: numberAttribute });
49
+ readonly strokeWidth = input(3, { transform: numberAttribute });
50
50
  readonly root = input<boolean>(false);
51
51
  }