valtech-components 2.0.419 → 2.0.420

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 (107) hide show
  1. package/esm2022/lib/components/atoms/button/button.component.mjs +30 -102
  2. package/esm2022/lib/components/atoms/countdown/countdown.component.mjs +2 -7
  3. package/esm2022/lib/components/atoms/display/display.component.mjs +18 -101
  4. package/esm2022/lib/components/atoms/image/image.component.mjs +2 -5
  5. package/esm2022/lib/components/atoms/price-tag/price-tag.component.mjs +2 -12
  6. package/esm2022/lib/components/atoms/qr-code/qr-code.component.mjs +4 -29
  7. package/esm2022/lib/components/atoms/text/text.component.mjs +49 -171
  8. package/esm2022/lib/components/atoms/title/title.component.mjs +23 -65
  9. package/esm2022/lib/components/atoms/title/types.mjs +7 -19
  10. package/esm2022/lib/components/molecules/accordion/accordion.component.mjs +7 -53
  11. package/esm2022/lib/components/molecules/alert-box/alert-box.component.mjs +7 -26
  12. package/esm2022/lib/components/molecules/breadcrumb/breadcrumb.component.mjs +7 -42
  13. package/esm2022/lib/components/molecules/check-input/check-input.component.mjs +12 -41
  14. package/esm2022/lib/components/molecules/chip-group/chip-group.component.mjs +3 -28
  15. package/esm2022/lib/components/molecules/code-display/code-display.component.mjs +2 -5
  16. package/esm2022/lib/components/molecules/command-display/command-display.component.mjs +3 -6
  17. package/esm2022/lib/components/molecules/comment/comment.component.mjs +5 -31
  18. package/esm2022/lib/components/molecules/currency-input/currency-input.component.mjs +2 -23
  19. package/esm2022/lib/components/molecules/date-range-input/date-range-input.component.mjs +2 -29
  20. package/esm2022/lib/components/molecules/expandable-text/expandable-text.component.mjs +4 -6
  21. package/esm2022/lib/components/molecules/glow-card/glow-card.component.mjs +16 -40
  22. package/esm2022/lib/components/molecules/language-selector/language-selector.component.mjs +25 -125
  23. package/esm2022/lib/components/molecules/multi-select-search/multi-select-search.component.mjs +4 -6
  24. package/esm2022/lib/components/molecules/number-stepper/number-stepper.component.mjs +2 -10
  25. package/esm2022/lib/components/molecules/participant-card/participant-card.component.mjs +2 -4
  26. package/esm2022/lib/components/molecules/phone-input/phone-input.component.mjs +2 -23
  27. package/esm2022/lib/components/molecules/plain-code-box/plain-code-box.component.mjs +3 -6
  28. package/esm2022/lib/components/molecules/popover-selector/popover-selector.component.mjs +9 -12
  29. package/esm2022/lib/components/molecules/raffle-status-card/raffle-status-card.component.mjs +3 -11
  30. package/esm2022/lib/components/molecules/range-input/range-input.component.mjs +4 -25
  31. package/esm2022/lib/components/molecules/segment-control/segment-control.component.mjs +3 -34
  32. package/esm2022/lib/components/molecules/select-input/select-input.component.mjs +11 -20
  33. package/esm2022/lib/components/molecules/select-search/select-search.component.mjs +4 -6
  34. package/esm2022/lib/components/molecules/share-buttons/share-buttons.component.mjs +1 -6
  35. package/esm2022/lib/components/molecules/stepper/stepper.component.mjs +3 -28
  36. package/esm2022/lib/components/molecules/tabs/tabs.component.mjs +7 -41
  37. package/esm2022/lib/components/molecules/textarea-input/textarea-input.component.mjs +2 -27
  38. package/esm2022/lib/components/molecules/ticket-grid/ticket-grid.component.mjs +2 -10
  39. package/esm2022/lib/components/molecules/toggle-input/toggle-input.component.mjs +7 -37
  40. package/esm2022/lib/components/molecules/winner-display/winner-display.component.mjs +1 -12
  41. package/esm2022/lib/components/organisms/comment-section/comment-section.component.mjs +8 -54
  42. package/esm2022/lib/components/organisms/data-table/data-table.component.mjs +1 -3
  43. package/esm2022/lib/components/organisms/wizard/wizard.component.mjs +3 -5
  44. package/esm2022/lib/services/locale.service.mjs +75 -0
  45. package/esm2022/lib/services/types.mjs +5 -3
  46. package/esm2022/public-api.mjs +2 -7
  47. package/fesm2022/valtech-components.mjs +366 -2279
  48. package/fesm2022/valtech-components.mjs.map +1 -1
  49. package/lib/components/atoms/button/button.component.d.ts +12 -37
  50. package/lib/components/atoms/countdown/countdown.component.d.ts +0 -1
  51. package/lib/components/atoms/display/display.component.d.ts +8 -60
  52. package/lib/components/atoms/image/image.component.d.ts +0 -2
  53. package/lib/components/atoms/price-tag/price-tag.component.d.ts +0 -1
  54. package/lib/components/atoms/qr-code/qr-code.component.d.ts +2 -6
  55. package/lib/components/atoms/text/text.component.d.ts +20 -68
  56. package/lib/components/atoms/title/title.component.d.ts +7 -12
  57. package/lib/components/atoms/title/types.d.ts +11 -24
  58. package/lib/components/molecules/accordion/accordion.component.d.ts +2 -9
  59. package/lib/components/molecules/alert-box/alert-box.component.d.ts +3 -8
  60. package/lib/components/molecules/breadcrumb/breadcrumb.component.d.ts +2 -8
  61. package/lib/components/molecules/check-input/check-input.component.d.ts +2 -10
  62. package/lib/components/molecules/chip-group/chip-group.component.d.ts +2 -8
  63. package/lib/components/molecules/code-display/code-display.component.d.ts +0 -2
  64. package/lib/components/molecules/command-display/command-display.component.d.ts +0 -3
  65. package/lib/components/molecules/comment/comment.component.d.ts +2 -6
  66. package/lib/components/molecules/currency-input/currency-input.component.d.ts +0 -3
  67. package/lib/components/molecules/date-range-input/date-range-input.component.d.ts +0 -3
  68. package/lib/components/molecules/expandable-text/expandable-text.component.d.ts +0 -1
  69. package/lib/components/molecules/glow-card/glow-card.component.d.ts +5 -9
  70. package/lib/components/molecules/language-selector/language-selector.component.d.ts +7 -19
  71. package/lib/components/molecules/multi-select-search/multi-select-search.component.d.ts +0 -2
  72. package/lib/components/molecules/number-stepper/number-stepper.component.d.ts +0 -1
  73. package/lib/components/molecules/participant-card/participant-card.component.d.ts +0 -1
  74. package/lib/components/molecules/phone-input/phone-input.component.d.ts +0 -3
  75. package/lib/components/molecules/plain-code-box/plain-code-box.component.d.ts +0 -3
  76. package/lib/components/molecules/popover-selector/popover-selector.component.d.ts +3 -4
  77. package/lib/components/molecules/raffle-status-card/raffle-status-card.component.d.ts +0 -1
  78. package/lib/components/molecules/range-input/range-input.component.d.ts +3 -8
  79. package/lib/components/molecules/segment-control/segment-control.component.d.ts +2 -8
  80. package/lib/components/molecules/select-input/select-input.component.d.ts +2 -3
  81. package/lib/components/molecules/select-search/select-search.component.d.ts +0 -2
  82. package/lib/components/molecules/share-buttons/share-buttons.component.d.ts +0 -1
  83. package/lib/components/molecules/stepper/stepper.component.d.ts +2 -8
  84. package/lib/components/molecules/tabs/tabs.component.d.ts +2 -8
  85. package/lib/components/molecules/textarea-input/textarea-input.component.d.ts +2 -6
  86. package/lib/components/molecules/ticket-grid/ticket-grid.component.d.ts +0 -1
  87. package/lib/components/molecules/toggle-input/toggle-input.component.d.ts +2 -8
  88. package/lib/components/molecules/winner-display/winner-display.component.d.ts +0 -1
  89. package/lib/components/organisms/comment-section/comment-section.component.d.ts +2 -6
  90. package/lib/components/organisms/data-table/data-table.component.d.ts +0 -1
  91. package/lib/components/organisms/wizard/wizard.component.d.ts +0 -2
  92. package/lib/services/locale.service.d.ts +52 -0
  93. package/lib/services/types.d.ts +1 -6
  94. package/package.json +1 -1
  95. package/public-api.d.ts +1 -5
  96. package/esm2022/lib/services/lang-provider/components/lang-settings.mjs +0 -13
  97. package/esm2022/lib/services/lang-provider/content.mjs +0 -156
  98. package/esm2022/lib/services/lang-provider/lang-provider.service.mjs +0 -530
  99. package/esm2022/lib/services/lang-provider/types.mjs +0 -23
  100. package/esm2022/lib/shared/utils/content.mjs +0 -186
  101. package/esm2022/lib/shared/utils/simple-content.mjs +0 -119
  102. package/lib/services/lang-provider/components/lang-settings.d.ts +0 -3
  103. package/lib/services/lang-provider/content.d.ts +0 -17
  104. package/lib/services/lang-provider/lang-provider.service.d.ts +0 -264
  105. package/lib/services/lang-provider/types.d.ts +0 -30
  106. package/lib/shared/utils/content.d.ts +0 -199
  107. package/lib/shared/utils/simple-content.d.ts +0 -120
