@sixbell-telco/sdk 1.1.0 → 1.2.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +600 -166
  3. package/_index.css +34 -4
  4. package/components/badge/src/badge.component.d.ts +0 -4
  5. package/components/dialog/dialog-actions/dialog-actions.component.d.ts +8 -0
  6. package/components/dialog/dialog-content/dialog-content.component.d.ts +5 -0
  7. package/components/dialog/dialog-sub-title/dialog-sub-title.component.d.ts +5 -0
  8. package/components/dialog/dialog-title/dialog-title.component.d.ts +9 -0
  9. package/components/{modal → dialog}/index.d.ts +1 -1
  10. package/components/dialog/public-api.d.ts +5 -0
  11. package/components/dialog/src/dialog.component.d.ts +146 -0
  12. package/directives/auto-focus/src/autofocus.directive.d.ts +3 -3
  13. package/fesm2022/sixbell-telco-sdk-components-badge.mjs +1 -1
  14. package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
  15. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +356 -0
  16. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -0
  17. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +3 -0
  18. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
  19. package/fesm2022/sixbell-telco-sdk-components-toast.mjs +2 -2
  20. package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
  21. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +3 -3
  22. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -1
  23. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +221 -65
  24. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -1
  25. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +210 -62
  26. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
  27. package/package.json +17 -17
  28. package/utils/theme/README.md +185 -0
  29. package/utils/theme/src/theme.service.d.ts +168 -17
  30. package/utils/translation/README.md +274 -0
  31. package/utils/translation/public-api.d.ts +3 -0
  32. package/utils/translation/src/translation.service.d.ts +134 -49
  33. package/components/modal/modal-actions/modal-actions.component.d.ts +0 -8
  34. package/components/modal/modal-content/modal-content.component.d.ts +0 -5
  35. package/components/modal/modal-title/modal-title.component.d.ts +0 -5
  36. package/components/modal/public-api.d.ts +0 -4
  37. package/components/modal/src/modal.component.d.ts +0 -102
  38. package/fesm2022/sixbell-telco-sdk-components-modal.mjs +0 -202
  39. package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +0 -1
  40. package/sixbell-telco-sdk-1.1.0.tgz +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Sixbell Telco SDK
2
2
 
3
- We are thrilled to have you here. This SDK is designed to provide you with a comprehensive set of UI components to accelerate your development process. Whether you are building a small project or a large-scale application, our components are crafted to be flexible, customizable, and easy to integrate.
3
+ We are thrilled to have you here. This SDK is designed to provide you with a comprehensive set of UI components and utils to accelerate your development process. Whether you are building a small project or a large-scale application, our components are crafted to be flexible, customizable, and easy to integrate.
4
4
 
5
5
  Explore the documentation, try out the examples, and start building amazing applications with Sixbell Telco SDK today!
6
6
 
@@ -16,47 +16,55 @@ Happy coding!
16
16
 
17
17
  ### General components
18
18
 
19
- | Component | Description |
20
- | -------------- | ---------------------------------- |
21
- | Accordion | Expandable/collapsible content |
22
- | Accordion Item | Item within an accordion |
23
- | Audio Player | Audio playback with track controls |
24
- | Avatar | User avatar display |
25
- | Button | Buttons for various actions |
26
- | Card | Container for content and actions |
27
- | Countdown | Countdown timer |
28
- | Dropdown | Dropdown menu for actions or links |
29
- | Dual List | Dual list for selecting items |
30
- | File Uploader | Upload files |
31
- | File Dropzone | Drag and drop file upload |
32
- | Icon | Display icons |
33
- | Link | Hyperlink component |
34
- | Modal | Modal dialog |
35
- | Notification | Display notifications |
36
- | Paginator | Pagination controls |
37
- | Product Card | Display product information |
38
- | Progress | Progress bar |
39
- | Tab | Tabbed navigation |
40
- | Table | Display tabular data |
41
- | Toast | Toast notifications |
42
- | Tooltip | Display tooltips |
43
- | Wizard | Step-by-step wizard |
19
+ | Component | Description | Documentation |
20
+ | -------------- | ---------------------------------- | ------------- |
21
+ | Accordion | Expandable/collapsible content | Coming soon |
22
+ | Accordion Item | Item within an accordion | Coming soon |
23
+ | Audio Player | Audio playback with track controls | Coming soon |
24
+ | Avatar | User avatar display | Coming soon |
25
+ | Button | Buttons for various actions | Coming soon |
26
+ | Card | Container for content and actions | Coming soon |
27
+ | Countdown | Countdown timer | Coming soon |
28
+ | Dialog | Dialog component | Coming soon |
29
+ | Dropdown | Dropdown menu for actions or links | Coming soon |
30
+ | Dropdown Menu | Advanced dropdown menu system | Coming soon |
31
+ | Dual List | Dual list for selecting items | Coming soon |
32
+ | File Uploader | Upload files | Coming soon |
33
+ | File Dropzone | Drag and drop file upload | Coming soon |
34
+ | Icon | Display icons | Coming soon |
35
+ | Link | Hyperlink component | Coming soon |
36
+ | Notification | Display notifications | Coming soon |
37
+ | Paginator | Pagination controls | Coming soon |
38
+ | Product Card | Display product information | Coming soon |
39
+ | Progress | Progress bar | Coming soon |
40
+ | Tab | Tabbed navigation | Coming soon |
41
+ | Table | Display tabular data | Coming soon |
42
+ | Toast | Toast notifications | Coming soon |
43
+ | Tooltip | Display tooltips | Coming soon |
44
+ | Wizard | Step-by-step wizard | Coming soon |
44
45
 
