@elavarasanbititude/ng-cwr-sidebar 0.0.7 → 0.0.8
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 +130 -14
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @elavarasanbititude/ng-cwr-sidebar
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40elavarasanbititude%2Fng-cwr-sidebar)
|
|
4
|
+
[](https://www.npmjs.com/package/@elavarasanbititude/ng-cwr-sidebar)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
6
|
|
|
3
7
|
A modern, flexible, and fully customizable Angular sidebar component library built with Angular 21 and SCSS. Perfect for building responsive navigation sidebars with nested menus, icons, and badges.
|
|
4
8
|
|
|
@@ -17,7 +21,20 @@ A modern, flexible, and fully customizable Angular sidebar component library bui
|
|
|
17
21
|
## Installation
|
|
18
22
|
|
|
19
23
|
```bash
|
|
20
|
-
npm install @
|
|
24
|
+
npm install @elavarasanbititude/ng-cwr-sidebar
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Requirements
|
|
28
|
+
|
|
29
|
+
This library requires the following peer dependencies:
|
|
30
|
+
|
|
31
|
+
- **Angular**: ^21.2.0
|
|
32
|
+
- **RxJS**: ~7.8.0
|
|
33
|
+
|
|
34
|
+
Make sure these packages are already installed in your project:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @angular/common @angular/core @angular/router rxjs
|
|
21
38
|
```
|
|
22
39
|
|
|
23
40
|
## Quick Start
|
|
@@ -25,7 +42,7 @@ npm install @yourname/ng-cwr-sidebar
|
|
|
25
42
|
### 1. Import the Component
|
|
26
43
|
|
|
27
44
|
```typescript
|
|
28
|
-
import { Sidebar } from '@
|
|
45
|
+
import { Sidebar } from '@elavarasanbititude/ng-cwr-sidebar';
|
|
29
46
|
|
|
30
47
|
@Component({
|
|
31
48
|
selector: 'app-root',
|
|
@@ -70,7 +87,7 @@ export class AppComponent {
|
|
|
70
87
|
### 2. Using the Sidebar Service
|
|
71
88
|
|
|
72
89
|
```typescript
|
|
73
|
-
import { SidebarService } from '@
|
|
90
|
+
import { SidebarService } from '@elavarasanbititude/ng-cwr-sidebar';
|
|
74
91
|
|
|
75
92
|
export class MyComponent {
|
|
76
93
|
constructor(private sidebarService: SidebarService) {}
|
|
@@ -112,17 +129,35 @@ interface SidebarConfig {
|
|
|
112
129
|
|
|
113
130
|
```typescript
|
|
114
131
|
interface SidebarMenuItem {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
// Identification & Display
|
|
133
|
+
id?: string; // Unique identifier
|
|
134
|
+
label: string; // Display label (required)
|
|
135
|
+
icon?: string; // Icon (emoji or HTML)
|
|
136
|
+
tooltip?: string; // Tooltip text on hover
|
|
137
|
+
cssClass?: string; // Additional CSS classes to apply
|
|
138
|
+
|
|
139
|
+
// Navigation & Actions
|
|
140
|
+
route?: string; // Router link
|
|
141
|
+
queryParams?: Record<string, any>; // Query parameters to pass with the route
|
|
142
|
+
queryParamsHandling?: 'merge' | 'preserve'; // How to handle query parameters
|
|
143
|
+
action?: () => void; // Custom click action function
|
|
144
|
+
target?: '_blank' | '_self' | '_parent' | '_top'; // Link target attribute
|
|
145
|
+
|
|
146
|
+
// Appearance & Structure
|
|
147
|
+
children?: SidebarMenuItem[]; // Nested menu items
|
|
122
148
|
badge?: {
|
|
123
149
|
text: string;
|
|
124
|
-
color?: string;
|
|
150
|
+
color?: string; // Badge background color
|
|
125
151
|
};
|
|
152
|
+
divider?: boolean; // Show a divider line after this item
|
|
153
|
+
|
|
154
|
+
// State & Visibility
|
|
155
|
+
disabled?: boolean; // Disable/grey out menu item
|
|
156
|
+
visible?: boolean; // Show/hide menu item based on custom logic
|
|
157
|
+
expandedByDefault?: boolean; // Whether to expand nested children by default
|
|
158
|
+
|
|
159
|
+
// Custom Logic
|
|
160
|
+
isActive?: () => boolean; // Custom function to determine if item is active
|
|
126
161
|
}
|
|
127
162
|
```
|
|
128
163
|
|
|
@@ -185,6 +220,58 @@ const menuItems: SidebarMenuItem[] = [
|
|
|
185
220
|
];
|
|
186
221
|
```
|
|
187
222
|
|
|
223
|
+
### Advanced Features
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
const menuItems: SidebarMenuItem[] = [
|
|
227
|
+
{
|
|
228
|
+
label: 'Dashboard',
|
|
229
|
+
icon: '📊',
|
|
230
|
+
route: '/dashboard',
|
|
231
|
+
tooltip: 'Go to dashboard',
|
|
232
|
+
expandedByDefault: true,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: 'External Link',
|
|
236
|
+
icon: '🔗',
|
|
237
|
+
route: 'https://example.com',
|
|
238
|
+
target: '_blank',
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
label: 'Admin Panel',
|
|
242
|
+
icon: '⚙️',
|
|
243
|
+
visible: userRole === 'admin', // Hide for non-admin users
|
|
244
|
+
children: [
|
|
245
|
+
{
|
|
246
|
+
label: 'Settings',
|
|
247
|
+
route: '/admin/settings',
|
|
248
|
+
tooltip: 'Configure application',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: 'Users',
|
|
252
|
+
route: '/admin/users',
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
label: 'Reports',
|
|
258
|
+
icon: '📈',
|
|
259
|
+
route: '/reports',
|
|
260
|
+
queryParams: { year: 2026, month: 4 },
|
|
261
|
+
queryParamsHandling: 'merge',
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
divider: true,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
label: 'Help',
|
|
268
|
+
icon: '❓',
|
|
269
|
+
disabled: maintenanceMode,
|
|
270
|
+
isActive: () => router.url.includes('/help'),
|
|
271
|
+
},
|
|
272
|
+
];
|
|
273
|
+
```
|
|
274
|
+
|
|
188
275
|
### Themed Configuration
|
|
189
276
|
|
|
190
277
|
```typescript
|
|
@@ -291,13 +378,42 @@ The component uses SCSS and includes both light and dark theme variants. You can
|
|
|
291
378
|
- Safari (latest)
|
|
292
379
|
- Edge (latest)
|
|
293
380
|
|
|
381
|
+
## Changelog
|
|
382
|
+
|
|
383
|
+
See [CHANGELOG.md](./CHANGELOG.md) for detailed information about each release.
|
|
384
|
+
|
|
294
385
|
## License
|
|
295
386
|
|
|
296
|
-
MIT
|
|
387
|
+
MIT © [Bititude](https://github.com/bititude)
|
|
388
|
+
|
|
389
|
+
## Support
|
|
390
|
+
|
|
391
|
+
For issues, questions, or contributions:
|
|
392
|
+
|
|
393
|
+
- **Create an Issue**: [GitHub Issues](https://github.com/bititude/ng-cwr-sidebar/issues)
|
|
394
|
+
- **Documentation**: Check this README for comprehensive usage examples
|
|
395
|
+
- **Community**: Open to pull requests and community contributions
|
|
297
396
|
|
|
298
397
|
## Contributing
|
|
299
398
|
|
|
300
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
399
|
+
Contributions are welcome! Please feel free to submit a Pull Request. To contribute:
|
|
400
|
+
|
|
401
|
+
1. Fork the repository
|
|
402
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
403
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
404
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
405
|
+
5. Open a Pull Request
|
|
406
|
+
|
|
407
|
+
Please ensure your code follows the project's coding standards and includes appropriate tests.
|
|
408
|
+
|
|
409
|
+
## Related Packages
|
|
410
|
+
|
|
411
|
+
- [@elavarasanbititude/design-system](https://github.com/bititude/design-system) - Design tokens and styles
|
|
412
|
+
- Other CWR packages available in the [Bititude Platform](https://github.com/bititude/platform)
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
Made with ❤️ by [Bititude](https://github.com/bititude)
|
|
301
417
|
|
|
302
418
|
## Support
|
|
303
419
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elavarasanbititude/ng-cwr-sidebar",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "A modern, flexible, and customizable Angular sidebar component library",
|
|
5
5
|
"author": "elavarasanbititude",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/
|
|
9
|
+
"url": "https://github.com/bititude/platform",
|
|
10
|
+
"directory": "packages/ng-cwr-sidebar"
|
|
10
11
|
},
|
|
11
12
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/
|
|
13
|
+
"url": "https://github.com/bititude/platform/issues"
|
|
13
14
|
},
|
|
14
|
-
"homepage": "https://github.com/
|
|
15
|
+
"homepage": "https://github.com/bititude/platform/tree/main/packages/ng-cwr-sidebar#readme",
|
|
15
16
|
"keywords": [
|
|
16
17
|
"angular",
|
|
17
18
|
"sidebar",
|