@@ -1,199 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { LangService } from '../../services/lang-provider/lang-provider.service';
3
- /**
4
- * Content utilities for reactive text binding in components.
5
- *
6
- * These utilities provide a convenient way to bind component properties
7
- * to language content that automatically updates when the language changes.
8
- */
9
- /**
10
- * Unified configuration for content binding with optional interpolation.
11
- * Supports both simple content retrieval and content with dynamic values.
12
- */
13
- export interface ContentConfig {
14
- /**
15
- * The component class name (used for content lookup).
16
- * If omitted, searches in global content (_global namespace).
17
- */
18
- className?: string;
19
- /** The content key to retrieve */
20
- key: string;
21
- /** Optional fallback text if content is not found */
22
- fallback?: string;
23
- /** Optional object with values to interpolate into the content string */
24
- interpolation?: Record<string, string | number>;
25
- }
26
- /**
27
- * @deprecated Use ContentConfig with interpolation property instead.
28
- * This interface is kept for backward compatibility.
29
- */
30
- export interface InterpolatedContentConfig extends ContentConfig {
31
- /** Object with values to interpolate into the content string */
32
- interpolation?: Record<string, string | number>;
33
- }
34
- /**
35
- * Create a reactive content observable from a content key.
36
- * This is the primary utility for the `fromContent` pattern with unified support
37
- * for both simple content and content with interpolation.
38
- *
39
- * @param langService - The language service instance
40
- * @param config - Content configuration with optional interpolation
41
- * @returns Observable that emits the content string and updates on language change
42
- *
43
- * @example Simple content:
44
- * ```typescript
45
- * // Component-specific content
46
- * this.title$ = fromContent(this.langService, {
47
- * className: 'HeaderComponent',
48
- * key: 'title',
49
- * fallback: 'Default Title'
50
- * });
51
- *
52
- * // Global content (no className needed)
53
- * this.saveButton$ = fromContent(this.langService, {
54
- * key: 'save'
55
- * });
56
- * ```
57
- *
58
- * @example Content with interpolation:
59
- * ```typescript
60
- * // Content: "Hello {name}, you have {count} messages"
61
- * this.greeting$ = fromContent(this.langService, {
62
- * className: 'WelcomeComponent',
63
- * key: 'greeting',
64
- * interpolation: { name: 'John', count: 5 }
65
- * });
66
- * // Results in: "Hello John, you have 5 messages"
67
- * ```
68
- */
69
- export declare function fromContent(langService: LangService, config: ContentConfig): Observable<string>;
70
- /**
71
- * Create a reactive content observable with interpolation support.
72
- *
73
- * @deprecated Use fromContent() with interpolation property instead.
74
- * This method is kept for backward compatibility.
75
- *
76
- * @param langService - The language service instance
77
- * @param config - Interpolated content configuration
78
- * @returns Observable that emits the interpolated content string
79
- *
80
- * @example Migration:
81
- * ```typescript
82
- * // OLD (deprecated):
83
- * this.greeting$ = fromContentWithInterpolation(this.langService, {
84
- * className: 'WelcomeComponent',
85
- * key: 'greeting',
86
- * interpolation: { name: 'John', count: 5 }
87
- * });
88
- *
89
- * // NEW (recommended):
90
- * this.greeting$ = fromContent(this.langService, {
91
- * className: 'WelcomeComponent',
92
- * key: 'greeting',
93
- * interpolation: { name: 'John', count: 5 }
94
- * });
95
- * ```
96
- */
97
- export declare function fromContentWithInterpolation(langService: LangService, config: InterpolatedContentConfig): Observable<string>;
98
- /**
99
- * Create multiple reactive content observables at once.
100
- * Useful when a component needs several content strings.
101
- *
102
- * @param langService - The language service instance
103
- * @param className - The component class name
104
- * @param keys - Array of content keys to retrieve
105
- * @returns Observable that emits an object with all requested content
106
- *
107
- * @example
108
- * ```typescript
109
- * this.content$ = fromMultipleContent(this.langService, 'FormComponent', [
110
- * 'title', 'submitButton', 'cancelButton'
111
- * ]);
112
- *
113
- * // In template
114
- * <ng-container *ngIf="content$ | async as content">
115
- * <h2>{{ content.title }}</h2>
116
- * <button>{{ content.submitButton }}</button>
117
- * <button>{{ content.cancelButton }}</button>
118
- * </ng-container>
119
- * ```
120
- */
121
- export declare function fromMultipleContent(langService: LangService, className: string, keys: string[]): Observable<Record<string, string>>;
122
- /**
123
- * Helper function to interpolate values into a content string.
124
- * Replaces placeholders in the format {key} with corresponding values.
125
- *
126
- * @param content - The content string with placeholders
127
- * @param values - Object with values to interpolate
128
- * @returns The interpolated string
129
- *
130
- * @example
131
- * ```typescript
132
- * const result = interpolateContent("Hello {name}!", { name: "World" });
133
- * // Returns: "Hello World!"
134
- * ```
135
- */
136
- export declare function interpolateContent(content: string, values?: Record<string, string | number>): string;
137
- /**
138
- * Type-safe content key builder for better IDE support.
139
- * This is a utility type that can be used to ensure content keys exist.
140
- *
141
- * @example
142
- * ```typescript
143
- * // Define your component's content keys
144
- * interface MyComponentContent {
145
- * title: string;
146
- * description: string;
147
- * submitButton: string;
148
- * }
149
- *
150
- * // Use with type safety
151
- * const titleKey: ContentKey<MyComponentContent> = 'title'; // ✓ Valid
152
- * const invalidKey: ContentKey<MyComponentContent> = 'invalid'; // ✗ Type error
153
- * ```
154
- */
155
- export type ContentKey<T> = keyof T & string;
156
- /**
157
- * Factory function to create a content helper bound to a specific component class.
158
- * This creates a more convenient API for components that need multiple content strings.
159
- *
160
- * @param langService - The language service instance
161
- * @param className - The component class name
162
- * @returns Object with convenient methods for content retrieval
163
- *
164
- * @example
165
- * ```typescript
166
- * export class MyComponent {
167
- * private content = createContentHelper(this.langService, 'MyComponent');
168
- *
169
- * constructor(private langService: LangService) {}
170
- *
171
- * ngOnInit() {
172
- * this.title$ = this.content.get('title');
173
- * this.allContent$ = this.content.getMultiple(['title', 'description']);
174
- * }
175
- * }
176
- * ```
177
- */
178
- export declare function createContentHelper(langService: LangService, className: string): {
179
- /**
180
- * Get a single content string reactively.
181
- */
182
- get(key: string, fallback?: string): Observable<string>;
183
- /**
184
- * Get multiple content strings reactively.
185
- */
186
- getMultiple(keys: string[]): Observable<Record<string, string>>;
187
- /**
188
- * Get content with interpolation.
189
- */
190
- getWithInterpolation(key: string, interpolation: Record<string, string | number>, fallback?: string): Observable<string>;
191
- /**
192
- * Get a single content string synchronously (current language only).
193
- */
194
- getText(key: string, fallback?: string): string;
195
- /**
196
- * Check if a content key exists.
197
- */
198
- hasContent(key: string): boolean;
199
- };
@@ -1,120 +0,0 @@
1
- /**
2
- * Simplified content utilities for the new LangService-only system.
3
- * This replaces the old reactive-content.ts with a much simpler approach.
4
- */
5
- /**
6
- * Base metadata for components that support reactive content.
7
- * Simplified version that works directly with LangService.
8
- */
9
- export interface ReactiveContentMetadata {
10
- /** Static content text (takes precedence over reactive content) */
11
- content?: string;
12
- /** Content key for reactive content from LangService */
13
- contentKey?: string;
14
- /** Component class name for content lookup */
15
- contentClass?: string;
16
- /** Fallback text if content is not found */
17
- contentFallback?: string;
18
- }
19
- /**
20
- * Extended metadata for text-based components with reactive content support.
21
- */
22
- export interface ReactiveTextMetadata extends ReactiveContentMetadata {
23
- /** Static content text */
24
- content?: string;
25
- /** Content key for reactive lookup */
26
- contentKey?: string;
27
- /** Component class name */
28
- contentClass?: string;
29
- /** Fallback text */
30
- contentFallback?: string;
31
- }
32
- /**
33
- * Extended metadata for components that support content interpolation.
34
- */
35
- export interface ReactiveContentWithInterpolation extends ReactiveContentMetadata {
36
- /** Interpolation data for parameterized content */
37
- contentInterpolation?: Record<string, string | number>;
38
- }
39
- /**
40
- * Helper function to determine if component should use reactive content.
41
- * @param metadata Component metadata
42
- * @returns True if component should use reactive content
43
- */
44
- export declare function shouldUseReactiveContent(metadata: ReactiveContentMetadata): boolean;
45
- /**
46
- * Extract content configuration from metadata.
47
- * @param metadata Component metadata
48
- * @returns Content configuration for LangService
49
- */
50
- export declare function extractContentConfig(metadata: ReactiveContentMetadata): {
51
- className: string;
52
- key: string;
53
- fallback: string;
54
- };
55
- /**
56
- * Create reactive content metadata with defaults.
57
- * @param config Partial content configuration
58
- * @returns Complete reactive content metadata
59
- */
60
- export declare function createReactiveContentMetadata(config: Partial<ReactiveContentMetadata>): ReactiveContentMetadata;
61
- /**
62
- * Interpolate content string with values.
63
- * Replaces placeholders like {{key}} or {key} with actual values.
64
- *
65
- * @param content - Content string with placeholders
66
- * @param values - Values to interpolate
67
- * @returns Interpolated string
68
- *
69
- * @example
70
- * ```typescript
71
- * interpolateContent('Hello {{name}}!', { name: 'World' })
72
- * // Returns: 'Hello World!'
73
- * ```
74
- */
75
- export declare function interpolateContent(content: string, values?: Record<string, string | number>): string;
76
- /**
77
- * Check if component should use reactive content with interpolation.
78
- * @param metadata Component metadata with interpolation
79
- * @returns True if component should use reactive content with interpolation
80
- */
81
- export declare function shouldUseReactiveContentWithInterpolation(metadata: ReactiveContentWithInterpolation): boolean;
82
- /**
83
- * Extract content configuration with interpolation from metadata.
84
- * @param metadata Component metadata with interpolation
85
- * @returns Content configuration for LangService with interpolation data
86
- */
87
- export declare function extractContentConfigWithInterpolation(metadata: ReactiveContentWithInterpolation): {
88
- className: string;
89
- key: string;
90
- fallback: string;
91
- interpolation: Record<string, string | number>;
92
- };
93
- /**
94
- * Helper function to get reactive content with interpolation using LangService.
95
- * This provides a unified way to get reactive, interpolated content.
96
- *
97
- * @param langService - The LangService instance
98
- * @param metadata - Component metadata with interpolation
99
- * @returns Observable that emits interpolated content
100
- *
101
- * @example
102
- * ```typescript
103
- * const content$ = fromContentWithInterpolation(this.langService, {
104
- * contentClass: 'MyComponent',
105
- * contentKey: 'greeting',
106
- * contentInterpolation: { name: 'World' }
107
- * });
108
- * ```
109
- */
110
- export declare function fromContentWithInterpolation(langService: any, // LangService type would cause circular dependency
111
- metadata: ReactiveContentWithInterpolation): any;
112
- /**
113
- * Helper function to get static content with interpolation.
114
- * This provides interpolation for static content strings.
115
- *
116
- * @param content - Static content string
117
- * @param interpolationData - Values to interpolate
118
- * @returns Interpolated string
119
- */
120
- export declare function interpolateStaticContent(content: string, interpolationData?: Record<string, string | number>): string;