ng-hub-ui-breadcrumbs 1.0.2 β 21.0.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 +185 -437
- package/fesm2022/ng-hub-ui-breadcrumbs.mjs +26 -35
- package/fesm2022/ng-hub-ui-breadcrumbs.mjs.map +1 -1
- package/package.json +3 -5
- package/src/lib/styles/breadcrumbs.scss +93 -0
- package/types/ng-hub-ui-breadcrumbs.d.ts +42 -0
- package/esm2022/lib/components/hub-breadcrumbs/hub-breadcrumbs.component.mjs +0 -25
- package/esm2022/lib/directives/hub-breadcrumb-item.directive.mjs +0 -17
- package/esm2022/lib/hub-breadcrumbs.module.mjs +0 -18
- package/esm2022/lib/services/hub-breadcrumbs.service.mjs +0 -72
- package/esm2022/lib/types/breadcrumb-item.mjs +0 -2
- package/esm2022/lib/types/breadcrumb-template-context.mjs +0 -2
- package/esm2022/ng-hub-ui-breadcrumbs.mjs +0 -5
- package/esm2022/public-api.mjs +0 -8
- package/index.d.ts +0 -5
- package/lib/components/hub-breadcrumbs/hub-breadcrumbs.component.d.ts +0 -9
- package/lib/directives/hub-breadcrumb-item.directive.d.ts +0 -7
- package/lib/hub-breadcrumbs.module.d.ts +0 -8
- package/lib/services/hub-breadcrumbs.service.d.ts +0 -12
- package/lib/types/breadcrumb-item.d.ts +0 -5
- package/lib/types/breadcrumb-template-context.d.ts +0 -5
- package/ng-hub-ui-breadcrumbs-1.0.2.tgz +0 -0
- package/public-api.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,489 +1,298 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ng-hub-ui-breadcrumbs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+

