@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 CHANGED
@@ -1,63 +1,274 @@
1
- # AngularComponents
1
+ # @vroxal/vd-angular
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.0.0.
3
+ Angular component library for the Vroxal Design.
4
4
 
5
- ## Code scaffolding
5
+ ## What This Package Includes
6
6
 
7
- Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
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
- ng generate component component-name
32
+ npm install @vroxal/vd-angular @vroxal/vd-tokens @vroxal/vd-icons @angular/cdk
11
33
  ```
12
34
 
13
- For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
35
+ ## Required Global Styles
14
36
 
15
- ```bash
16
- ng generate --help
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
- ## Building
62
+ Without these styles, tokens, icons, and some shared component styles will be missing.
20
63
 
21
- To build the library, run:
64
+ ## Quick Start
22
65
 
23
- ```bash
24
- ng build angular-components
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
- This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
140
+ ### Dialog
28
141
 
29
- ### Publishing the Library
142
+ `VdDialogService.open()` renders an Angular `TemplateRef` and resolves a promise with `'primary'`, `'secondary'`, or `'close'`.
30
143
 
31
- Once the project is built, you can publish your library by following these steps:
144
+ ```ts
145
+ import { Component, TemplateRef, ViewChild } from '@angular/core';
146
+ import { VdButton, VdDialogService, VdInput } from '@vroxal/vd-angular';
32
147
 
33
- 1. Navigate to the `dist` directory:
34
- ```bash
35
- cd dist/angular-components
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
- 2. Run the `npm publish` command to publish your library to the npm registry:
39
- ```bash
40
- npm publish
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
- ## Running unit tests
163
+ constructor(private readonly dialogService: VdDialogService) {}
44
164
 
45
- To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
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
- ng test
248
+ npm run build:lib
49
249
  ```
50
250
 
51
- ## Running end-to-end tests
251
+ Or with Angular CLI:
52
252
 
53
- For end-to-end (e2e) testing, run:
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
- ng e2e
264
+ npm test
57
265
  ```
58
266
 
59
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
267
+ ## Publishing
60
268
 
61
- ## Additional Resources
269
+ After building:
62
270
 
63
- For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
271
+ ```bash
272
+ cd dist/angular-components
273
+ npm publish
274
+ ```