@vroxal/vd-angular 1.0.1 → 1.1.0
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 +243 -32
- package/fesm2022/vroxal-vd-angular.mjs +38 -38
- package/fesm2022/vroxal-vd-angular.mjs.map +1 -1
- package/guidelines/USAGE_GUIDELINES.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,63 +1,274 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vroxal/vd-angular
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular component library for the Vroxal Design.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What This Package Includes
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`@vroxal/vd-angular` provides Vroxal UI building blocks for Angular applications, including:
|
|
8
|
+
|
|
9
|
+
- actions and inputs
|
|
10
|
+
- date and time pickers
|
|
11
|
+
- dropdowns, tooltips, dialogs, drawers, and confirmation flows
|
|
12
|
+
- navigation and layout components
|
|
13
|
+
- data display and feedback states
|
|
14
|
+
|
|
15
|
+
The package is designed to be used together with:
|
|
16
|
+
|
|
17
|
+
- `@vroxal/vd-tokens`
|
|
18
|
+
- `@vroxal/vd-icons`
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- Angular 21
|
|
23
|
+
- `@angular/cdk`
|
|
24
|
+
- `@vroxal/vd-tokens`
|
|
25
|
+
- `@vroxal/vd-icons`
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Install the package and its peer dependencies:
|
|
8
30
|
|
|
9
31
|
```bash
|
|
10
|
-
|
|
32
|
+
npm install @vroxal/vd-angular @vroxal/vd-tokens @vroxal/vd-icons @angular/cdk
|
|
11
33
|
```
|
|
12
34
|
|
|
13
|
-
|
|
35
|
+
## Required Global Styles
|
|
14
36
|
|
|
15
|
-
|
|
16
|
-
|
|
37
|
+
Add the Vroxal tokens, icons, and library stylesheet to your app's global styles.
|
|
38
|
+
|
|
39
|
+
Example `angular.json` configuration:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"projects": {
|
|
44
|
+
"your-app": {
|
|
45
|
+
"architect": {
|
|
46
|
+
"build": {
|
|
47
|
+
"options": {
|
|
48
|
+
"styles": [
|
|
49
|
+
"node_modules/@vroxal/vd-tokens/dist/index.css",
|
|
50
|
+
"node_modules/@vroxal/vd-icons/dist/vd-icon.css",
|
|
51
|
+
"node_modules/@vroxal/vd-angular/styles/style.css",
|
|
52
|
+
"src/styles.css"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
17
60
|
```
|
|
18
61
|
|
|
19
|
-
|
|
62
|
+
Without these styles, tokens, icons, and some shared component styles will be missing.
|
|
20
63
|
|
|
21
|
-
|
|
64
|
+
## Quick Start
|
|
22
65
|
|
|
23
|
-
|
|
24
|
-
|
|
66
|
+
Import standalone components from the package root:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { Component } from '@angular/core';
|
|
70
|
+
import { VdButton, VdInput } from '@vroxal/vd-angular';
|
|
71
|
+
|
|
72
|
+
@Component({
|
|
73
|
+
selector: 'app-example',
|
|
74
|
+
standalone: true,
|
|
75
|
+
imports: [VdButton, VdInput],
|
|
76
|
+
template: `
|
|
77
|
+
<vd-input label="Email" placeholder="Enter your email"></vd-input>
|
|
78
|
+
<vd-button label="Continue"></vd-button>
|
|
79
|
+
`,
|
|
80
|
+
})
|
|
81
|
+
export class ExampleComponent {}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## NgModule Support
|
|
85
|
+
|
|
86
|
+
If your app still uses NgModules, import the bundled module:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { NgModule } from '@angular/core';
|
|
90
|
+
import { VdAngularComponentsModule } from '@vroxal/vd-angular';
|
|
91
|
+
|
|
92
|
+
@NgModule({
|
|
93
|
+
imports: [VdAngularComponentsModule],
|
|
94
|
+
})
|
|
95
|
+
export class SharedUiModule {}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Overlay Services
|
|
99
|
+
|
|
100
|
+
Some library features are used through services instead of direct template composition.
|
|
101
|
+
|
|
102
|
+
### Toast
|
|
103
|
+
|
|
104
|
+
Add a single toast host near the app shell:
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<router-outlet></router-outlet> <vd-toast></vd-toast>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Trigger toasts from any injected service consumer:
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { Component } from '@angular/core';
|
|
114
|
+
import { VdButton, VdToast, VdToastService } from '@vroxal/vd-angular';
|
|
115
|
+
|
|
116
|
+
@Component({
|
|
117
|
+
selector: 'app-toast-example',
|
|
118
|
+
standalone: true,
|
|
119
|
+
imports: [VdButton, VdToast],
|
|
120
|
+
template: `
|
|
121
|
+
<vd-button label="Show toast" (click)="showToast()"></vd-button>
|
|
122
|
+
<vd-toast></vd-toast>
|
|
123
|
+
`,
|
|
124
|
+
})
|
|
125
|
+
export class ToastExampleComponent {
|
|
126
|
+
constructor(private readonly toastService: VdToastService) {
|
|
127
|
+
this.toastService.configure({ placement: 'bottom-right', maxStack: 3 });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
showToast(): void {
|
|
131
|
+
this.toastService.show({
|
|
132
|
+
color: 'success',
|
|
133
|
+
title: 'Saved',
|
|
134
|
+
description: 'Your changes were saved successfully.',
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
25
138
|
```
|
|
26
139
|
|
|
27
|
-
|
|
140
|
+
### Dialog
|
|
28
141
|
|
|
29
|
-
|
|
142
|
+
`VdDialogService.open()` renders an Angular `TemplateRef` and resolves a promise with `'primary'`, `'secondary'`, or `'close'`.
|
|
30
143
|
|
|
31
|
-
|
|
144
|
+
```ts
|
|
145
|
+
import { Component, TemplateRef, ViewChild } from '@angular/core';
|
|
146
|
+
import { VdButton, VdDialogService, VdInput } from '@vroxal/vd-angular';
|
|
32
147
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
148
|
+
@Component({
|
|
149
|
+
selector: 'app-dialog-example',
|
|
150
|
+
standalone: true,
|
|
151
|
+
imports: [VdButton, VdInput],
|
|
152
|
+
template: `
|
|
153
|
+
<ng-template #dialogContent>
|
|
154
|
+
<vd-input label="Name" placeholder="Enter name"></vd-input>
|
|
155
|
+
</ng-template>
|
|
37
156
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
157
|
+
<vd-button label="Open dialog" (click)="openDialog()"></vd-button>
|
|
158
|
+
`,
|
|
159
|
+
})
|
|
160
|
+
export class DialogExampleComponent {
|
|
161
|
+
@ViewChild('dialogContent', { static: true }) dialogContent!: TemplateRef<unknown>;
|
|
42
162
|
|
|
43
|
-
|
|
163
|
+
constructor(private readonly dialogService: VdDialogService) {}
|
|
44
164
|
|
|
45
|
-
|
|
165
|
+
openDialog(): void {
|
|
166
|
+
this.dialogService
|
|
167
|
+
.open({
|
|
168
|
+
title: 'Edit Details',
|
|
169
|
+
contentTemplate: this.dialogContent,
|
|
170
|
+
primaryActionLabel: 'Save',
|
|
171
|
+
secondaryActionLabel: 'Cancel',
|
|
172
|
+
})
|
|
173
|
+
.then((result) => {
|
|
174
|
+
if (result === 'primary') {
|
|
175
|
+
// persist changes
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Drawer
|
|
183
|
+
|
|
184
|
+
`VdDrawerService.open()` also accepts a `TemplateRef` and resolves `'primary'`, `'secondary'`, or `'close'`.
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
this.drawerService.open({
|
|
188
|
+
title: 'Customer Details',
|
|
189
|
+
size: 'md',
|
|
190
|
+
contentTemplate: this.drawerContent,
|
|
191
|
+
primaryActionLabel: 'Save Changes',
|
|
192
|
+
secondaryActionLabel: 'Cancel',
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Available sizes:
|
|
197
|
+
|
|
198
|
+
- `'sm'`
|
|
199
|
+
- `'md'`
|
|
200
|
+
- `'lg'`
|
|
201
|
+
|
|
202
|
+
### Confirmation Dialog
|
|
203
|
+
|
|
204
|
+
Use `VdConfirmationDialogService` for confirm/cancel flows:
|
|
205
|
+
|
|
206
|
+
```ts
|
|
207
|
+
this.confirmationDialogService.confirm({
|
|
208
|
+
title: 'Delete item?',
|
|
209
|
+
description: 'This action cannot be undone.',
|
|
210
|
+
color: 'error',
|
|
211
|
+
confirmLabel: 'Delete',
|
|
212
|
+
cancelLabel: 'Cancel',
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The returned promise resolves to `'confirm'` or `'cancel'`.
|
|
217
|
+
|
|
218
|
+
## Import Rules
|
|
219
|
+
|
|
220
|
+
- Import from `@vroxal/vd-angular` only
|
|
221
|
+
- Do not deep-import files from `src/`, `fesm2022/`, or internal folders
|
|
222
|
+
- Prefer the standalone component exports unless your app is still module-based
|
|
223
|
+
|
|
224
|
+
## Available Component Areas
|
|
225
|
+
|
|
226
|
+
- Actions: button, icon button, icon, badge
|
|
227
|
+
- Inputs and selection: input, textarea, select, number input, file input, checkbox, checkbox group, radio button, radio group, switch, verification code input
|
|
228
|
+
- Date and time: single date, range date, inline date, date-time, time picker
|
|
229
|
+
- Overlays and feedback: tooltip, dropdown, dialog, drawer, confirmation dialog, toast, alert
|
|
230
|
+
- Navigation and layout: breadcrumb, navbar, sidebar, accordion, divider, tab
|
|
231
|
+
- Data and states: datatable, pagination, progress tracker, empty state, loading state
|
|
232
|
+
|
|
233
|
+
## Package References
|
|
234
|
+
|
|
235
|
+
The published package includes usage guidance and the exported API inventory:
|
|
236
|
+
|
|
237
|
+
- `node_modules/@vroxal/vd-angular/guidelines/COMPONENT_REGISTRY.md`
|
|
238
|
+
- `node_modules/@vroxal/vd-angular/guidelines/USAGE_GUIDELINES.md`
|
|
239
|
+
- `node_modules/@vroxal/vd-angular/guidelines/component-registry.json`
|
|
240
|
+
|
|
241
|
+
These files are useful if you want the full selector list and service/component reference beyond the quick-start examples above.
|
|
242
|
+
|
|
243
|
+
## Development
|
|
244
|
+
|
|
245
|
+
From the workspace root:
|
|
46
246
|
|
|
47
247
|
```bash
|
|
48
|
-
|
|
248
|
+
npm run build:lib
|
|
49
249
|
```
|
|
50
250
|
|
|
51
|
-
|
|
251
|
+
Or with Angular CLI:
|
|
52
252
|
|
|
53
|
-
|
|
253
|
+
```bash
|
|
254
|
+
ng build angular-components
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
The packaged output is generated in `dist/angular-components`.
|
|
258
|
+
|
|
259
|
+
## Testing
|
|
260
|
+
|
|
261
|
+
Run workspace unit tests from the repo root:
|
|
54
262
|
|
|
55
263
|
```bash
|
|
56
|
-
|
|
264
|
+
npm test
|
|
57
265
|
```
|
|
58
266
|
|
|
59
|
-
|
|
267
|
+
## Publishing
|
|
60
268
|
|
|
61
|
-
|
|
269
|
+
After building:
|
|
62
270
|
|
|
63
|
-
|
|
271
|
+
```bash
|
|
272
|
+
cd dist/angular-components
|
|
273
|
+
npm publish
|
|
274
|
+
```
|