45
46
  ### Forms specific components
46
47
 
47
- | Component | Description |
48
- | ---------- | ------------------------------- |
49
- | Checkbox | Checkbox input |
50
- | Combobox | Combo box for selecting options |
51
- | Datepicker | Date selection input |
52
- | Form Error | Display form errors |
53
- | Input | Text input field |
54
- | Radio | Radio button input |
55
- | Range | Range slider input |
56
- | Select | Dropdown select input |
57
- | Switch | Toggle switch input |
58
- | Textarea | Multi-line text input |
59
- | Toggle | Toggle button input |
48
+ | Component | Description | Documentation |
49
+ | ---------- | ------------------------------- | ------------- |
50
+ | Checkbox | Checkbox input | Coming soon |
51
+ | Combobox | Combo box for selecting options | Coming soon |
52
+ | Datepicker | Date selection input | Coming soon |
53
+ | Form Error | Display form errors | Coming soon |
54
+ | Input | Text input field | Coming soon |
55
+ | Radio | Radio button input | Coming soon |
56
+ | Range | Range slider input | Coming soon |
57
+ | Select | Dropdown select input | Coming soon |
58
+ | Switch | Toggle switch input | Coming soon |
59
+ | Textarea | Multi-line text input | Coming soon |
60
+ | Toggle | Toggle button input | Coming soon |
61
+
62
+ ### Services
63
+
64
+ | Service | Description | Documentation |
65
+ | ------------------- | ---------------------------------------------------------------------------- | ------------------------------------- |
66
+ | Translation Service | Internationalization service with ngx-translate integration and IntelliSense | [README](utils/translation/README.md) |
67
+ | Theme Service | Theme management with reactive signals and automatic persistence | [README](utils/theme/README.md) |
60
68
 
61
69
  ## Setup
62
70
 
@@ -86,7 +94,7 @@ npm i -D @sixbell-telco/sdk @tailwindcss/typography daisyui @midudev/tailwind-an
86
94
 
