@sixbell-telco/sdk 1.0.3 → 1.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/CHANGELOG.md +102 -0
- package/README.md +641 -163
- package/_index.css +85 -28
- package/components/avatar/src/avatar.component.d.ts +40 -26
- package/components/badge/src/badge.component.d.ts +0 -4
- package/components/button/src/button.component.d.ts +2 -2
- package/components/dialog/dialog-actions/dialog-actions.component.d.ts +8 -0
- package/components/dialog/dialog-content/dialog-content.component.d.ts +5 -0
- package/components/dialog/dialog-sub-title/dialog-sub-title.component.d.ts +5 -0
- package/components/dialog/dialog-title/dialog-title.component.d.ts +5 -0
- package/components/dialog/index.d.ts +5 -0
- package/components/dialog/public-api.d.ts +5 -0
- package/components/dialog/src/dialog.component.d.ts +132 -0
- package/components/dropdown/dropdown-chevron/dropdown-chevron.component.d.ts +39 -0
- package/components/dropdown/dropdown-content/dropdown-content.component.d.ts +41 -0
- package/components/dropdown/dropdown-group/dropdown-group.component.d.ts +9 -0
- package/components/dropdown/dropdown-item/dropdown-item.component.d.ts +23 -12
- package/components/dropdown/dropdown-item-checkbox/dropdown-item-checkbox.component.d.ts +49 -0
- package/components/dropdown/dropdown-item-radio/dropdown-item-radio.component.d.ts +53 -0
- package/components/dropdown/dropdown-label/dropdown-label.component.d.ts +17 -0
- package/components/dropdown/dropdown-separator/dropdown-separator.component.d.ts +21 -0
- package/components/dropdown/dropdown-trigger/dropdown-trigger.component.d.ts +121 -0
- package/components/dropdown/public-api.d.ts +9 -0
- package/components/dropdown/src/dropdown.component.d.ts +20 -174
- package/components/dropdown/src/services/dropdown.service.d.ts +22 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar/dropdown-menu-bar.component.d.ts +22 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-content/dropdown-menu-bar-content.component.d.ts +64 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-item/dropdown-menu-bar-item.component.d.ts +37 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-item-checkbox/dropdown-menu-bar-item-checkbox.component.d.ts +54 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-item-radio/dropdown-menu-bar-item-radio.component.d.ts +58 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-label/dropdown-menu-bar-label.component.d.ts +16 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-separator/dropdown-menu-bar-separator.component.d.ts +16 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-sub-trigger/dropdown-menu-bar-sub-trigger.component.d.ts +29 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-trigger/dropdown-menu-bar-trigger.component.d.ts +50 -0
- package/components/dropdown-menu/bar/index.d.ts +5 -0
- package/components/dropdown-menu/bar/public-api.d.ts +9 -0
- package/components/dropdown-menu/context/dropdown-context-menu-trigger/dropdown-context-menu-trigger.component.d.ts +23 -0
- package/components/dropdown-menu/context/index.d.ts +5 -0
- package/components/dropdown-menu/context/public-api.d.ts +1 -0
- package/components/dropdown-menu/dropdown-menu-chevron/dropdown-menu-chevron.component.d.ts +43 -0
- package/components/dropdown-menu/index.d.ts +5 -0
- package/components/dropdown-menu/public-api.d.ts +13 -0
- package/components/dropdown-menu/src/directives/dropdown-menu.directive.d.ts +40 -0
- package/components/dropdown-menu/src/dropdown-menu/dropdown-menu.component.d.ts +9 -0
- package/components/dropdown-menu/src/dropdown-menu-content/dropdown-menu-content.component.d.ts +40 -0
- package/components/dropdown-menu/src/dropdown-menu-group/dropdown-menu-group.component.d.ts +8 -0
- package/components/dropdown-menu/src/dropdown-menu-item/dropdown-menu-item.component.d.ts +38 -0
- package/components/dropdown-menu/src/dropdown-menu-label/dropdown-menu-label.component.d.ts +16 -0
- package/components/dropdown-menu/src/dropdown-menu-separator/dropdown-menu-separator.component.d.ts +16 -0
- package/components/dropdown-menu/src/dropdown-menu-sub/dropdown-menu-sub.component.d.ts +8 -0
- package/components/dropdown-menu/src/dropdown-menu-sub-content/dropdown-menu-sub-content.component.d.ts +31 -0
- package/components/dropdown-menu/src/dropdown-menu-sub-trigger/dropdown-menu-sub-trigger.component.d.ts +18 -0
- package/components/dropdown-menu/src/dropdown-menu-trigger/dropdown-menu-trigger.component.d.ts +19 -0
- package/components/dropdown-menu/src/services/dropdown-menu.service.d.ts +22 -0
- package/directives/auto-focus/src/autofocus.directive.d.ts +3 -3
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +75 -39
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs +1 -1
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-button.mjs +1 -0
- package/fesm2022/sixbell-telco-sdk-components-button.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +305 -0
- package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs +529 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-context.mjs +52 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-context.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs +539 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +592 -213
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +5 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs +1 -1
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +295 -0
- package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +332 -0
- package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -0
- package/package.json +29 -9
- package/sixbell-telco-sdk-1.2.0.tgz +0 -0
- package/utils/theme/README.md +185 -0
- package/{components/modal → utils/theme}/index.d.ts +1 -1
- package/utils/theme/public-api.d.ts +1 -0
- package/utils/theme/src/theme.service.d.ts +206 -0
- package/utils/translation/README.md +274 -0
- package/utils/translation/index.d.ts +5 -0
- package/utils/translation/public-api.d.ts +5 -0
- package/utils/translation/src/translation.service.d.ts +197 -0
- package/components/modal/modal-actions/modal-actions.component.d.ts +0 -8
- package/components/modal/modal-content/modal-content.component.d.ts +0 -5
- package/components/modal/modal-title/modal-title.component.d.ts +0 -5
- package/components/modal/public-api.d.ts +0 -4
- package/components/modal/src/modal.component.d.ts +0 -102
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs +0 -202
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +0 -1
- package/sixbell-telco-sdk-1.0.3.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
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
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
|
|
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,30 +163,526 @@ 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
|
-
|
|
166
|
+
## Services Configuration
|
|
159
167
|
|
|
160
|
-
|
|
168
|
+
### Translation Service Setup
|
|
161
169
|
|
|
162
|
-
|
|
163
|
-
|
|
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
|
+
};
|
|
164
253
|
```
|
|
165
254
|
|
|
166
|
-
|
|
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
|
+
}
|
|
167
461
|
|
|
168
|
-
|
|
169
|
-
|
|
462
|
+
@font-face {
|
|
463
|
+
font-family: 'Poppins';
|
|
464
|
+
font-weight: 900;
|
|
465
|
+
font-style: normal;
|
|
466
|
+
src: url('./assets/fonts/Poppins-Black.ttf');
|
|
467
|
+
}
|
|
170
468
|
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
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
|
+
}
|
|
174
476
|
|
|
175
|
-
|
|
477
|
+
@font-face {
|
|
478
|
+
font-family: 'Poppins';
|
|
479
|
+
font-weight: 500;
|
|
480
|
+
font-style: italic;
|
|
481
|
+
src: url('./assets/fonts/Poppins-MediumItalic.ttf');
|
|
482
|
+
}
|
|
176
483
|
|
|
177
|
-
|
|
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`):**
|
|
178
544
|
|
|
179
545
|
```json
|
|
180
546
|
{
|
|
181
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
|
+
}
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
Repeat this pattern for all your translation files. Without these keys, the language names won't be properly displayed in language selector components.
|
|
649
|
+
|
|
650
|
+
### Translation Files Setup
|
|
651
|
+
|
|
652
|
+
Create translation files in `/assets/i18n/` with the following structure:
|
|
653
|
+
|
|
654
|
+
```
|
|
655
|
+
src/
|
|
656
|
+
assets/
|
|
657
|
+
i18n/
|
|
658
|
+
en.json
|
|
659
|
+
es.json
|
|
660
|
+
pt.json
|
|
661
|
+
de.json // if using additional languages
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
#### English (`en.json`)
|
|
665
|
+
|
|
666
|
+
```json
|
|
667
|
+
{
|
|
668
|
+
"sdk": {
|
|
669
|
+
"theme": {
|
|
670
|
+
"themes": {
|
|
671
|
+
"sixbell_telco": "Sixbell telco"
|
|
672
|
+
},
|
|
673
|
+
"schemes": {
|
|
674
|
+
"system": "System",
|
|
675
|
+
"light": "Light",
|
|
676
|
+
"dark": "Dark"
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
"language": {
|
|
680
|
+
"languages": {
|
|
681
|
+
"en": "English",
|
|
682
|
+
"es": "Spanish",
|
|
683
|
+
"pt": "Portuguese"
|
|
684
|
+
}
|
|
685
|
+
},
|
|
182
686
|
"fileUpload": {
|
|
183
687
|
"dropzone": {
|
|
184
688
|
"selectPrompt": "Click to select files or drag and drop here",
|
|
@@ -267,11 +771,28 @@ npm install @ngx-translate/core@16.0 @ngx-translate/http-loader@16.0 ngx-transla
|
|
|
267
771
|
}
|
|
268
772
|
```
|
|
269
773
|
|
|
270
|
-
|
|
774
|
+
#### Spanish (`es.json`)
|
|
271
775
|
|
|
272
776
|
```json
|
|
273
777
|
{
|
|
274
778
|
"sdk": {
|
|
779
|
+
"theme": {
|
|
780
|
+
"themes": {
|
|
781
|
+
"sixbell_telco": "Sixbell telco"
|
|
782
|
+
},
|
|
783
|
+
"schemes": {
|
|
784
|
+
"system": "Sistema",
|
|
785
|
+
"light": "Claro",
|
|
786
|
+
"dark": "Oscuro"
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
"language": {
|
|
790
|
+
"languages": {
|
|
791
|
+
"en": "Inglés",
|
|
792
|
+
"es": "Español",
|
|
793
|
+
"pt": "Portugués"
|
|
794
|
+
}
|
|
795
|
+
},
|
|
275
796
|
"fileUpload": {
|
|
276
797
|
"dropzone": {
|
|
277
798
|
"selectPrompt": "Haz clic para seleccionar archivos o arrastra y suelta aquí",
|
|
@@ -360,11 +881,28 @@ npm install @ngx-translate/core@16.0 @ngx-translate/http-loader@16.0 ngx-transla
|
|
|
360
881
|
}
|
|
361
882
|
```
|
|
362
883
|
|
|
363
|
-
|
|
884
|
+
#### Portuguese (`pt.json`)
|
|
364
885
|
|
|
365
886
|
```json
|
|
366
887
|
{
|
|
367
888
|
"sdk": {
|
|
889
|
+
"theme": {
|
|
890
|
+
"themes": {
|
|
891
|
+
"sixbell_telco": "Sixbell telco"
|
|
892
|
+
},
|
|
893
|
+
"schemes": {
|
|
894
|
+
"system": "Sistema",
|
|
895
|
+
"light": "Claro",
|
|
896
|
+
"dark": "Escuro"
|
|
897
|
+
}
|
|
898
|
+
},
|
|
899
|
+
"language": {
|
|
900
|
+
"languages": {
|
|
901
|
+
"en": "Inglês",
|
|
902
|
+
"es": "Espanhol",
|
|
903
|
+
"pt": "Português"
|
|
904
|
+
}
|
|
905
|
+
},
|
|
368
906
|
"fileUpload": {
|
|
369
907
|
"dropzone": {
|
|
370
908
|
"selectPrompt": "Haz clic para seleccionar archivos o arrastra y suelta aquí",
|
|
@@ -453,117 +991,13 @@ npm install @ngx-translate/core@16.0 @ngx-translate/http-loader@16.0 ngx-transla
|
|
|
453
991
|
}
|
|
454
992
|
```
|
|
455
993
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
```ts
|
|
459
|
-
import { HttpBackend } from '@angular/common/http';
|
|
460
|
-
import { provideRouter } from '@angular/router';
|
|
461
|
-
import { provideTranslateService, TranslateLoader } from '@ngx-translate/core';
|
|
462
|
-
import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';
|
|
463
|
-
|
|
464
|
-
export function HttpLoaderFactory(_httpBackend: HttpBackend) {
|
|
465
|
-
return new MultiTranslateHttpLoader(_httpBackend, ['/assets/i18n/', '/assets/i18n/sdk/']);
|
|
466
|
-
}
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
5. Then, add the provider to your application configuration:
|
|
470
|
-
|
|
471
|
-
```ts
|
|
472
|
-
import { ApplicationConfig } from '@angular/core';
|
|
473
|
-
import { provideHttpClient } from '@angular/common/http';
|
|
474
|
-
|
|
475
|
-
export const appConfig: ApplicationConfig = {
|
|
476
|
-
providers: [
|
|
477
|
-
provideRouter(routes),
|
|
478
|
-
provideHttpClient(),
|
|
479
|
-
provideTranslateService({ loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, deps: [HttpBackend] } }),
|
|
480
|
-
],
|
|
481
|
-
};
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
6. After, add a traslation service like this one to encapsulate all the translation logic:
|
|
485
|
-
|
|
486
|
-
```ts
|
|
487
|
-
import { Injectable, inject } from '@angular/core';
|
|
488
|
-
import { EnvironmentService } from '@core/services/environment/environment.service';
|
|
489
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
490
|
-
|
|
491
|
-
export interface Locale {
|
|
492
|
-
lang: string;
|
|
493
|
-
data: object;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
const LOCALIZATION_LOCAL_STORAGE_KEY = 'language';
|
|
497
|
-
|
|
498
|
-
@Injectable({
|
|
499
|
-
providedIn: 'root',
|
|
500
|
-
})
|
|
501
|
-
export class TranslationService {
|
|
502
|
-
translate = inject(TranslateService);
|
|
503
|
-
environmentService = inject(EnvironmentService);
|
|
504
|
-
|
|
505
|
-
constructor() {
|
|
506
|
-
const defaultLanguage: string = this.environmentService.language;
|
|
507
|
-
|
|
508
|
-
// add new langIds to the list
|
|
509
|
-
this.translate.addLangs([defaultLanguage]);
|
|
510
|
-
|
|
511
|
-
// this language will be used as a fallback when a translation isn't found in the current language
|
|
512
|
-
this.translate.setDefaultLang(defaultLanguage);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
loadTranslations(langs: string[]): void {
|
|
516
|
-
this.translate.addLangs(langs);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
setLanguage(lang: string) {
|
|
520
|
-
if (lang) {
|
|
521
|
-
this.translate.use(lang);
|
|
522
|
-
localStorage.setItem(LOCALIZATION_LOCAL_STORAGE_KEY, lang);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
getSelectedLanguage(): string {
|
|
527
|
-
return localStorage.getItem(LOCALIZATION_LOCAL_STORAGE_KEY) ?? this.translate.getDefaultLang();
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
instant(key: string, params?: object | undefined) {
|
|
531
|
-
if (params) {
|
|
532
|
-
return this.translate.instant(key, params);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
return this.translate.instant(key);
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
7. Finally, call the traslation service in app.component to load the translations:
|
|
994
|
+
## Usage Examples
|
|
541
995
|
|
|
542
|
-
|
|
543
|
-
import { Component } from '@angular/core';
|
|
544
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
545
|
-
|
|
546
|
-
@Component({
|
|
547
|
-
selector: 'app-root',
|
|
548
|
-
template: `<router-outlet></router-outlet>`,
|
|
549
|
-
})
|
|
550
|
-
export class AppComponent {
|
|
551
|
-
translationService = inject(TranslationService);
|
|
552
|
-
|
|
553
|
-
constructor() {
|
|
554
|
-
// register translations
|
|
555
|
-
this.translationService.loadTranslations(['es', 'en', 'pt']);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
With this configuration, all the translations related to the SDK will be loaded.
|
|
561
|
-
|
|
562
|
-
## Usage Example
|
|
996
|
+
### Using Components
|
|
563
997
|
|
|
564
998
|
Here's a basic example of using a button component:
|
|
565
999
|
|
|
566
|
-
```
|
|
1000
|
+
```typescript
|
|
567
1001
|
// app.component.ts
|
|
568
1002
|
import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
|
|
569
1003
|
|
|
@@ -572,12 +1006,56 @@ import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
|
|
|
572
1006
|
template: `
|
|
573
1007
|
<div>
|
|
574
1008
|
<h1>Awesome button</h1>
|
|
575
|
-
|
|
1009
|
+
<st-button variant="primary">Click me!</st-button>
|
|
576
1010
|
</div>
|
|
577
1011
|
`
|
|
578
1012
|
})
|
|
579
1013
|
```
|
|
580
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
|
+
|
|
581
1059
|
## Documentation
|
|
582
1060
|
|
|
583
1061
|
For detailed component documentation, visit our [Storybook](https://storybook.js.org/tutorials/intro-to-storybook/angular/en/get-started/)
|
|
@@ -586,4 +1064,4 @@ For detailed component documentation, visit our [Storybook](https://storybook.js
|
|
|
586
1064
|
|
|
587
1065
|
## Last update
|
|
588
1066
|
|
|
589
|
-
This file was last updated
|
|
1067
|
+
This file was last updated on August 13th, 2025.
|