ng-hub-ui-stepper 1.3.1 β 21.2.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 +143 -171
- package/fesm2022/ng-hub-ui-stepper.mjs +447 -251
- package/fesm2022/ng-hub-ui-stepper.mjs.map +1 -1
- package/package.json +9 -15
- package/types/ng-hub-ui-stepper.d.ts +301 -0
- package/esm2022/lib/next-button.directive.mjs +0 -41
- package/esm2022/lib/previous-button.directive.mjs +0 -41
- package/esm2022/lib/services/stepper-theme-service.mjs +0 -21
- package/esm2022/lib/step/step.component.mjs +0 -57
- package/esm2022/lib/step-trigger.directive.mjs +0 -16
- package/esm2022/lib/stepper/stepper.component.mjs +0 -156
- package/esm2022/lib/stepper-nav.directive.mjs +0 -16
- package/esm2022/lib/stepper.module.mjs +0 -54
- package/esm2022/lib/submit-button.directive.mjs +0 -39
- package/esm2022/ng-hub-ui-stepper.mjs +0 -5
- package/esm2022/public-api.mjs +0 -13
- package/index.d.ts +0 -5
- package/lib/next-button.directive.d.ts +0 -10
- package/lib/previous-button.directive.d.ts +0 -10
- package/lib/services/stepper-theme-service.d.ts +0 -11
- package/lib/step/step.component.d.ts +0 -29
- package/lib/step-trigger.directive.d.ts +0 -8
- package/lib/stepper/stepper.component.d.ts +0 -86
- package/lib/stepper-nav.directive.d.ts +0 -8
- package/lib/stepper.module.d.ts +0 -14
- package/lib/submit-button.directive.d.ts +0 -10
- package/ng-hub-ui-stepper-1.3.1.tgz +0 -0
- package/public-api.d.ts +0 -9
package/README.md
CHANGED
|
@@ -1,248 +1,220 @@
|
|
|
1
1
|
# ng-hub-ui-stepper
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/ng-hub-ui-stepper)
|
|
4
|
+
[](https://github.com/carlos-morcillo/ng-hub-ui-stepper/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
A flexible, customizable, and accessible stepper component for Angular 21+. Perfect for multi-step forms, wizards, and guided user experiences with a focus on developer experience and modern standards.
|
|
7
|
+
|
|
8
|
+
> [!IMPORTANT]
|
|
9
|
+
> This version (21.2.0) is built for **Angular 21** and uses the new **Signals** architecture.
|
|
10
|
+
|
|
11
|
+
## π§© Library Family `ng-hub-ui`
|
|
12
|
+
|
|
13
|
+
This library is part of the **ng-hub-ui** ecosystem:
|
|
14
|
+
|
|
15
|
+
- [**ng-hub-ui-accordion**](https://www.npmjs.com/package/ng-hub-ui-accordion)
|
|
16
|
+
- [**ng-hub-ui-avatar**](https://www.npmjs.com/package/ng-hub-ui-avatar)
|
|
17
|
+
- [**ng-hub-ui-board**](https://www.npmjs.com/package/ng-hub-ui-board)
|
|
18
|
+
- [**ng-hub-ui-breadcrumbs**](https://www.npmjs.com/package/ng-hub-ui-breadcrumbs)
|
|
19
|
+
- [**ng-hub-ui-calendar**](https://www.npmjs.com/package/ng-hub-ui-calendar)
|
|
20
|
+
- [**ng-hub-ui-modal**](https://www.npmjs.com/package/ng-hub-ui-modal)
|
|
21
|
+
- [**ng-hub-ui-paginable**](https://www.npmjs.com/package/ng-hub-ui-paginable)
|
|
22
|
+
- [**ng-hub-ui-portal**](https://www.npmjs.com/package/ng-hub-ui-portal)
|
|
23
|
+
- [**ng-hub-ui-stepper**](https://www.npmjs.com/package/ng-hub-ui-stepper)
|
|
24
|
+
- [**ng-hub-ui-utils**](https://www.npmjs.com/package/ng-hub-ui-utils)
|
|
4
25
|
|
|
5
26
|
## Table of Contents
|
|
6
27
|
|
|
7
|
-
- [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- [With Custom Navigation](#with-custom-navigation)
|
|
23
|
-
- [Contributing](#contributing)
|
|
24
|
-
- [Support the Project](#support-the-project)
|
|
25
|
-
- [Inspiration](#inspiration)
|
|
26
|
-
- [License](#license)
|
|
28
|
+
- [Features](#features)
|
|
29
|
+
- [Installation](#installation)
|
|
30
|
+
- [Usage (Quick Start)](#usage-quick-start)
|
|
31
|
+
- [Examples](#examples)
|
|
32
|
+
- [Linear Stepper](#linear-stepper)
|
|
33
|
+
- [Custom Navigation](#custom-navigation)
|
|
34
|
+
- [Custom Buttons](#custom-buttons)
|
|
35
|
+
- [API Reference](#api-reference)
|
|
36
|
+
- [StepperComponent](#steppercomponent)
|
|
37
|
+
- [StepComponent](#stepcomponent)
|
|
38
|
+
- [Directives](#directives)
|
|
39
|
+
- [Interfaces](#interfaces)
|
|
40
|
+
- [Styling](#styling)
|
|
41
|
+
- [Contributing](#contributing)
|
|
42
|
+
- [License](#license)
|
|
27
43
|
|
|
28
44
|
## Features
|
|
29
45
|
|
|
30
|
-
- π
|
|
31
|
-
- π¨ Highly
|
|
32
|
-
- βΏ Accessible
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
- π§© Modular architecture for easy extension
|
|
46
|
+
- π **Angular 21+ Built-in**: Uses Signals and new control flow syntax.
|
|
47
|
+
- π¨ **Highly Customizable**: Easy to theme via CSS variables and custom templates.
|
|
48
|
+
- βΏ **Accessible**: Proper ARIA roles and keyboard navigation.
|
|
49
|
+
- π’ **Multi-layout**: Supports Vertical, Sidebar, and RTL modes.
|
|
50
|
+
- π **Smooth Transitions**: Built-in CSS animations.
|
|
51
|
+
- π§© **Flexible Controls**: Use default buttons or project your own.
|
|
37
52
|
|
|
38
53
|
## Installation
|
|
39
54
|
|
|
40
|
-
Install the package using npm:
|
|
41
|
-
|
|
42
55
|
```bash
|
|
43
56
|
npm install ng-hub-ui-stepper
|
|
44
57
|
```
|
|
45
58
|
|
|
46
|
-
## Usage
|
|
59
|
+
## Usage (Quick Start)
|
|
47
60
|
|
|
48
|
-
|
|
61
|
+
Import the `StepperModule` in your module/component:
|
|
49
62
|
|
|
50
63
|
```typescript
|
|
51
64
|
import { StepperModule } from 'ng-hub-ui-stepper';
|
|
52
65
|
|
|
53
|
-
@
|
|
66
|
+
@Component({
|
|
67
|
+
standalone: true,
|
|
54
68
|
imports: [StepperModule],
|
|
55
69
|
// ...
|
|
56
70
|
})
|
|
57
|
-
export class
|
|
71
|
+
export class YourComponent { }
|
|
58
72
|
```
|
|
59
73
|
|
|
60
|
-
|
|
74
|
+
In your template:
|
|
61
75
|
|
|
62
76
|
```html
|
|
63
77
|
<hub-stepper>
|
|
64
|
-
<hub-step title="
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
<hub-step title="Account Setup">
|
|
79
|
+
<h3>Welcome!</h3>
|
|
80
|
+
<p>Setup your account details here.</p>
|
|
67
81
|
</hub-step>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
82
|
+
|
|
83
|
+
<hub-step title="Personal Info">
|
|
84
|
+
<h3>Profile Data</h3>
|
|
85
|
+
<p>Tell us more about yourself.</p>
|
|
71
86
|
</hub-step>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
|
|
88
|
+
<hub-step title="Review">
|
|
89
|
+
<h3>Save & Finalize</h3>
|
|
90
|
+
<p>Ready to go?</p>
|
|
75
91
|
</hub-step>
|
|
76
92
|
</hub-stepper>
|
|
77
93
|
```
|
|
78
94
|
|
|
79
|
-
##
|
|
80
|
-
|
|
81
|
-
### Stepper Component
|
|
82
|
-
|
|
83
|
-
| Input | Type | Default | Description |
|
|
84
|
-
|----------------------|-----------|---------|------------------------------------------------|
|
|
85
|
-
| `backLabel` | string | 'Back' | Label for the back button |
|
|
86
|
-
| `continueLabel` | string | 'Continue' | Label for the continue button |
|
|
87
|
-
| `submitLabel` | string | 'Submit'| Label for the submit button |
|
|
88
|
-
|
|
89
|
-
| Output | Type | Description |
|
|
90
|
-
|------------|---------------------|---------------------------------------|
|
|
91
|
-
| `completed`| EventEmitter<void> | Emitted when the stepper is completed |
|
|
92
|
-
| `previousStep` | EventEmitter<number> | Emitted when moving to the previous step |
|
|
93
|
-
| `nextStep` | EventEmitter<number> | Emitted when moving to the next step |
|
|
94
|
-
|
|
95
|
-
### Step Component
|
|
96
|
-
|
|
97
|
-
| Input | Type | Default | Description |
|
|
98
|
-
|-----------|---------|--------|--------------------------------------|
|
|
99
|
-
| `index` | number | required | The index of this step |
|
|
100
|
-
| `title` | string | optional | The title of this step |
|
|
101
|
-
| `disabled`| boolean | false | Whether this step is disabled |
|
|
95
|
+
## Examples
|
|
102
96
|
|
|
103
|
-
|
|
97
|
+
### Linear Stepper
|
|
104
98
|
|
|
105
|
-
|
|
99
|
+
Control navigation by enabling/disabling steps programmatically.
|
|
106
100
|
|
|
107
|
-
|
|
101
|
+
```html
|
|
102
|
+
<hub-stepper (completed)="onFinish()">
|
|
103
|
+
<hub-step title="Step 1">
|
|
104
|
+
<!-- Step 1 Content -->
|
|
105
|
+
</hub-step>
|
|
108
106
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
--stepper-secondary-color: #b5b5c3;
|
|
114
|
-
--stepper-background-color: #f3f6f9;
|
|
115
|
-
--stepper-text-color: #181c32;
|
|
116
|
-
--stepper-disabled-color: #e1e3ea;
|
|
117
|
-
}
|
|
107
|
+
<hub-step title="Step 2" [disabled]="!isStep1Valid()">
|
|
108
|
+
<!-- Step 2 Content -->
|
|
109
|
+
</hub-step>
|
|
110
|
+
</hub-stepper>
|
|
118
111
|
```
|
|
119
112
|
|
|
120
|
-
###
|
|
113
|
+
### Custom Navigation
|
|
121
114
|
|
|
122
|
-
|
|
115
|
+
Provide your own navigation template using the `stepperNavTpt` property.
|
|
123
116
|
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
@
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
117
|
+
```html
|
|
118
|
+
<hub-stepper>
|
|
119
|
+
<nav *stepperNav="let steps = steps; let currentIndex = currentIndex" class="my-custom-nav">
|
|
120
|
+
@for (step of steps; track step; let i = $index) {
|
|
121
|
+
<button
|
|
122
|
+
[class.active]="i === currentIndex"
|
|
123
|
+
(click)="goTo(i)">
|
|
124
|
+
{{ step.title() }}
|
|
125
|
+
</button>
|
|
126
|
+
}
|
|
127
|
+
</nav>
|
|
128
|
+
|
|
129
|
+
<hub-step title="A">...</hub-step>
|
|
130
|
+
<hub-step title="B">...</hub-step>
|
|
131
|
+
</hub-stepper>
|
|
138
132
|
```
|
|
139
133
|
|
|
140
|
-
|
|
134
|
+
### Custom Buttons
|
|
141
135
|
|
|
142
|
-
|
|
143
|
-
You can customize the navigation buttons using the provided directives:
|
|
136
|
+
Project your own buttons to override the default footer.
|
|
144
137
|
|
|
145
138
|
```html
|
|
146
139
|
<hub-stepper>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<button
|
|
150
|
-
<button
|
|
140
|
+
<hub-step>...</hub-step>
|
|
141
|
+
|
|
142
|
+
<button previousButton class="btn-back">Go back</button>
|
|
143
|
+
<button nextButton class="btn-next">Next step</button>
|
|
144
|
+
<button submitButton class="btn-done">Complete</button>
|
|
151
145
|
</hub-stepper>
|
|
152
146
|
```
|
|
153
147
|
|
|
154
|
-
|
|
148
|
+
## API Reference
|
|
155
149
|
|
|
156
|
-
###
|
|
150
|
+
### StepperComponent (`hub-stepper`)
|
|
157
151
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
152
|
+
| Input | Type | Default | Description |
|
|
153
|
+
|---|---|---|---|
|
|
154
|
+
| `backLabel` | `string` | `'Back'` | Label for the back button. |
|
|
155
|
+
| `continueLabel` | `string` | `'Continue'` | Label for the continue button. |
|
|
156
|
+
| `submitLabel` | `string` | `'Submit'` | Label for the submit button. |
|
|
157
|
+
| `options` | `StepperOptions` | `{}` | Visual and layout configuration. |
|
|
162
158
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
| Output | Type | Description |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `completed` | `EventEmitter<void>` | Emitted when the last step is completed. |
|
|
162
|
+
| `previousStep` | `EventEmitter<number>` | Emitted when moving back. Passes the new index. |
|
|
163
|
+
| `nextStep` | `EventEmitter<number>` | Emitted when moving forward. Passes the new index. |
|
|
167
164
|
|
|
168
|
-
|
|
165
|
+
### StepComponent (`hub-step`)
|
|
169
166
|
|
|
170
|
-
|
|
167
|
+
| Input | Type | Default | Description |
|
|
168
|
+
|---|---|---|---|
|
|
169
|
+
| `title` | `string` | `optional` | Text displayed in navigation. |
|
|
170
|
+
| `disabled` | `boolean` | `false` | Prevents navigation to this step. |
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
- Keyboard navigation is supported
|
|
174
|
-
- Color contrast ratios meet WCAG AA standards -->
|
|
172
|
+
### Directives
|
|
175
173
|
|
|
176
|
-
|
|
174
|
+
- `nextButton`: Apply to any button to use it as the "next" control.
|
|
175
|
+
- `previousButton`: Apply to any button to use it as the "back" control.
|
|
176
|
+
- `submitButton`: Apply to any button to use it as the "submit" control.
|
|
177
|
+
- `stepperNav`: Mark a template to be used as custom navigation.
|
|
177
178
|
|
|
178
|
-
###
|
|
179
|
+
### Interfaces
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
<!-- Address form fields -->
|
|
187
|
-
</hub-step>
|
|
188
|
-
<hub-step title="Confirmation">
|
|
189
|
-
<!-- Confirmation step -->
|
|
190
|
-
</hub-step>
|
|
191
|
-
</hub-stepper>
|
|
181
|
+
#### `StepperOptions`
|
|
182
|
+
```typescript
|
|
183
|
+
interface StepperOptions {
|
|
184
|
+
layout?: 'vertical' | 'sidebar';
|
|
185
|
+
rtl?: boolean;
|
|
186
|
+
}
|
|
192
187
|
```
|
|
193
188
|
|
|
194
|
-
|
|
189
|
+
## Styling
|
|
195
190
|
|
|
196
|
-
|
|
197
|
-
<hub-stepper [stepperNavTpt]="customNav">
|
|
198
|
-
<!-- Steps content -->
|
|
199
|
-
</hub-stepper>
|
|
191
|
+
Customize the component using CSS variables. For a complete list of available tokens, see the [CSS Variables Reference](docs/css-variables-reference.md).
|
|
200
192
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
</ul>
|
|
208
|
-
</ng-template>
|
|
193
|
+
```css
|
|
194
|
+
.my-stepper {
|
|
195
|
+
--hub-stepper-primary-color: #009ef7;
|
|
196
|
+
--hub-stepper-surface-color: #ffffff;
|
|
197
|
+
--hub-stepper-gap: 1.5rem;
|
|
198
|
+
}
|
|
209
199
|
```
|
|
210
200
|
|
|
211
201
|
## Contributing
|
|
212
202
|
|
|
213
|
-
We welcome contributions
|
|
214
|
-
|
|
215
|
-
1. Fork the repository
|
|
216
|
-
2. Create your feature branch: `git checkout -b feature/AmazingFeature`
|
|
217
|
-
3. Commit your changes: `git commit -m 'Add some AmazingFeature'`
|
|
218
|
-
4. Push to the branch: `git push origin feature/AmazingFeature`
|
|
219
|
-
5. Open a pull request
|
|
203
|
+
We welcome contributions! Please follow our [Commit Guidelines](https://github.com/carlos-morcillo/ng-hub-ui/blob/main/CONTRIBUTING.md).
|
|
220
204
|
|
|
221
|
-
|
|
205
|
+
1. Fork the repo.
|
|
206
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`).
|
|
207
|
+
3. Commit your changes.
|
|
208
|
+
4. Push to the branch.
|
|
209
|
+
5. Create a Pull Request.
|
|
222
210
|
|
|
223
|
-
## Support
|
|
211
|
+
## Support
|
|
224
212
|
|
|
225
|
-
If you find this project helpful
|
|
213
|
+
If you find this project helpful, consider supporting its development:
|
|
226
214
|
|
|
227
|
-
[](https://
|
|
228
|
-
|
|
229
|
-
Your support is greatly appreciated and helps maintain and improve this project!
|
|
230
|
-
|
|
231
|
-
## Inspiration
|
|
232
|
-
|
|
233
|
-
This project was inspired by the need for a flexible, customizable, and accessible stepper component in the Angular ecosystem. We drew inspiration from:
|
|
234
|
-
|
|
235
|
-
- Material Design's Stepper component
|
|
236
|
-
- Various multi-step form implementations across the web
|
|
237
|
-
- Feedback and feature requests from the Angular community
|
|
238
|
-
|
|
239
|
-
My goal was to create a component that combined the best features of existing solutions while adding my own improvements and focusing on customization and accessibility.
|
|
215
|
+
[](https://buymeacoffee.com/carlosmorcillo)
|
|
240
216
|
|
|
241
217
|
## License
|
|
242
218
|
|
|
243
219
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
244
220
|
|
|
245
|
-
---
|
|
246
|
-
|
|
247
|
-
Made with β€οΈ by [Carlos Morcillo FernΓ‘ndez]
|
|
248
|
-
|