87
95
  2. Configure Tailwind CSS ([Tailwind guide](https://tailwindcss.com/docs/guides/angular))
88
96
 
89
- 3. Add the provided configuration to gobla stylesheet where you configured tailwind [See detailed config below]
97
+ 3. Add the provided configuration to global stylesheet where you configured tailwind [See detailed config below]
90
98
 
91
99
  ```css
92
100
  @import '../node_modules/@sixbell-telco/sdk/_index.css';
@@ -155,33 +163,512 @@ These settings improve your development experience:
155
163
 
156
164
  With these settings, VSCode will provide class autocompletion for the library's custom attributes and utility functions.
157
165
 
158
- 6. **Translations**
166
+ ## Services Configuration
159
167
 
160
- Before setting up translations, first install the necessary packages:
168
+ ### Translation Service Setup
161
169
 
162
- ```bash
163
- npm install @ngx-translate/core@16.0 @ngx-translate/http-loader@16.0 ngx-translate-multi-http-loader@19.0
170
+ The Translation Service provides internationalization with TypeScript IntelliSense support. Configure it in your `app.config.ts`:
171
+
172
+ ```typescript
173
+ // app.config.ts
174
+ import { provideTranslation } from '@sixbell-telco/sdk/utils/translation';
175
+
176
+ export const appConfig: ApplicationConfig = {
177
+ providers: [
178
+ provideHttpClient(),
179
+ provideTranslation({
180
+ // Optional: Add additional languages beyond en, es, pt
181
+ additionalLanguages: [
182
+ { code: 'de', name: 'Deutsch' },
183
+ { code: 'fr', name: 'Français' },
184
+ { code: 'it', name: 'Italiano' },
185
+ ],
186
+ defaultLang: 'es', // IntelliSense: 'en' | 'es' | 'pt' | 'de' | 'fr' | 'it'
187
+ excludeLanguages: ['pt'], // Optional: exclude default languages (or any other)
188
+ translationPaths: ['/assets/i18n/', '/assets/i18n/sdk/'], // By default looks in '/assets/i18n/'
189
+ }),
190
+ ],
191
+ };
192
+ ```
193
+
194
+ ### Theme Service Setup
195
+
196
+ The Theme Service provides reactive theme management. Configure it in your `app.config.ts`:
197
+
198
+ ```typescript
199
+ // app.config.ts
200
+ import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
201
+
202
+ export const appConfig: ApplicationConfig = {
203
+ providers: [
204
+ provideTheme({
205
+ defaultScheme: 'system', // 'system' | 'light' | 'dark'
206
+ defaultTheme: 'sixbell_telco', // IntelliSense: 'sixbell_telco' | custom
207
+ // Optional: Add additional themes
208
+ additionalThemes: ['custom'],
209
+ // Optional: Exclude default themes (or any other)
210
+ excludeThemes: [],
211
+ }),
212
+ ],
213
+ };
214
+ ```
215
+
216
+ ### Complete Configuration Example
217
+
218
+ ```typescript
219
+ // app.config.ts
220
+ import { DialogModule } from '@angular/cdk/dialog';
221
+ import { ApplicationConfig, importProvidersFrom } from '@angular/core';
222
+ import { provideRouter } from '@angular/router';
223
+ import { provideHttpClient } from '@angular/common/http';
224
+ import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
225
+ import { provideTranslation } from '@sixbell-telco/sdk/utils/translation';
226
+ import { routes } from './app.routes';
227
+
228
+ export const appConfig: ApplicationConfig = {
229
+ providers: [
230
+ provideRouter(routes),
231
+ provideHttpClient(),
232
+ // CDK Dialog providers (required for dialog component)
233
+ importProvidersFrom(DialogModule),
234
+ // Translation configuration
235
+ provideTranslation({
236
+ additionalLanguages: [
237
+ { code: 'de', name: 'Deutsch' },
238
+ { code: 'fr', name: 'Français' },
239
+ ],
240
+ defaultLang: 'es',
241
+ excludeLanguages: ['pt'],
242
+ translationPaths: ['/assets/i18n/', '/assets/i18n/sdk/'],
243
+ }),
244
+ // Theme configuration
245
+ provideTheme({
246
+ defaultScheme: 'system',
247
+ additionalThemes: ['custom'],
248
+ excludeThemes: ['custom'],
249
+ defaultTheme: 'custom',
250
+ }),
251
+ ],
252
+ };
253
+ ```
254
+
255
+ ## Adding Custom Themes
256
+
257
+ To add a custom theme to your application, you need to:
258
+
259
+ ### 1. Create CSS Theme Definitions
260
+
261
+ Add your custom theme CSS variables to your global stylesheet. Each theme needs both light and dark variants:
262
+
263
+ ```css
264
+ /* Example: Adding a "custom" theme */
265
+ @plugin "daisyui/theme" {
266
+ name: 'custom__light';
267
+ default: true;
268
+ prefersdark: false;
269
+ color-scheme: 'light';
270
+
271
+ /* Daisy UI Colors */
272
+ --color-base-100: oklch(96.65% 0.0045 258.32);
273
+ --color-base-200: oklch(100% 0 0);
274
+ --color-base-300: oklch(92.88% 0.0126 255.51);
275
+ --color-base-content: oklch(0.1897 0.0206 258.33);
276
+ --color-primary: oklch(35.203% 0.18861 299.401);
277
+ --color-primary-content: oklch(100% 0 0);
278
+ --color-secondary: oklch(86.57% 0.0064 255.48);
279
+ --color-secondary-content: oklch(13.49% 0.0024 286.07);
280
+ --color-accent: oklch(0.6166 0.2453 349.35);
281
+ --color-accent-content: oklch(13.49% 0.0024 286.07);
282
+ --color-neutral: oklch(0.9572 0.0034 247.86);
283
+ --color-neutral-content: oklch(13.49% 0.0024 286.07);
284
+ --color-info: oklch(25.831% 0.13707 301.152);
285
+ --color-info-content: oklch(100% 0 0);
286
+ --color-success: oklch(70.341% 0.23623 142.618);
287
+ --color-success-content: oklch(56.981% 0.19039 142.681);
288
+ --color-warning: oklch(84.416% 0.17209 84.936);
289
+ --color-warning-content: oklch(73.945% 0.14957 84.396);
290
+ --color-error: oklch(59.153% 0.20203 21.222);
291
+ --color-error-content: oklch(51.818% 0.18926 22.792);
292
+
293
+ /* Daisy UI Properties */
294
+ /* border radius */
295
+ --radius-selector: 0.5rem; /* For small sized components like checkbox, toggle, badge, etc. */
296
+ --radius-field: 0.25rem; /* For medium sized components like button, input, select, tab, etc. */
297
+ --radius-box: 0.5rem; /* For large sized components like card, modal, alert, etc. */
298
+
299
+ /* base sizes */
300
+ --size-selector: 0.25rem;
301
+ --size-field: 0.25rem;
302
+
303
+ /* border size */
304
+ --border: 1px;
305
+
306
+ /* effects */
307
+ --depth: 0;
308
+ --noise: 0;
309
+
310
+ /* Custom Colors */
311
+ --color-base-50: color-mix(in oklch, var(--color-base-200), #000 7%);
312
+ --color-primary-gradient: color-mix(in oklch, var(--color-primary) 60%, #121212);
313
+ --color-primary-gradient-content: oklch(100% 0 0);
314
+ --color-secondary-gradient: color-mix(in oklch, var(--color-secondary) 60%, #121212);
315
+ --color-secondary-gradient-content: oklch(13.49% 0.0024 286.07);
316
+ --color-tertiary-gradient: color-mix(in oklch, var(--color-tertiary) 60%, #121212);
317
+ --color-tertiary-gradient-content: oklch(13.49% 0.0024 286.07);
318
+ --color-accent-gradient: color-mix(in oklch, var(--color-accent) 60%, #121212);
319
+ --color-accent-gradient-content: oklch(100% 0 0);
320
+ --color-tertiary: oklch(72.52% 0 0);
321
+ --color-tertiary-content: oklch(13.49% 0.0024 286.07);
322
+ --color-neutral-secondary: oklch(73.97% 0.0115 280.4);
323
+ --color-neutral-secondary-content: oklch(100% 0 0);
324
+ --color-neutral-tertiary: oklch(100% 0 0);
325
+ --color-neutral-tertiary-content: oklch(73.97% 0.0115 280.4);
326
+ --color-base-placeholder: oklch(51.6% 0.0073 255.51);
327
+ --color-backdrop: oklch(0% 0 0/ 0.4);
328
+
329
+ --shadow-primary: oklch(0.8975 0 0);
330
+ --shadow-backdrop: oklch(0% 0 0/ 0.25);
331
+
332
+ --color-metrics-increase: oklch(74.59% 0.1812 152.33);
333
+ --color-metrics-decrease: oklch(63.07% 0.194 29.44);
334
+ --color-metrics-neutral: oklch(62.99% 0.0152 202.37);
335
+
336
+ --color-metrics-intensity-highest: oklch(65.64% 0.1155 219.3);
337
+ --color-metrics-intensity-high: oklch(68.62% 0.0925 226.08);
338
+ --color-metrics-intensity-medium: oklch(68.62% 0.0925 226.08);
339
+ --color-metrics-intensity-low: oklch(76.18% 0.0656 213.66);
340
+ --color-metrics-intensity-lowest: oklch(78% 0.0473 211.88);
341
+ }
342
+
343
+ @plugin "daisyui/theme" {
344
+ name: 'custom__dark';
345
+ default: false;
346
+ prefersdark: true;
347
+ color-scheme: 'dark';
348
+
349
+ /* Daisy UI Colors */
350
+ --color-base-100: oklch(18.22% 0 0);
351
+ --color-base-200: oklch(23.5% 0 0);
352
+ --color-base-300: oklch(28.5% 0 0);
353
+ --color-base-content: oklch(100% 0 0);
354
+ --color-primary: oklch(0.4764 0.1861 294.4);
355
+ --color-primary-content: oklch(100% 0 0);
356
+ --color-secondary: oklch(48.72% 0.0161 276.78);
357
+ --color-secondary-content: oklch(100% 0 0);
358
+ --color-accent: oklch(0.6166 0.2453 349.35);
359
+ --color-accent-content: oklch(23.5% 0 0);
360
+ --color-neutral: oklch(49.26% 0 0);
361
+ --color-neutral-content: oklch(100% 0 0);
362
+ --color-info: oklch(55.86% 0.1907 256);
363
+ --color-info-content: oklch(100% 0 0);
364
+ --color-success: oklch(73.79% 0.2409 140.89);
365
+ --color-success-content: oklch(36.22% 0.1147 140.02);
366
+ --color-warning: oklch(85.44% 0.1839 108.37);
367
+ --color-warning-content: oklch(46.41% 0.0998 109);
368
+ --color-error: oklch(65.92% 0.2275 29.05);
369
+ --color-error-content: oklch(25.91% 0.0904 29.25);
370
+
371
+ /* border radius */
372
+ --radius-selector: 0.5rem;
373
+ --radius-field: 0.25rem;
374
+ --radius-box: 0.5rem;
375
+
376
+ /* base sizes */
377
+ --size-selector: 0.25rem;
378
+ --size-field: 0.25rem;
379
+
380
+ /* border size */
381
+ --border: 1px;
382
+
383
+ /* effects */
384
+ --depth: 0;
385
+ --noise: 0;
386
+
387
+ /* Custom Colors */
388
+ --color-base-50: color-mix(in oklch, var(--color-base-200), #000 7%);
389
+ --color-primary-gradient: color-mix(in oklch, var(--color-primary) 60%, #121212);
390
+ --color-primary-gradient-content: oklch(100% 0 0);
391
+ --color-secondary-gradient: color-mix(in oklch, var(--color-secondary) 60%, #121212);
392
+ --color-secondary-gradient-content: oklch(100% 0 0);
393
+ --color-tertiary-gradient: color-mix(in oklch, var(--color-tertiary) 60%, #121212);
394
+ --color-tertiary-gradient-content: oklch(100% 0 0);
395
+ --color-accent-gradient: color-mix(in oklch, var(--color-accent) 60%, #121212);
396
+ --color-accent-gradient-content: oklch(100% 0 0);
397
+ --color-tertiary: oklch(72.52% 0 0);
398
+ --color-tertiary-content: oklch(13.49% 0.0024 286.07);
399
+ --color-neutral-secondary: oklch(73.97% 0.0115 280.4);
400
+ --color-neutral-secondary-content: oklch(100% 0 0);
401
+ --color-neutral-tertiary: oklch(0.822 0.1033 307.69);
402
+ --color-neutral-tertiary-content: oklch(73.97% 0.0115 280.4);
403
+ --color-base-placeholder: oklch(51.6% 0.0073 255.51);
404
+ --color-backdrop: oklch(0% 0 0/ 0.4);
405
+
406
+ --shadow-primary: oklch(0 0 0);
407
+ --shadow-backdrop: oklch(0% 0 0/ 0.25);
408
+
409
+ --color-metrics-increase: oklch(74.59% 0.1812 152.33);
410
+ --color-metrics-decrease: oklch(63.07% 0.194 29.44);
411
+ --color-metrics-neutral: oklch(62.99% 0.0152 202.37);
412
+
413
+ --color-metrics-intensity-highest: oklch(65.64% 0.1155 219.3);
414
+ --color-metrics-intensity-high: oklch(68.62% 0.0925 226.08);
415
+ --color-metrics-intensity-medium: oklch(68.62% 0.0925 226.08);
416
+ --color-metrics-intensity-low: oklch(76.18% 0.0656 213.66);
417
+ --color-metrics-intensity-lowest: oklch(78% 0.0473 211.88);
418
+ }
419
+
420
+ @theme {
421
+ --font-poppins: Poppins, sans-serif;
422
+ --font-heading: Poppins, sans-serif;
423
+ --font-body: Poppins, sans-serif;
424
+ }
425
+
426
+ /* regular and bold weights */
427
+ @font-face {
428
+ font-family: 'Poppins';
429
+ font-weight: 400;
430
+ font-style: normal;
431
+ src: url('./assets/fonts/Poppins-Regular.ttf');
432
+ }
433
+
434
+ @font-face {
435
+ font-family: 'Poppins';
436
+ font-weight: 500;
437
+ font-style: normal;
438
+ src: url('./assets/fonts/Poppins-Medium.ttf');
439
+ }
440
+
441
+ @font-face {
442
+ font-family: 'Poppins';
443
+ font-weight: 600;
444
+ font-style: normal;
445
+ src: url('./assets/fonts/Poppins-SemiBold.ttf');
446
+ }
447
+
448
+ @font-face {
449
+ font-family: 'Poppins';
450
+ font-weight: 700;
451
+ font-style: normal;
452
+ src: url('./assets/fonts/Poppins-Bold.ttf');
453
+ }
454
+
455
+ @font-face {
456
+ font-family: 'Poppins';
457
+ font-weight: 800;
458
+ font-style: normal;
459
+ src: url('./assets/fonts/Poppins-ExtraBold.ttf');
460
+ }
461
+
462
+ @font-face {
463
+ font-family: 'Poppins';
464
+ font-weight: 900;
465
+ font-style: normal;
466
+ src: url('./assets/fonts/Poppins-Black.ttf');
467
+ }
468
+
469
+ /* italic style */
470
+ @font-face {
471
+ font-family: 'Poppins';
472
+ font-weight: 400;
473
+ font-style: italic;
474
+ src: url('./assets/fonts/Poppins-Italic.ttf');
475
+ }
476
+
477
+ @font-face {
478
+ font-family: 'Poppins';
479
+ font-weight: 500;
480
+ font-style: italic;
481
+ src: url('./assets/fonts/Poppins-MediumItalic.ttf');
482
+ }
483
+
484
+ @font-face {
485
+ font-family: 'Poppins';
486
+ font-weight: 600;
487
+ font-style: italic;
488
+ src: url('./assets/fonts/Poppins-SemiBoldItalic.ttf');
489
+ }
490
+
491
+ @font-face {
492
+ font-family: 'Poppins';
493
+ font-weight: 700;
494
+ font-style: italic;
495
+ src: url('./assets/fonts/Poppins-BoldItalic.ttf');
496
+ }
497
+
498
+ @font-face {
499
+ font-family: 'Poppins';
500
+ font-weight: 800;
501
+ font-style: italic;
502
+ src: url('./assets/fonts/Poppins-ExtraBoldItalic.ttf');
503
+ }
504
+
505
+ @font-face {
506
+ font-family: 'Poppins';
507
+ font-weight: 900;
508
+ font-style: italic;
509
+ src: url('./assets/fonts/Poppins-BlackItalic.ttf');
510
+ }
511
+ ```
512
+
513
+ ### 2. Add Theme to Service Configuration
514
+
515
+ Include your custom theme in the theme service configuration:
516
+
517
+ ```typescript
518
+ provideTheme({
519
+ additionalThemes: ['custom'], // Add your theme here
520
+ defaultTheme: 'custom', // Optionally set as default
521
+ }),
522
+ ```
523
+
524
+ ### 3. Add Theme Translation Keys
525
+
526
+ Add the theme name to your translation files so it appears correctly in theme selectors:
527
+
528
+ **English (`en.json`):**
529
+
530
+ ```json
531
+ {
532
+ "sdk": {
533
+ "theme": {
534
+ "themes": {
535
+ "sixbell_telco": "Sixbell Telco",
536
+ "custom": "Custom"
537
+ }
538
+ }
539
+ }
540
+ }
541
+ ```
542
+
543
+ **Spanish (`es.json`):**
544
+
545
+ ```json
546
+ {
547
+ "sdk": {
548
+ "theme": {
549
+ "themes": {
550
+ "sixbell_telco": "Sixbell Telco",
551
+ "custom": "Perzonalizado"
552
+ }
553
+ }
554
+ }
555
+ }
556
+ ```
557
+
558
+ **Portuguese (`pt.json`):**
559
+
560
+ ```json
561
+ {
562
+ "sdk": {
563
+ "theme": {
564
+ "themes": {
565
+ "sixbell_telco": "Sixbell Telco",
566
+ "custom": "Personalizado"
567
+ }
568
+ }
569
+ }
570
+ }
571
+ ```
572
+
573
+ Now your custom theme will be available in the theme service and will appear in theme selector components with proper translations.
574
+
575
+ ## Adding Custom Languages
576
+
577
+ To add additional languages to your application:
578
+
579
+ ### 1. Create Translation Files
580
+
581
+ Add your language translation file to `/assets/i18n/` following the naming convention `[language-code].json`:
582
+
583
+ ```
584
+ src/
585
+ assets/
586
+ i18n/
587
+ en.json
588
+ es.json
589
+ pt.json
590
+ de.json // New German translations
591
+ fr.json // New French translations
592
+ ```
593
+
594
+ ### 2. Add Language to Service Configuration
595
+
596
+ Include your custom languages in the translation service configuration:
597
+
598
+ ```typescript
599
+ provideTranslation({
600
+ additionalLanguages: [
601
+ { code: 'de', name: 'Deutsch' },
602
+ { code: 'fr', name: 'Français' },
603
+ ],
604
+ defaultLang: 'de', // Optionally set as default
605
+ }),
606
+ ```
607
+
608
+ ### 3. Add Language Translation Keys
609
+
610
+ **Important:** For custom languages to appear in language selector components, you must add the language keys to the translation files:
611
+
612
+ **English (`en.json`):**
613
+
614
+ ```json
615
+ {
616
+ "sdk": {
617
+ "language": {
618
+ "languages": {
619
+ "en": "English",
620
+ "es": "Spanish",
621
+ "pt": "Portuguese",
622
+ "de": "German",
623
+ "fr": "French"
624
+ }
625
+ }
626
+ }
627
+ }
628
+ ```
629
+
630
+ **German (`de.json`):**
631
+
632
+ ```json
633
+ {
634
+ "sdk": {
635
+ "language": {
636
+ "languages": {
637
+ "en": "Englisch",
638
+ "es": "Spanisch",
639
+ "pt": "Portugiesisch",
640
+ "de": "Deutsch",
641
+ "fr": "Französisch"
642
+ }
643
+ }
644
+ }
645
+ }
164
646
  ```
165
647
 
166
- #### Setup
648
+ Repeat this pattern for all your translation files. Without these keys, the language names won't be properly displayed in language selector components.
167
649
 
168
- 1. Create a folder (e.g., `/assets/i18n`) to store your translation files.
169
- 2. In the folder, add separate JSON files for each language:
650
+ ### Translation Files Setup
170
651
 
171
- - en.json (English)
172
- - es.json (Spanish)
173
- - pt.json (Portuguese)
652
+ Create translation files in `/assets/i18n/` with the following structure:
174
653
 
175
- 3. In each file, include the corresponding translations for file uploader, for example:
654
+ ```
655
+ src/
656
+ assets/
657
+ i18n/
658
+ en.json
659
+ es.json
660
+ pt.json
661
+ de.json // if using additional languages
662
+ ```
176
663
 
177
- ##### English
664
+ #### English (`en.json`)
178
665
 
179
666
  ```json
180
667
  {
181
668
  "sdk": {
182
669
  "theme": {
183
670
  "themes": {
184
- "vivid_elegance": "Vivid Elegance"
671
+ "sixbell_telco": "Sixbell telco"
185
672
  },
186
673
  "schemes": {
187
674
  "system": "System",
@@ -284,14 +771,14 @@ npm install @ngx-translate/core@16.0 @ngx-translate/http-loader@16.0 ngx-transla
284
771
  }
285
772
  ```
286
773
 
287
- ##### Spanish
774
+ #### Spanish (`es.json`)
288
775
 
289
776
  ```json
290
777
  {
291
778
  "sdk": {
292
779
  "theme": {
293
780
  "themes": {
294
- "vivid_elegance": "Elegancia Vívida"
781
+ "sixbell_telco": "Sixbell telco"
295
782
  },
296
783
  "schemes": {
297
784
  "system": "Sistema",
@@ -394,14 +881,14 @@ npm install @ngx-translate/core@16.0 @ngx-translate/http-loader@16.0 ngx-transla
394
881
  }
395
882
  ```
396
883
 
397
- ##### Portuguese
884
+ #### Portuguese (`pt.json`)
398
885
 
399
886
  ```json
400
887
  {
401
888
  "sdk": {
402
889
  "theme": {
403
890
  "themes": {
404
- "vivid_elegance": "Elegância Vívida"
891
+ "sixbell_telco": "Sixbell telco"
405
892
  },
406
893
  "schemes": {
407
894
  "system": "Sistema",
@@ -409,6 +896,13 @@ npm install @ngx-translate/core@16.0 @ngx-translate/http-loader@16.0 ngx-transla
409
896
  "dark": "Escuro"
410
897
  }
411
898
  },
899
+ "language": {
900
+ "languages": {
901
+ "en": "Inglês",
902
+ "es": "Espanhol",
903
+ "pt": "Português"
904
+ }
905
+ },
412
906
  "fileUpload": {
413
907
  "dropzone": {
414
908
  "selectPrompt": "Haz clic para seleccionar archivos o arrastra y suelta aquí",
@@ -497,117 +991,13 @@ npm install @ngx-translate/core@16.0 @ngx-translate/http-loader@16.0 ngx-transla
497
991
  }
498
992
  ```
499
993
 
500
- 4. Configure your translation loader. If you are using Angular i18n, ngx-translate, etc., first import in your app.config.ts:
501
-
502
- ```ts
503
- import { HttpBackend } from '@angular/common/http';
504
- import { provideRouter } from '@angular/router';
505
- import { provideTranslateService, TranslateLoader } from '@ngx-translate/core';
506
- import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';
507
-
508
- export function HttpLoaderFactory(_httpBackend: HttpBackend) {
509
- return new MultiTranslateHttpLoader(_httpBackend, ['/assets/i18n/', '/assets/i18n/sdk/']);
510
- }
511
- ```
512
-
513
- 5. Then, add the provider to your application configuration:
994
+ ## Usage Examples
514
995
 
515
- ```ts
516
- import { ApplicationConfig } from '@angular/core';
517
- import { provideHttpClient } from '@angular/common/http';
518
-
519
- export const appConfig: ApplicationConfig = {
520
- providers: [
521
- provideRouter(routes),
522
- provideHttpClient(),
523
- provideTranslateService({ loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, deps: [HttpBackend] } }),
524
- ],
525
- };
526
- ```
527
-
528
- 6. After, add a traslation service like this one to encapsulate all the translation logic:
529
-
530
- ```ts
531
- import { Injectable, inject } from '@angular/core';
532
- import { EnvironmentService } from '@core/services/environment/environment.service';
533
- import { TranslateService } from '@ngx-translate/core';
534
-
535
- export interface Locale {
536
- lang: string;
537
- data: object;
538
- }
539
-
540
- const LOCALIZATION_LOCAL_STORAGE_KEY = 'language';
541
-
542
- @Injectable({
543
- providedIn: 'root',
544
- })
545
- export class TranslationService {
546
- translate = inject(TranslateService);
547
- environmentService = inject(EnvironmentService);
548
-
549
- constructor() {
550
- const defaultLanguage: string = this.environmentService.language;
551
-
552
- // add new langIds to the list
553
- this.translate.addLangs([defaultLanguage]);
554
-
555
- // this language will be used as a fallback when a translation isn't found in the current language
556
- this.translate.setDefaultLang(defaultLanguage);
557
- }
558
-
559
- loadTranslations(langs: string[]): void {
560
- this.translate.addLangs(langs);
561
- }
562
-
563
- setLanguage(lang: string) {
564
- if (lang) {
565
- this.translate.use(lang);
566
- localStorage.setItem(LOCALIZATION_LOCAL_STORAGE_KEY, lang);
567
- }
568
- }
569
-
570
- getSelectedLanguage(): string {
571
- return localStorage.getItem(LOCALIZATION_LOCAL_STORAGE_KEY) ?? this.translate.getDefaultLang();
572
- }
573
-
574
- instant(key: string, params?: object | undefined) {
575
- if (params) {
576
- return this.translate.instant(key, params);
577
- }
578
-
579
- return this.translate.instant(key);
580
- }
581
- }
582
- ```
583
-
584
- 7. Finally, call the traslation service in app.component to load the translations:
585
-
586
- ```ts
587
- import { Component } from '@angular/core';
588
- import { TranslateService } from '@ngx-translate/core';
589
-
590
- @Component({
591
- selector: 'app-root',
592
- template: `<router-outlet></router-outlet>`,
593
- })
594
- export class AppComponent {
595
- translationService = inject(TranslationService);
596
-
597
- constructor() {
598
- // register translations
599
- this.translationService.loadTranslations(['es', 'en', 'pt']);
600
- }
601
- }
602
- ```
603
-
604
- With this configuration, all the translations related to the SDK will be loaded.
605
-
606
- ## Usage Example
996
+ ### Using Components
607
997
 
608
998
  Here's a basic example of using a button component:
609
999
 
610
- ```ts
1000
+ ```typescript
611
1001
  // app.component.ts
612
1002
  import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
613
1003
 
@@ -616,12 +1006,56 @@ import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
616
1006
  template: `
617
1007
  <div>
618
1008
  <h1>Awesome button</h1>
619
- <st-button variant="primary">Click me!</st-button>
1009
+ <st-button variant="primary">Click me!</st-button>
620
1010
  </div>
621
1011
  `
622
1012
  })
