valtech-components 4.0.5 → 4.0.6

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 (59) hide show
  1. package/esm2022/lib/components/atoms/button/button.component.mjs +15 -5
  2. package/esm2022/lib/components/atoms/fab/fab.component.mjs +8 -18
  3. package/esm2022/lib/components/atoms/horizontal-scroll/horizontal-scroll.component.mjs +5 -7
  4. package/esm2022/lib/components/atoms/progress-bar/progress-bar.component.mjs +3 -1
  5. package/esm2022/lib/components/atoms/progress-bar/types.mjs +1 -1
  6. package/esm2022/lib/components/molecules/accordion/accordion.component.mjs +4 -6
  7. package/esm2022/lib/components/molecules/action-card/action-card.component.mjs +5 -5
  8. package/esm2022/lib/components/molecules/breadcrumb/breadcrumb.component.mjs +5 -5
  9. package/esm2022/lib/components/molecules/card/card.component.mjs +19 -9
  10. package/esm2022/lib/components/molecules/chip-group/chip-group.component.mjs +21 -13
  11. package/esm2022/lib/components/molecules/code-display/code-display.component.mjs +5 -5
  12. package/esm2022/lib/components/molecules/comment/comment.component.mjs +29 -56
  13. package/esm2022/lib/components/molecules/content-loader/content-loader.component.mjs +13 -3
  14. package/esm2022/lib/components/molecules/date-picker/date-picker.component.mjs +7 -15
  15. package/esm2022/lib/components/molecules/date-range-input/date-range-input.component.mjs +6 -10
  16. package/esm2022/lib/components/molecules/docs-code-example/docs-code-example.component.mjs +13 -5
  17. package/esm2022/lib/components/molecules/docs-nav-links/docs-nav-links.component.mjs +7 -13
  18. package/esm2022/lib/components/molecules/docs-search/docs-search.component.mjs +12 -28
  19. package/esm2022/lib/components/molecules/features-list/features-list.component.mjs +5 -5
  20. package/esm2022/lib/components/molecules/feedback-form/feedback-form.component.mjs +5 -5
  21. package/esm2022/lib/components/molecules/file-input/file-input.component.mjs +9 -3
  22. package/esm2022/lib/components/molecules/glow-card/glow-card.component.mjs +17 -15
  23. package/esm2022/lib/components/molecules/language-selector/language-selector.component.mjs +7 -5
  24. package/esm2022/lib/components/molecules/link/link.component.mjs +3 -3
  25. package/esm2022/lib/components/molecules/media-object/media-object.component.mjs +3 -3
  26. package/esm2022/lib/components/molecules/metric-card/metric-card.component.mjs +5 -3
  27. package/esm2022/lib/components/molecules/password-input/password-input.component.mjs +11 -3
  28. package/esm2022/lib/components/molecules/pill/pill.component.mjs +7 -7
  29. package/esm2022/lib/components/molecules/popover-selector/popover-selector.component.mjs +7 -7
  30. package/esm2022/lib/components/molecules/segment-control/segment-control.component.mjs +3 -3
  31. package/esm2022/lib/components/molecules/select-search/select-search.component.mjs +15 -3
  32. package/esm2022/lib/components/molecules/share-buttons/share-buttons.component.mjs +3 -1
  33. package/esm2022/lib/components/molecules/stats-card/stats-card.component.mjs +5 -5
  34. package/esm2022/lib/components/molecules/stepper/stepper.component.mjs +11 -13
  35. package/esm2022/lib/components/molecules/tabs/tabs.component.mjs +4 -6
  36. package/esm2022/lib/components/molecules/ticket-card/ticket-card.component.mjs +3 -3
  37. package/esm2022/lib/components/organisms/cookie-banner/cookie-banner.component.mjs +3 -1
  38. package/esm2022/lib/components/organisms/cookie-banner/types.mjs +1 -1
  39. package/esm2022/lib/components/organisms/data-table/data-table.component.mjs +11 -7
  40. package/esm2022/lib/components/organisms/login/login.component.mjs +3 -3
  41. package/esm2022/lib/services/page-state/page-state.i18n.mjs +19 -0
  42. package/esm2022/lib/services/page-state/page-state.mjs +101 -0
  43. package/esm2022/lib/version.mjs +2 -2
  44. package/esm2022/public-api.mjs +4 -1
  45. package/fesm2022/valtech-components.mjs +403 -278
  46. package/fesm2022/valtech-components.mjs.map +1 -1
  47. package/lib/components/atoms/progress-bar/types.d.ts +2 -0
  48. package/lib/components/atoms/rights-footer/rights-footer.component.d.ts +2 -2
  49. package/lib/components/atoms/text/text.component.d.ts +1 -1
  50. package/lib/components/atoms/user-avatar/user-avatar.component.d.ts +1 -1
  51. package/lib/components/molecules/features-list/features-list.component.d.ts +1 -1
  52. package/lib/components/organisms/article/article.component.d.ts +4 -4
  53. package/lib/components/organisms/cookie-banner/types.d.ts +2 -0
  54. package/lib/components/organisms/landing-steps/landing-steps.component.d.ts +1 -1
  55. package/lib/services/page-state/page-state.d.ts +74 -0
  56. package/lib/services/page-state/page-state.i18n.d.ts +6 -0
  57. package/lib/version.d.ts +1 -1
  58. package/package.json +1 -1
  59. package/public-api.d.ts +1 -0
