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 CHANGED
@@ -1,248 +1,220 @@
1
1
  # ng-hub-ui-stepper
2
2
 
3
- A flexible and customizable stepper component for Angular applications. Perfect for multi-step forms, wizards, and guided user experiences.
3
+ [![npm version](https://img.shields.io/npm/v/ng-hub-ui-stepper.svg)](https://www.npmjs.com/package/ng-hub-ui-stepper)
4
+ [![license](https://img.shields.io/npm/l/ng-hub-ui-stepper.svg)](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
- - [ng-hub-ui-stepper](#ng-hub-ui-stepper)
8
- - [Table of Contents](#table-of-contents)
9
- - [Features](#features)
10
- - [Installation](#installation)
11
- - [Usage](#usage)
12
- - [API Reference](#api-reference)
13
- - [Stepper Component](#stepper-component)
14
- - [Step Component](#step-component)
15
- - [Customization](#customization)
16
- - [CSS Variables](#css-variables)
17
- - [Programmatic Customization](#programmatic-customization)
18
- - [Custom Navigation Buttons](#custom-navigation-buttons)
19
- - [Custom Navigation Template](#custom-navigation-template)
20
- - [Examples](#examples)
21
- - [Basic Usage](#basic-usage)
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
- - πŸš€ Easy to integrate with existing Angular projects
31
- - 🎨 Highly customizable appearance and behavior
32
- - β™Ώ Accessible by default, following WCAG guidelines
33
- - πŸ“± Responsive design, works on all screen sizes
34
- - πŸ”’ Support for linear and non-linear step progression
35
- - πŸ”„ Built-in animations for smooth transitions
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
- 1. Import the `StepperModule` in your Angular module:
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
- @NgModule({
66
+ @Component({
67
+ standalone: true,
54
68
  imports: [StepperModule],
55
69
  // ...
56
70
  })
57
- export class YourModule { }
71
+ export class YourComponent { }
58
72
  ```
59
73
 
60
- 2. Use the stepper component in your template:
74
+ In your template:
61
75
 
62
76
  ```html
63
77
  <hub-stepper>
64
- <hub-step title="Step 1">
65
- <h2>Welcome to Step 1</h2>
66
- <p>This is the content of step 1.</p>
78
+ <hub-step title="Account Setup">
79
+ <h3>Welcome!</h3>
80
+ <p>Setup your account details here.</p>
67
81
  </hub-step>
68
- <hub-step title="Step 2">
69
- <h2>Moving on to Step 2</h2>
70
- <p>Here's what you need to do in step 2.</p>
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
- <hub-step title="Step 3">
73
- <h2>Final Step</h2>
74
- <p>Congratulations! You've reached the last step.</p>
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
- ## API Reference
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
- ## Customization
97
+ ### Linear Stepper
104
98
 
105
- The stepper component can be customized using CSS variables and by providing custom templates for navigation and buttons.
99
+ Control navigation by enabling/disabling steps programmatically.
106
100
 
107
- ### CSS Variables
101
+ ```html
102
+ <hub-stepper (completed)="onFinish()">
103
+ <hub-step title="Step 1">
104
+ <!-- Step 1 Content -->
105
+ </hub-step>
108
106
 
109
- ```css
110
- :root {
111
- --stepper-direction: column;
112
- --stepper-primary-color: #009ef7;
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
- ### Programmatic Customization
113
+ ### Custom Navigation
121
114
 
122
- You can also customize the stepper appearance programmatically using the `StepperThemeService`:
115
+ Provide your own navigation template using the `stepperNavTpt` property.
123
116
 
124
- ```typescript
125
- import { StepperThemeService } from '@hub-ui/stepper';
126
-
127
- @Component({...})
128
- export class YourComponent implements OnInit {
129
- constructor(private themeService: StepperThemeService) {}
130
-
131
- ngOnInit() {
132
- this.themeService.setTheme({
133
- 'primary-color': '#ff4081',
134
- 'background-color': '#f0f0f0'
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
- This allows you to change the theme dynamically based on user preferences or other conditions in your application.
134
+ ### Custom Buttons
141
135
 
142
- ### Custom Navigation Buttons
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
- <!-- Step content -->
148
- <button previousButton>Custom Back</button>
149
- <button nextButton>Custom Next</button>
150
- <button submitButton>Custom Submit</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
- These directives (previousButton, nextButton, and submitButton) automatically handle the navigation logic and apply default styling classes.
148
+ ## API Reference
155
149
 
156
- ### Custom Navigation Template
150
+ ### StepperComponent (`hub-stepper`)
157
151
 
158
- ```html
159
- <hub-stepper [stepperNavTpt]="customNavTemplate">
160
- <!-- step content -->
161
- </hub-stepper>
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
- <ng-template #customNavTemplate let-steps="steps" let-currentIndex="currentIndex">
164
- <!-- Your custom navigation markup -->
165
- </ng-template>
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
- <!-- ## Accessibility
165
+ ### StepComponent (`hub-step`)
169
166
 
170
- This component is designed with accessibility in mind:
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
- - Proper ARIA attributes are used for navigation and step content
173
- - Keyboard navigation is supported
174
- - Color contrast ratios meet WCAG AA standards -->
172
+ ### Directives
175
173
 
176
- ## Examples
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
- ### Basic Usage
179
+ ### Interfaces
179
180
 
180
- ```html
181
- <hub-stepper>
182
- <hub-step title="Personal Info">
183
- <!-- Personal info form fields -->
184
- </hub-step>
185
- <hub-step title="Address">
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
- ### With Custom Navigation
189
+ ## Styling
195
190
 
196
- ```html
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
- <ng-template #customNav let-steps="steps" let-currentIndex="currentIndex">
202
- <ul class="custom-nav">
203
- <li *ngFor="let step of steps; let i = index"
204
- [class.active]="i === currentIndex">
205
- {{ step.title }}
206
- </li>
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 to ng-hub-ui-stepper! Here's how you can help:
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
- Please make sure to update tests as appropriate and adhere to the [Angular Style Guide](https://angular.io/guide/styleguide).
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 the Project
211
+ ## Support
224
212
 
225
- If you find this project helpful and would like to support its development, you can buy me a coffee:
213
+ If you find this project helpful, consider supporting its development:
226
214
 
227
- [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/carlosmorcillo)
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
+ [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](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
-