|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A flexible and reusable breadcrumb component for Angular applications that automatically generates breadcrumbs entirely based on your routing configuration.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
npm install ng-hub-ui-breadcrumbs
|
|
9
|
-
```
|
|
8
|
+
## π§© Library Family `ng-hub-ui`
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
This library is part of the **ng-hub-ui** ecosystem:
|
|
12
11
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
12
|
+
- [**ng-hub-ui-accordion**](https://www.npmjs.com/package/ng-hub-ui-accordion)
|
|
13
|
+
- [**ng-hub-ui-avatar**](https://www.npmjs.com/package/ng-hub-ui-avatar)
|
|
14
|
+
- [**ng-hub-ui-board**](https://www.npmjs.com/package/ng-hub-ui-board)
|
|
15
|
+
- [**ng-hub-ui-breadcrumbs**](https://www.npmjs.com/package/ng-hub-ui-breadcrumbs)
|
|
16
|
+
- [**ng-hub-ui-calendar**](https://www.npmjs.com/package/ng-hub-ui-calendar)
|
|
17
|
+
- [**ng-hub-ui-modal**](https://www.npmjs.com/package/ng-hub-ui-modal)
|
|
18
|
+
- [**ng-hub-ui-paginable**](https://www.npmjs.com/package/ng-hub-ui-paginable)
|
|
19
|
+
- [**ng-hub-ui-portal**](https://www.npmjs.com/package/ng-hub-ui-portal)
|
|
20
|
+
- [**ng-hub-ui-stepper**](https://www.npmjs.com/package/ng-hub-ui-stepper)
|
|
21
|
+
- [**ng-hub-ui-utils**](https://www.npmjs.com/package/ng-hub-ui-utils)
|
|
18
22
|
|
|
19
|
-
##
|
|
23
|
+
## Table of Contents
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
- [Features](#features)
|
|
26
|
+
- [Installation](#installation)
|
|
27
|
+
- [Usage](#usage)
|
|
28
|
+
- [Examples](#examples)
|
|
29
|
+
- [API Reference](#api-reference)
|
|
30
|
+
- [Styling](#styling)
|
|
31
|
+
- [Support & License](#support--license)
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### 1. Standalone Components
|
|
33
|
+
## Features
|
|
26
34
|
|
|
27
|
-
|
|
35
|
+
- **Automatic Breadcrumb Generation**: Automatically builds breadcrumbs from your Angular `Routes` configuration.
|
|
36
|
+
- **Dynamic Labels**: Supports dynamic labels via functions or string interpolation using resolved data.
|
|
37
|
+
- **Custom Templates**: Full control over how each breadcrumb item is rendered using directives.
|
|
38
|
+
- **RTL Support**: Built-in support for Right-to-Left languages.
|
|
39
|
+
- **Lazy Loading Compatible**: Works seamlessly with lazy-loaded modules.
|
|
28
40
|
|
|
29
|
-
|
|
30
|
-
import { HubBreadcrumbComponent } from '@hub/breadcrumb';
|
|
31
|
-
import { HubBreadcrumbItemDirective } from '@hub/breadcrumb';
|
|
41
|
+
## Installation
|
|
32
42
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
imports: [HubBreadcrumbComponent, HubBreadcrumbItemDirective]
|
|
36
|
-
})
|
|
43
|
+
```bash
|
|
44
|
+
npm install ng-hub-ui-breadcrumbs
|
|
37
45
|
```
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### 1. Import the Component
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
You can import the `HubBreadcrumbsComponent` directly in your standalone component or module.
|
|
42
52
|
|
|
43
53
|
```typescript
|
|
44
|
-
import {
|
|
54
|
+
import { HubBreadcrumbsComponent } from 'ng-hub-ui-breadcrumbs';
|
|
45
55
|
|
|
46
|
-
@
|
|
47
|
-
|
|
56
|
+
@Component({
|
|
57
|
+
// ...
|
|
58
|
+
imports: [HubBreadcrumbsComponent]
|
|
48
59
|
})
|
|
49
|
-
export class
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Route Configuration
|
|
53
|
-
|
|
54
|
-
Configure your routes with breadcrumb data:
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
// app-routing.module.ts
|
|
58
|
-
const routes: Routes = [
|
|
59
|
-
{
|
|
60
|
-
path: '',
|
|
61
|
-
data: { breadcrumb: 'Home' }
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
path: 'products',
|
|
65
|
-
data: { breadcrumb: 'Products' },
|
|
66
|
-
children: [
|
|
67
|
-
{
|
|
68
|
-
path: ':id',
|
|
69
|
-
resolve: {
|
|
70
|
-
resolvedData: ProductResolver
|
|
71
|
-
},
|
|
72
|
-
data: {
|
|
73
|
-
breadcrumb: '{name}' // Will use the product name from resolver
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
];
|
|
60
|
+
export class AppComponent {}
|
|
79
61
|
```
|
|
80
62
|
|
|
81
|
-
### Add to Template
|
|
63
|
+
### 2. Add to Template
|
|
82
64
|
|
|
83
|
-
|
|
65
|
+
Place the component in your application's main layout or wherever you want breadcrumbs to appear.
|
|
84
66
|
|
|
85
67
|
```html
|
|
86
68
|
<hub-breadcrumbs></hub-breadcrumbs>
|
|
87
69
|
```
|
|
88
70
|
|
|
89
|
-
|
|
71
|
+
### 3. Configure Routes
|
|
90
72
|
|
|
91
|
-
|
|
73
|
+
The most critical part is adding `data: { breadcrumb: '...' }` to your routes.
|
|
92
74
|
|
|
75
|
+
````typescript
|
|
93
76
|
```typescript
|
|
94
77
|
const routes: Routes = [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
resolvedData: ProductResolver
|
|
78
|
+
{
|
|
79
|
+
path: '',
|
|
80
|
+
data: { breadcrumb: 'Home' } // Standard static label
|
|
99
81
|
},
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
{
|
|
83
|
+
path: 'products',
|
|
84
|
+
data: { breadcrumb: 'Products' },
|
|
85
|
+
children: [
|
|
86
|
+
// ... child routes
|
|
87
|
+
]
|
|
102
88
|
}
|
|
103
|
-
}
|
|
104
89
|
];
|
|
105
|
-
|
|
90
|
+
````
|
|
106
91
|
|
|
107
|
-
###
|
|
108
|
-
|
|
109
|
-
You can also use functions to generate dynamic labels:
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
const routes: Routes = [
|
|
113
|
-
{
|
|
114
|
-
path: 'products',
|
|
115
|
-
resolve: { info: infoResolver },
|
|
116
|
-
data: { breadcrumb: (data: any) => `${data.info.title}` },
|
|
117
|
-
}
|
|
118
|
-
];
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Component Features
|
|
122
|
-
|
|
123
|
-
The breadcrumb component automatically:
|
|
124
|
-
- Listens to route changes
|
|
125
|
-
- Extracts breadcrumb data from route configuration
|
|
126
|
-
- Builds the breadcrumb path
|
|
127
|
-
- Handles template customization
|
|
128
|
-
- Supports RTL languages
|
|
129
|
-
|
|
130
|
-
### Working with Lazy Loading
|
|
92
|
+
### 4. Working with Lazy Loading
|
|
131
93
|
|
|
132
94
|
For lazy-loaded modules, configure the parent route with breadcrumb data:
|
|
133
95
|
|
|
134
96
|
```typescript
|
|
135
97
|
// app-routing.module.ts
|
|
136
98
|
const routes: Routes = [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
99
|
+
{
|
|
100
|
+
path: 'admin',
|
|
101
|
+
data: { breadcrumb: 'Administration' },
|
|
102
|
+
loadChildren: () => import('./admin/admin.module').then((m) => m.AdminModule)
|
|
103
|
+
}
|
|
142
104
|
];
|
|
143
105
|
|
|
144
106
|
// admin-routing.module.ts
|
|
145
107
|
const adminRoutes: Routes = [
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
108
|
+
{
|
|
109
|
+
path: 'users',
|
|
110
|
+
data: { breadcrumb: 'Users' }
|
|
111
|
+
}
|
|
150
112
|
];
|
|
151
113
|
```
|
|
152
114
|
|
|
153
115
|
This will generate breadcrumbs like: Home > Administration > Users
|
|
154
116
|
|
|
155
|
-
##
|
|
117
|
+
## Examples
|
|
156
118
|
|
|
157
|
-
|
|
119
|
+
### Dynamic Labels with Functions
|
|
158
120
|
|
|
159
|
-
|
|
121
|
+
You can use a function to generate the breadcrumb label dynamically based on route data.
|
|
160
122
|
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
<span class="hub-breadcrumb__text">{{ item.label }}</span>
|
|
123
|
+
```typescript
|
|
124
|
+
const routes: Routes = [
|
|
125
|
+
{
|
|
126
|
+
path: 'dashboard',
|
|
127
|
+
resolve: { userInfo: UserResolver },
|
|
128
|
+
data: {
|
|
129
|
+
breadcrumb: (data: any) => `User: ${data.userInfo.name}` // Function creates label from resolved data
|
|
130
|
+
}
|
|
170
131
|
}
|
|
171
|
-
|
|
172
|
-
</hub-breadcrumbs>
|
|
132
|
+
];
|
|
173
133
|
```
|
|
174
134
|
|
|
175
|
-
###
|
|
135
|
+
### Dynamic Labels with Interpolation
|
|
176
136
|
|
|
177
|
-
|
|
137
|
+
Alternatively, you can use string interpolation `{key}` if your data is under a `resolvedData` property.
|
|
178
138
|
|
|
179
139
|
```typescript
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
140
|
+
const routes: Routes = [
|
|
141
|
+
{
|
|
142
|
+
path: 'product/:id',
|
|
143
|
+
resolve: {
|
|
144
|
+
resolvedData: ProductResolver // Must be named 'resolvedData' for interpolation
|
|
145
|
+
},
|
|
146
|
+
data: {
|
|
147
|
+
breadcrumb: 'Product: {name}' // Replaces {name} with resolvedData.name
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
];
|
|
190
151
|
```
|
|
191
152
|
|
|
192
|
-
###
|
|
153
|
+
### Custom Icons
|
|
193
154
|
|
|
194
|
-
|
|
195
|
-
```html
|
|
196
|
-
<hub-breadcrumbs>
|
|
197
|
-
<ng-template hubBreadcrumbItem let-item let-isLast="isLast">
|
|
198
|
-
@if (!isLast) {
|
|
199
|
-
<a [routerLink]="item.url" class="hub-breadcrumb__link">
|
|
200
|
-
<i [class]="item.data?.icon"></i>
|
|
201
|
-
{{ item.label }}
|
|
202
|
-
</a>
|
|
203
|
-
} @else {
|
|
204
|
-
<span class="hub-breadcrumb__text">
|
|
205
|
-
<i [class]="item.data?.icon"></i>
|
|
206
|
-
{{ item.label }}
|
|
207
|
-
</span>
|
|
208
|
-
}
|
|
209
|
-
</ng-template>
|
|
210
|
-
</hub-breadcrumbs>
|
|
211
|
-
```
|
|
155
|
+
You can attach arbitrary data (like icons) to your route config and use it in a custom template.
|
|
212
156
|
|
|
213
|
-
Route configuration for icons:
|
|
214
157
|
```typescript
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
158
|
+
// Route Configuration
|
|
159
|
+
{
|
|
160
|
+
path: 'settings',
|
|
161
|
+
data: {
|
|
162
|
+
breadcrumb: 'Settings',
|
|
163
|
+
icon: 'fa fa-cog' // Custom data property
|
|
222
164
|
}
|
|
223
|
-
|
|
165
|
+
}
|
|
224
166
|
```
|
|
225
167
|
|
|
226
|
-
With custom separators:
|
|
227
168
|
```html
|
|
169
|
+
<!-- Custom Template Implementation -->
|
|
228
170
|
<hub-breadcrumbs>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
<span class="hub-breadcrumb__text">{{ item.label }}</span>
|
|
237
|
-
}
|
|
238
|
-
</ng-template>
|
|
171
|
+
<ng-template hubBreadcrumbItem let-item let-isLast="isLast">
|
|
172
|
+
<!-- 'item.data' contains the entire route data object -->
|
|
173
|
+
@if (item.data.icon) {
|
|
174
|
+
<i [class]="item.data.icon"></i>
|
|
175
|
+
}
|
|
176
|
+
<a [routerLink]="item.url">{{ item.label }}</a>
|
|
177
|
+
</ng-template>
|
|
239
178
|
</hub-breadcrumbs>
|
|
240
179
|
```
|
|
241
180
|
|
|
242
|
-
|
|
243
|
-
- Handling the navigation with `routerLink`
|
|
244
|
-
- Managing active/inactive states
|
|
245
|
-
- Applying appropriate styles
|
|
246
|
-
- Handling RTL if needed
|
|
247
|
-
|
|
248
|
-
## Styling
|
|
249
|
-
|
|
250
|
-
The breadcrumb component uses CSS variables for styling, making it highly customizable. It's designed to work with or without Bootstrap.
|
|
251
|
-
|
|
252
|
-
### Default SCSS Variables
|
|
253
|
-
|
|
254
|
-
These SCSS variables set the default values:
|
|
255
|
-
|
|
256
|
-
```scss
|
|
257
|
-
$border-radius-pill: 50rem !default;
|
|
258
|
-
$secondary-color: black !default;
|
|
259
|
-
$breadcrumb-font-size: null !default;
|
|
260
|
-
$breadcrumb-padding-y: 0.25rem !default;
|
|
261
|
-
$breadcrumb-padding-x: 1rem !default;
|
|
262
|
-
$breadcrumb-item-padding-x: 0.5rem !default;
|
|
263
|
-
$breadcrumb-margin-bottom: 0 !default;
|
|
264
|
-
$breadcrumb-bg: white !default;
|
|
265
|
-
$breadcrumb-divider-color: $secondary-color !default;
|
|
266
|
-
$breadcrumb-active-color: $secondary-color !default;
|
|
267
|
-
$breadcrumb-divider: quote('>') !default;
|
|
268
|
-
$breadcrumb-divider-flipped: $breadcrumb-divider !default;
|
|
269
|
-
$breadcrumb-border-radius: $border-radius-pill !default;
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### CSS Variables
|
|
273
|
-
|
|
274
|
-
These variables are exposed for runtime customization:
|
|
181
|
+
### Custom Template & Separators
|
|
275
182
|
|
|
276
|
-
|
|
277
|
-
.hub-breadcrumb__list {
|
|
278
|
-
--hub-breadcrumb-padding-x: 1rem;
|
|
279
|
-
--hub-breadcrumb-padding-y: 0.25rem;
|
|
280
|
-
--hub-breadcrumb-margin-bottom: 0;
|
|
281
|
-
--hub-breadcrumb-bg: white;
|
|
282
|
-
--hub-breadcrumb-border-radius: 50rem;
|
|
283
|
-
--hub-breadcrumb-divider-color: black;
|
|
284
|
-
--hub-breadcrumb-item-padding-x: 0.5rem;
|
|
285
|
-
--hub-breadcrumb-item-active-color: black;
|
|
286
|
-
}
|
|
287
|
-
```
|
|
183
|
+
Fully customize the structure, including separators/dividers.
|
|
288
184
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
.hub-breadcrumb__list {
|
|
302
|
-
--hub-breadcrumb-bg: #f8f9fa;
|
|
303
|
-
--hub-breadcrumb-divider-color: #6c757d;
|
|
304
|
-
}
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
3. Override classes directly:
|
|
308
|
-
```scss
|
|
309
|
-
.hub-breadcrumb__item {
|
|
310
|
-
&--active {
|
|
311
|
-
font-weight: bold;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### RTL Support
|
|
317
|
-
|
|
318
|
-
The component automatically handles RTL languages by flipping the divider. You can customize the flipped divider using:
|
|
319
|
-
|
|
320
|
-
```scss
|
|
321
|
-
$breadcrumb-divider-flipped: quote('<');
|
|
185
|
+
```html
|
|
186
|
+
<hub-breadcrumbs>
|
|
187
|
+
<ng-template hubBreadcrumbItem let-item let-isLast="isLast">
|
|
188
|
+
<span class="my-breadcrumb-item">
|
|
189
|
+
<a [routerLink]="item.url">{{ item.label }}</a>
|
|
190
|
+
</span>
|
|
191
|
+
<!-- Custom Separator -->
|
|
192
|
+
@if (!isLast) {
|
|
193
|
+
<span class="separator"> / </span>
|
|
194
|
+
}
|
|
195
|
+
</ng-template>
|
|
196
|
+
</hub-breadcrumbs>
|
|
322
197
|
```
|
|
323
198
|
|
|
324
|
-
|
|
199
|
+
## API Reference
|
|
325
200
|
|
|
326
|
-
|
|
327
|
-
- `.hub-breadcrumb` - Block (host component)
|
|
328
|
-
- `.hub-breadcrumb__list` - Element (container)
|
|
329
|
-
- `.hub-breadcrumb__item` - Element (each breadcrumb)
|
|
330
|
-
- `.hub-breadcrumb__item--active` - Modifier (active state)
|
|
201
|
+
### HubBreadcrumbsComponent
|
|
331
202
|
|
|
332
|
-
|
|
203
|
+
The main container component. It doesn't have any inputs as it reads directly from the Router.
|
|
333
204
|
|
|
334
|
-
|
|
205
|
+
| Selector | Exported As |
|
|
206
|
+
| ----------------- | ---------------- |
|
|
207
|
+
| `hub-breadcrumbs` | `hubBreadcrumbs` |
|
|
335
208
|
|
|
336
|
-
###
|
|
209
|
+
### HubBreadcrumbItemDirective
|
|
337
210
|
|
|
338
|
-
|
|
211
|
+
A structural directive used to define a custom template for breadcrumb items.
|
|
339
212
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
--hub-breadcrumb-bg: #e9ecef;
|
|
344
|
-
--hub-breadcrumb-item-active-color: #0d6efd;
|
|
345
|
-
"></hub-breadcrumbs>
|
|
346
|
-
```
|
|
213
|
+
| Selector | Context Type |
|
|
214
|
+
| --------------------- | --------------------------- |
|
|
215
|
+
| `[hubBreadcrumbItem]` | `BreadcrumbTemplateContext` |
|
|
347
216
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
1. Custom divider:
|
|
351
|
-
```html
|
|
352
|
-
<hub-breadcrumbs style="--hub-breadcrumb-divider: 'β'"></hub-breadcrumbs>
|
|
353
|
-
<hub-breadcrumbs style="--hub-breadcrumb-divider: '>'"></hub-breadcrumbs>
|
|
354
|
-
<hub-breadcrumbs style="--hub-breadcrumb-divider: '/'"></hub-breadcrumbs>
|
|
355
|
-
<hub-breadcrumbs style="--hub-breadcrumb-divider: 'πΈ'"></hub-breadcrumbs>
|
|
356
|
-
```
|
|
217
|
+
### Interfaces
|
|
357
218
|
|
|
358
|
-
|
|
359
|
-
```html
|
|
360
|
-
<hub-breadcrumbs style="
|
|
361
|
-
--hub-breadcrumb-bg: transparent;
|
|
362
|
-
--hub-breadcrumb-divider-color: #6c757d;
|
|
363
|
-
--hub-breadcrumb-item-active-color: #0d6efd;
|
|
364
|
-
"></hub-breadcrumbs>
|
|
365
|
-
```
|
|
219
|
+
#### BreadcrumbItem
|
|
366
220
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
--hub-breadcrumb-item-padding-x: 1rem;
|
|
373
|
-
"></hub-breadcrumbs>
|
|
374
|
-
```
|
|
221
|
+
| Property | Type | Description |
|
|
222
|
+
| -------- | -------- | ------------------------------------------------------- |
|
|
223
|
+
| `label` | `string` | The resolved text to display for the breadcrumb. |
|
|
224
|
+
| `url` | `string` | The full URL path to navigate to. |
|
|
225
|
+
| `data` | `any` | The original route data object (useful for icons, etc). |
|
|
375
226
|
|
|
376
|
-
|
|
227
|
+
#### BreadcrumbTemplateContext
|
|
377
228
|
|
|
378
|
-
|
|
229
|
+
| Property | Type | Description |
|
|
230
|
+
| ----------- | ---------------- | ------------------------------------------------------------- |
|
|
231
|
+
| `$implicit` | `BreadcrumbItem` | The current breadcrumb item object. |
|
|
232
|
+
| `isLast` | `boolean` | True if this item is the last one in the list (current page). |
|
|
379
233
|
|
|
380
|
-
|
|
234
|
+
## Styling
|
|
381
235
|
|
|
382
|
-
|
|
383
|
-
```typescript
|
|
384
|
-
@Component({
|
|
385
|
-
selector: 'hub-breadcrumb',
|
|
386
|
-
standalone: true
|
|
387
|
-
})
|
|
388
|
-
```
|
|
236
|
+
`ng-hub-ui-breadcrumbs` is fully style-configurable through CSS custom properties.
|
|
389
237
|
|
|
390
|
-
|
|
238
|
+
For a complete and up-to-date token catalog, see [CSS Variables Reference](./docs/css-variables-reference.md).
|
|
391
239
|
|
|
392
|
-
###
|
|
240
|
+
### Import styles
|
|
393
241
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
@Directive({
|
|
397
|
-
selector: '[hubBreadcrumbItem]',
|
|
398
|
-
standalone: true
|
|
399
|
-
})
|
|
242
|
+
```scss
|
|
243
|
+
@use 'ng-hub-ui-breadcrumbs/src/lib/styles/breadcrumbs.scss';
|
|
400
244
|
```
|
|
401
245
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
### Interfaces
|
|
405
|
-
|
|
406
|
-
#### BreadcrumbItem
|
|
407
|
-
```typescript
|
|
408
|
-
interface BreadcrumbItem {
|
|
409
|
-
label: string; // Display text
|
|
410
|
-
url: string; // Navigation URL
|
|
411
|
-
data: any; // Additional data from route configuration
|
|
412
|
-
}
|
|
413
|
-
```
|
|
246
|
+
### Quick customization example (framework-agnostic)
|
|
414
247
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
248
|
+
```scss
|
|
249
|
+
.hub-breadcrumbs__list {
|
|
250
|
+
--hub-breadcrumb-bg: #f8f9fa;
|
|
251
|
+
--hub-breadcrumb-divider: 'β';
|
|
252
|
+
--hub-breadcrumb-link-color: #0d6efd;
|
|
253
|
+
--hub-breadcrumb-item-active-color: #6c757d;
|
|
420
254
|
}
|
|
421
255
|
```
|
|
422
256
|
|
|
423
|
-
###
|
|
424
|
-
|
|
425
|
-
The component reads breadcrumb configuration from route data:
|
|
257
|
+
### Bootstrap integration (optional)
|
|
426
258
|
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
259
|
+
```scss
|
|
260
|
+
.hub-breadcrumbs__list {
|
|
261
|
+
--hub-breadcrumb-bg: var(--bs-light);
|
|
262
|
+
--hub-breadcrumb-link-color: var(--bs-primary);
|
|
263
|
+
--hub-breadcrumb-link-hover-color: var(--bs-primary-text-emphasis);
|
|
264
|
+
--hub-breadcrumb-item-active-color: var(--bs-secondary-color);
|
|
432
265
|
}
|
|
433
266
|
```
|
|
434
267
|
|
|
435
|
-
### CSS Custom Properties
|
|
436
|
-
|
|
437
|
-
| Property | Description | Default |
|
|
438
|
-
|----------|-------------|---------|
|
|
439
|
-
| `--hub-breadcrumb-padding-x` | Horizontal padding | `1rem` |
|
|
440
|
-
| `--hub-breadcrumb-padding-y` | Vertical padding | `0.25rem` |
|
|
441
|
-
| `--hub-breadcrumb-margin-bottom` | Bottom margin | `0` |
|
|
442
|
-
| `--hub-breadcrumb-bg` | Background color | `white` |
|
|
443
|
-
| `--hub-breadcrumb-border-radius` | Border radius | `50rem` |
|
|
444
|
-
| `--hub-breadcrumb-divider-color` | Divider color | `black` |
|
|
445
|
-
| `--hub-breadcrumb-item-padding-x` | Item spacing | `0.5rem` |
|
|
446
|
-
| `--hub-breadcrumb-item-active-color` | Active item color | `black` |
|
|
447
|
-
|
|
448
|
-
### SCSS Variables
|
|
449
|
-
|
|
450
|
-
| Variable | Description | Default |
|
|
451
|
-
|----------|-------------|---------|
|
|
452
|
-
| `$breadcrumb-padding-y` | Vertical padding | `0.25rem` |
|
|
453
|
-
| `$breadcrumb-padding-x` | Horizontal padding | `1rem` |
|
|
454
|
-
| `$breadcrumb-margin-bottom` | Bottom margin | `0` |
|
|
455
|
-
| `$breadcrumb-bg` | Background color | `white` |
|
|
456
|
-
| `$breadcrumb-divider` | Divider character | `'>'` |
|
|
457
|
-
| `$breadcrumb-divider-flipped` | RTL divider character | Same as `$breadcrumb-divider` |
|
|
458
|
-
| `$breadcrumb-border-radius` | Border radius | `50rem` |
|
|
459
|
-
| `$breadcrumb-active-color` | Active item color | `black` |
|
|
460
|
-
|
|
461
|
-
|
|
462
268
|
## Contributing
|
|
463
269
|
|
|
464
270
|
We appreciate your interest in contributing to Hub Breadcrumb! Here's how you can help:
|
|
465
271
|
|
|
466
272
|
### Development Setup
|
|
467
273
|
|
|
468
|
-
1.
|
|
469
|
-
```bash
|
|
470
|
-
git clone https://github.com/carlos-morcillo/ng-hub-ui-breadcrumbs.git
|
|
471
|
-
cd ng-hub-ui-breadcrumbs
|
|
472
|
-
```
|
|
274
|
+
1. **Clone the repository**
|
|
473
275
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
```
|
|
276
|
+
```bash
|
|
277
|
+
git clone https://github.com/carlos-morcillo/ng-hub-ui-breadcrumbs.git
|
|
278
|
+
cd ng-hub-ui-breadcrumbs
|
|
279
|
+
```
|
|
478
280
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
281
|
+
2. **Install dependencies**
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
npm install
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
3. **Start the development server**
|
|
288
|
+
```bash
|
|
289
|
+
npm start
|
|
290
|
+
```
|
|
483
291
|
|
|
484
292
|
### Testing
|
|
485
293
|
|
|
486
294
|
Run the test suite:
|
|
295
|
+
|
|
487
296
|
```bash
|
|
488
297
|
# Unit tests
|
|
489
298
|
npm run test
|
|
@@ -495,27 +304,6 @@ npm run e2e
|
|
|
495
304
|
npm run test:coverage
|
|
496
305
|
```
|
|
497
306
|
|
|
498
|
-
### Project Structure
|
|
499
|
-
|
|
500
|
-
```
|
|
501
|
-
ng-hub-ui-breadcrumbs/
|
|
502
|
-
βββ src/
|
|
503
|
-
β βββ lib/
|
|
504
|
-
β β βββ components/
|
|
505
|
-
β β β βββ hub-breadcrumb.component.ts
|
|
506
|
-
β β β βββ hub-breadcrumb.component.spec.ts
|
|
507
|
-
β β β βββ hub-breadcrumb.component.scss
|
|
508
|
-
β β βββ directives/
|
|
509
|
-
β β β βββ hub-breadcrumb-item.directive.ts
|
|
510
|
-
β β βββ services/
|
|
511
|
-
β β β βββ hub-breadcrumb.service.ts
|
|
512
|
-
β β βββ interfaces/
|
|
513
|
-
β β βββ breadcrumb-item.ts
|
|
514
|
-
β βββ public-api.ts
|
|
515
|
-
βββ README.md
|
|
516
|
-
βββ package.json
|
|
517
|
-
```
|
|
518
|
-
|
|
519
307
|
### Commit Guidelines
|
|
520
308
|
|
|
521
309
|
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
@@ -529,61 +317,21 @@ We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
|
529
317
|
- `chore:` Maintenance tasks
|
|
530
318
|
|
|
531
319
|
Example:
|
|
532
|
-
```bash
|
|
533
|
-
git commit -m "feat: add custom divider support"
|
|
534
|
-
```
|
|
535
320
|
|
|
536
|
-
### Pull Request Process
|
|
537
|
-
|
|
538
|
-
1. Fork the repository
|
|
539
|
-
2. Create a new branch:
|
|
540
321
|
```bash
|
|
541
|
-
git
|
|
322
|
+
git commit -m "feat: add custom divider support"
|
|
542
323
|
```
|
|
543
|
-
3. Make your changes
|
|
544
|
-
4. Add tests for any new functionality
|
|
545
|
-
5. Update documentation if needed
|
|
546
|
-
6. Submit a Pull Request
|
|
547
324
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
- Write unit tests for new features
|
|
551
|
-
- Follow Angular style guide
|
|
552
|
-
- Update documentation for API changes
|
|
553
|
-
- Maintain backward compatibility
|
|
554
|
-
- Add comments for complex logic
|
|
555
|
-
|
|
556
|
-
### Issues
|
|
557
|
-
|
|
558
|
-
Before creating an issue, please:
|
|
559
|
-
|
|
560
|
-
- Check existing issues
|
|
561
|
-
- Use the issue template
|
|
562
|
-
- Include reproduction steps
|
|
563
|
-
- Specify your environment
|
|
564
|
-
|
|
565
|
-
### Code Style
|
|
566
|
-
|
|
567
|
-
We follow the [Angular Style Guide](https://angular.io/guide/styleguide):
|
|
568
|
-
|
|
569
|
-
- Use TypeScript
|
|
570
|
-
- Follow BEM for CSS
|
|
571
|
-
- Maintain consistent naming
|
|
572
|
-
- Add JSDoc comments
|
|
573
|
-
|
|
574
|
-
## Support the Project
|
|
325
|
+
## Support & License
|
|
575
326
|
|
|
576
327
|
If you find this project helpful and would like to support its development, you can buy me a coffee:
|
|
577
328
|
|
|
578
|
-
[](https://
|
|
329
|
+
[](https://buymeacoffee.com/carlosmorcillo)
|
|
579
330
|
|
|
580
331
|
Your support is greatly appreciated and helps maintain and improve this project!
|
|
581
332
|
|
|
582
|
-
## License
|
|
583
|
-
|
|
584
333
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
585
334
|
|
|
586
335
|
---
|
|
587
336
|
|
|
588
337
|
Made with β€οΈ by [Carlos Morcillo FernΓ‘ndez]
|
|
589
|
-
|