@@ -16,4 +16,6 @@ export interface ProgressBarMetadata {
16
16
  buffer: number;
17
17
  type: 'determinate' | 'indeterminate';
18
18
  rounded: boolean;
19
+ /** Accessible label for screen readers (aria-label). Defaults to 'Progreso'. */
20
+ label?: string;
19
21
  }
@@ -39,11 +39,11 @@ export declare class RightsFooterComponent {
39
39
  /**
40
40
  * Computed helper for align prop in template.
41
41
  */
42
- propsAlign: import("@angular/core").Signal<"left" | "right" | "center">;
42
+ propsAlign: import("@angular/core").Signal<"left" | "center" | "right">;
43
43
  /**
44
44
  * Computed helper for color prop in template.
45
45
  */
46
- propsColor: import("@angular/core").Signal<"primary" | "secondary" | "tertiary" | "success" | "warning" | "danger" | "light" | "medium" | "dark">;
46
+ propsColor: import("@angular/core").Signal<"success" | "medium" | "primary" | "secondary" | "tertiary" | "warning" | "danger" | "light" | "dark">;
47
47
  /**
48
48
  * Computed helper for withMargin prop in template.
49
49
  */
@@ -11,7 +11,7 @@ export declare class TextComponent {
11
11
  */
12
12
  displayContent: import("@angular/core").Signal<string>;
13
13
  propsColor: import("@angular/core").Signal<import("@ionic/core").Color>;
14
- propsSize: import("@angular/core").Signal<"medium" | "small" | "large" | "xlarge">;
14
+ propsSize: import("@angular/core").Signal<"small" | "medium" | "large" | "xlarge">;
15
15
  propsBold: import("@angular/core").Signal<boolean>;
16
16
  propsProcessLinks: import("@angular/core").Signal<boolean>;
17
17
  propsAllowPartialBold: import("@angular/core").Signal<boolean>;
@@ -38,7 +38,7 @@ export declare class UserAvatarComponent {
38
38
  readonly imageUrl: import("@angular/core").Signal<string>;
39
39
  /** Iniciales — 1-2 chars derivados de name (preferred) o email prefix. */
40
40
  readonly initials: import("@angular/core").Signal<string>;
41
- readonly sizeClass: import("@angular/core").Signal<"medium" | "small" | "large" | "xlarge" | "xsmall">;
41
+ readonly sizeClass: import("@angular/core").Signal<"small" | "medium" | "large" | "xlarge" | "xsmall">;
42
42
  readonly shapeClass: import("@angular/core").Signal<"circle" | "square">;
43
43
  /** Background — explicito o derivado deterministicamente del user. */
44
44
  readonly bgColor: import("@angular/core").Signal<string>;
@@ -41,7 +41,7 @@ export declare class FeaturesListComponent {
41
41
  iconColor: string;
42
42
  iconSize: number;
43
43
  mode: "horizontal" | "vertical";
44
- gap: "medium" | "small" | "large";
44
+ gap: "small" | "medium" | "large";
45
45
  alignment: "center" | "start";
46
46
  imageShape: "circle" | "square";
47
47
  maxVisible: number;
@@ -45,7 +45,7 @@ export declare class ArticleComponent implements OnInit {
45
45
  getVideoElement(element: ArticleElement): ArticleVideoElement;
46
46
  getCustomElement(element: ArticleElement): ArticleCustomElement;
47
47
  getQuoteTextProps(element: ArticleElement): {
48
- size: "medium" | "small" | "large" | "xlarge";
48
+ size: "small" | "medium" | "large" | "xlarge";
49
49
  color: import("@ionic/core").Color;
50
50
  content?: string;
51
51
  bold: boolean;
@@ -57,11 +57,11 @@ export declare class ArticleComponent implements OnInit {
57
57
  linkConfig?: import("valtech-components").LinkProcessorConfig;
58
58
  allowPartialBold?: boolean;
59
59
  authorColor?: import("@ionic/core").Color;
60
- alignment?: "left" | "right" | "center";
60
+ alignment?: "left" | "center" | "right";
61
61
  showQuoteMark?: boolean;
62
62
  };
63
63
  getHighlightTextProps(element: ArticleElement): {
64
- size: "medium" | "small" | "large" | "xlarge";
64
+ size: "small" | "medium" | "large" | "xlarge";
65
65
  color: import("@ionic/core").Color;
66
66
  content?: string;
67
67
  bold: boolean;
@@ -93,7 +93,7 @@ export declare class ArticleComponent implements OnInit {
93
93
  shape?: "round";
94
94
  size?: "default" | "small" | "large";
95
95
  fill?: "default" | "clear" | "outline" | "solid";
96
- type: "button" | "submit" | "reset";
96
+ type: "reset" | "submit" | "button";
97
97
  token?: string;
98
98
  ref?: any;
99
99
  handler?: (value: any) => any;
@@ -19,6 +19,8 @@ export type CookieBannerPosition = 'bottom' | 'top';
19
19
  export interface CookieBannerMetadata {
20
20
  /** Whether the banner is shown. Parent toggles based on `hasDecided`. */
21
21
  visible: boolean;
22
+ /** Accessible label for the dialog (aria-label). Defaults to 'Aviso de cookies'. */
23
+ ariaLabel?: string;
22
24
  /** Where the banner anchors. Default `'bottom'`. */
23
25
  position?: CookieBannerPosition;
24
26
  /** Short title above the message (optional). */
@@ -4,7 +4,7 @@ export declare class LandingStepsComponent {
4
4
  private readonly props_;
5
5
  set props(v: LandingStepsMetadata);
6
6
  readonly p: import("@angular/core").Signal<LandingStepsMetadata>;
7
- readonly cols: import("@angular/core").Signal<3 | 2 | 4>;
7
+ readonly cols: import("@angular/core").Signal<2 | 3 | 4>;
8
8
  readonly accentColor: import("@angular/core").Signal<string>;
9
9
  static ɵfac: i0.ɵɵFactoryDeclaration<LandingStepsComponent, never>;
10
10
  static ɵcmp: i0.ɵɵComponentDeclaration<LandingStepsComponent, "val-landing-steps", never, { "props": { "alias": "props"; "required": false; }; }, {}, never, never, true, never>;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * createPageState — helper estándar para el patrón loading/error/data de una
3
+ * página con datos remotos (HTTP o Firestore one-shot).
4
+ *
5
+ * Encapsula el boilerplate repetido en cada vista:
6
+ * - `loading` signal (true mientras carga o recarga).
7
+ * - `loadError` signal (el error crudo o null).
8
+ * - `errorState` computed que convierte el error a `EmptyStateMetadata` listo
9
+ * para `<val-empty-state>`, reactivo al idioma.
10
+ * - `reload()` function que re-ejecuta el `loader` async.
11
+ *
12
+ * El caller controla el template; `createPageState` solo maneja el estado:
13
+ *
14
+ * ```ts
15
+ * readonly page = createPageState(
16
+ * this.i18n,
17
+ * async () => {
18
+ * const res = await firstValueFrom(this.svc.getData());
19
+ * this.items.set(res.items);
20
+ * },
21
+ * { errorTitle: () => this.t('errorTitle'), retryLabel: () => this.t('retry') }
22
+ * );
23
+ * ```
24
+ *
25
+ * Template:
26
+ * ```html
27
+ * @if (page.loading()) { <val-skeleton-layout [props]="{ preset: 'list' }" /> }
28
+ * @else if (page.errorState(); as e) { <val-empty-state [props]="e" /> }
29
+ * @else { <!-- content --> }
30
+ * ```
31
+ *
32
+ * El helper llama a `reload()` automáticamente al construirse (carga inicial),
33
+ * igual que el patrón clásico `void this.load()` en el constructor.
34
+ * Para deshabilitar la carga automática, pasar `{ autoLoad: false }`.
35
+ *
36
+ * Para pull-to-refresh usar `connectPageRefresh(() => page.reload())` como siempre.
37
+ */
38
+ import { EmptyStateMetadata } from '../../components/molecules/empty-state/types';
39
+ import { I18nService } from '../i18n';
40
+ /** Labels i18n para el empty-state de error. Funciones para ser reactivas. */
41
+ export interface PageStateLabels {
42
+ errorTitle?: () => string;
43
+ offlineTitle?: () => string;
44
+ offlineHint?: () => string;
45
+ retryLabel?: () => string;
46
+ /** Descripción del error (default: mensaje del backend). */
47
+ errorDescription?: (err: unknown) => string;
48
+ }
49
+ /** Objeto retornado por `createPageState`. */
50
+ export interface PageState {
51
+ /** true mientras el loader está en curso. */
52
+ readonly loading: () => boolean;
53
+ /** Error crudo del último intento (null si fue exitoso). */
54
+ readonly loadError: () => unknown | null;
55
+ /**
56
+ * Props para `<val-empty-state>` — null si no hay error.
57
+ * Reactivo al idioma (llama `i18n.lang()` internamente).
58
+ */
59
+ readonly errorState: () => EmptyStateMetadata | null;
60
+ /** Re-ejecuta el loader (sets loading=true, limpia error). */
61
+ reload(): Promise<void>;
62
+ }
63
+ /**
64
+ * Crea el estado de carga de una página.
65
+ *
66
+ * @param i18n - `I18nService` inyectado en la page (para reactividad al idioma).
67
+ * @param loader - función async que carga los datos y los siembra en signals
68
+ * propias de la page. Si lanza, el error se captura en `loadError`.
69
+ * @param labels - labels i18n opcionales. Si se omiten usa defaults genéricos.
70
+ * @param options - `autoLoad`: si false no carga al construirse (default true).
71
+ */
72
+ export declare function createPageState(i18n: I18nService, loader: () => Promise<void>, labels?: PageStateLabels, options?: {
73
+ autoLoad?: boolean;
74
+ }): PageState;
@@ -0,0 +1,6 @@
1
+ import { LanguagesContent } from '../i18n/types';
2
+ /**
3
+ * Defaults i18n embebidos en `createPageState`. Namespace `PageState`.
4
+ * Auto-registrados la primera vez que se llama al helper.
5
+ */
6
+ export declare const PAGE_STATE_I18N: LanguagesContent;
package/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "4.0.5";
5
+ export declare const VERSION = "4.0.6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
package/public-api.d.ts CHANGED
@@ -369,6 +369,7 @@ export * from './lib/services/network-status';
369
369
  export * from './lib/components/molecules/network-banner/network-banner.component';
370
370
  export * from './lib/services/page-refresh/page-refresh.service';
371
371
  export * from './lib/services/refreshable-stream';
372
+ export * from './lib/services/page-state/page-state';
372
373
  export * from './lib/services/app-config';
373
374
  export * from './lib/services/app-version';
374
375
  export * from './lib/services/presets';