ps-helix 0.1.0 → 2.0.1
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 +1013 -153
- package/THEME.md +443 -0
- package/fesm2022/ps-helix.mjs +2701 -1369
- package/fesm2022/ps-helix.mjs.map +1 -1
- package/index.d.ts +2521 -3
- package/package.json +6 -6
- package/src/lib/styles/base/global.css +28 -0
- package/src/lib/styles/base/reset.css +25 -0
- package/src/lib/styles/themes/dark.css +53 -26
- package/src/lib/styles/themes/light.css +42 -21
- package/src/lib/styles/tokens/animations.tokens.css +21 -0
- package/src/lib/styles/tokens/effects.tokens.css +38 -0
- package/src/lib/styles/tokens/layout.tokens.css +32 -0
- package/src/lib/styles/tokens/sizing.tokens.css +94 -0
- package/src/lib/styles/tokens/spacing.tokens.css +23 -0
- package/src/lib/styles/tokens/typography.tokens.css +34 -0
- package/src/lib/styles/{utils/animations.css → utilities/animations.utils.css} +11 -30
- package/src/lib/styles/{utils/colors.css → utilities/colors.utils.css} +3 -8
- package/src/lib/styles/{utils/focus.css → utilities/focus.utils.css} +1 -15
- package/src/lib/styles/{utils/layout.css → utilities/layout.utils.css} +2 -16
- package/src/lib/styles/{utils/responsive.css → utilities/responsive.utils.css} +32 -32
- package/src/lib/styles/{utils/spacing.css → utilities/spacing.utils.css} +2 -24
- package/src/lib/styles/utilities/typography.utils.css +36 -0
- package/styles.css +31 -8
- package/lib/components/alert/alert.component.d.ts +0 -26
- package/lib/components/alert/alert.types.d.ts +0 -46
- package/lib/components/avatar/avatar.component.d.ts +0 -20
- package/lib/components/avatar/avatar.types.d.ts +0 -33
- package/lib/components/badge/badge.component.d.ts +0 -25
- package/lib/components/badge/badge.types.d.ts +0 -4
- package/lib/components/button/button.component.d.ts +0 -25
- package/lib/components/button/button.types.d.ts +0 -16
- package/lib/components/card/card.component.d.ts +0 -82
- package/lib/components/card/card.types.d.ts +0 -31
- package/lib/components/charts/pie-chart/pie-chart.component.d.ts +0 -29
- package/lib/components/charts/pie-chart/pie-chart.types.d.ts +0 -45
- package/lib/components/checkbox/checkbox.component.d.ts +0 -23
- package/lib/components/checkbox/checkbox.types.d.ts +0 -4
- package/lib/components/collapse/collapse.component.d.ts +0 -17
- package/lib/components/collapse/collapse.types.d.ts +0 -8
- package/lib/components/dropdown/dropdown.component.d.ts +0 -32
- package/lib/components/dropdown/dropdown.types.d.ts +0 -36
- package/lib/components/horizontal-card/horizontal-card.component.d.ts +0 -33
- package/lib/components/info-card/info-card.component.d.ts +0 -28
- package/lib/components/info-card/info-card.types.d.ts +0 -12
- package/lib/components/input/input.component.d.ts +0 -63
- package/lib/components/input/input.types.d.ts +0 -28
- package/lib/components/menu/menu.component.d.ts +0 -24
- package/lib/components/menu/menu.types.d.ts +0 -33
- package/lib/components/modal/modal.component.d.ts +0 -73
- package/lib/components/modal/modal.types.d.ts +0 -27
- package/lib/components/pagination/pagination.component.d.ts +0 -36
- package/lib/components/pagination/pagination.types.d.ts +0 -27
- package/lib/components/progressbar/progressbar.component.d.ts +0 -22
- package/lib/components/progressbar/progressbar.types.d.ts +0 -29
- package/lib/components/radio/radio.component.d.ts +0 -32
- package/lib/components/radio/radio.types.d.ts +0 -29
- package/lib/components/select/select.component.d.ts +0 -84
- package/lib/components/select/select.types.d.ts +0 -82
- package/lib/components/sidebar/sidebar.component.d.ts +0 -30
- package/lib/components/sidebar/sidebar.types.d.ts +0 -21
- package/lib/components/spinloader/spinloader.component.d.ts +0 -21
- package/lib/components/spinloader/spinloader.types.d.ts +0 -23
- package/lib/components/stat-card/stat-card.component.d.ts +0 -48
- package/lib/components/stepper/stepper.component.d.ts +0 -42
- package/lib/components/stepper/stepper.types.d.ts +0 -59
- package/lib/components/switch/switch.component.d.ts +0 -34
- package/lib/components/switch/switch.types.d.ts +0 -25
- package/lib/components/tab-bar/tab-bar.component.d.ts +0 -27
- package/lib/components/tab-bar/tab-bar.types.d.ts +0 -28
- package/lib/components/table/table.component.d.ts +0 -56
- package/lib/components/table/table.types.d.ts +0 -70
- package/lib/components/tabs/tabs.component.d.ts +0 -37
- package/lib/components/tabs/tabs.types.d.ts +0 -32
- package/lib/components/tag/tag.component.d.ts +0 -24
- package/lib/components/tag/tag.types.d.ts +0 -25
- package/lib/components/toast/toast.component.d.ts +0 -24
- package/lib/components/toast/toast.service.d.ts +0 -38
- package/lib/components/toast/toast.types.d.ts +0 -40
- package/lib/components/tooltip/tooltip.component.d.ts +0 -38
- package/lib/components/tooltip/tooltip.types.d.ts +0 -21
- package/lib/services/scroll.service.d.ts +0 -8
- package/lib/services/theme/theme.service.d.ts +0 -41
- package/lib/services/theme/types/theme.types.d.ts +0 -9
- package/lib/services/translation/translation.service.d.ts +0 -25
- package/lib/services/translation/types/i18n.types.d.ts +0 -8
- package/public-api.d.ts +0 -62
- package/src/lib/styles/reset.css +0 -164
- package/src/lib/styles/utils/typography.css +0 -68
package/README.md
CHANGED
|
@@ -1,50 +1,162 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Helix Design System
|
|
2
|
+
|
|
3
|
+
A comprehensive Angular component library built with Angular 20+ featuring modern design patterns, accessibility-first development, and optimal developer experience.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/ps-helix)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://angular.dev/)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
|
|
10
|
+
## Table of Contents
|
|
11
|
+
|
|
12
|
+
- [Overview](#overview)
|
|
13
|
+
- [Prerequisites](#prerequisites)
|
|
14
|
+
- [Installation](#installation)
|
|
15
|
+
- [Quick Start](#quick-start)
|
|
16
|
+
- [Configuration](#configuration)
|
|
17
|
+
- [Global Styles](#global-styles)
|
|
18
|
+
- [Phosphor Icons Setup](#phosphor-icons-setup)
|
|
19
|
+
- [Theme Service](#theme-service)
|
|
20
|
+
- [Translation Service](#translation-service)
|
|
21
|
+
- [Scroll Service](#scroll-service)
|
|
22
|
+
- [Core Concepts](#core-concepts)
|
|
23
|
+
- [Standalone Components](#standalone-components)
|
|
24
|
+
- [Signal-Based Reactivity](#signal-based-reactivity)
|
|
25
|
+
- [Type Safety](#type-safety)
|
|
26
|
+
- [Dependency Injection](#dependency-injection)
|
|
27
|
+
- [Available Components](#available-components)
|
|
28
|
+
- [Service APIs](#service-apis)
|
|
29
|
+
- [ThemeService](#themeservice)
|
|
30
|
+
- [ToastService](#toastservice)
|
|
31
|
+
- [ScrollService](#scrollservice)
|
|
32
|
+
- [TranslationService](#translationservice)
|
|
33
|
+
- [Exported Types](#exported-types)
|
|
34
|
+
- [Theming](#theming)
|
|
35
|
+
- [Best Practices](#best-practices)
|
|
36
|
+
- [Troubleshooting](#troubleshooting)
|
|
37
|
+
- [Browser Support](#browser-support)
|
|
38
|
+
- [Development Scripts](#development-scripts)
|
|
39
|
+
- [Contributing](#contributing)
|
|
40
|
+
- [License](#license)
|
|
41
|
+
- [Resources](#resources)
|
|
42
|
+
|
|
43
|
+
## Overview
|
|
44
|
+
|
|
45
|
+
Helix is a production-ready design system that provides:
|
|
46
|
+
|
|
47
|
+
- **28 Standalone Components** - All components are standalone, no NgModules required
|
|
48
|
+
- **Signal-Based Reactivity** - Built with Angular 20 signals for optimal performance
|
|
49
|
+
- **Accessibility First** - WCAG 2.1 AA compliant out of the box
|
|
50
|
+
- **TypeScript Strict Mode** - Full type safety and IntelliSense support
|
|
51
|
+
- **Complete Type Exports** - All component types and enums exported for type-safe development
|
|
52
|
+
- **Customizable Theming** - Light/dark modes with brand color customization
|
|
53
|
+
- **Phosphor Icons** - 6000+ icons with multiple weight variants
|
|
54
|
+
- **i18n Support** - Built-in internationalization with ngx-translate
|
|
55
|
+
- **Responsive Design** - Mobile-first approach with comprehensive breakpoint system
|
|
56
|
+
- **Modern Architecture** - Built with Angular 20 standalone components and signals
|
|
57
|
+
|
|
58
|
+
## Prerequisites
|
|
59
|
+
|
|
60
|
+
Before installing Helix, ensure your development environment meets these requirements:
|
|
61
|
+
|
|
62
|
+
- **Node.js**: 18.x or higher
|
|
63
|
+
- **npm**: 9.x or higher
|
|
64
|
+
- **Angular**: 20.0.0 or higher
|
|
65
|
+
- **Angular CLI**: 20.0.0 or higher
|
|
66
|
+
- **TypeScript**: 5.8.0 or higher
|
|
67
|
+
|
|
68
|
+
### Required Peer Dependencies
|
|
2
69
|
|
|
3
|
-
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"@angular/common": "^20.0.0",
|
|
73
|
+
"@angular/core": "^20.0.0",
|
|
74
|
+
"@angular/forms": "^20.0.0",
|
|
75
|
+
"@ngx-translate/core": "^15.0.0",
|
|
76
|
+
"rxjs": "^7.8.0"
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Included Dependencies
|
|
81
|
+
|
|
82
|
+
The following dependencies are bundled with ps-helix:
|
|
83
|
+
|
|
84
|
+
- **@phosphor-icons/web**: 2.0.3 - Icon library
|
|
85
|
+
- **date-fns**: ^3.3.1 - Date utility functions
|
|
86
|
+
- **tslib**: ^2.6.0 - TypeScript runtime library
|
|
4
87
|
|
|
5
88
|
## Installation
|
|
6
89
|
|
|
90
|
+
Install the package via npm:
|
|
91
|
+
|
|
7
92
|
```bash
|
|
8
93
|
npm install ps-helix
|
|
9
94
|
```
|
|
10
95
|
|
|
11
|
-
|
|
96
|
+
All peer dependencies should be automatically installed. If not, install them manually:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm install @angular/common@^20.0.0 @angular/core@^20.0.0 @angular/forms@^20.0.0 @ngx-translate/core@^15.0.0 rxjs@^7.8.0
|
|
100
|
+
```
|
|
12
101
|
|
|
13
|
-
|
|
102
|
+
### Verify Installation
|
|
103
|
+
|
|
104
|
+
After installation, verify that ps-helix is in your `package.json`:
|
|
14
105
|
|
|
15
106
|
```json
|
|
16
107
|
{
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"@ngx-translate/core": "^15.0.0",
|
|
21
|
-
"rxjs": "^7.8.0"
|
|
108
|
+
"dependencies": {
|
|
109
|
+
"ps-helix": "^2.0.0"
|
|
110
|
+
}
|
|
22
111
|
}
|
|
23
112
|
```
|
|
24
113
|
|
|
25
|
-
##
|
|
114
|
+
## Quick Start
|
|
26
115
|
|
|
27
|
-
### 1
|
|
116
|
+
### Step 1: Import Global Styles
|
|
28
117
|
|
|
29
|
-
In your `styles.css`
|
|
118
|
+
In your main `styles.css` file, import the Helix stylesheet:
|
|
30
119
|
|
|
31
120
|
```css
|
|
32
121
|
@import 'ps-helix/styles.css';
|
|
33
122
|
```
|
|
34
123
|
|
|
35
|
-
This
|
|
36
|
-
- CSS Reset
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
124
|
+
This single import includes:
|
|
125
|
+
- CSS Reset (normalize styles across browsers)
|
|
126
|
+
- Design Tokens (spacing, typography, colors, etc.)
|
|
127
|
+
- Light and Dark theme variables
|
|
128
|
+
- Utility classes (spacing, typography, layout, etc.)
|
|
129
|
+
- Responsive breakpoints and grid system
|
|
41
130
|
- Animation utilities
|
|
42
|
-
- Focus styles
|
|
43
|
-
|
|
131
|
+
- Focus management styles
|
|
132
|
+
|
|
133
|
+
### Step 2: Configure Phosphor Icons
|
|
134
|
+
|
|
135
|
+
Add Phosphor Icons CDN links to your `src/index.html` in the `<head>` section:
|
|
136
|
+
|
|
137
|
+
```html
|
|
138
|
+
<!DOCTYPE html>
|
|
139
|
+
<html lang="en">
|
|
140
|
+
<head>
|
|
141
|
+
<meta charset="UTF-8" />
|
|
142
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
143
|
+
<title>Your App</title>
|
|
144
|
+
|
|
145
|
+
<!-- Phosphor Icons CDN -->
|
|
146
|
+
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.0.3/src/regular/style.css">
|
|
147
|
+
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.0.3/src/fill/style.css">
|
|
148
|
+
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.0.3/src/bold/style.css">
|
|
149
|
+
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.0.3/src/light/style.css">
|
|
150
|
+
</head>
|
|
151
|
+
<body>
|
|
152
|
+
<app-root></app-root>
|
|
153
|
+
</body>
|
|
154
|
+
</html>
|
|
155
|
+
```
|
|
44
156
|
|
|
45
|
-
###
|
|
157
|
+
### Step 3: Import and Use Components
|
|
46
158
|
|
|
47
|
-
All components are standalone
|
|
159
|
+
All components are standalone. Import them directly where needed:
|
|
48
160
|
|
|
49
161
|
```typescript
|
|
50
162
|
import { Component } from '@angular/core';
|
|
@@ -52,24 +164,119 @@ import { PshButtonComponent } from 'ps-helix';
|
|
|
52
164
|
|
|
53
165
|
@Component({
|
|
54
166
|
selector: 'app-root',
|
|
55
|
-
standalone: true,
|
|
56
167
|
imports: [PshButtonComponent],
|
|
57
168
|
template: `
|
|
58
169
|
<psh-button
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
170
|
+
variant="primary"
|
|
171
|
+
size="medium"
|
|
172
|
+
(clicked)="handleClick()">
|
|
173
|
+
Click Me
|
|
62
174
|
</psh-button>
|
|
63
175
|
`
|
|
64
176
|
})
|
|
65
|
-
export class AppComponent {
|
|
177
|
+
export class AppComponent {
|
|
178
|
+
handleClick() {
|
|
179
|
+
console.log('Button clicked!');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Step 4: Initialize Theme Service (Optional)
|
|
185
|
+
|
|
186
|
+
If you want to use theme switching, inject the ThemeService:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
190
|
+
import { ThemeService } from 'ps-helix';
|
|
191
|
+
|
|
192
|
+
@Component({
|
|
193
|
+
selector: 'app-root',
|
|
194
|
+
template: `
|
|
195
|
+
<button (click)="themeService.toggleTheme()">
|
|
196
|
+
Toggle Theme ({{ themeService.themeName() }})
|
|
197
|
+
</button>
|
|
198
|
+
`
|
|
199
|
+
})
|
|
200
|
+
export class AppComponent implements OnInit {
|
|
201
|
+
themeService = inject(ThemeService);
|
|
202
|
+
|
|
203
|
+
ngOnInit() {
|
|
204
|
+
// Theme is initialized automatically
|
|
205
|
+
console.log('Current theme:', this.themeService.themeName());
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Step 5: Verify Everything Works
|
|
211
|
+
|
|
212
|
+
Create a simple test component to ensure the library is working:
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
import { Component } from '@angular/core';
|
|
216
|
+
import { PshButtonComponent, PshCardComponent, PshAlertComponent } from 'ps-helix';
|
|
217
|
+
|
|
218
|
+
@Component({
|
|
219
|
+
selector: 'app-test',
|
|
220
|
+
imports: [PshButtonComponent, PshCardComponent, PshAlertComponent],
|
|
221
|
+
template: `
|
|
222
|
+
<psh-card>
|
|
223
|
+
<h2>Helix Design System</h2>
|
|
224
|
+
<psh-alert type="success" message="Installation successful!" />
|
|
225
|
+
<psh-button variant="primary">Test Button</psh-button>
|
|
226
|
+
</psh-card>
|
|
227
|
+
`
|
|
228
|
+
})
|
|
229
|
+
export class TestComponent {}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Configuration
|
|
233
|
+
|
|
234
|
+
### Global Styles
|
|
235
|
+
|
|
236
|
+
The design system provides a comprehensive set of CSS custom properties (CSS variables) that you can use in your own styles:
|
|
237
|
+
|
|
238
|
+
```css
|
|
239
|
+
/* Using design tokens in your custom styles */
|
|
240
|
+
.my-custom-component {
|
|
241
|
+
padding: var(--spacing-md);
|
|
242
|
+
margin-bottom: var(--spacing-lg);
|
|
243
|
+
background: var(--surface-card);
|
|
244
|
+
color: var(--text-color);
|
|
245
|
+
border-radius: var(--border-radius);
|
|
246
|
+
box-shadow: var(--shadow-md);
|
|
247
|
+
}
|
|
66
248
|
```
|
|
67
249
|
|
|
68
|
-
###
|
|
250
|
+
### Phosphor Icons Setup
|
|
251
|
+
|
|
252
|
+
After adding the CDN links, use icons in your templates:
|
|
253
|
+
|
|
254
|
+
```html
|
|
255
|
+
<!-- Regular weight (default) -->
|
|
256
|
+
<i class="ph ph-heart"></i>
|
|
257
|
+
|
|
258
|
+
<!-- Fill weight -->
|
|
259
|
+
<i class="ph-fill ph-heart"></i>
|
|
260
|
+
|
|
261
|
+
<!-- Bold weight -->
|
|
262
|
+
<i class="ph-bold ph-heart"></i>
|
|
263
|
+
|
|
264
|
+
<!-- Light weight -->
|
|
265
|
+
<i class="ph-light ph-heart"></i>
|
|
266
|
+
|
|
267
|
+
<!-- With accessibility label for icon-only buttons -->
|
|
268
|
+
<button aria-label="Like this item">
|
|
269
|
+
<i class="ph ph-heart" aria-hidden="true"></i>
|
|
270
|
+
</button>
|
|
271
|
+
```
|
|
69
272
|
|
|
70
|
-
|
|
273
|
+
Browse all 6000+ icons at: [https://phosphoricons.com/](https://phosphoricons.com/)
|
|
71
274
|
|
|
72
|
-
|
|
275
|
+
### Theme Service
|
|
276
|
+
|
|
277
|
+
The `ThemeService` manages light/dark theme switching and custom brand colors.
|
|
278
|
+
|
|
279
|
+
#### Basic Theme Switching
|
|
73
280
|
|
|
74
281
|
```typescript
|
|
75
282
|
import { Component, inject } from '@angular/core';
|
|
@@ -77,7 +284,6 @@ import { ThemeService } from 'ps-helix';
|
|
|
77
284
|
|
|
78
285
|
@Component({
|
|
79
286
|
selector: 'app-root',
|
|
80
|
-
standalone: true,
|
|
81
287
|
template: `
|
|
82
288
|
<button (click)="toggleTheme()">
|
|
83
289
|
Current theme: {{ themeService.themeName() }}
|
|
@@ -93,194 +299,848 @@ export class AppComponent {
|
|
|
93
299
|
}
|
|
94
300
|
```
|
|
95
301
|
|
|
96
|
-
|
|
302
|
+
For complete theming documentation including custom brand colors, see [THEME.md](./THEME.md).
|
|
303
|
+
|
|
304
|
+
### Translation Service
|
|
97
305
|
|
|
98
|
-
Configure internationalization with
|
|
306
|
+
Configure internationalization with ngx-translate:
|
|
99
307
|
|
|
100
308
|
```typescript
|
|
101
|
-
|
|
102
|
-
import {
|
|
309
|
+
// src/main.ts
|
|
310
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
311
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
312
|
+
import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-translate/core';
|
|
313
|
+
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
314
|
+
import { HttpClient } from '@angular/common/http';
|
|
315
|
+
import { AppComponent } from './app/app.component';
|
|
316
|
+
|
|
317
|
+
export function HttpLoaderFactory(http: HttpClient) {
|
|
318
|
+
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
|
319
|
+
}
|
|
103
320
|
|
|
104
|
-
|
|
321
|
+
bootstrapApplication(AppComponent, {
|
|
105
322
|
providers: [
|
|
106
|
-
|
|
323
|
+
provideHttpClient(),
|
|
324
|
+
...TranslateModule.forRoot({
|
|
325
|
+
defaultLanguage: 'en',
|
|
326
|
+
loader: {
|
|
327
|
+
provide: TranslateLoader,
|
|
328
|
+
useFactory: HttpLoaderFactory,
|
|
329
|
+
deps: [HttpClient]
|
|
330
|
+
}
|
|
331
|
+
}).providers || []
|
|
107
332
|
]
|
|
108
|
-
}
|
|
333
|
+
}).then(ref => {
|
|
334
|
+
const translateService = ref.injector.get(TranslateService);
|
|
335
|
+
translateService.use('en');
|
|
336
|
+
});
|
|
109
337
|
```
|
|
110
338
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
### Form Components
|
|
114
|
-
- `PshButtonComponent` - Versatile button with multiple variants and states
|
|
115
|
-
- `PshInputComponent` - Text input with validation support
|
|
116
|
-
- `PshCheckboxComponent` - Checkbox with customizable states
|
|
117
|
-
- `PshRadioComponent` - Radio button for single selection
|
|
118
|
-
- `PshSelectComponent` - Dropdown select with search
|
|
119
|
-
- `PshSwitchComponent` - Toggle switch component
|
|
120
|
-
|
|
121
|
-
### Layout Components
|
|
122
|
-
- `PshCardComponent` - Content container with variants
|
|
123
|
-
- `PshModalComponent` - Modal dialog overlay
|
|
124
|
-
- `PshSidebarComponent` - Collapsible sidebar navigation
|
|
125
|
-
- `PshCollapseComponent` - Expandable content section
|
|
126
|
-
- `PshTabsComponent` - Tabbed content organization
|
|
127
|
-
- `PshTabBarComponent` - Bottom tab bar navigation
|
|
128
|
-
|
|
129
|
-
### Feedback Components
|
|
130
|
-
- `PshAlertComponent` - Alert messages with severity levels
|
|
131
|
-
- `PshToastComponent` - Toast notifications
|
|
132
|
-
- `PshSpinloaderComponent` - Loading spinner
|
|
133
|
-
- `PshProgressbarComponent` - Progress indicator
|
|
134
|
-
- `PshTooltipComponent` - Contextual tooltips
|
|
135
|
-
|
|
136
|
-
### Data Display Components
|
|
137
|
-
- `PshTableComponent` - Data table with sorting and pagination
|
|
138
|
-
- `PshBadgeComponent` - Status badges and indicators
|
|
139
|
-
- `PshTagComponent` - Removable tags
|
|
140
|
-
- `PshAvatarComponent` - User avatar with fallback
|
|
141
|
-
- `PshPieChartComponent` - Pie chart visualization
|
|
142
|
-
|
|
143
|
-
### Navigation Components
|
|
144
|
-
- `PshMenuComponent` - Dropdown menu
|
|
145
|
-
- `PshPaginationComponent` - Pagination controls
|
|
146
|
-
- `PshStepperComponent` - Step-by-step wizard
|
|
147
|
-
- `PshDropdownComponent` - Dropdown trigger and content
|
|
148
|
-
|
|
149
|
-
## Component Usage Examples
|
|
150
|
-
|
|
151
|
-
### Button
|
|
339
|
+
#### Using TranslationService in Components
|
|
152
340
|
|
|
153
341
|
```typescript
|
|
154
|
-
import {
|
|
342
|
+
import { Component, inject } from '@angular/core';
|
|
343
|
+
import { TranslationService } from 'ps-helix';
|
|
344
|
+
|
|
345
|
+
@Component({
|
|
346
|
+
selector: 'app-example',
|
|
347
|
+
template: `
|
|
348
|
+
<select (change)="changeLanguage($event)">
|
|
349
|
+
<option value="en">English</option>
|
|
350
|
+
<option value="fr">Français</option>
|
|
351
|
+
<option value="es">Español</option>
|
|
352
|
+
</select>
|
|
353
|
+
`
|
|
354
|
+
})
|
|
355
|
+
export class ExampleComponent {
|
|
356
|
+
private translationService = inject(TranslationService);
|
|
155
357
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
[loading]="false"
|
|
162
|
-
(clicked)="handleClick($event)">
|
|
163
|
-
Submit
|
|
164
|
-
</psh-button>
|
|
358
|
+
changeLanguage(event: Event) {
|
|
359
|
+
const lang = (event.target as HTMLSelectElement).value;
|
|
360
|
+
this.translationService.setLanguage(lang);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
165
363
|
```
|
|
166
364
|
|
|
167
|
-
###
|
|
365
|
+
### Scroll Service
|
|
366
|
+
|
|
367
|
+
The `ScrollService` provides utilities for scroll management:
|
|
168
368
|
|
|
169
369
|
```typescript
|
|
170
|
-
import {
|
|
171
|
-
import {
|
|
370
|
+
import { Component, inject } from '@angular/core';
|
|
371
|
+
import { ScrollService } from 'ps-helix';
|
|
172
372
|
|
|
173
|
-
|
|
174
|
-
|
|
373
|
+
@Component({
|
|
374
|
+
selector: 'app-example',
|
|
375
|
+
template: `
|
|
376
|
+
<button (click)="scrollToTop()">Back to Top</button>
|
|
377
|
+
<button (click)="scrollToElement('#section-2')">Go to Section 2</button>
|
|
378
|
+
`
|
|
379
|
+
})
|
|
380
|
+
export class ExampleComponent {
|
|
381
|
+
private scrollService = inject(ScrollService);
|
|
382
|
+
|
|
383
|
+
scrollToTop() {
|
|
384
|
+
this.scrollService.scrollToTop();
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
scrollToElement(selector: string) {
|
|
388
|
+
this.scrollService.scrollToElement(selector);
|
|
389
|
+
}
|
|
175
390
|
}
|
|
391
|
+
```
|
|
176
392
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
393
|
+
## Core Concepts
|
|
394
|
+
|
|
395
|
+
### Standalone Components
|
|
396
|
+
|
|
397
|
+
All Helix components are standalone (no NgModules required):
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
import { Component } from '@angular/core';
|
|
401
|
+
import {
|
|
402
|
+
PshButtonComponent,
|
|
403
|
+
PshInputComponent,
|
|
404
|
+
PshCardComponent
|
|
405
|
+
} from 'ps-helix';
|
|
406
|
+
|
|
407
|
+
@Component({
|
|
408
|
+
selector: 'app-form',
|
|
409
|
+
imports: [
|
|
410
|
+
PshButtonComponent,
|
|
411
|
+
PshInputComponent,
|
|
412
|
+
PshCardComponent
|
|
413
|
+
],
|
|
414
|
+
template: `
|
|
415
|
+
<psh-card>
|
|
416
|
+
<psh-input label="Email" />
|
|
417
|
+
<psh-button variant="primary">Submit</psh-button>
|
|
418
|
+
</psh-card>
|
|
419
|
+
`
|
|
420
|
+
})
|
|
421
|
+
export class FormComponent {}
|
|
184
422
|
```
|
|
185
423
|
|
|
186
|
-
###
|
|
424
|
+
### Signal-Based Reactivity
|
|
425
|
+
|
|
426
|
+
Components use Angular signals for optimal change detection:
|
|
187
427
|
|
|
188
428
|
```typescript
|
|
429
|
+
import { Component, signal } from '@angular/core';
|
|
189
430
|
import { PshModalComponent } from 'ps-helix';
|
|
190
|
-
import { signal } from '@angular/core';
|
|
191
431
|
|
|
192
|
-
|
|
432
|
+
@Component({
|
|
433
|
+
selector: 'app-example',
|
|
434
|
+
imports: [PshModalComponent],
|
|
435
|
+
template: `
|
|
436
|
+
<button (click)="isOpen.set(true)">Open Modal</button>
|
|
437
|
+
|
|
438
|
+
<psh-modal [(open)]="isOpen" title="Confirmation">
|
|
439
|
+
<p>Are you sure?</p>
|
|
440
|
+
</psh-modal>
|
|
441
|
+
`
|
|
442
|
+
})
|
|
443
|
+
export class ExampleComponent {
|
|
193
444
|
isOpen = signal(false);
|
|
194
445
|
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Type Safety
|
|
449
|
+
|
|
450
|
+
All components export TypeScript types for type-safe development:
|
|
195
451
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
452
|
+
```typescript
|
|
453
|
+
import { Component } from '@angular/core';
|
|
454
|
+
import { PshButtonComponent, ButtonVariant, ButtonSize } from 'ps-helix';
|
|
455
|
+
|
|
456
|
+
@Component({
|
|
457
|
+
selector: 'app-example',
|
|
458
|
+
imports: [PshButtonComponent],
|
|
459
|
+
template: `
|
|
460
|
+
<psh-button [variant]="variant" [size]="size">
|
|
461
|
+
{{ buttonText }}
|
|
462
|
+
</psh-button>
|
|
463
|
+
`
|
|
464
|
+
})
|
|
465
|
+
export class ExampleComponent {
|
|
466
|
+
variant: ButtonVariant = 'primary'; // Type-safe
|
|
467
|
+
size: ButtonSize = 'medium'; // Type-safe
|
|
468
|
+
buttonText = 'Click Me';
|
|
469
|
+
}
|
|
206
470
|
```
|
|
207
471
|
|
|
208
|
-
###
|
|
472
|
+
### Dependency Injection
|
|
473
|
+
|
|
474
|
+
Use modern `inject()` function instead of constructor injection:
|
|
209
475
|
|
|
210
476
|
```typescript
|
|
211
477
|
import { Component, inject } from '@angular/core';
|
|
478
|
+
import { ThemeService, ToastService } from 'ps-helix';
|
|
479
|
+
|
|
480
|
+
@Component({
|
|
481
|
+
selector: 'app-example',
|
|
482
|
+
template: `<button (click)="showToast()">Show Toast</button>`
|
|
483
|
+
})
|
|
484
|
+
export class ExampleComponent {
|
|
485
|
+
// Modern injection syntax
|
|
486
|
+
private themeService = inject(ThemeService);
|
|
487
|
+
private toastService = inject(ToastService);
|
|
488
|
+
|
|
489
|
+
showToast() {
|
|
490
|
+
this.toastService.success('Hello from Helix!');
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## Available Components
|
|
496
|
+
|
|
497
|
+
Helix provides **28 production-ready components** organized by category:
|
|
498
|
+
|
|
499
|
+
### Form Components (6)
|
|
500
|
+
|
|
501
|
+
- **PshButtonComponent** - Versatile button with multiple variants, sizes, and states
|
|
502
|
+
- **PshInputComponent** - Text input with validation, error messages, and form control integration
|
|
503
|
+
- **PshCheckboxComponent** - Checkbox with customizable states and labels
|
|
504
|
+
- **PshRadioComponent** - Radio button for single selection from a group
|
|
505
|
+
- **PshSelectComponent** - Dropdown select with search, filtering, and custom rendering
|
|
506
|
+
- **PshSwitchComponent** - Toggle switch with on/off states
|
|
507
|
+
|
|
508
|
+
### Layout Components (6)
|
|
509
|
+
|
|
510
|
+
- **PshCardComponent** - Flexible content container with header, body, and footer sections
|
|
511
|
+
- **PshModalComponent** - Modal dialog overlay with backdrop and keyboard navigation
|
|
512
|
+
- **PshSidebarComponent** - Collapsible sidebar navigation with responsive behavior
|
|
513
|
+
- **PshCollapseComponent** - Expandable/collapsible content section with animation
|
|
514
|
+
- **PshTabsComponent** + **PshTabComponent** - Tabbed content organization with keyboard navigation
|
|
515
|
+
- **PshTabBarComponent** - Bottom tab bar navigation for mobile-first applications
|
|
516
|
+
|
|
517
|
+
### Feedback Components (5)
|
|
518
|
+
|
|
519
|
+
- **PshAlertComponent** - Alert messages with severity levels (success, info, warning, error)
|
|
520
|
+
- **PshToastComponent** + **ToastService** - Toast notification system with queue management
|
|
521
|
+
- **PshSpinloaderComponent** - Loading spinner with various sizes
|
|
522
|
+
- **PshProgressbarComponent** - Progress indicator with percentage display
|
|
523
|
+
- **PshTooltipComponent** - Contextual tooltips with multiple positions
|
|
524
|
+
|
|
525
|
+
### Data Display Components (7)
|
|
526
|
+
|
|
527
|
+
- **PshTableComponent** - Data table with sorting, pagination, and custom rendering
|
|
528
|
+
- **PshBadgeComponent** - Status badges and indicators with various colors
|
|
529
|
+
- **PshTagComponent** - Removable tags for labels and filters
|
|
530
|
+
- **PshAvatarComponent** - User avatar with image, initials, or icon fallback
|
|
531
|
+
- **PshStatCardComponent** - Statistical card for dashboards
|
|
532
|
+
- **PshInfoCardComponent** - Information card with icon and content
|
|
533
|
+
- **PshHorizontalCardComponent** - Horizontal layout card component
|
|
534
|
+
|
|
535
|
+
### Navigation Components (4)
|
|
536
|
+
|
|
537
|
+
- **PshMenuComponent** - Dropdown menu with nested items
|
|
538
|
+
- **PshPaginationComponent** - Pagination controls with page numbers
|
|
539
|
+
- **PshStepperComponent** + **PshStepComponent** - Step-by-step wizard navigation with validation
|
|
540
|
+
- **PshDropdownComponent** - Dropdown trigger and content container
|
|
541
|
+
|
|
542
|
+
## Service APIs
|
|
543
|
+
|
|
544
|
+
### ThemeService
|
|
545
|
+
|
|
546
|
+
Manage application themes and custom brand colors.
|
|
547
|
+
|
|
548
|
+
**Methods:**
|
|
549
|
+
- `setDarkTheme(isDark: boolean)` - Set theme mode
|
|
550
|
+
- `toggleTheme()` - Toggle between light and dark
|
|
551
|
+
- `updateTheme(name: 'light' | 'dark')` - Update theme by name
|
|
552
|
+
- `applyInsurerTheme()` - Apply custom brand colors
|
|
553
|
+
|
|
554
|
+
**Computed Signals:**
|
|
555
|
+
- `themeName()` - Returns current theme name
|
|
556
|
+
- `isDarkTheme()` - Returns boolean for dark mode
|
|
557
|
+
- `themeInfo()` - Returns complete theme information
|
|
558
|
+
|
|
559
|
+
**Example:**
|
|
560
|
+
|
|
561
|
+
```typescript
|
|
562
|
+
import { inject } from '@angular/core';
|
|
563
|
+
import { ThemeService } from 'ps-helix';
|
|
564
|
+
|
|
565
|
+
export class MyComponent {
|
|
566
|
+
themeService = inject(ThemeService);
|
|
567
|
+
|
|
568
|
+
get currentTheme() {
|
|
569
|
+
return this.themeService.themeName(); // 'light' or 'dark'
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
get isDark() {
|
|
573
|
+
return this.themeService.isDarkTheme(); // boolean
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
switchTheme() {
|
|
577
|
+
this.themeService.toggleTheme();
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### ToastService
|
|
583
|
+
|
|
584
|
+
Display temporary notification messages.
|
|
585
|
+
|
|
586
|
+
**Methods:**
|
|
587
|
+
- `success(message: string, options?)` - Show success toast
|
|
588
|
+
- `error(message: string, options?)` - Show error toast
|
|
589
|
+
- `warning(message: string, options?)` - Show warning toast
|
|
590
|
+
- `info(message: string, options?)` - Show info toast
|
|
591
|
+
|
|
592
|
+
**Options:**
|
|
593
|
+
- `duration?: number` - Display duration in milliseconds (default: 3000)
|
|
594
|
+
- `position?: ToastPosition` - 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'
|
|
595
|
+
|
|
596
|
+
**Example:**
|
|
597
|
+
|
|
598
|
+
```typescript
|
|
599
|
+
import { inject } from '@angular/core';
|
|
212
600
|
import { ToastService } from 'ps-helix';
|
|
213
601
|
|
|
214
602
|
export class MyComponent {
|
|
215
603
|
private toastService = inject(ToastService);
|
|
216
604
|
|
|
217
|
-
|
|
218
|
-
|
|
605
|
+
saveData() {
|
|
606
|
+
try {
|
|
607
|
+
// Save logic
|
|
608
|
+
this.toastService.success('Data saved successfully!');
|
|
609
|
+
} catch (error) {
|
|
610
|
+
this.toastService.error('Failed to save data');
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
showCustom() {
|
|
615
|
+
this.toastService.info('Processing...', {
|
|
616
|
+
duration: 5000,
|
|
617
|
+
position: 'bottom-right'
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### ScrollService
|
|
624
|
+
|
|
625
|
+
Utility service for scroll management and smooth scrolling.
|
|
626
|
+
|
|
627
|
+
**Methods:**
|
|
628
|
+
- `scrollToTop()` - Scroll to page top smoothly
|
|
629
|
+
- `scrollToElement(selector: string)` - Scroll to specific element
|
|
630
|
+
- `disableScroll()` - Disable page scrolling (useful for modals)
|
|
631
|
+
- `enableScroll()` - Re-enable page scrolling
|
|
632
|
+
|
|
633
|
+
**Example:**
|
|
634
|
+
|
|
635
|
+
```typescript
|
|
636
|
+
import { inject } from '@angular/core';
|
|
637
|
+
import { ScrollService } from 'ps-helix';
|
|
638
|
+
|
|
639
|
+
export class MyComponent {
|
|
640
|
+
private scrollService = inject(ScrollService);
|
|
641
|
+
|
|
642
|
+
backToTop() {
|
|
643
|
+
this.scrollService.scrollToTop();
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
goToSection(sectionId: string) {
|
|
647
|
+
this.scrollService.scrollToElement(`#${sectionId}`);
|
|
219
648
|
}
|
|
220
649
|
|
|
221
|
-
|
|
222
|
-
this.
|
|
650
|
+
openModal() {
|
|
651
|
+
this.scrollService.disableScroll();
|
|
652
|
+
// Show modal
|
|
223
653
|
}
|
|
224
654
|
|
|
225
|
-
|
|
226
|
-
this.
|
|
655
|
+
closeModal() {
|
|
656
|
+
this.scrollService.enableScroll();
|
|
657
|
+
// Hide modal
|
|
227
658
|
}
|
|
228
659
|
}
|
|
229
660
|
```
|
|
230
661
|
|
|
231
|
-
|
|
662
|
+
### TranslationService
|
|
232
663
|
|
|
233
|
-
|
|
664
|
+
Wrapper service for ngx-translate functionality.
|
|
234
665
|
|
|
235
|
-
|
|
666
|
+
**Methods:**
|
|
667
|
+
- `setLanguage(lang: string)` - Change application language
|
|
668
|
+
- `getTranslation(key: string)` - Get translation for a key
|
|
669
|
+
- `instant(key: string)` - Get instant translation (synchronous)
|
|
236
670
|
|
|
237
|
-
|
|
671
|
+
**Example:**
|
|
238
672
|
|
|
239
673
|
```typescript
|
|
240
|
-
import {
|
|
241
|
-
import {
|
|
674
|
+
import { Component, inject } from '@angular/core';
|
|
675
|
+
import { TranslationService } from 'ps-helix';
|
|
242
676
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
677
|
+
@Component({
|
|
678
|
+
selector: 'app-language-selector',
|
|
679
|
+
template: `
|
|
680
|
+
<select (change)="changeLanguage($event)">
|
|
681
|
+
<option value="en">English</option>
|
|
682
|
+
<option value="fr">Français</option>
|
|
683
|
+
<option value="es">Español</option>
|
|
684
|
+
<option value="de">Deutsch</option>
|
|
685
|
+
</select>
|
|
686
|
+
`
|
|
687
|
+
})
|
|
688
|
+
export class LanguageSelectorComponent {
|
|
689
|
+
private translationService = inject(TranslationService);
|
|
247
690
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
};
|
|
691
|
+
changeLanguage(event: Event) {
|
|
692
|
+
const selectedLang = (event.target as HTMLSelectElement).value;
|
|
693
|
+
this.translationService.setLanguage(selectedLang);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
256
696
|
```
|
|
257
697
|
|
|
258
|
-
##
|
|
698
|
+
## Exported Types
|
|
699
|
+
|
|
700
|
+
All component types and enums are exported for type-safe development:
|
|
259
701
|
|
|
260
|
-
|
|
702
|
+
### Alert Types
|
|
261
703
|
|
|
262
704
|
```typescript
|
|
263
|
-
import {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
705
|
+
import { AlertType, AlertVariant } from 'ps-helix';
|
|
706
|
+
|
|
707
|
+
const type: AlertType = 'success' | 'error' | 'warning' | 'info';
|
|
708
|
+
const variant: AlertVariant = 'solid' | 'outlined' | 'soft';
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
### Avatar Types
|
|
712
|
+
|
|
713
|
+
```typescript
|
|
714
|
+
import { AvatarSize, AvatarShape } from 'ps-helix';
|
|
715
|
+
|
|
716
|
+
const size: AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
717
|
+
const shape: AvatarShape = 'circle' | 'square';
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Badge Types
|
|
721
|
+
|
|
722
|
+
```typescript
|
|
723
|
+
import { BadgeSize, BadgeVariant } from 'ps-helix';
|
|
724
|
+
|
|
725
|
+
const size: BadgeSize = 'sm' | 'md' | 'lg';
|
|
726
|
+
const variant: BadgeVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
### Button Types
|
|
730
|
+
|
|
731
|
+
```typescript
|
|
732
|
+
import { ButtonAppearance, ButtonSize, ButtonVariant } from 'ps-helix';
|
|
733
|
+
|
|
734
|
+
const appearance: ButtonAppearance = 'filled' | 'outlined' | 'text' | 'ghost';
|
|
735
|
+
const size: ButtonSize = 'small' | 'medium' | 'large';
|
|
736
|
+
const variant: ButtonVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
### Input Types
|
|
740
|
+
|
|
741
|
+
```typescript
|
|
742
|
+
import { InputSize, InputType } from 'ps-helix';
|
|
743
|
+
|
|
744
|
+
const size: InputSize = 'small' | 'medium' | 'large';
|
|
745
|
+
const type: InputType = 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search';
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
### Modal Types
|
|
749
|
+
|
|
750
|
+
```typescript
|
|
751
|
+
import { ModalSize } from 'ps-helix';
|
|
752
|
+
|
|
753
|
+
const size: ModalSize = 'small' | 'medium' | 'large' | 'fullscreen';
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
### Select Types
|
|
757
|
+
|
|
758
|
+
```typescript
|
|
759
|
+
import { SelectFilterMode, SelectPlacement, SelectSize } from 'ps-helix';
|
|
760
|
+
|
|
761
|
+
const filterMode: SelectFilterMode = 'none' | 'startsWith' | 'contains';
|
|
762
|
+
const placement: SelectPlacement = 'bottom' | 'top';
|
|
763
|
+
const size: SelectSize = 'small' | 'medium' | 'large';
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
### Stepper Types
|
|
767
|
+
|
|
768
|
+
```typescript
|
|
769
|
+
import { StepperVariant } from 'ps-helix';
|
|
770
|
+
|
|
771
|
+
const variant: StepperVariant = 'default' | 'numbered' | 'progress';
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
### Table Types
|
|
775
|
+
|
|
776
|
+
```typescript
|
|
777
|
+
import { TableColumn, TableSortDirection } from 'ps-helix';
|
|
778
|
+
|
|
779
|
+
const sortDirection: TableSortDirection = 'asc' | 'desc' | null;
|
|
780
|
+
|
|
781
|
+
interface TableColumn<T> {
|
|
782
|
+
key: string;
|
|
783
|
+
label: string;
|
|
784
|
+
sortable?: boolean;
|
|
785
|
+
width?: string;
|
|
786
|
+
align?: 'left' | 'center' | 'right';
|
|
787
|
+
render?: (item: T) => string;
|
|
788
|
+
}
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
### Toast Types
|
|
792
|
+
|
|
793
|
+
```typescript
|
|
794
|
+
import { ToastPosition, ToastVariant } from 'ps-helix';
|
|
795
|
+
|
|
796
|
+
const position: ToastPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
797
|
+
const variant: ToastVariant = 'success' | 'error' | 'warning' | 'info';
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
### Tooltip Types
|
|
801
|
+
|
|
802
|
+
```typescript
|
|
803
|
+
import { TooltipPlacement, TooltipTrigger } from 'ps-helix';
|
|
804
|
+
|
|
805
|
+
const placement: TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
806
|
+
const trigger: TooltipTrigger = 'hover' | 'click' | 'focus';
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
For a complete list of all exported types, see the [type definitions](./src/public-api.ts).
|
|
810
|
+
|
|
811
|
+
## Theming
|
|
812
|
+
|
|
813
|
+
### Default Colors
|
|
814
|
+
|
|
815
|
+
Helix provides default theme colors:
|
|
816
|
+
- **Primary**: `#0F02C4` (Deep Blue)
|
|
817
|
+
- **Secondary**: `#7B3AEC` (Purple)
|
|
818
|
+
|
|
819
|
+
### Custom Brand Colors
|
|
820
|
+
|
|
821
|
+
Customize to match your brand identity using the injection token pattern. See the complete guide in [THEME.md](./THEME.md).
|
|
822
|
+
|
|
823
|
+
### Available CSS Variables
|
|
824
|
+
|
|
825
|
+
Once configured, numerous CSS variables are available:
|
|
826
|
+
|
|
827
|
+
**Primary Color:**
|
|
828
|
+
- `--primary-color`
|
|
829
|
+
- `--primary-color-light`
|
|
830
|
+
- `--primary-color-lighter`
|
|
831
|
+
- `--primary-color-dark`
|
|
832
|
+
- `--primary-color-darker`
|
|
833
|
+
- `--primary-color-text`
|
|
834
|
+
- `--primary-color-rgb`
|
|
835
|
+
|
|
836
|
+
**Secondary Color:**
|
|
837
|
+
- `--secondary-color`
|
|
838
|
+
- `--secondary-color-light`
|
|
839
|
+
- `--secondary-color-lighter`
|
|
840
|
+
- `--secondary-color-dark`
|
|
841
|
+
- `--secondary-color-darker`
|
|
842
|
+
- `--secondary-color-text`
|
|
843
|
+
- `--secondary-color-rgb`
|
|
844
|
+
|
|
845
|
+
### Using Custom Variables
|
|
846
|
+
|
|
847
|
+
```css
|
|
848
|
+
.my-button {
|
|
849
|
+
background: var(--primary-color);
|
|
850
|
+
color: var(--primary-color-text);
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
.my-button:hover {
|
|
854
|
+
background: var(--primary-color-light);
|
|
855
|
+
}
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
For complete theming guide including custom colors, dynamic changes, and advanced configurations, see [THEME.md](./THEME.md).
|
|
859
|
+
|
|
860
|
+
## Best Practices
|
|
861
|
+
|
|
862
|
+
### Component Organization
|
|
863
|
+
|
|
864
|
+
```typescript
|
|
865
|
+
// ✅ Good: Import only what you need
|
|
866
|
+
import { PshButtonComponent, PshInputComponent } from 'ps-helix';
|
|
867
|
+
|
|
868
|
+
// ❌ Avoid: Don't import entire module
|
|
869
|
+
import * as Helix from 'ps-helix';
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
### Type Safety
|
|
873
|
+
|
|
874
|
+
```typescript
|
|
875
|
+
// ✅ Good: Use exported types
|
|
876
|
+
import { ButtonVariant, ButtonSize } from 'ps-helix';
|
|
268
877
|
|
|
269
878
|
const variant: ButtonVariant = 'primary';
|
|
270
879
|
const size: ButtonSize = 'medium';
|
|
880
|
+
|
|
881
|
+
// ❌ Avoid: Magic strings without types
|
|
882
|
+
const variant = 'primary'; // No type checking
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
### Signal Usage
|
|
886
|
+
|
|
887
|
+
```typescript
|
|
888
|
+
// ✅ Good: Use signals for reactive state
|
|
889
|
+
import { signal } from '@angular/core';
|
|
890
|
+
|
|
891
|
+
export class MyComponent {
|
|
892
|
+
isVisible = signal(false);
|
|
893
|
+
|
|
894
|
+
toggle() {
|
|
895
|
+
this.isVisible.update(v => !v);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// ❌ Avoid: Traditional properties for reactive UI
|
|
900
|
+
export class MyComponent {
|
|
901
|
+
isVisible = false; // Won't trigger change detection optimally
|
|
902
|
+
}
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
### Accessibility
|
|
906
|
+
|
|
907
|
+
```html
|
|
908
|
+
<!-- ✅ Good: Proper ARIA labels for icon-only buttons -->
|
|
909
|
+
<button aria-label="Delete item" (click)="delete()">
|
|
910
|
+
<i class="ph ph-trash" aria-hidden="true"></i>
|
|
911
|
+
</button>
|
|
912
|
+
|
|
913
|
+
<!-- ❌ Avoid: Icon buttons without labels -->
|
|
914
|
+
<button (click)="delete()">
|
|
915
|
+
<i class="ph ph-trash"></i>
|
|
916
|
+
</button>
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
### Form Integration
|
|
920
|
+
|
|
921
|
+
```typescript
|
|
922
|
+
// ✅ Good: Reactive forms with FormControl
|
|
923
|
+
import { FormControl, Validators } from '@angular/forms';
|
|
924
|
+
|
|
925
|
+
export class MyComponent {
|
|
926
|
+
emailControl = new FormControl('', [
|
|
927
|
+
Validators.required,
|
|
928
|
+
Validators.email
|
|
929
|
+
]);
|
|
930
|
+
}
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
```html
|
|
934
|
+
<psh-input
|
|
935
|
+
label="Email"
|
|
936
|
+
[formControl]="emailControl"
|
|
937
|
+
[required]="true">
|
|
938
|
+
</psh-input>
|
|
271
939
|
```
|
|
272
940
|
|
|
941
|
+
### Performance Optimization
|
|
942
|
+
|
|
943
|
+
```typescript
|
|
944
|
+
// ✅ Good: Use OnPush change detection
|
|
945
|
+
import { ChangeDetectionStrategy } from '@angular/core';
|
|
946
|
+
|
|
947
|
+
@Component({
|
|
948
|
+
selector: 'app-example',
|
|
949
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
950
|
+
template: `...`
|
|
951
|
+
})
|
|
952
|
+
export class ExampleComponent {}
|
|
953
|
+
|
|
954
|
+
// ✅ Good: Use trackBy for lists
|
|
955
|
+
@Component({
|
|
956
|
+
template: `
|
|
957
|
+
@for (item of items(); track item.id) {
|
|
958
|
+
<psh-card>{{ item.name }}</psh-card>
|
|
959
|
+
}
|
|
960
|
+
`
|
|
961
|
+
})
|
|
962
|
+
export class ListComponent {
|
|
963
|
+
items = signal<Item[]>([]);
|
|
964
|
+
}
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
### Testing
|
|
968
|
+
|
|
969
|
+
```typescript
|
|
970
|
+
// ✅ Good: Test components with TestBed
|
|
971
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
972
|
+
import { PshButtonComponent } from 'ps-helix';
|
|
973
|
+
|
|
974
|
+
describe('MyComponent', () => {
|
|
975
|
+
let component: MyComponent;
|
|
976
|
+
let fixture: ComponentFixture<MyComponent>;
|
|
977
|
+
|
|
978
|
+
beforeEach(async () => {
|
|
979
|
+
await TestBed.configureTestingModule({
|
|
980
|
+
imports: [MyComponent, PshButtonComponent]
|
|
981
|
+
}).compileComponents();
|
|
982
|
+
|
|
983
|
+
fixture = TestBed.createComponent(MyComponent);
|
|
984
|
+
component = fixture.componentInstance;
|
|
985
|
+
fixture.detectChanges();
|
|
986
|
+
});
|
|
987
|
+
|
|
988
|
+
it('should create', () => {
|
|
989
|
+
expect(component).toBeTruthy();
|
|
990
|
+
});
|
|
991
|
+
});
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
## Troubleshooting
|
|
995
|
+
|
|
996
|
+
### Styles Not Applied
|
|
997
|
+
|
|
998
|
+
**Problem**: Components appear unstyled or broken.
|
|
999
|
+
|
|
1000
|
+
**Solution**: Ensure you've imported the global stylesheet:
|
|
1001
|
+
|
|
1002
|
+
```css
|
|
1003
|
+
/* In src/styles.css */
|
|
1004
|
+
@import 'ps-helix/styles.css';
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
### Icons Not Displaying
|
|
1008
|
+
|
|
1009
|
+
**Problem**: Icons show as empty squares or missing glyphs.
|
|
1010
|
+
|
|
1011
|
+
**Solution**: Verify Phosphor Icons CDN links are in `index.html`:
|
|
1012
|
+
|
|
1013
|
+
```html
|
|
1014
|
+
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.0.3/src/regular/style.css">
|
|
1015
|
+
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.0.3/src/fill/style.css">
|
|
1016
|
+
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.0.3/src/bold/style.css">
|
|
1017
|
+
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.0.3/src/light/style.css">
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
### Custom Colors Not Applying
|
|
1021
|
+
|
|
1022
|
+
**Problem**: Brand colors aren't being used.
|
|
1023
|
+
|
|
1024
|
+
**Solution**:
|
|
1025
|
+
1. Verify your theme context service implements `InsurerContextService`
|
|
1026
|
+
2. Check the provider configuration in `main.ts` or `app.config.ts`
|
|
1027
|
+
3. Ensure you're using valid hex color codes (e.g., `#FF0000`)
|
|
1028
|
+
4. Call `themeService.applyInsurerTheme()` after color changes
|
|
1029
|
+
|
|
1030
|
+
See [THEME.md](./THEME.md) for complete theming documentation.
|
|
1031
|
+
|
|
1032
|
+
### TypeScript Errors
|
|
1033
|
+
|
|
1034
|
+
**Problem**: TypeScript compilation errors with component imports.
|
|
1035
|
+
|
|
1036
|
+
**Solution**:
|
|
1037
|
+
1. Verify Angular version is 20.0.0 or higher
|
|
1038
|
+
2. Check `tsconfig.json` has `"strict": true`
|
|
1039
|
+
3. Ensure all peer dependencies are installed
|
|
1040
|
+
4. Clear node_modules and reinstall: `rm -rf node_modules && npm install`
|
|
1041
|
+
|
|
1042
|
+
### Performance Issues
|
|
1043
|
+
|
|
1044
|
+
**Problem**: Application feels slow or unresponsive.
|
|
1045
|
+
|
|
1046
|
+
**Solution**:
|
|
1047
|
+
1. Use `OnPush` change detection strategy
|
|
1048
|
+
2. Implement proper signal usage
|
|
1049
|
+
3. Avoid unnecessary component re-renders
|
|
1050
|
+
4. Use `trackBy` functions in `@for` loops
|
|
1051
|
+
5. Lazy load routes and components where possible
|
|
1052
|
+
|
|
1053
|
+
### Build Errors
|
|
1054
|
+
|
|
1055
|
+
**Problem**: Build fails with module resolution errors.
|
|
1056
|
+
|
|
1057
|
+
**Solution**:
|
|
1058
|
+
1. Verify package.json includes ps-helix in dependencies
|
|
1059
|
+
2. Clear Angular cache: `ng cache clean`
|
|
1060
|
+
3. Delete .angular folder and rebuild
|
|
1061
|
+
4. Check that all peer dependencies match required versions
|
|
1062
|
+
|
|
1063
|
+
### Runtime Errors
|
|
1064
|
+
|
|
1065
|
+
**Problem**: Errors in browser console at runtime.
|
|
1066
|
+
|
|
1067
|
+
**Solution**:
|
|
1068
|
+
1. Check browser console for specific error messages
|
|
1069
|
+
2. Verify all required services are provided
|
|
1070
|
+
3. Ensure ThemeService is initialized if using custom themes
|
|
1071
|
+
4. Check that ngx-translate is properly configured if using i18n
|
|
1072
|
+
|
|
273
1073
|
## Browser Support
|
|
274
1074
|
|
|
275
|
-
|
|
276
|
-
- Firefox (latest)
|
|
277
|
-
- Safari (latest)
|
|
278
|
-
- Edge (latest)
|
|
1075
|
+
Helix Design System supports:
|
|
279
1076
|
|
|
280
|
-
|
|
1077
|
+
- **Chrome**: Latest 2 versions
|
|
1078
|
+
- **Firefox**: Latest 2 versions
|
|
1079
|
+
- **Safari**: Latest 2 versions
|
|
1080
|
+
- **Edge**: Latest 2 versions
|
|
1081
|
+
- **Mobile browsers**: iOS Safari 14+, Chrome Android latest
|
|
1082
|
+
|
|
1083
|
+
**Note**: Internet Explorer is not supported.
|
|
1084
|
+
|
|
1085
|
+
## Development Scripts
|
|
1086
|
+
|
|
1087
|
+
The following npm scripts are available for library development:
|
|
1088
|
+
|
|
1089
|
+
```bash
|
|
1090
|
+
# Build the library
|
|
1091
|
+
npm run build:lib
|
|
1092
|
+
|
|
1093
|
+
# Watch for changes and rebuild
|
|
1094
|
+
npm run watch:lib
|
|
1095
|
+
|
|
1096
|
+
# Publish to npm registry
|
|
1097
|
+
npm run publish:lib
|
|
1098
|
+
|
|
1099
|
+
# Build demo application
|
|
1100
|
+
npm run build
|
|
281
1101
|
|
|
282
|
-
|
|
1102
|
+
# Run demo application in dev mode
|
|
1103
|
+
npm run dev
|
|
1104
|
+
```
|
|
283
1105
|
|
|
284
1106
|
## Contributing
|
|
285
1107
|
|
|
286
|
-
|
|
1108
|
+
We welcome contributions! To contribute to Helix Design System:
|
|
1109
|
+
|
|
1110
|
+
1. Fork the repository
|
|
1111
|
+
2. Create a feature branch: `git checkout -b feature/my-feature`
|
|
1112
|
+
3. Make your changes and commit: `git commit -am 'Add new feature'`
|
|
1113
|
+
4. Push to the branch: `git push origin feature/my-feature`
|
|
1114
|
+
5. Submit a pull request
|
|
1115
|
+
|
|
1116
|
+
### Development Guidelines
|
|
1117
|
+
|
|
1118
|
+
- Follow Angular style guide
|
|
1119
|
+
- Use TypeScript strict mode
|
|
1120
|
+
- Write tests for new components
|
|
1121
|
+
- Document all public APIs
|
|
1122
|
+
- Ensure accessibility compliance (WCAG 2.1 AA)
|
|
1123
|
+
- Keep components small and focused
|
|
1124
|
+
- Use signals for reactive state
|
|
1125
|
+
|
|
1126
|
+
## License
|
|
1127
|
+
|
|
1128
|
+
MIT License - see LICENSE file for details.
|
|
1129
|
+
|
|
1130
|
+
Copyright (c) 2025 PACK Solutions
|
|
1131
|
+
|
|
1132
|
+
## Resources
|
|
1133
|
+
|
|
1134
|
+
- **Theme Customization Guide**: [THEME.md](./THEME.md)
|
|
1135
|
+
- **Component Documentation**: Individual component README files in `/lib/components/`
|
|
1136
|
+
- **Phosphor Icons**: [https://phosphoricons.com/](https://phosphoricons.com/)
|
|
1137
|
+
- **Angular Documentation**: [https://angular.dev/](https://angular.dev/)
|
|
1138
|
+
- **TypeScript Documentation**: [https://www.typescriptlang.org/](https://www.typescriptlang.org/)
|
|
1139
|
+
- **ngx-translate**: [https://github.com/ngx-translate/core](https://github.com/ngx-translate/core)
|
|
1140
|
+
|
|
1141
|
+
---
|
|
1142
|
+
|
|
1143
|
+
**Version**: 2.0.0
|
|
1144
|
+
**Built with**: Angular 20.0.0, TypeScript 5.8.0, Phosphor Icons 2.0.3
|
|
1145
|
+
**Author**: Fabrice PEREZ | Product Designer at PACK Solutions
|
|
1146
|
+
**Last Updated**: November 2025
|