623
1013
  ```
624
1014
 
1015
+ ### Using Services in Components
1016
+
1017
+ ```typescript
1018
+ // component.ts
1019
+ import { ThemeService } from '@sixbell-telco/sdk/utils/theme';
1020
+ import { TranslationService } from '@sixbell-telco/sdk/utils/translation';
1021
+
1022
+ @Component({
1023
+ template: `
1024
+ <div [class]="themeService.finalTheme()">
1025
+ <h1>{{ 'welcome.title' | translate }}</h1>
1026
+ <p>Current theme: {{ themeService.selectedTheme() }}</p>
1027
+ <p>Dark mode: {{ themeService.isDarkTheme() ? 'Yes' : 'No' }}</p>
1028
+
1029
+ <!-- Theme selector -->
1030
+ <select (change)="changeTheme($event.target.value)">
1031
+ @for (theme of themeService.getAvailableThemes(); track theme) {
1032
+ <option [value]="theme">{{ theme }}</option>
1033
+ }
1034
+ </select>
1035
+
1036
+ <!-- Language selector -->
1037
+ <select (change)="changeLanguage($event.target.value)">
1038
+ @for (lang of translationService.getAvailableLanguageCodes(); track lang) {
1039
+ <option [value]="lang">{{ translationService.getLanguageDisplayName(lang) }}</option>
1040
+ }
1041
+ </select>
1042
+ </div>
1043
+ `,
1044
+ })
1045
+ export class MyComponent {
1046
+ themeService = inject(ThemeService);
1047
+ translationService = inject(TranslationService);
1048
+
1049
+ changeTheme(theme: string) {
1050
+ this.themeService.setTheme(theme);
1051
+ }
1052
+
1053
+ changeLanguage(language: string) {
1054
+ this.translationService.setLanguage(language);
1055
+ }
1056
+ }
1057
+ ```
1058
+
625
1059
  ## Documentation
626
1060
 
627
1061
  For detailed component documentation, visit our [Storybook](https://storybook.js.org/tutorials/intro-to-storybook/angular/en/get-started/)
@@ -630,4 +1064,4 @@ For detailed component documentation, visit our [Storybook](https://storybook.js
630
1064
 
631
1065
  ## Last update
632
1066
 
633
- This file was last updated in July 18th, 2025.
1067
+ This file was last updated on August 13th, 2025.