@odx/angular 12.4.2 → 12.6.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.
Files changed (152) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/cdk/autocomplete-control/lib/autocomplete-control.d.ts +3 -3
  3. package/components/bar/lib/directives/bar-button.directive.d.ts +2 -1
  4. package/components/select/lib/directives/index.d.ts +1 -0
  5. package/components/select/lib/directives/select-all.directive.d.ts +13 -0
  6. package/components/select/lib/select.component.d.ts +24 -3
  7. package/esm2022/cdk/autocomplete-control/lib/autocomplete-control.mjs +2 -2
  8. package/esm2022/components/autocomplete/lib/autocomplete.component.mjs +2 -2
  9. package/esm2022/components/bar/lib/directives/bar-button.directive.mjs +5 -7
  10. package/esm2022/components/select/lib/components/select-option/select-option.component.mjs +2 -3
  11. package/esm2022/components/select/lib/directives/index.mjs +2 -1
  12. package/esm2022/components/select/lib/directives/select-all.directive.mjs +33 -0
  13. package/esm2022/components/select/lib/select.component.mjs +69 -16
  14. package/fesm2022/odx-angular-animations.mjs.map +1 -1
  15. package/fesm2022/odx-angular-breakpoints.mjs +1 -1
  16. package/fesm2022/odx-angular-breakpoints.mjs.map +1 -1
  17. package/fesm2022/odx-angular-cdk-a11y.mjs +1 -1
  18. package/fesm2022/odx-angular-cdk-a11y.mjs.map +1 -1
  19. package/fesm2022/odx-angular-cdk-active-indicator.mjs +1 -1
  20. package/fesm2022/odx-angular-cdk-active-indicator.mjs.map +1 -1
  21. package/fesm2022/odx-angular-cdk-autocomplete-control.mjs +2 -2
  22. package/fesm2022/odx-angular-cdk-autocomplete-control.mjs.map +1 -1
  23. package/fesm2022/odx-angular-cdk-checkbox-control.mjs +1 -1
  24. package/fesm2022/odx-angular-cdk-checkbox-control.mjs.map +1 -1
  25. package/fesm2022/odx-angular-cdk-connected-overlay.mjs +1 -1
  26. package/fesm2022/odx-angular-cdk-connected-overlay.mjs.map +1 -1
  27. package/fesm2022/odx-angular-cdk-custom-form-control.mjs +1 -1
  28. package/fesm2022/odx-angular-cdk-custom-form-control.mjs.map +1 -1
  29. package/fesm2022/odx-angular-cdk-dynamic-view.mjs +1 -1
  30. package/fesm2022/odx-angular-cdk-dynamic-view.mjs.map +1 -1
  31. package/fesm2022/odx-angular-cdk-event-plugins.mjs.map +1 -1
  32. package/fesm2022/odx-angular-cdk-expandable.mjs +1 -1
  33. package/fesm2022/odx-angular-cdk-expandable.mjs.map +1 -1
  34. package/fesm2022/odx-angular-cdk-option-control.mjs +1 -1
  35. package/fesm2022/odx-angular-cdk-option-control.mjs.map +1 -1
  36. package/fesm2022/odx-angular-cdk-radio-group-control.mjs +1 -1
  37. package/fesm2022/odx-angular-cdk-radio-group-control.mjs.map +1 -1
  38. package/fesm2022/odx-angular-components-accordion.mjs +1 -1
  39. package/fesm2022/odx-angular-components-accordion.mjs.map +1 -1
  40. package/fesm2022/odx-angular-components-action-group.mjs +1 -1
  41. package/fesm2022/odx-angular-components-action-group.mjs.map +1 -1
  42. package/fesm2022/odx-angular-components-area-header.mjs +1 -1
  43. package/fesm2022/odx-angular-components-area-header.mjs.map +1 -1
  44. package/fesm2022/odx-angular-components-autocomplete.mjs +2 -2
  45. package/fesm2022/odx-angular-components-autocomplete.mjs.map +1 -1
  46. package/fesm2022/odx-angular-components-avatar.mjs +1 -1
  47. package/fesm2022/odx-angular-components-avatar.mjs.map +1 -1
  48. package/fesm2022/odx-angular-components-badge.mjs +1 -1
  49. package/fesm2022/odx-angular-components-badge.mjs.map +1 -1
  50. package/fesm2022/odx-angular-components-bar.mjs +5 -7
  51. package/fesm2022/odx-angular-components-bar.mjs.map +1 -1
  52. package/fesm2022/odx-angular-components-breadcrumbs.mjs +1 -1
  53. package/fesm2022/odx-angular-components-breadcrumbs.mjs.map +1 -1
  54. package/fesm2022/odx-angular-components-button-group.mjs +1 -1
  55. package/fesm2022/odx-angular-components-button-group.mjs.map +1 -1
  56. package/fesm2022/odx-angular-components-button.mjs +1 -1
  57. package/fesm2022/odx-angular-components-button.mjs.map +1 -1
  58. package/fesm2022/odx-angular-components-calendar.mjs +2 -2
  59. package/fesm2022/odx-angular-components-calendar.mjs.map +1 -1
  60. package/fesm2022/odx-angular-components-card.mjs +2 -2
  61. package/fesm2022/odx-angular-components-card.mjs.map +1 -1
  62. package/fesm2022/odx-angular-components-checkbox.mjs +1 -1
  63. package/fesm2022/odx-angular-components-checkbox.mjs.map +1 -1
  64. package/fesm2022/odx-angular-components-chip.mjs +1 -1
  65. package/fesm2022/odx-angular-components-chip.mjs.map +1 -1
  66. package/fesm2022/odx-angular-components-circular-progress.mjs +1 -1
  67. package/fesm2022/odx-angular-components-circular-progress.mjs.map +1 -1
  68. package/fesm2022/odx-angular-components-content-box.mjs +1 -1
  69. package/fesm2022/odx-angular-components-content-box.mjs.map +1 -1
  70. package/fesm2022/odx-angular-components-datepicker.mjs +2 -2
  71. package/fesm2022/odx-angular-components-datepicker.mjs.map +1 -1
  72. package/fesm2022/odx-angular-components-daterangepicker.mjs +3 -3
  73. package/fesm2022/odx-angular-components-daterangepicker.mjs.map +1 -1
  74. package/fesm2022/odx-angular-components-dropdown.mjs +1 -1
  75. package/fesm2022/odx-angular-components-dropdown.mjs.map +1 -1
  76. package/fesm2022/odx-angular-components-error-page.mjs +1 -1
  77. package/fesm2022/odx-angular-components-error-page.mjs.map +1 -1
  78. package/fesm2022/odx-angular-components-footer.mjs +2 -2
  79. package/fesm2022/odx-angular-components-footer.mjs.map +1 -1
  80. package/fesm2022/odx-angular-components-form-field.mjs +1 -1
  81. package/fesm2022/odx-angular-components-form-field.mjs.map +1 -1
  82. package/fesm2022/odx-angular-components-header-navigation.mjs +1 -1
  83. package/fesm2022/odx-angular-components-header-navigation.mjs.map +1 -1
  84. package/fesm2022/odx-angular-components-header.mjs +1 -1
  85. package/fesm2022/odx-angular-components-header.mjs.map +1 -1
  86. package/fesm2022/odx-angular-components-icon.mjs +1 -1
  87. package/fesm2022/odx-angular-components-icon.mjs.map +1 -1
  88. package/fesm2022/odx-angular-components-inline-message.mjs +1 -1
  89. package/fesm2022/odx-angular-components-inline-message.mjs.map +1 -1
  90. package/fesm2022/odx-angular-components-link.mjs.map +1 -1
  91. package/fesm2022/odx-angular-components-list.mjs +2 -2
  92. package/fesm2022/odx-angular-components-list.mjs.map +1 -1
  93. package/fesm2022/odx-angular-components-loading-spinner.mjs +1 -1
  94. package/fesm2022/odx-angular-components-loading-spinner.mjs.map +1 -1
  95. package/fesm2022/odx-angular-components-logo.mjs +1 -1
  96. package/fesm2022/odx-angular-components-logo.mjs.map +1 -1
  97. package/fesm2022/odx-angular-components-main-menu.mjs +2 -2
  98. package/fesm2022/odx-angular-components-main-menu.mjs.map +1 -1
  99. package/fesm2022/odx-angular-components-mainfilter-group.mjs +1 -1
  100. package/fesm2022/odx-angular-components-mainfilter-group.mjs.map +1 -1
  101. package/fesm2022/odx-angular-components-menu.mjs +1 -1
  102. package/fesm2022/odx-angular-components-menu.mjs.map +1 -1
  103. package/fesm2022/odx-angular-components-modal.mjs +1 -1
  104. package/fesm2022/odx-angular-components-modal.mjs.map +1 -1
  105. package/fesm2022/odx-angular-components-navigation-back.mjs +1 -1
  106. package/fesm2022/odx-angular-components-navigation-back.mjs.map +1 -1
  107. package/fesm2022/odx-angular-components-notification-testing.mjs.map +1 -1
  108. package/fesm2022/odx-angular-components-notification.mjs +3 -3
  109. package/fesm2022/odx-angular-components-notification.mjs.map +1 -1
  110. package/fesm2022/odx-angular-components-paginator.mjs +1 -1
  111. package/fesm2022/odx-angular-components-paginator.mjs.map +1 -1
  112. package/fesm2022/odx-angular-components-progress.mjs +1 -1
  113. package/fesm2022/odx-angular-components-progress.mjs.map +1 -1
  114. package/fesm2022/odx-angular-components-radio-group.mjs +1 -1
  115. package/fesm2022/odx-angular-components-radio-group.mjs.map +1 -1
  116. package/fesm2022/odx-angular-components-rail-navigation.mjs +1 -1
  117. package/fesm2022/odx-angular-components-rail-navigation.mjs.map +1 -1
  118. package/fesm2022/odx-angular-components-rich-list.mjs +1 -1
  119. package/fesm2022/odx-angular-components-rich-list.mjs.map +1 -1
  120. package/fesm2022/odx-angular-components-search-bar.mjs.map +1 -1
  121. package/fesm2022/odx-angular-components-select.mjs +101 -19
  122. package/fesm2022/odx-angular-components-select.mjs.map +1 -1
  123. package/fesm2022/odx-angular-components-slider.mjs +1 -1
  124. package/fesm2022/odx-angular-components-slider.mjs.map +1 -1
  125. package/fesm2022/odx-angular-components-spinbox.mjs +1 -1
  126. package/fesm2022/odx-angular-components-spinbox.mjs.map +1 -1
  127. package/fesm2022/odx-angular-components-switch.mjs +1 -1
  128. package/fesm2022/odx-angular-components-switch.mjs.map +1 -1
  129. package/fesm2022/odx-angular-components-tab-bar.mjs +1 -1
  130. package/fesm2022/odx-angular-components-tab-bar.mjs.map +1 -1
  131. package/fesm2022/odx-angular-components-table.mjs +1 -1
  132. package/fesm2022/odx-angular-components-table.mjs.map +1 -1
  133. package/fesm2022/odx-angular-components-timepicker.mjs +2 -2
  134. package/fesm2022/odx-angular-components-timepicker.mjs.map +1 -1
  135. package/fesm2022/odx-angular-components-toast.mjs +1 -1
  136. package/fesm2022/odx-angular-components-toast.mjs.map +1 -1
  137. package/fesm2022/odx-angular-components-toggle-button-group.mjs +1 -1
  138. package/fesm2022/odx-angular-components-toggle-button-group.mjs.map +1 -1
  139. package/fesm2022/odx-angular-components-tooltip.mjs +1 -1
  140. package/fesm2022/odx-angular-components-tooltip.mjs.map +1 -1
  141. package/fesm2022/odx-angular-components-wizard.mjs +1 -1
  142. package/fesm2022/odx-angular-components-wizard.mjs.map +1 -1
  143. package/fesm2022/odx-angular-internal-translate.mjs.map +1 -1
  144. package/fesm2022/odx-angular-internal.mjs.map +1 -1
  145. package/fesm2022/odx-angular-localization.mjs.map +1 -1
  146. package/fesm2022/odx-angular-rxjs.mjs.map +1 -1
  147. package/fesm2022/odx-angular-sdk.mjs.map +1 -1
  148. package/fesm2022/odx-angular-theming.mjs.map +1 -1
  149. package/fesm2022/odx-angular-utils.mjs.map +1 -1
  150. package/fesm2022/odx-angular.mjs +2 -2
  151. package/fesm2022/odx-angular.mjs.map +1 -1
  152. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-components-toggle-button-group.mjs","sources":["../../../../libs/angular/components/toggle-button-group/src/lib/components/toggle-button/toggle-button.component.ts","../../../../libs/angular/components/toggle-button-group/src/lib/components/toggle-button/toggle-button.component.html","../../../../libs/angular/components/toggle-button-group/src/lib/toggle-button-group.component.ts","../../../../libs/angular/components/toggle-button-group/src/lib/toggle-button-group.component.html","../../../../libs/angular/components/toggle-button-group/src/lib/toggle-button-group.module.ts","../../../../libs/angular/components/toggle-button-group/src/odx-angular-components-toggle-button-group.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ElementRef, ViewChild, ViewEncapsulation } from '@angular/core';\nimport { DisabledController, ReadonlyController } from '@odx/angular';\nimport { RadioControlDirective } from '@odx/angular/cdk/radio-group-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\n\n/**\n * ToggleButtonComponent represents an individual toggle button, akin to a radio button but styled distinctly.\n * It integrates with Angular's forms as part of a radio group control, allowing for keyboard navigation and\n * accessibility features. This component is designed to be used within a `ToggleButtonGroupComponent`.\n *\n * @template T - The type of the value handled by the toggle button.\n *\n * Extends RadioControlDirective to provide additional behavior.\n *\n * @see {RadioControlDirective}\n */\n@CSSComponent('toggle-button')\n@Component({\n standalone: true,\n selector: 'odx-toggle-button',\n templateUrl: './toggle-button.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [DisabledController.connect(), ReadonlyController.connect()],\n host: {\n role: 'button',\n },\n})\nexport class ToggleButtonComponent<T = unknown> extends RadioControlDirective<T> {\n @ViewChild('input')\n protected inputElement!: ElementRef<HTMLInputElement>;\n\n public readonly element = injectElement();\n\n /**\n * Sets focus to the input element of the toggle button.\n */\n public focus(): void {\n this.inputElement.nativeElement?.focus();\n }\n}\n","<label class=\"odx-toggle-button__label\">\n <div class=\"odx-toggle-button__indicator\">\n <input\n class=\"odx-radio-button__input\"\n type=\"radio\"\n [attr.aria-checked]=\"ariaChecked\"\n [attr.aria-invalid]=\"radioGroupControl.hasError || null\"\n [attr.aria-readonly]=\"readonlyController?.readonly || null\"\n [attr.aria-required]=\"radioGroupControl.isRequired || null\"\n [checked]=\"isActive\"\n [disabled]=\"disabledController?.disabled || readonlyController?.readonly\"\n [name]=\"radioGroupControl.name\"\n [readonly]=\"readonlyController?.readonly\"\n [required]=\"radioGroupControl.isRequired\"\n [value]=\"value\"\n (change)=\"radioGroupControl.updateValue(value)\"\n #input\n />\n <ng-content />\n </div>\n</label>\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, ContentChildren, forwardRef, inject, OnInit, QueryList, ViewEncapsulation } from '@angular/core';\nimport { DelegateFocusDirective, DisabledController, ReadonlyController } from '@odx/angular';\nimport { ActiveIndicatorDirective } from '@odx/angular/cdk/active-indicator';\nimport { RADIO_GROUP_CONTROL, RadioGroupControlDirective } from '@odx/angular/cdk/radio-group-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { injectElement, untilDestroyed } from '@odx/angular/utils';\nimport { defer, map, merge, startWith, tap } from 'rxjs';\nimport { ToggleButtonComponent } from './components';\n\n/**\n * ToggleButtonGroupComponent acts as a container for a group of toggle buttons,\n * managing their state and focus within a group context.\n *\n * @template T - The type of the value handled by the toggle buttons.\n *\n * It extends the RadioGroupControlDirective, allowing it to control the selection and state\n * of contained toggle buttons similar to how radio buttons are managed.\n *\n * Has host directive DelegateFocusDirective.\n *\n * @see {RadioGroupControlDirective}\n * @see {DelegateFocusDirective}\n */\n@CSSComponent('toggle-button-group')\n@Component({\n standalone: true,\n selector: 'odx-toggle-button-group',\n imports: [CommonModule, ActiveIndicatorDirective],\n templateUrl: './toggle-button-group.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {\n provide: RADIO_GROUP_CONTROL,\n useExisting: forwardRef(() => ToggleButtonGroupComponent),\n multi: false,\n },\n DisabledController.connect(),\n ReadonlyController.connect(),\n ],\n hostDirectives: [DelegateFocusDirective],\n})\nexport class ToggleButtonGroupComponent<T = unknown> extends RadioGroupControlDirective<T> implements OnInit {\n private readonly delegateFocusDirective = inject(DelegateFocusDirective, { host: true });\n private readonly takeUntilDestroyed = untilDestroyed();\n\n protected activeElement$ = defer(() => merge(this.toggleButtons.changes, this.change$)).pipe(\n startWith(undefined),\n map(() => this.toggleButtons.find((button) => button.isActive)?.element.nativeElement ?? null),\n tap((activeElement) => this.element.nativeElement.classList.toggle('is-active', !!activeElement)),\n );\n\n @ContentChildren(ToggleButtonComponent)\n protected toggleButtons!: QueryList<ToggleButtonComponent>;\n\n public readonly element = injectElement();\n\n public ngOnInit(): void {\n this.delegateFocusDirective.focused.pipe(this.takeUntilDestroyed()).subscribe(() => {\n this.getFirstToggleButton()?.focus();\n });\n }\n\n private getFirstToggleButton(): ToggleButtonComponent | null {\n return this.toggleButtons?.toArray()[0] ?? null;\n }\n}\n","<ng-content select=\"odx-toggle-button\" />\n<div class=\"odx-toggle-button-group__indicator\" [odxActiveIndicator]=\"activeElement$ | async\"></div>\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { ToggleButtonComponent } from './components';\nimport { ToggleButtonGroupComponent } from './toggle-button-group.component';\n\nconst modules = [ToggleButtonGroupComponent, ToggleButtonComponent];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class ToggleButtonGroupModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAMA;;;;;;;;;;AAUG;AAaI,IAAM,qBAAqB,GAA3B,MAAM,qBAAmC,SAAQ,qBAAwB,CAAA;AAAzE,IAAA,WAAA,GAAA;;QAIW,IAAO,CAAA,OAAA,GAAG,aAAa,EAAE;AAQ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,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAC1B,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,mBAAmB;AAC5B,4BAAA,WAAW,EAAE,UAAU,CAAC,gCAAgC,CAAC;AACzD,4BAAA,KAAK,EAAE,KAAK;AACb,yBAAA;wBACD,kBAAkB,CAAC,OAAO,EAAE;wBAC5B,kBAAkB,CAAC,OAAO,EAAE;qBAC7B,EACe,cAAA,EAAA,CAAC,sBAAsB,CAAC,EAAA,QAAA,EAAA,yJAAA,EAAA;8BAa9B,aAAa,EAAA,CAAA;sBADtB,eAAe;uBAAC,qBAAqB;;;AEhDxC,MAAM,OAAO,GAAG,CAAC,0BAA0B,EAAE,qBAAqB,CAAC;MAMtD,uBAAuB,CAAA;+GAAvB,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAvB,uBAAuB,EAAA,OAAA,EAAA,CANnB,0BAA0B,EAAE,qBAAqB,aAItD,UAAU,EAJL,0BAA0B,EAAE,qBAAqB,CAAA,EAAA,CAAA,CAAA;gHAMrD,uBAAuB,EAAA,OAAA,EAAA,CANnB,0BAA0B,EAI/B,UAAU,CAAA,EAAA,CAAA,CAAA;;4FAET,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAJnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA;;;ACVD;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-components-toggle-button-group.mjs","sources":["../../../../libs/angular/components/toggle-button-group/src/lib/components/toggle-button/toggle-button.component.ts","../../../../libs/angular/components/toggle-button-group/src/lib/components/toggle-button/toggle-button.component.html","../../../../libs/angular/components/toggle-button-group/src/lib/toggle-button-group.component.ts","../../../../libs/angular/components/toggle-button-group/src/lib/toggle-button-group.component.html","../../../../libs/angular/components/toggle-button-group/src/lib/toggle-button-group.module.ts","../../../../libs/angular/components/toggle-button-group/src/odx-angular-components-toggle-button-group.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ElementRef, ViewChild, ViewEncapsulation } from '@angular/core';\nimport { DisabledController, ReadonlyController } from '@odx/angular';\nimport { RadioControlDirective } from '@odx/angular/cdk/radio-group-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\n\n/**\n * ToggleButtonComponent represents an individual toggle button, akin to a radio button but styled distinctly.\n * It integrates with Angular's forms as part of a radio group control, allowing for keyboard navigation and\n * accessibility features. This component is designed to be used within a `ToggleButtonGroupComponent`.\n *\n * @template T - The type of the value handled by the toggle button.\n *\n * Extends RadioControlDirective to provide additional behavior.\n *\n * @see {RadioControlDirective}\n */\n@CSSComponent('toggle-button')\n@Component({\n standalone: true,\n selector: 'odx-toggle-button',\n templateUrl: './toggle-button.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [DisabledController.connect(), ReadonlyController.connect()],\n host: {\n role: 'button',\n },\n})\nexport class ToggleButtonComponent<T = unknown> extends RadioControlDirective<T> {\n @ViewChild('input')\n protected inputElement!: ElementRef<HTMLInputElement>;\n\n public readonly element = injectElement();\n\n /**\n * Sets focus to the input element of the toggle button.\n */\n public focus(): void {\n this.inputElement.nativeElement?.focus();\n }\n}\n","<label class=\"odx-toggle-button__label\">\n <div class=\"odx-toggle-button__indicator\">\n <input\n class=\"odx-radio-button__input\"\n type=\"radio\"\n [attr.aria-checked]=\"ariaChecked\"\n [attr.aria-invalid]=\"radioGroupControl.hasError || null\"\n [attr.aria-readonly]=\"readonlyController?.readonly || null\"\n [attr.aria-required]=\"radioGroupControl.isRequired || null\"\n [checked]=\"isActive\"\n [disabled]=\"disabledController?.disabled || readonlyController?.readonly\"\n [name]=\"radioGroupControl.name\"\n [readonly]=\"readonlyController?.readonly\"\n [required]=\"radioGroupControl.isRequired\"\n [value]=\"value\"\n (change)=\"radioGroupControl.updateValue(value)\"\n #input\n />\n <ng-content />\n </div>\n</label>\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, ContentChildren, forwardRef, inject, OnInit, QueryList, ViewEncapsulation } from '@angular/core';\nimport { DelegateFocusDirective, DisabledController, ReadonlyController } from '@odx/angular';\nimport { ActiveIndicatorDirective } from '@odx/angular/cdk/active-indicator';\nimport { RADIO_GROUP_CONTROL, RadioGroupControlDirective } from '@odx/angular/cdk/radio-group-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { injectElement, untilDestroyed } from '@odx/angular/utils';\nimport { defer, map, merge, startWith, tap } from 'rxjs';\nimport { ToggleButtonComponent } from './components';\n\n/**\n * ToggleButtonGroupComponent acts as a container for a group of toggle buttons,\n * managing their state and focus within a group context.\n *\n * @template T - The type of the value handled by the toggle buttons.\n *\n * It extends the RadioGroupControlDirective, allowing it to control the selection and state\n * of contained toggle buttons similar to how radio buttons are managed.\n *\n * Has host directive DelegateFocusDirective.\n *\n * @see {RadioGroupControlDirective}\n * @see {DelegateFocusDirective}\n */\n@CSSComponent('toggle-button-group')\n@Component({\n standalone: true,\n selector: 'odx-toggle-button-group',\n imports: [CommonModule, ActiveIndicatorDirective],\n templateUrl: './toggle-button-group.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {\n provide: RADIO_GROUP_CONTROL,\n useExisting: forwardRef(() => ToggleButtonGroupComponent),\n multi: false,\n },\n DisabledController.connect(),\n ReadonlyController.connect(),\n ],\n hostDirectives: [DelegateFocusDirective],\n})\nexport class ToggleButtonGroupComponent<T = unknown> extends RadioGroupControlDirective<T> implements OnInit {\n private readonly delegateFocusDirective = inject(DelegateFocusDirective, { host: true });\n private readonly takeUntilDestroyed = untilDestroyed();\n\n protected activeElement$ = defer(() => merge(this.toggleButtons.changes, this.change$)).pipe(\n startWith(undefined),\n map(() => this.toggleButtons.find((button) => button.isActive)?.element.nativeElement ?? null),\n tap((activeElement) => this.element.nativeElement.classList.toggle('is-active', !!activeElement)),\n );\n\n @ContentChildren(ToggleButtonComponent)\n protected toggleButtons!: QueryList<ToggleButtonComponent>;\n\n public readonly element = injectElement();\n\n public ngOnInit(): void {\n this.delegateFocusDirective.focused.pipe(this.takeUntilDestroyed()).subscribe(() => {\n this.getFirstToggleButton()?.focus();\n });\n }\n\n private getFirstToggleButton(): ToggleButtonComponent | null {\n return this.toggleButtons?.toArray()[0] ?? null;\n }\n}\n","<ng-content select=\"odx-toggle-button\" />\n<div class=\"odx-toggle-button-group__indicator\" [odxActiveIndicator]=\"activeElement$ | async\"></div>\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { ToggleButtonComponent } from './components';\nimport { ToggleButtonGroupComponent } from './toggle-button-group.component';\n\nconst modules = [ToggleButtonGroupComponent, ToggleButtonComponent];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class ToggleButtonGroupModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAMA;;;;;;;;;;AAUG;AAaI,IAAM,qBAAqB,GAA3B,MAAM,qBAAmC,SAAQ,qBAAwB,CAAA;AAAzE,IAAA,WAAA,GAAA;;QAIW,IAAO,CAAA,OAAA,GAAG,aAAa,EAAE,CAAC;AAQ3C,KAAA;AANC;;AAEG;IACI,KAAK,GAAA;AACV,QAAA,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC;KAC1C;+GAXU,qBAAqB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAArB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,O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BAAA;wBACD,kBAAkB,CAAC,OAAO,EAAE;wBAC5B,kBAAkB,CAAC,OAAO,EAAE;qBAC7B,EACe,cAAA,EAAA,CAAC,sBAAsB,CAAC,EAAA,QAAA,EAAA,yJAAA,EAAA,CAAA;8BAa9B,aAAa,EAAA,CAAA;sBADtB,eAAe;uBAAC,qBAAqB,CAAA;;;AEhDxC,MAAM,OAAO,GAAG,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAC;MAMvD,uBAAuB,CAAA;+GAAvB,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAvB,uBAAuB,EAAA,OAAA,EAAA,CANnB,0BAA0B,EAAE,qBAAqB,aAItD,UAAU,EAJL,0BAA0B,EAAE,qBAAqB,CAAA,EAAA,CAAA,CAAA,EAAA;gHAMrD,uBAAuB,EAAA,OAAA,EAAA,CANnB,0BAA0B,EAI/B,UAAU,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAET,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAJnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA,CAAA;;;ACVD;;AAEG;;;;"}
@@ -2,7 +2,7 @@ import { createConfigTokens, injectElement, EventManager, untilDestroyed, hasCha
2
2
  import { __decorate, __metadata } from 'tslib';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import * as i0 from '@angular/core';
5
- import { inject, Injector, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, booleanAttribute, Directive } from '@angular/core';
5
+ import { inject, Injector, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, booleanAttribute, Directive } from '@angular/core';
6
6
  import { ConnectedOverlayService } from '@odx/angular/cdk/connected-overlay';
7
7
  import { CSSModifier, CSSComponent, deepmerge } from '@odx/angular/internal';
8
8
  import { delayUntil } from '@odx/angular/rxjs';
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-components-tooltip.mjs","sources":["../../../../libs/angular/components/tooltip/src/lib/helpers/resolve-tooltip-trigger-events.ts","../../../../libs/angular/components/tooltip/src/lib/models/tooltip-size.ts","../../../../libs/angular/components/tooltip/src/lib/models/tooltip-options.ts","../../../../libs/angular/components/tooltip/src/lib/tooltip.config.ts","../../../../libs/angular/components/tooltip/src/lib/tooltip.component.ts","../../../../libs/angular/components/tooltip/src/lib/tooltip.component.html","../../../../libs/angular/components/tooltip/src/lib/tooltip.directive.ts","../../../../libs/angular/components/tooltip/src/odx-angular-components-tooltip.ts"],"sourcesContent":["import { TooltipTrigger } from '../models';\n\n/**\n * @internal\n * Resolves the appropriate event names for the provided tooltip trigger.\n *\n * @param {TooltipTrigger} trigger - The trigger to resolve.\n * @returns {[string, string | null]} - The event names for the trigger.\n */\nexport function resolveTooltipTriggerEvents(trigger: TooltipTrigger): [string, string | null] {\n if (trigger === 'click') {\n return ['click', null];\n } else {\n return ['mouseenter', 'mouseleave'];\n }\n}\n","export type TooltipSize = typeof TooltipSize[keyof typeof TooltipSize];\n\nexport const TooltipSize = {\n AUTO: 'auto',\n SMALL: 'small',\n MEDIUM: 'medium',\n LARGE: 'large',\n} as const;\n","import { ConnectedOverlayOptions } from '@odx/angular/cdk/connected-overlay';\nimport { TooltipSize } from './tooltip-size';\nimport { TooltipTrigger } from './tooltip-trigger';\n\nexport interface TooltipOptions extends Pick<ConnectedOverlayOptions, 'position' | 'matchReferenceWidth'> {\n trigger: TooltipTrigger;\n delayIn: number;\n delayOut: number;\n size: TooltipSize;\n}\n\nexport const DefaultTooltipOptions: TooltipOptions = {\n matchReferenceWidth: false,\n size: TooltipSize.AUTO,\n trigger: 'hover',\n position: 'top',\n delayIn: 0,\n delayOut: 0,\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { DefaultTooltipOptions, TooltipOptions } from './models';\n\nexport type TooltipConfig = TooltipOptions;\n\n/**\n * Utility functions generated by `createConfigTokens` to handle injection and provision of `TooltipConfig`.\n * These include tokens and functions to access and provide the default configuration for tooltips.\n *\n * `TooltipDefaultConfig` provides the default settings for tooltips.\n * `TooltipConfig` is a token that can be used to inject tooltip configuration settings.\n * `injectTooltipConfig` is a function that retrieves the current tooltip configuration.\n * `provideTooltipConfig` is a function used to specify a custom configuration for tooltips.\n *\n * @example\n * ```ts\n * // In module providers:\n * providers: [\n * provideTooltipConfig({ // ... global module configuration }),\n * ]\n *\n * // In a component or service:\n * constructor(@Inject(TooltipConfig) private readonly config: TooltipConfig) {}\n *\n * // Or using the `injectTooltipConfig` function:\n * @Component({ ... })\n * export class MyComponent {\n * private readonly config = injectTooltipConfig();\n * }\n * ```\n */\nexport const { TooltipDefaultConfig, TooltipConfig, injectTooltipConfig, provideTooltipConfig } = createConfigTokens(\n 'Tooltip',\n '@odx/angular/components/tooltip',\n {\n ...DefaultTooltipOptions,\n } as TooltipConfig,\n);\n","import { ChangeDetectionStrategy, Component, inject, Injector, Input, Type, ViewEncapsulation } from '@angular/core';\nimport { DynamicContent, DynamicViewDirective } from '@odx/angular/cdk/dynamic-view';\nimport { CSSComponent, CSSModifier } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\nimport { TooltipSize } from './models';\nimport { injectTooltipConfig } from './tooltip.config';\n\n/**\n /**\n * TooltipComponent displays contextual information related to an element when the user hovers over\n * or focuses on the element. It supports dynamic content and can be styled with different sizes.\n *\n * The component uses dynamic content rendering to provide flexible display options including text,\n * templates, or even other Angular components, making it highly customizable.\n */\n@CSSComponent('tooltip')\n@Component({\n standalone: true,\n selector: 'odx-tooltip',\n imports: [DynamicViewDirective],\n templateUrl: './tooltip.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.id]': 'id',\n role: 'tooltip',\n },\n})\nexport class TooltipComponent {\n private readonly config = injectTooltipConfig();\n protected readonly injector = inject(Injector);\n public readonly element = injectElement();\n\n /**\n * The ID attribute of the tooltip, used for accessibility purposes to link the tooltip with its owner element.\n *\n * @type {string | null}\n * @default null\n */\n @Input()\n public id: string | null = null;\n\n /**\n * The content to be displayed within the tooltip. This can be text, a template reference, or a dynamic component.\n *\n * @type {DynamicContent | null}\n */\n @Input()\n public content?: Exclude<DynamicContent, Type<unknown>> | null;\n\n /**\n * Determines the size of the tooltip. It can adjust based on the content size or be set to specific dimensions.\n * The size influences the CSS class applied to the tooltip, allowing for custom styles.\n *\n * @type {TooltipSize}\n * @default TooltipSize.AUTO from the configuration\n */\n @CSSModifier()\n @Input()\n public size: TooltipSize = this.config.size;\n}\n","<ng-template [odxDynamicView]=\"content\" [odxDynamicViewInjector]=\"injector\" />\n","import { DOCUMENT } from '@angular/common';\nimport { booleanAttribute, Directive, inject, Injector, Input, OnChanges, OnDestroy, OnInit, Type } from '@angular/core';\nimport { ConnectedOverlayRef, ConnectedOverlayService } from '@odx/angular/cdk/connected-overlay';\nimport { DynamicContent } from '@odx/angular/cdk/dynamic-view';\nimport { CSSComponent, deepmerge } from '@odx/angular/internal';\nimport { delayUntil } from '@odx/angular/rxjs';\nimport { EventManager, getUniqueId, hasChanged, injectElement, NgChanges, untilDestroyed } from '@odx/angular/utils';\nimport { filter, merge, Subject, tap } from 'rxjs';\nimport { resolveTooltipTriggerEvents } from './helpers';\nimport { TooltipOptions, TooltipSize } from './models';\nimport { TooltipComponent } from './tooltip.component';\nimport { injectTooltipConfig } from './tooltip.config';\n\n/**\n * TooltipDirective manages tooltips for host elements by creating overlay components dynamically.\n * It provides configuration options such as content, delay timings, visibility, and tooltip sizing.\n * This directive uses Angular's connected overlay system to position and manage tooltip visibility.\n */\n@CSSComponent('tooltip-host')\n@Directive({\n standalone: true,\n selector: '[odxTooltip]',\n exportAs: 'odxTooltip',\n providers: [EventManager],\n host: {\n '[attr.aria-describedby]': 'tooltipId',\n },\n})\nexport class TooltipDirective implements OnInit, OnChanges, OnDestroy {\n private readonly eventManager = inject(EventManager);\n private readonly connectedOverlayService = inject(ConnectedOverlayService);\n private readonly showTrigger$$ = new Subject<void>();\n private readonly hideTrigger$$ = new Subject<void>();\n private readonly document = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n private connectedOverlayRef: ConnectedOverlayRef | null = null;\n private tooltipOptions = injectTooltipConfig();\n private ignoreBrowserTabSwitchFocus = false;\n\n protected tooltipId: string | null = null;\n public readonly element = injectElement();\n\n /**\n * Input for dynamic content to display in the tooltip.\n * This content is reactive and can change dynamically.\n *\n * @type {DynamicContent | null}\n * @default null\n */\n @Input('odxTooltip')\n public content?: Exclude<DynamicContent, Type<unknown>> | null = null;\n\n /**\n * Controls whether the tooltip is disabled. A disabled tooltip will not be displayed.\n *\n * @type {boolean}\n * @default false\n */\n @Input({ alias: 'odxTooltipDisabled', transform: booleanAttribute })\n public disabled = false;\n\n /**\n * Configuration options for the tooltip.\n * It allows setting various behaviors like delay and positioning.\n *\n * @param {Partial<TooltipOptions> | null | undefined}\n */\n @Input('odxTooltipOptions')\n public set options(value: Partial<TooltipOptions> | null | undefined) {\n this.tooltipOptions = deepmerge(this.tooltipOptions, value) as TooltipOptions;\n }\n\n /**\n * Sets the size of the tooltip.\n *\n * @type {TooltipSize}\n * @default null\n */\n @Input('odxTooltipSize')\n public size?: TooltipSize | null = null;\n\n /**\n * Controls the visibility of the tooltip.\n * Useful for programmatically toggling the tooltip display.\n *\n * @type {boolean}\n * @default false\n */\n @Input({ alias: 'odxTooltipVisible', transform: booleanAttribute })\n public visible = false;\n\n /**\n * Indicates whether the tooltip is currently open.\n *\n * @returns {boolean}\n */\n public get isOpen(): boolean {\n return this.connectedOverlayRef !== null;\n }\n\n constructor() {\n const takeUntilDestroyed = untilDestroyed();\n const show$ = this.showTrigger$$.pipe(\n filter(() => !this.isOpen),\n delayUntil(() => this.tooltipOptions.delayIn, this.hideTrigger$$),\n tap(() => this.show()),\n );\n const hide$ = this.hideTrigger$$.pipe(\n filter(() => this.isOpen),\n delayUntil(() => this.tooltipOptions.delayOut, this.showTrigger$$),\n tap(() => this.hide()),\n );\n merge(show$, hide$).pipe(takeUntilDestroyed()).subscribe();\n }\n\n public ngOnInit(): void {\n this.registerEvents();\n }\n\n public ngOnChanges(changes: NgChanges<TooltipDirective>): void {\n if (hasChanged(changes, 'disabled') && this.disabled) {\n this.hide();\n }\n if (hasChanged(changes, ['content', 'size'])) {\n this.connectedOverlayRef?.update({ context: { content: this.content, size: this.size } });\n }\n if (hasChanged(changes, 'options')) {\n this.connectedOverlayRef?.update(this.tooltipOptions);\n this.registerEvents();\n }\n if (this.visible && !this.disabled) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n public ngOnDestroy(): void {\n this.hide(true);\n }\n\n /**\n * Shows the tooltip, creating and attaching the overlay to the host element.\n */\n public show(): void {\n if (this.isOpen || this.disabled || !this.content) return;\n this.tooltipId = getUniqueId('odx-tooltip');\n this.connectedOverlayRef = this.connectedOverlayService.createOverlay(\n this.element.nativeElement,\n {\n ...this.tooltipOptions,\n containerClass: 'odx-tooltip-overlay',\n content: TooltipComponent,\n context: { content: this.content, size: this.size ?? this.tooltipOptions.size, id: this.tooltipId },\n showArrow: true,\n enableFallback: true,\n nonInteractive: true,\n },\n {\n host: this.element.nativeElement.parentElement,\n injector: this.injector,\n },\n );\n }\n\n /**\n * Hides the tooltip, detaching the overlay from the host element.\n */\n public hide(force = false): void {\n if ((!this.isOpen || (this.visible && !this.disabled)) && !force) return;\n this.connectedOverlayRef?.close(force);\n this.connectedOverlayRef = null;\n this.tooltipId = null;\n }\n\n private registerEvents(): void {\n const [openEvent, closeEvent] = resolveTooltipTriggerEvents(this.tooltipOptions.trigger);\n this.eventManager.destroyListeners();\n this.eventManager.register([openEvent, 'focusin'], (event: Event | undefined) => {\n if (this.ignoreBrowserTabSwitchFocus && event?.type === 'focusin') {\n this.ignoreBrowserTabSwitchFocus = false;\n return;\n }\n this.showTrigger$$.next();\n });\n this.eventManager.register([closeEvent, 'focusout'], () => this.hideTrigger$$.next());\n this.eventManager.register(['keyup.esc'], () => this.hideTrigger$$.next(), 'document');\n this.eventManager.register(\n ['visibilitychange'],\n () => {\n if (this.document.visibilityState === 'hidden') {\n this.ignoreBrowserTabSwitchFocus = true;\n }\n },\n 'document',\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEA;;;;;;AAMG;AACG,SAAU,2BAA2B,CAAC,OAAuB,EAAA;AACjE,IAAA,IAAI,OAAO,KAAK,OAAO,EAAE;AACvB,QAAA,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;;SACjB;AACL,QAAA,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC;;AAEvC;;ACba,MAAA,WAAW,GAAG;AACzB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,KAAK,EAAE,OAAO;;;ACKH,MAAA,qBAAqB,GAAmB;AACnD,IAAA,mBAAmB,EAAE,KAAK;IAC1B,IAAI,EAAE,WAAW,CAAC,IAAI;AACtB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,OAAO,EAAE,CAAC;AACV,IAAA,QAAQ,EAAE,CAAC;;;ACZb;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACU,MAAA,EAAE,oBAAoB,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,GAAG,kBAAkB,CAClH,SAAS,EACT,iCAAiC,EACjC;AACE,IAAA,GAAG,qBAAqB;AACR,CAAA;;AC7BpB;;;;;;;AAOG;AAcI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB,CAAA;AAAtB,IAAA,WAAA,GAAA;QACY,IAAM,CAAA,MAAA,GAAG,mBAAmB,EAAE;AAC5B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CA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BADd,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,gBAAgB,EAAE;gBAUxD,OAAO,EAAA,CAAA;sBADjB,KAAK;uBAAC,mBAAmB;gBAYnB,IAAI,EAAA,CAAA;sBADV,KAAK;uBAAC,gBAAgB;gBAWhB,OAAO,EAAA,CAAA;sBADb,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,EAAE;;;ACxFpE;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-components-tooltip.mjs","sources":["../../../../libs/angular/components/tooltip/src/lib/helpers/resolve-tooltip-trigger-events.ts","../../../../libs/angular/components/tooltip/src/lib/models/tooltip-size.ts","../../../../libs/angular/components/tooltip/src/lib/models/tooltip-options.ts","../../../../libs/angular/components/tooltip/src/lib/tooltip.config.ts","../../../../libs/angular/components/tooltip/src/lib/tooltip.component.ts","../../../../libs/angular/components/tooltip/src/lib/tooltip.component.html","../../../../libs/angular/components/tooltip/src/lib/tooltip.directive.ts","../../../../libs/angular/components/tooltip/src/odx-angular-components-tooltip.ts"],"sourcesContent":["import { TooltipTrigger } from '../models';\n\n/**\n * @internal\n * Resolves the appropriate event names for the provided tooltip trigger.\n *\n * @param {TooltipTrigger} trigger - The trigger to resolve.\n * @returns {[string, string | null]} - The event names for the trigger.\n */\nexport function resolveTooltipTriggerEvents(trigger: TooltipTrigger): [string, string | null] {\n if (trigger === 'click') {\n return ['click', null];\n } else {\n return ['mouseenter', 'mouseleave'];\n }\n}\n","export type TooltipSize = typeof TooltipSize[keyof typeof TooltipSize];\n\nexport const TooltipSize = {\n AUTO: 'auto',\n SMALL: 'small',\n MEDIUM: 'medium',\n LARGE: 'large',\n} as const;\n","import { ConnectedOverlayOptions } from '@odx/angular/cdk/connected-overlay';\nimport { TooltipSize } from './tooltip-size';\nimport { TooltipTrigger } from './tooltip-trigger';\n\nexport interface TooltipOptions extends Pick<ConnectedOverlayOptions, 'position' | 'matchReferenceWidth'> {\n trigger: TooltipTrigger;\n delayIn: number;\n delayOut: number;\n size: TooltipSize;\n}\n\nexport const DefaultTooltipOptions: TooltipOptions = {\n matchReferenceWidth: false,\n size: TooltipSize.AUTO,\n trigger: 'hover',\n position: 'top',\n delayIn: 0,\n delayOut: 0,\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { DefaultTooltipOptions, TooltipOptions } from './models';\n\nexport type TooltipConfig = TooltipOptions;\n\n/**\n * Utility functions generated by `createConfigTokens` to handle injection and provision of `TooltipConfig`.\n * These include tokens and functions to access and provide the default configuration for tooltips.\n *\n * `TooltipDefaultConfig` provides the default settings for tooltips.\n * `TooltipConfig` is a token that can be used to inject tooltip configuration settings.\n * `injectTooltipConfig` is a function that retrieves the current tooltip configuration.\n * `provideTooltipConfig` is a function used to specify a custom configuration for tooltips.\n *\n * @example\n * ```ts\n * // In module providers:\n * providers: [\n * provideTooltipConfig({ // ... global module configuration }),\n * ]\n *\n * // In a component or service:\n * constructor(@Inject(TooltipConfig) private readonly config: TooltipConfig) {}\n *\n * // Or using the `injectTooltipConfig` function:\n * @Component({ ... })\n * export class MyComponent {\n * private readonly config = injectTooltipConfig();\n * }\n * ```\n */\nexport const { TooltipDefaultConfig, TooltipConfig, injectTooltipConfig, provideTooltipConfig } = createConfigTokens(\n 'Tooltip',\n '@odx/angular/components/tooltip',\n {\n ...DefaultTooltipOptions,\n } as TooltipConfig,\n);\n","import { ChangeDetectionStrategy, Component, inject, Injector, Input, Type, ViewEncapsulation } from '@angular/core';\nimport { DynamicContent, DynamicViewDirective } from '@odx/angular/cdk/dynamic-view';\nimport { CSSComponent, CSSModifier } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\nimport { TooltipSize } from './models';\nimport { injectTooltipConfig } from './tooltip.config';\n\n/**\n /**\n * TooltipComponent displays contextual information related to an element when the user hovers over\n * or focuses on the element. It supports dynamic content and can be styled with different sizes.\n *\n * The component uses dynamic content rendering to provide flexible display options including text,\n * templates, or even other Angular components, making it highly customizable.\n */\n@CSSComponent('tooltip')\n@Component({\n standalone: true,\n selector: 'odx-tooltip',\n imports: [DynamicViewDirective],\n templateUrl: './tooltip.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.id]': 'id',\n role: 'tooltip',\n },\n})\nexport class TooltipComponent {\n private readonly config = injectTooltipConfig();\n protected readonly injector = inject(Injector);\n public readonly element = injectElement();\n\n /**\n * The ID attribute of the tooltip, used for accessibility purposes to link the tooltip with its owner element.\n *\n * @type {string | null}\n * @default null\n */\n @Input()\n public id: string | null = null;\n\n /**\n * The content to be displayed within the tooltip. This can be text, a template reference, or a dynamic component.\n *\n * @type {DynamicContent | null}\n */\n @Input()\n public content?: Exclude<DynamicContent, Type<unknown>> | null;\n\n /**\n * Determines the size of the tooltip. It can adjust based on the content size or be set to specific dimensions.\n * The size influences the CSS class applied to the tooltip, allowing for custom styles.\n *\n * @type {TooltipSize}\n * @default TooltipSize.AUTO from the configuration\n */\n @CSSModifier()\n @Input()\n public size: TooltipSize = this.config.size;\n}\n","<ng-template [odxDynamicView]=\"content\" [odxDynamicViewInjector]=\"injector\" />\n","import { DOCUMENT } from '@angular/common';\nimport { booleanAttribute, Directive, inject, Injector, Input, OnChanges, OnDestroy, OnInit, Type } from '@angular/core';\nimport { ConnectedOverlayRef, ConnectedOverlayService } from '@odx/angular/cdk/connected-overlay';\nimport { DynamicContent } from '@odx/angular/cdk/dynamic-view';\nimport { CSSComponent, deepmerge } from '@odx/angular/internal';\nimport { delayUntil } from '@odx/angular/rxjs';\nimport { EventManager, getUniqueId, hasChanged, injectElement, NgChanges, untilDestroyed } from '@odx/angular/utils';\nimport { filter, merge, Subject, tap } from 'rxjs';\nimport { resolveTooltipTriggerEvents } from './helpers';\nimport { TooltipOptions, TooltipSize } from './models';\nimport { TooltipComponent } from './tooltip.component';\nimport { injectTooltipConfig } from './tooltip.config';\n\n/**\n * TooltipDirective manages tooltips for host elements by creating overlay components dynamically.\n * It provides configuration options such as content, delay timings, visibility, and tooltip sizing.\n * This directive uses Angular's connected overlay system to position and manage tooltip visibility.\n */\n@CSSComponent('tooltip-host')\n@Directive({\n standalone: true,\n selector: '[odxTooltip]',\n exportAs: 'odxTooltip',\n providers: [EventManager],\n host: {\n '[attr.aria-describedby]': 'tooltipId',\n },\n})\nexport class TooltipDirective implements OnInit, OnChanges, OnDestroy {\n private readonly eventManager = inject(EventManager);\n private readonly connectedOverlayService = inject(ConnectedOverlayService);\n private readonly showTrigger$$ = new Subject<void>();\n private readonly hideTrigger$$ = new Subject<void>();\n private readonly document = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n private connectedOverlayRef: ConnectedOverlayRef | null = null;\n private tooltipOptions = injectTooltipConfig();\n private ignoreBrowserTabSwitchFocus = false;\n\n protected tooltipId: string | null = null;\n public readonly element = injectElement();\n\n /**\n * Input for dynamic content to display in the tooltip.\n * This content is reactive and can change dynamically.\n *\n * @type {DynamicContent | null}\n * @default null\n */\n @Input('odxTooltip')\n public content?: Exclude<DynamicContent, Type<unknown>> | null = null;\n\n /**\n * Controls whether the tooltip is disabled. A disabled tooltip will not be displayed.\n *\n * @type {boolean}\n * @default false\n */\n @Input({ alias: 'odxTooltipDisabled', transform: booleanAttribute })\n public disabled = false;\n\n /**\n * Configuration options for the tooltip.\n * It allows setting various behaviors like delay and positioning.\n *\n * @param {Partial<TooltipOptions> | null | undefined}\n */\n @Input('odxTooltipOptions')\n public set options(value: Partial<TooltipOptions> | null | undefined) {\n this.tooltipOptions = deepmerge(this.tooltipOptions, value) as TooltipOptions;\n }\n\n /**\n * Sets the size of the tooltip.\n *\n * @type {TooltipSize}\n * @default null\n */\n @Input('odxTooltipSize')\n public size?: TooltipSize | null = null;\n\n /**\n * Controls the visibility of the tooltip.\n * Useful for programmatically toggling the tooltip display.\n *\n * @type {boolean}\n * @default false\n */\n @Input({ alias: 'odxTooltipVisible', transform: booleanAttribute })\n public visible = false;\n\n /**\n * Indicates whether the tooltip is currently open.\n *\n * @returns {boolean}\n */\n public get isOpen(): boolean {\n return this.connectedOverlayRef !== null;\n }\n\n constructor() {\n const takeUntilDestroyed = untilDestroyed();\n const show$ = this.showTrigger$$.pipe(\n filter(() => !this.isOpen),\n delayUntil(() => this.tooltipOptions.delayIn, this.hideTrigger$$),\n tap(() => this.show()),\n );\n const hide$ = this.hideTrigger$$.pipe(\n filter(() => this.isOpen),\n delayUntil(() => this.tooltipOptions.delayOut, this.showTrigger$$),\n tap(() => this.hide()),\n );\n merge(show$, hide$).pipe(takeUntilDestroyed()).subscribe();\n }\n\n public ngOnInit(): void {\n this.registerEvents();\n }\n\n public ngOnChanges(changes: NgChanges<TooltipDirective>): void {\n if (hasChanged(changes, 'disabled') && this.disabled) {\n this.hide();\n }\n if (hasChanged(changes, ['content', 'size'])) {\n this.connectedOverlayRef?.update({ context: { content: this.content, size: this.size } });\n }\n if (hasChanged(changes, 'options')) {\n this.connectedOverlayRef?.update(this.tooltipOptions);\n this.registerEvents();\n }\n if (this.visible && !this.disabled) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n public ngOnDestroy(): void {\n this.hide(true);\n }\n\n /**\n * Shows the tooltip, creating and attaching the overlay to the host element.\n */\n public show(): void {\n if (this.isOpen || this.disabled || !this.content) return;\n this.tooltipId = getUniqueId('odx-tooltip');\n this.connectedOverlayRef = this.connectedOverlayService.createOverlay(\n this.element.nativeElement,\n {\n ...this.tooltipOptions,\n containerClass: 'odx-tooltip-overlay',\n content: TooltipComponent,\n context: { content: this.content, size: this.size ?? this.tooltipOptions.size, id: this.tooltipId },\n showArrow: true,\n enableFallback: true,\n nonInteractive: true,\n },\n {\n host: this.element.nativeElement.parentElement,\n injector: this.injector,\n },\n );\n }\n\n /**\n * Hides the tooltip, detaching the overlay from the host element.\n */\n public hide(force = false): void {\n if ((!this.isOpen || (this.visible && !this.disabled)) && !force) return;\n this.connectedOverlayRef?.close(force);\n this.connectedOverlayRef = null;\n this.tooltipId = null;\n }\n\n private registerEvents(): void {\n const [openEvent, closeEvent] = resolveTooltipTriggerEvents(this.tooltipOptions.trigger);\n this.eventManager.destroyListeners();\n this.eventManager.register([openEvent, 'focusin'], (event: Event | undefined) => {\n if (this.ignoreBrowserTabSwitchFocus && event?.type === 'focusin') {\n this.ignoreBrowserTabSwitchFocus = false;\n return;\n }\n this.showTrigger$$.next();\n });\n this.eventManager.register([closeEvent, 'focusout'], () => this.hideTrigger$$.next());\n this.eventManager.register(['keyup.esc'], () => this.hideTrigger$$.next(), 'document');\n this.eventManager.register(\n ['visibilitychange'],\n () => {\n if (this.document.visibilityState === 'hidden') {\n this.ignoreBrowserTabSwitchFocus = true;\n }\n },\n 'document',\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEA;;;;;;AAMG;AACG,SAAU,2BAA2B,CAAC,OAAuB,EAAA;AACjE,IAAA,IAAI,OAAO,KAAK,OAAO,EAAE;AACvB,QAAA,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;KACxB;SAAM;AACL,QAAA,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;KACrC;AACH;;ACba,MAAA,WAAW,GAAG;AACzB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,KAAK,EAAE,OAAO;;;ACKH,MAAA,qBAAqB,GAAmB;AACnD,IAAA,mBAAmB,EAAE,KAAK;IAC1B,IAAI,EAAE,WAAW,CAAC,IAAI;AACtB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,OAAO,EAAE,CAAC;AACV,IAAA,QAAQ,EAAE,CAAC;;;ACZb;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACU,MAAA,EAAE,oBAAoB,EA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import { HostListener, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, inject, Renderer2, EventEmitter, booleanAttribute, Output, ContentChildren, NgModule } from '@angular/core';
3
+ import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, HostListener, inject, Renderer2, EventEmitter, booleanAttribute, ContentChildren, Output, NgModule } from '@angular/core';
4
4
  import * as i1 from '@odx/angular';
5
5
  import { WithTabIndex, WithDisabledState, WindowRef, CoreModule } from '@odx/angular';
6
6
  import { IconComponent } from '@odx/angular/components/icon';
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-components-wizard.mjs","sources":["../../../../libs/angular/components/wizard/src/lib/components/wizard-step/wizard-step.component.ts","../../../../libs/angular/components/wizard/src/lib/components/wizard-step/wizard-step.component.html","../../../../libs/angular/components/wizard/src/lib/wizard.component.ts","../../../../libs/angular/components/wizard/src/lib/wizard.component.html","../../../../libs/angular/components/wizard/src/lib/wizard.module.ts","../../../../libs/angular/components/wizard/src/odx-angular-components-wizard.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, HostListener, Input, ViewEncapsulation } from '@angular/core';\nimport { WithDisabledState, WithTabIndex } from '@odx/angular';\nimport { IconComponent } from '@odx/angular/components/icon';\nimport { CSSComponent, CSSModifier } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\nimport { Subject } from 'rxjs';\n\n/**\n * WizardStepComponent represents an individual step within a wizard navigation sequence. It can be configured\n * to display icons, listen for user interactions, and indicate various states such as active, passed, or valid.\n * This component interacts with the WizardComponent to manage the step progression and visibility.\n *\n * Has host directives WithTabIndex and WithDisabledState.\n *\n * @see {WithTabIndex}\n * @see {WithDisabledState}\n */\n@CSSComponent('wizard-step')\n@Component({\n selector: 'odx-wizard-step',\n templateUrl: './wizard-step.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [IconComponent],\n hostDirectives: [WithTabIndex, WithDisabledState],\n})\nexport class WizardStepComponent {\n public readonly element = injectElement();\n\n /**\n * Emitted when the step is chosen by the user, indicating that the step should be activated.\n *\n * @emits {WizardStepComponent} The chosen step.\n */\n public readonly stepChosen$ = new Subject<WizardStepComponent>();\n\n /**\n * Indicates if this step was the last one interacted with in the wizard sequence.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public isLastTouched = false;\n\n /**\n * Indicates if this step is currently active.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public active = false;\n\n /**\n * Indicates if this step has been passed in the navigation sequence.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public passed = false;\n\n /**\n * Controls the visibility of this step in the UI.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public visible = true;\n\n /**\n * Indicates if this step is valid and can be progressed to.\n *\n * @type {boolean}\n * @default false\n */\n @CSSModifier()\n @Input()\n public valid = false;\n\n /**\n * Indicates if this step has been touched by the user.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public touched = false;\n\n /**\n * Sets the validation state of this step.\n *\n * @param {boolean} state - The new validation state.\n */\n public setValid(state: boolean): void {\n this.valid = state;\n }\n\n @HostListener('click')\n @HostListener('keyup.enter')\n @HostListener('keyup.space')\n protected chooseStep(): void {\n this.stepChosen$.next(this);\n }\n}\n","<span class=\"odx-wizard-step__label\">\n <ng-content />\n</span>\n\n<div class=\"odx-wizard-step__holder\">\n <span class=\"odx-wizard-step__line-before\"></span>\n <span class=\"odx-wizard-step__circle\"> <odx-icon class=\"odx-wizard-step__icon\" name=\"check\" iconSet=\"core\" /> </span>\n <span class=\"odx-wizard-step__line-after\"></span>\n</div>\n","import {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n EventEmitter,\n inject,\n Input,\n Output,\n QueryList,\n Renderer2,\n ViewEncapsulation,\n} from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { CSSComponent, CSSModifier } from '@odx/angular/internal';\nimport { injectElement, untilDestroyed } from '@odx/angular/utils';\nimport { BehaviorSubject, debounceTime, fromEvent, merge, tap } from 'rxjs';\nimport { WizardStepComponent } from './components';\n\n/**\n * WizardComponent manages a series of steps, providing functionality for navigating forwards and backwards\n * through the steps. It dynamically adjusts the visibility of steps based on the available space and current active step.\n * The component supports both horizontal and vertical orientations.\n */\n@CSSComponent('wizard')\n@Component({\n selector: 'odx-wizard',\n templateUrl: './wizard.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class WizardComponent implements AfterViewInit {\n private readonly destroyed = untilDestroyed();\n private readonly renderer = inject(Renderer2);\n\n private readonly responsive$ = new BehaviorSubject<boolean>(true);\n private visibleStepsSegments = 0;\n private readonly dottedLineStart = this.renderer.createElement('div');\n private readonly dottedLineEnd = this.renderer.createElement('div');\n\n private readonly windowRef = inject(WindowRef);\n private activeStep = 0;\n\n @ContentChildren(WizardStepComponent)\n protected readonly steps!: QueryList<WizardStepComponent>;\n\n public readonly element = injectElement();\n\n /**\n * Indicates if the wizard layout should be vertical. When true, the wizard orientation changes to vertical.\n *\n * @type {boolean}\n * @default false\n */\n @CSSModifier()\n @Input({ transform: booleanAttribute })\n public vertical = false;\n\n /**\n * Indicates whether the wizard component is responsive\n * and hides the steps that do not fit in the available space.\n */\n @Input({ transform: booleanAttribute })\n public set responsive(value: boolean) {\n this.responsive$.next(value);\n }\n\n /**\n * Event emitted when the active step changes, providing the index of the new active step.\n *\n * @emits {number}\n */\n @Output()\n public activeStepChanged: EventEmitter<number> = new EventEmitter();\n\n public ngAfterViewInit(): void {\n if (!this.steps) return;\n [this.dottedLineStart, this.dottedLineEnd].forEach((l) => this.renderer.addClass(l, 'odx-wizard-step__dotted-line'));\n this.visibleStepsSegments = this.calculateVisibleStepsSegments();\n this.setActiveStep();\n\n merge(fromEvent(this.windowRef.nativeWindow, 'resize'), this.steps.changes, this.responsive$)\n .pipe(this.destroyed(), debounceTime(600))\n .subscribe(() => {\n this.visibleStepsSegments = this.calculateVisibleStepsSegments();\n this.setHiddenSteps();\n });\n this.clickStepSubscriber();\n }\n\n /**\n * Navigates to the next step in the wizard.\n */\n public nextStep(): void {\n this.activeStep < this.steps.length - 1 && this.changeStepHandler(this.steps.get(this.activeStep + 1) as WizardStepComponent);\n }\n\n /**\n * Navigates to the previous step in the wizard.\n */\n public previousStep(): void {\n this.activeStep > 0 && this.changeStepHandler(this.steps.get(this.activeStep - 1) as WizardStepComponent);\n }\n\n /**\n * Sets the active step to the specified index.\n */\n public setActiveStepValid(): void {\n this.steps.get(this.activeStep)?.setValid(true);\n }\n\n /**\n * Sets the validity of a step at the specified index.\n *\n * @param {number} stepIndex - Index of the step to set validity.\n * @param {boolean} valid - Whether the step should be valid or not.\n */\n public setStepValid(stepIndex: number, valid: boolean): void {\n const step = this.steps.get(stepIndex);\n if (step) {\n step.setValid(valid);\n if (stepIndex === this.activeStep) {\n this.activeStepChanged.emit(this.activeStep);\n }\n }\n }\n\n /**\n * Returns whether the step at the specified index is valid.\n *\n * @param {number} stepIndex - Index of the step to check validity.\n * @returns {boolean} - Whether the step is valid or not.\n */\n public isStepValid(stepIndex: number): boolean {\n return !!this.steps.get(stepIndex)?.valid;\n }\n\n /**\n * Returns whether the current active step is valid.\n *\n * @returns {boolean} - Whether the current step is valid or not.\n */\n public isCurrentStepValid(): boolean {\n return this.isStepValid(this.activeStep);\n }\n\n private calculateVisibleStepsSegments(): number {\n if (!this.responsive$.getValue()) return this.steps.length;\n const container = this.element.nativeElement;\n const { width, height } = container.getBoundingClientRect();\n const containerSize = this.vertical ? height : width;\n\n let visibleSteps = 0;\n let summaryStepsSize = 0;\n const prop = this.vertical ? 'flex-basis' : 'min-width';\n const minStepSize = parseInt(this.getStyleFromCSS(this.steps.first.element.nativeElement, prop));\n\n this.steps.forEach(() => {\n summaryStepsSize += minStepSize;\n if (summaryStepsSize < containerSize) visibleSteps++;\n });\n\n return visibleSteps;\n }\n\n private getStyleFromCSS(el: HTMLElement, prop: string): string {\n return this.windowRef.nativeWindow.getComputedStyle(el).getPropertyValue(prop);\n }\n\n private setActiveStep(): void {\n const touched: WizardStepComponent[] = [];\n this.steps.forEach((step, index) => {\n step.active = false;\n step.isLastTouched = false;\n if (this.activeStep === index) step.touched = true;\n step.touched && touched.push(step);\n this.activeStep === index && (step.active = true);\n step.passed = index <= this.activeStep;\n });\n const lastTouched = touched.pop();\n lastTouched && (lastTouched.isLastTouched = true);\n this.setHiddenSteps();\n }\n\n private clickStepSubscriber(): void {\n merge(...this.steps.map((step) => step.stepChosen$))\n .pipe(\n this.destroyed(),\n tap((step) => this.changeStepHandler(step)),\n )\n .subscribe();\n }\n\n private changeStepHandler(step: WizardStepComponent): void {\n const index = this.steps.toArray().indexOf(step);\n const isPreviousStepValid = this.steps.get(index - 1)?.valid;\n const isFirstStepTarget = index === 0;\n\n if ((isPreviousStepValid || isFirstStepTarget) && index !== this.activeStep) {\n this.activeStep = index;\n this.activeStepChanged.emit(this.activeStep);\n this.setActiveStep();\n }\n }\n\n private setHiddenSteps() {\n const length = this.steps.length;\n\n [this.dottedLineStart, this.dottedLineEnd].forEach((l) => this.setDottedLineActive(l, true));\n\n this.renderer.insertBefore(this.element.nativeElement, this.dottedLineStart, this.steps.get(1)?.element.nativeElement);\n this.renderer.insertBefore(this.element.nativeElement, this.dottedLineEnd, this.steps.get(length - 1)?.element.nativeElement);\n const start = this.activeStep < length / 2;\n const stepsForHide = this.steps.toArray().slice(1, -1);\n const visibleStepsSegments = this.visibleStepsSegments - 2;\n stepsForHide.forEach((step, i) => {\n if (length > this.visibleStepsSegments) {\n step.visible = start\n ? i < visibleStepsSegments - 1 || this.isNeighbors(i, stepsForHide)\n : i > stepsForHide.length - (visibleStepsSegments - 1) || this.isNeighbors(i, stepsForHide);\n } else {\n step.visible = true;\n }\n });\n const filteredVisibleSteps = stepsForHide.filter((s) => s.visible);\n if (visibleStepsSegments - 1 < filteredVisibleSteps.length && length > this.visibleStepsSegments) {\n const overflowSize = filteredVisibleSteps.length - visibleStepsSegments + 1;\n const index = start ? overflowSize : filteredVisibleSteps.length - overflowSize - 1;\n\n filteredVisibleSteps.forEach((s, i) => {\n (start ? i <= index : i >= index) && !this.isNeighbors(i, filteredVisibleSteps) && (s.visible = false);\n });\n }\n\n this.steps.last.active && (stepsForHide[stepsForHide.length - 1].visible = true);\n this.steps.first.active && (stepsForHide[0].visible = true);\n\n !this.steps.get(1)?.visible && this.setDottedLineActive(this.dottedLineStart);\n !this.steps.get(length - 2)?.visible && this.setDottedLineActive(this.dottedLineEnd);\n }\n\n private isNeighbors(index: number, steps: WizardStepComponent[]): boolean {\n const activeStep = steps.indexOf(steps.find((s) => s.active) as WizardStepComponent);\n return activeStep !== -1 && (index === activeStep - 1 || index === activeStep + 1 || index === activeStep);\n }\n\n private setDottedLineActive(line: HTMLElement, unset?: boolean): void {\n unset ? this.renderer.removeClass(line, 'odx-wizard-step__dotted-line--active') : this.renderer.addClass(line, 'odx-wizard-step__dotted-line--active');\n }\n}\n","<ng-content select=\"odx-wizard-step\" />\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { WizardStepComponent } from './components';\nimport { WizardComponent } from './wizard.component';\n\nconst modules = [WizardComponent, WizardStepComponent];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class WizardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAOA;;;;;;;;;AASG;AAWU,IAAA,mBAAmB,GAAzB,MAAM,mBAAmB,CAAA;AAAzB,IAAA,WAAA,GAAA;QACW,IAAO,CAAA,OAAA,GAAG,aAAa,EAAE;AAEzC;;;;AAIG;AACa,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,OAAO,EAAuB;AAEhE;;;;AAIG;QAEI,IAAa,CAAA,aAAA,GAAG,KAAK;AAE5B;;;;AAIG;QAEI,IAAM,CAAA,MAAA,GAAG,KAAK;AAErB;;;;AAIG;QAEI,IAAM,CAAA,MAAA,GAAG,KAAK;AAErB;;;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AAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA;;;ACVD;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-components-wizard.mjs","sources":["../../../../libs/angular/components/wizard/src/lib/components/wizard-step/wizard-step.component.ts","../../../../libs/angular/components/wizard/src/lib/components/wizard-step/wizard-step.component.html","../../../../libs/angular/components/wizard/src/lib/wizard.component.ts","../../../../libs/angular/components/wizard/src/lib/wizard.component.html","../../../../libs/angular/components/wizard/src/lib/wizard.module.ts","../../../../libs/angular/components/wizard/src/odx-angular-components-wizard.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, HostListener, Input, ViewEncapsulation } from '@angular/core';\nimport { WithDisabledState, WithTabIndex } from '@odx/angular';\nimport { IconComponent } from '@odx/angular/components/icon';\nimport { CSSComponent, CSSModifier } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\nimport { Subject } from 'rxjs';\n\n/**\n * WizardStepComponent represents an individual step within a wizard navigation sequence. It can be configured\n * to display icons, listen for user interactions, and indicate various states such as active, passed, or valid.\n * This component interacts with the WizardComponent to manage the step progression and visibility.\n *\n * Has host directives WithTabIndex and WithDisabledState.\n *\n * @see {WithTabIndex}\n * @see {WithDisabledState}\n */\n@CSSComponent('wizard-step')\n@Component({\n selector: 'odx-wizard-step',\n templateUrl: './wizard-step.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [IconComponent],\n hostDirectives: [WithTabIndex, WithDisabledState],\n})\nexport class WizardStepComponent {\n public readonly element = injectElement();\n\n /**\n * Emitted when the step is chosen by the user, indicating that the step should be activated.\n *\n * @emits {WizardStepComponent} The chosen step.\n */\n public readonly stepChosen$ = new Subject<WizardStepComponent>();\n\n /**\n * Indicates if this step was the last one interacted with in the wizard sequence.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public isLastTouched = false;\n\n /**\n * Indicates if this step is currently active.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public active = false;\n\n /**\n * Indicates if this step has been passed in the navigation sequence.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public passed = false;\n\n /**\n * Controls the visibility of this step in the UI.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public visible = true;\n\n /**\n * Indicates if this step is valid and can be progressed to.\n *\n * @type {boolean}\n * @default false\n */\n @CSSModifier()\n @Input()\n public valid = false;\n\n /**\n * Indicates if this step has been touched by the user.\n *\n * @type {boolean}\n */\n @CSSModifier()\n public touched = false;\n\n /**\n * Sets the validation state of this step.\n *\n * @param {boolean} state - The new validation state.\n */\n public setValid(state: boolean): void {\n this.valid = state;\n }\n\n @HostListener('click')\n @HostListener('keyup.enter')\n @HostListener('keyup.space')\n protected chooseStep(): void {\n this.stepChosen$.next(this);\n }\n}\n","<span class=\"odx-wizard-step__label\">\n <ng-content />\n</span>\n\n<div class=\"odx-wizard-step__holder\">\n <span class=\"odx-wizard-step__line-before\"></span>\n <span class=\"odx-wizard-step__circle\"> <odx-icon class=\"odx-wizard-step__icon\" name=\"check\" iconSet=\"core\" /> </span>\n <span class=\"odx-wizard-step__line-after\"></span>\n</div>\n","import {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n EventEmitter,\n inject,\n Input,\n Output,\n QueryList,\n Renderer2,\n ViewEncapsulation,\n} from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { CSSComponent, CSSModifier } from '@odx/angular/internal';\nimport { injectElement, untilDestroyed } from '@odx/angular/utils';\nimport { BehaviorSubject, debounceTime, fromEvent, merge, tap } from 'rxjs';\nimport { WizardStepComponent } from './components';\n\n/**\n * WizardComponent manages a series of steps, providing functionality for navigating forwards and backwards\n * through the steps. It dynamically adjusts the visibility of steps based on the available space and current active step.\n * The component supports both horizontal and vertical orientations.\n */\n@CSSComponent('wizard')\n@Component({\n selector: 'odx-wizard',\n templateUrl: './wizard.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class WizardComponent implements AfterViewInit {\n private readonly destroyed = untilDestroyed();\n private readonly renderer = inject(Renderer2);\n\n private readonly responsive$ = new BehaviorSubject<boolean>(true);\n private visibleStepsSegments = 0;\n private readonly dottedLineStart = this.renderer.createElement('div');\n private readonly dottedLineEnd = this.renderer.createElement('div');\n\n private readonly windowRef = inject(WindowRef);\n private activeStep = 0;\n\n @ContentChildren(WizardStepComponent)\n protected readonly steps!: QueryList<WizardStepComponent>;\n\n public readonly element = injectElement();\n\n /**\n * Indicates if the wizard layout should be vertical. When true, the wizard orientation changes to vertical.\n *\n * @type {boolean}\n * @default false\n */\n @CSSModifier()\n @Input({ transform: booleanAttribute })\n public vertical = false;\n\n /**\n * Indicates whether the wizard component is responsive\n * and hides the steps that do not fit in the available space.\n */\n @Input({ transform: booleanAttribute })\n public set responsive(value: boolean) {\n this.responsive$.next(value);\n }\n\n /**\n * Event emitted when the active step changes, providing the index of the new active step.\n *\n * @emits {number}\n */\n @Output()\n public activeStepChanged: EventEmitter<number> = new EventEmitter();\n\n public ngAfterViewInit(): void {\n if (!this.steps) return;\n [this.dottedLineStart, this.dottedLineEnd].forEach((l) => this.renderer.addClass(l, 'odx-wizard-step__dotted-line'));\n this.visibleStepsSegments = this.calculateVisibleStepsSegments();\n this.setActiveStep();\n\n merge(fromEvent(this.windowRef.nativeWindow, 'resize'), this.steps.changes, this.responsive$)\n .pipe(this.destroyed(), debounceTime(600))\n .subscribe(() => {\n this.visibleStepsSegments = this.calculateVisibleStepsSegments();\n this.setHiddenSteps();\n });\n this.clickStepSubscriber();\n }\n\n /**\n * Navigates to the next step in the wizard.\n */\n public nextStep(): void {\n this.activeStep < this.steps.length - 1 && this.changeStepHandler(this.steps.get(this.activeStep + 1) as WizardStepComponent);\n }\n\n /**\n * Navigates to the previous step in the wizard.\n */\n public previousStep(): void {\n this.activeStep > 0 && this.changeStepHandler(this.steps.get(this.activeStep - 1) as WizardStepComponent);\n }\n\n /**\n * Sets the active step to the specified index.\n */\n public setActiveStepValid(): void {\n this.steps.get(this.activeStep)?.setValid(true);\n }\n\n /**\n * Sets the validity of a step at the specified index.\n *\n * @param {number} stepIndex - Index of the step to set validity.\n * @param {boolean} valid - Whether the step should be valid or not.\n */\n public setStepValid(stepIndex: number, valid: boolean): void {\n const step = this.steps.get(stepIndex);\n if (step) {\n step.setValid(valid);\n if (stepIndex === this.activeStep) {\n this.activeStepChanged.emit(this.activeStep);\n }\n }\n }\n\n /**\n * Returns whether the step at the specified index is valid.\n *\n * @param {number} stepIndex - Index of the step to check validity.\n * @returns {boolean} - Whether the step is valid or not.\n */\n public isStepValid(stepIndex: number): boolean {\n return !!this.steps.get(stepIndex)?.valid;\n }\n\n /**\n * Returns whether the current active step is valid.\n *\n * @returns {boolean} - Whether the current step is valid or not.\n */\n public isCurrentStepValid(): boolean {\n return this.isStepValid(this.activeStep);\n }\n\n private calculateVisibleStepsSegments(): number {\n if (!this.responsive$.getValue()) return this.steps.length;\n const container = this.element.nativeElement;\n const { width, height } = container.getBoundingClientRect();\n const containerSize = this.vertical ? height : width;\n\n let visibleSteps = 0;\n let summaryStepsSize = 0;\n const prop = this.vertical ? 'flex-basis' : 'min-width';\n const minStepSize = parseInt(this.getStyleFromCSS(this.steps.first.element.nativeElement, prop));\n\n this.steps.forEach(() => {\n summaryStepsSize += minStepSize;\n if (summaryStepsSize < containerSize) visibleSteps++;\n });\n\n return visibleSteps;\n }\n\n private getStyleFromCSS(el: HTMLElement, prop: string): string {\n return this.windowRef.nativeWindow.getComputedStyle(el).getPropertyValue(prop);\n }\n\n private setActiveStep(): void {\n const touched: WizardStepComponent[] = [];\n this.steps.forEach((step, index) => {\n step.active = false;\n step.isLastTouched = false;\n if (this.activeStep === index) step.touched = true;\n step.touched && touched.push(step);\n this.activeStep === index && (step.active = true);\n step.passed = index <= this.activeStep;\n });\n const lastTouched = touched.pop();\n lastTouched && (lastTouched.isLastTouched = true);\n this.setHiddenSteps();\n }\n\n private clickStepSubscriber(): void {\n merge(...this.steps.map((step) => step.stepChosen$))\n .pipe(\n this.destroyed(),\n tap((step) => this.changeStepHandler(step)),\n )\n .subscribe();\n }\n\n private changeStepHandler(step: WizardStepComponent): void {\n const index = this.steps.toArray().indexOf(step);\n const isPreviousStepValid = this.steps.get(index - 1)?.valid;\n const isFirstStepTarget = index === 0;\n\n if ((isPreviousStepValid || isFirstStepTarget) && index !== this.activeStep) {\n this.activeStep = index;\n this.activeStepChanged.emit(this.activeStep);\n this.setActiveStep();\n }\n }\n\n private setHiddenSteps() {\n const length = this.steps.length;\n\n [this.dottedLineStart, this.dottedLineEnd].forEach((l) => this.setDottedLineActive(l, true));\n\n this.renderer.insertBefore(this.element.nativeElement, this.dottedLineStart, this.steps.get(1)?.element.nativeElement);\n this.renderer.insertBefore(this.element.nativeElement, this.dottedLineEnd, this.steps.get(length - 1)?.element.nativeElement);\n const start = this.activeStep < length / 2;\n const stepsForHide = this.steps.toArray().slice(1, -1);\n const visibleStepsSegments = this.visibleStepsSegments - 2;\n stepsForHide.forEach((step, i) => {\n if (length > this.visibleStepsSegments) {\n step.visible = start\n ? i < visibleStepsSegments - 1 || this.isNeighbors(i, stepsForHide)\n : i > stepsForHide.length - (visibleStepsSegments - 1) || this.isNeighbors(i, stepsForHide);\n } else {\n step.visible = true;\n }\n });\n const filteredVisibleSteps = stepsForHide.filter((s) => s.visible);\n if (visibleStepsSegments - 1 < filteredVisibleSteps.length && length > this.visibleStepsSegments) {\n const overflowSize = filteredVisibleSteps.length - visibleStepsSegments + 1;\n const index = start ? overflowSize : filteredVisibleSteps.length - overflowSize - 1;\n\n filteredVisibleSteps.forEach((s, i) => {\n (start ? i <= index : i >= index) && !this.isNeighbors(i, filteredVisibleSteps) && (s.visible = false);\n });\n }\n\n this.steps.last.active && (stepsForHide[stepsForHide.length - 1].visible = true);\n this.steps.first.active && (stepsForHide[0].visible = true);\n\n !this.steps.get(1)?.visible && this.setDottedLineActive(this.dottedLineStart);\n !this.steps.get(length - 2)?.visible && this.setDottedLineActive(this.dottedLineEnd);\n }\n\n private isNeighbors(index: number, steps: WizardStepComponent[]): boolean {\n const activeStep = steps.indexOf(steps.find((s) => s.active) as WizardStepComponent);\n return activeStep !== -1 && (index === activeStep - 1 || index === activeStep + 1 || index === activeStep);\n }\n\n private setDottedLineActive(line: HTMLElement, unset?: boolean): void {\n unset ? this.renderer.removeClass(line, 'odx-wizard-step__dotted-line--active') : this.renderer.addClass(line, 'odx-wizard-step__dotted-line--active');\n }\n}\n","<ng-content select=\"odx-wizard-step\" />\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { WizardStepComponent } from './components';\nimport { WizardComponent } from './wizard.component';\n\nconst modules = [WizardComponent, WizardStepComponent];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class WizardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAOA;;;;;;;;;AASG;AAWU,IAAA,mBAAmB,GAAzB,MAAM,mBAAmB,CAAA;AAAzB,IAAA,WAAA,GAAA;QACW,IAAO,CAAA,OAAA,GAAG,aAAa,EAAE,CAAC;AAE1C;;;;AAIG;AACa,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,OAAO,EAAuB,CAAC;AAEjE;;;;AAIG;QAEI,IAAa,CAAA,aAAA,GAAG,KAAK,CAAC;AAE7B;;;;AAIG;QAEI,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;AAEtB;;;;AAIG;QAEI,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;AAEtB;;;;AAIG;QAEI,IAAO,CAAA,OAAA,GAAG,IAAI,CAAC;AAEtB;;;;;AAKG;QAGI,IAAK,CAAA,KAAA,GAAG,KAAK,CAAC;AAErB;;;;AAIG;QAEI,IAAO,CAAA,OAAA,GAAG,KAAK,C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,CAAA;sBADd,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAQ3B,UAAU,EAAA,CAAA;sBADpB,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAW/B,iBAAiB,EAAA,CAAA;sBADvB,MAAM;;;AErET,MAAM,OAAO,GAAG,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;MAM1C,YAAY,CAAA;+GAAZ,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAZ,YAAY,EAAA,OAAA,EAAA,CANR,eAAe,EAAE,mBAAmB,aAIzC,UAAU,EAJL,eAAe,EAAE,mBAAmB,CAAA,EAAA,CAAA,CAAA,EAAA;gHAMxC,YAAY,EAAA,OAAA,EAAA,CANS,mBAAmB,EAIzC,UAAU,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAET,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA,CAAA;;;ACVD;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-internal-translate.mjs","sources":["../../../../libs/angular/internal/translate/src/lib/translate.service.ts","../../../../libs/angular/internal/translate/src/lib/pipes/translate.pipe.ts","../../../../libs/angular/internal/translate/src/lib/translate.config.ts","../../../../libs/angular/internal/translate/src/odx-angular-internal-translate.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { LocalizationService } from '@odx/angular/localization';\nimport { getLanguageCode } from '@odx/angular/utils';\nimport { distinctUntilChanged, map, Observable, shareReplay, startWith } from 'rxjs';\nimport { TranslationObject } from './models';\n\n/**\n * Service for translating keys into localized text. It listens to changes in the active language\n * and provides translated strings based on the current language preference. The service uses\n * provided `TranslationObject` containing the translations for each supported language.\n *\n * @example\n * ```ts\n * // Using TranslateService in a component\n * class MyComponent {\n * constructor(private translateService: TranslateService) {\n * translateService.translate('greeting').subscribe(translatedText => {\n * console.log(translatedText); // Outputs \"Hello\" or \"Bonjour\" based on the active language\n * });\n * }\n * }\n * ```\n */\nexport class TranslateService {\n private readonly localizationService = inject(LocalizationService);\n\n /**\n * An observable that emits the current translation object based on the active language.\n * It ensures that translations are updated dynamically whenever the user's language preference changes.\n *\n * @emits {TranslationObject} activeTranslation$ - The translation object for the active language.\n */\n public readonly activeTranslation$ = this.localizationService.activeLanguage$.pipe(\n startWith(this.localizationService.defaultLanguage),\n distinctUntilChanged(),\n map((language) => {\n const languageCode = getLanguageCode(language);\n if (this.translations[language]) {\n return this.translations[language];\n }\n if (this.translations[languageCode]) {\n return this.translations[languageCode];\n }\n return this.translations[this.localizationService.defaultLanguage];\n }),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n constructor(private readonly translations: TranslationObject) {}\n\n /**\n * Translates a key into its localized text, optionally replacing placeholders with dynamic values.\n * @param {string} key - The translation key to translate.\n * @param {Record<string, unknown>} [data={}] - An object mapping placeholder names to replacement values.\n * @returns {Observable<string>} An observable emitting the translated text, with placeholders replaced by provided values.\n */\n public translate(key: string, data: Record<string, unknown> = {}): Observable<string> {\n return this.activeTranslation$.pipe(\n map((translation) =>\n Object.entries(data).reduce((acc, [variableName, variable]) => {\n const variableRegex = RegExp(`{{\\\\s*${variableName}\\\\s*}}`, 'g');\n return acc.replace(variableRegex, variable as never);\n }, translation[key] ?? ''),\n ),\n );\n }\n}\n","import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { TranslateService } from '../translate.service';\n\n@Pipe({\n standalone: true,\n name: 'odxTranslate',\n pure: true,\n})\nexport class TranslatePipe implements PipeTransform {\n private readonly translateService = inject(TranslateService);\n\n public transform(key: string, placeholder: Record<string, unknown> = {}): Observable<string> {\n return this.translateService.translate(key, placeholder);\n }\n}\n","import { TranslationObject } from './models';\nimport { TranslateService } from './translate.service';\n\n/**\n * Provides a configuration for Angular's dependency injection system to instantiate the `TranslateService`\n * with a specific set of translations. This function is useful for setting up the translation service\n * at the module level, ensuring that a single instance with a consistent set of translations is used\n * throughout the application.\n *\n * @param {TranslationObject} translations - An object containing key-value pairs where each key is a\n * translation key and the value is the translated string or an object containing translations for\n * nested keys. This object should include translations for all supported languages.\n * @returns {Provider} An Angular provider configuration object that can be used in the `providers` array\n * of an `@NgModule` or `@Component` decorator to supply the `TranslateService` with the provided translations.\n *\n * @example\n * ```ts\n * // Example usage in an Angular module\n * import { NgModule } from '@angular/core';\n * import { provideTranslations } from '@odx/angular/internal/translate';\n *\n * const appTranslations = {\n * en: { welcome: \"Welcome\" },\n * fr: { welcome: \"Bienvenue\" }\n * };\n *\n * @NgModule({\n * providers: [\n * provideTranslations(appTranslations)\n * ]\n * })\n * export class AppModule { }\n * ```\n */\nexport function provideTranslations(translations: TranslationObject) {\n return {\n provide: TranslateService,\n useFactory: () => new TranslateService(translations),\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAMA;;;;;;;;;;;;;;;;AAgBG;MACU,gBAAgB,CAAA;AAyB3B,IAAA,WAAA,CAA6B,YAA+B,EAAA;QAA/B,IAAY,CAAA,YAAA,GAAZ,YAAY;AAxBxB,QAAA,IAAA,CAAA,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AAElE;;;;;AAKG;QACa,IAAkB,CAAA,kBAAA,GAAG,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,IAAI,CAChF,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,EACnD,oBAAoB,EAAE,EACtB,GAAG,CAAC,CAAC,QAAQ,KAAI;AACf,YAAA,MAAM,YAAY,GAAG,eAAe,CAAC,QAAQ,CAAC;AAC9C,YAAA,IAAI,IAAI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A,CAAA,IAAA,EAAA,CAAA,CAAA;6GAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,cAAA,EAAA,CAAA,CAAA;;4FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBALzB,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE,cAAc;AACpB,oBAAA,IAAI,EAAE,IAAI;AACX,iBAAA;;;ACLD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACG,SAAU,mBAAmB,CAAC,YAA+B,EAAA;IACjE,OAAO;AACL,QAAA,OAAO,EAAE,gBAAgB;QACzB,UAAU,EAAE,MAAM,IAAI,gBAAgB,CAAC,YAAY,CAAC;KACrD;AACH;;ACvCA;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-internal-translate.mjs","sources":["../../../../libs/angular/internal/translate/src/lib/translate.service.ts","../../../../libs/angular/internal/translate/src/lib/pipes/translate.pipe.ts","../../../../libs/angular/internal/translate/src/lib/translate.config.ts","../../../../libs/angular/internal/translate/src/odx-angular-internal-translate.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { LocalizationService } from '@odx/angular/localization';\nimport { getLanguageCode } from '@odx/angular/utils';\nimport { distinctUntilChanged, map, Observable, shareReplay, startWith } from 'rxjs';\nimport { TranslationObject } from './models';\n\n/**\n * Service for translating keys into localized text. It listens to changes in the active language\n * and provides translated strings based on the current language preference. The service uses\n * provided `TranslationObject` containing the translations for each supported language.\n *\n * @example\n * ```ts\n * // Using TranslateService in a component\n * class MyComponent {\n * constructor(private translateService: TranslateService) {\n * translateService.translate('greeting').subscribe(translatedText => {\n * console.log(translatedText); // Outputs \"Hello\" or \"Bonjour\" based on the active language\n * });\n * }\n * }\n * ```\n */\nexport class TranslateService {\n private readonly localizationService = inject(LocalizationService);\n\n /**\n * An observable that emits the current translation object based on the active language.\n * It ensures that translations are updated dynamically whenever the user's language preference changes.\n *\n * @emits {TranslationObject} activeTranslation$ - The translation object for the active language.\n */\n public readonly activeTranslation$ = this.localizationService.activeLanguage$.pipe(\n startWith(this.localizationService.defaultLanguage),\n distinctUntilChanged(),\n map((language) => {\n const languageCode = getLanguageCode(language);\n if (this.translations[language]) {\n return this.translations[language];\n }\n if (this.translations[languageCode]) {\n return this.translations[languageCode];\n }\n return this.translations[this.localizationService.defaultLanguage];\n }),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n constructor(private readonly translations: TranslationObject) {}\n\n /**\n * Translates a key into its localized text, optionally replacing placeholders with dynamic values.\n * @param {string} key - The translation key to translate.\n * @param {Record<string, unknown>} [data={}] - An object mapping placeholder names to replacement values.\n * @returns {Observable<string>} An observable emitting the translated text, with placeholders replaced by provided values.\n */\n public translate(key: string, data: Record<string, unknown> = {}): Observable<string> {\n return this.activeTranslation$.pipe(\n map((translation) =>\n Object.entries(data).reduce((acc, [variableName, variable]) => {\n const variableRegex = RegExp(`{{\\\\s*${variableName}\\\\s*}}`, 'g');\n return acc.replace(variableRegex, variable as never);\n }, translation[key] ?? ''),\n ),\n );\n }\n}\n","import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { TranslateService } from '../translate.service';\n\n@Pipe({\n standalone: true,\n name: 'odxTranslate',\n pure: true,\n})\nexport class TranslatePipe implements PipeTransform {\n private readonly translateService = inject(TranslateService);\n\n public transform(key: string, placeholder: Record<string, unknown> = {}): Observable<string> {\n return this.translateService.translate(key, placeholder);\n }\n}\n","import { TranslationObject } from './models';\nimport { TranslateService } from './translate.service';\n\n/**\n * Provides a configuration for Angular's dependency injection system to instantiate the `TranslateService`\n * with a specific set of translations. This function is useful for setting up the translation service\n * at the module level, ensuring that a single instance with a consistent set of translations is used\n * throughout the application.\n *\n * @param {TranslationObject} translations - An object containing key-value pairs where each key is a\n * translation key and the value is the translated string or an object containing translations for\n * nested keys. This object should include translations for all supported languages.\n * @returns {Provider} An Angular provider configuration object that can be used in the `providers` array\n * of an `@NgModule` or `@Component` decorator to supply the `TranslateService` with the provided translations.\n *\n * @example\n * ```ts\n * // Example usage in an Angular module\n * import { NgModule } from '@angular/core';\n * import { provideTranslations } from '@odx/angular/internal/translate';\n *\n * const appTranslations = {\n * en: { welcome: \"Welcome\" },\n * fr: { welcome: \"Bienvenue\" }\n * };\n *\n * @NgModule({\n * providers: [\n * provideTranslations(appTranslations)\n * ]\n * })\n * export class AppModule { }\n * ```\n */\nexport function provideTranslations(translations: TranslationObject) {\n return {\n provide: TranslateService,\n useFactory: () => new TranslateService(translations),\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAMA;;;;;;;;;;;;;;;;AAgBG;MACU,gBAAgB,CAAA;AAyB3B,IAAA,WAAA,CAA6B,YAA+B,EAAA;QAA/B,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAmB;AAxB3C,QAAA,IAAA,CAAA,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAEnE;;;;;AAKG;QACa,IAAkB,CAAA,kBAAA,GAAG,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,IAAI,CAChF,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,EACnD,oBAAoB,EAAE,EACtB,GAAG,CAAC,CAAC,QAAQ,KAAI;AACf,YAAA,MAAM,YAAY,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAC/C,YAAA,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;AAC/B,gBAAA,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;aACpC;AACD,YAAA,IAAI,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE;AACnC,gBAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;aACxC;YACD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,C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BAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE,cAAc;AACpB,oBAAA,IAAI,EAAE,IAAI;AACX,iBAAA,CAAA;;;ACLD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACG,SAAU,mBAAmB,CAAC,YAA+B,EAAA;IACjE,OAAO;AACL,QAAA,OAAO,EAAE,gBAAgB;QACzB,UAAU,EAAE,MAAM,IAAI,gBAAgB,CAAC,YAAY,CAAC;KACrD,CAAC;AACJ;;ACvCA;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-internal.mjs","sources":["../../../../libs/angular/internal/src/lib/helpers/camel-to-kebab-case.ts","../../../../libs/angular/internal/src/lib/helpers/decorator-property-name.ts","../../../../libs/angular/internal/src/lib/helpers/deepmerge.ts","../../../../libs/angular/internal/src/lib/helpers/fast-equals.ts","../../../../libs/angular/internal/src/lib/helpers/get-css-variables.ts","../../../../libs/angular/internal/src/lib/helpers/get-enum-values.ts","../../../../libs/angular/internal/src/lib/helpers/toggle-form-disabled-state.ts","../../../../libs/angular/internal/src/lib/decorators/css-component.ts","../../../../libs/angular/internal/src/lib/decorators/css-modifier.ts","../../../../libs/angular/internal/src/lib/logger.ts","../../../../libs/angular/internal/src/odx-angular-internal.ts"],"sourcesContent":["/** @internal */\n/* istanbul ignore next */\nexport function camelToKebabCase(value: string): string {\n if (value !== value.toLowerCase()) {\n return value.replace(/[A-Z]/g, (match, index) => {\n const char = match.toLowerCase();\n\n return index === 0 ? char : `-${char}`;\n });\n }\n return value;\n}\n","/**\n * @internal\n * Generates a unique property name for a decorator.\n *\n * @param {string} decoratorName - The name of the decorator.\n * @param {string} propertyName - The name of the property.\n * @returns {string} - The unique property name.\n */\nexport function decoratorPropertyName<D extends string, T extends string>(decoratorName: D, propertyName: T): `__ODX_${D}_${T}__` {\n return `__ODX_${decoratorName}_${propertyName}__`;\n}\n","import { deepmergeCustom } from 'deepmerge-ts';\n\nexport const deepmerge = deepmergeCustom({\n mergeArrays: false,\n mergeSets: false,\n});\n","import { deepEqual } from 'fast-equals';\n\nexport const fastDeepEqual = (obj1: unknown, obj2: unknown) => deepEqual(obj1, obj2);\n","interface CSSVariableDefinition {\n name: string;\n value: string;\n}\n\n/* istanbul ignore next */\nfunction isSameDomain({ href }: StyleSheet): boolean {\n return !href || href.startsWith(window.location.origin);\n}\n\n/** @internal */\n/* istanbul ignore next */\nexport function getCSSVariables(filter: RegExp, selector = ':root'): CSSVariableDefinition[] {\n const stylesheets = Array.from(document.styleSheets).filter(isSameDomain);\n\n return stylesheets.reduce<CSSVariableDefinition[]>((variables, { cssRules }) => {\n const rules = Array.from(cssRules).filter(({ type }) => type === CSSRule.STYLE_RULE) as CSSStyleRule[];\n for (const { style, selectorText } of rules) {\n for (const propName of Array.from(style)) {\n const name = propName.trim();\n if (!name.startsWith('--') || !filter.test(name) || (selector && selectorText !== selector)) continue;\n variables.push({ name, value: style.getPropertyValue(propName).trim() });\n }\n }\n return variables;\n }, []);\n}\n","/** @internal */\nexport function getEnumValues<TEnum, TKeys extends string>(e: { [key in TKeys]: TEnum }): TEnum[] {\n const keys = Object.keys(e) as TKeys[];\n return keys.filter((key) => e[key] !== undefined).map((key) => e[key]);\n}\n","import { FormGroup } from '@angular/forms';\n\n/** @internal */\nexport function toggleFormDisabledState(form: FormGroup) {\n form.disabled ? form.enable() : form.disable();\n console.log('form', form);\n}\n","import { ElementRef, Type } from '@angular/core';\nimport { decoratorPropertyName } from '../helpers';\n\nexport const CSS_COMPONENT_NAME = decoratorPropertyName('CSSComponent', 'name');\n\n/** @internal */\nexport interface CSSComponent {\n readonly element: ElementRef<HTMLElement>;\n}\n\n/** @internal */\n/* istanbul ignore next */\nexport function CSSComponent(name: string, prefix = 'odx') {\n return (target: Type<CSSComponent>) => {\n const cssClass = `${prefix}-${name}`;\n Object.defineProperty(target.prototype, CSS_COMPONENT_NAME, {\n value: cssClass,\n });\n\n (function (this: unknown, ngOnInit?: () => void) {\n target.prototype.ngOnInit = function (this: CSSComponent) {\n this.element.nativeElement.classList.add(cssClass);\n ngOnInit?.call(this);\n };\n })(target.prototype.ngOnInit);\n };\n}\n","import { camelToKebabCase, decoratorPropertyName } from '../helpers';\nimport { CSSComponent, CSS_COMPONENT_NAME } from './css-component';\n\n/** @internal */\ninterface CSSModifierOptions {\n withComponentPrefix?: boolean;\n withPrefix?: boolean;\n}\n\ntype CSSComponentInstance = CSSComponent & Record<string, unknown>;\n\n/** @internal */\n/* istanbul ignore next */\nexport function CSSModifier(options?: CSSModifierOptions) {\n return (target: CSSComponent, propertyKey: PropertyKey) => {\n const propertyKeyName = propertyKey.toString();\n const propertyKeyKebabCase = camelToKebabCase(propertyKeyName);\n const propertySymbol = decoratorPropertyName('CSSModifier', propertyKeyName);\n const propertyDefaultValue = decoratorPropertyName('CSSModifier', `${propertyKeyName}_default`);\n\n function createModifierClass(this: CSSComponentInstance, value: unknown) {\n if (typeof value === 'boolean' || (typeof value === 'string' && value.length > 0)) {\n let modifier = typeof value === 'boolean' ? propertyKeyKebabCase : value;\n if (options?.withPrefix) {\n modifier = `${propertyKeyName}-${modifier}`;\n }\n if (options?.withComponentPrefix ?? true) {\n return `${this[CSS_COMPONENT_NAME]}--${modifier}`;\n }\n return modifier;\n }\n return null;\n }\n\n function getter(this: CSSComponentInstance) {\n return this[propertySymbol];\n }\n\n function setter(this: CSSComponentInstance, value: unknown) {\n this[propertyDefaultValue] ??= value;\n const currentValue = this[propertySymbol] ?? null;\n const nextValue = value ?? this[propertyDefaultValue] ?? null;\n\n if (nextValue !== currentValue) {\n const currentModifierClass = createModifierClass.call(this, currentValue);\n if (currentModifierClass !== null) {\n this.element.nativeElement.classList.remove(currentModifierClass);\n }\n const newModifierClass = createModifierClass.call(this, nextValue);\n if (newModifierClass !== null && (typeof nextValue === 'boolean' ? nextValue : true)) {\n this.element.nativeElement.classList.add(newModifierClass);\n }\n }\n this[propertySymbol] = nextValue;\n }\n Object.defineProperty(target, propertyKey, {\n get: getter,\n set: setter,\n });\n };\n}\n","import { isDevMode } from '@angular/core';\n\nexport class Logger {\n private isEnabled: boolean;\n private readonly name: string;\n private readonly prefix: string;\n\n constructor(name: string) {\n this.name = name;\n this.prefix = `[${this.name}]`;\n this.isEnabled = isDevMode();\n }\n\n public log(...data: unknown[]): void {\n this.handle('log', data);\n }\n\n public info(...data: unknown[]): void {\n this.handle('info', data);\n }\n\n public warn(...data: unknown[]): void {\n this.handle('warn', data);\n }\n\n public error(...data: unknown[]): void {\n this.handle('error', data);\n }\n\n public debug(...data: unknown[]): void {\n this.handle('debug', data);\n }\n\n public group(name: string, groupHandler: (this: Logger, log: (...data: unknown[]) => void) => void, collapsed = true): void {\n if (!this.isEnabled) return;\n console[collapsed ? 'groupCollapsed' : 'group'](this.prefix, name);\n groupHandler.apply(this, [console.info]);\n console.groupEnd();\n }\n\n public enable(): void {\n this.isEnabled = true;\n }\n\n public disable(): void {\n this.isEnabled = false;\n }\n\n protected handle(method: 'debug' | 'log' | 'info' | 'warn' | 'error', data: unknown[]): void {\n if (!this.isEnabled) return;\n console[method](this.prefix, ...data);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;AACA;AACM,SAAU,gBAAgB,CAAC,KAAa,EAAA;AAC5C,IAAA,IAAI,KAAK,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;QACjC,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAI;AAC9C,YAAA,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,EAAE;AAEhC,YAAA,OAAO,KAAK,KAAK,CAAC,GAAG,IAAI,GAAG,CAAI,CAAA,EAAA,IAAI,EAAE;AACxC,SAAC,CAAC;;AAEJ,IAAA,OAAO,KAAK;AACd;;ACXA;;;;;;;AAOG;AACa,SAAA,qBAAqB,CAAqC,aAAgB,EAAE,YAAe,EAAA;AACzG,IAAA,OAAO,CAAS,MA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C5B,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;;IAGpB,KAAK,CAAC,GAAG,IAAe,EAAA;AAC7B,QAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;;IAGrB,KAAK,CAAC,GAAG,IAAe,EAAA;AAC7B,QAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;;AAGrB,IAAA,KAAK,CAAC,IAAY,EAAE,YAAuE,EAAE,SAAS,GAAG,IAAI,EAAA;QAClH,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE;AACrB,QAAA,OAAO,CAAC,SAAS,GAAG,gBAAgB,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;QAClE,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,OAAO,CAAC,QAAQ,EAAE;;IAGb,MAAM,GAAA;AACX,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI;;IAGhB,OAAO,GAAA;AACZ,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK;;IAGd,MAAM,CAAC,MAAmD,EAAE,IAAe,EAAA;QACnF,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE;QACrB,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;;AAExC;;ACpDD;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-internal.mjs","sources":["../../../../libs/angular/internal/src/lib/helpers/camel-to-kebab-case.ts","../../../../libs/angular/internal/src/lib/helpers/decorator-property-name.ts","../../../../libs/angular/internal/src/lib/helpers/deepmerge.ts","../../../../libs/angular/internal/src/lib/helpers/fast-equals.ts","../../../../libs/angular/internal/src/lib/helpers/get-css-variables.ts","../../../../libs/angular/internal/src/lib/helpers/get-enum-values.ts","../../../../libs/angular/internal/src/lib/helpers/toggle-form-disabled-state.ts","../../../../libs/angular/internal/src/lib/decorators/css-component.ts","../../../../libs/angular/internal/src/lib/decorators/css-modifier.ts","../../../../libs/angular/internal/src/lib/logger.ts","../../../../libs/angular/internal/src/odx-angular-internal.ts"],"sourcesContent":["/** @internal */\n/* istanbul ignore next */\nexport function camelToKebabCase(value: string): string {\n if (value !== value.toLowerCase()) {\n return value.replace(/[A-Z]/g, (match, index) => {\n const char = match.toLowerCase();\n\n return index === 0 ? char : `-${char}`;\n });\n }\n return value;\n}\n","/**\n * @internal\n * Generates a unique property name for a decorator.\n *\n * @param {string} decoratorName - The name of the decorator.\n * @param {string} propertyName - The name of the property.\n * @returns {string} - The unique property name.\n */\nexport function decoratorPropertyName<D extends string, T extends string>(decoratorName: D, propertyName: T): `__ODX_${D}_${T}__` {\n return `__ODX_${decoratorName}_${propertyName}__`;\n}\n","import { deepmergeCustom } from 'deepmerge-ts';\n\nexport const deepmerge = deepmergeCustom({\n mergeArrays: false,\n mergeSets: false,\n});\n","import { deepEqual } from 'fast-equals';\n\nexport const fastDeepEqual = (obj1: unknown, obj2: unknown) => deepEqual(obj1, obj2);\n","interface CSSVariableDefinition {\n name: string;\n value: string;\n}\n\n/* istanbul ignore next */\nfunction isSameDomain({ href }: StyleSheet): boolean {\n return !href || href.startsWith(window.location.origin);\n}\n\n/** @internal */\n/* istanbul ignore next */\nexport function getCSSVariables(filter: RegExp, selector = ':root'): CSSVariableDefinition[] {\n const stylesheets = Array.from(document.styleSheets).filter(isSameDomain);\n\n return stylesheets.reduce<CSSVariableDefinition[]>((variables, { cssRules }) => {\n const rules = Array.from(cssRules).filter(({ type }) => type === CSSRule.STYLE_RULE) as CSSStyleRule[];\n for (const { style, selectorText } of rules) {\n for (const propName of Array.from(style)) {\n const name = propName.trim();\n if (!name.startsWith('--') || !filter.test(name) || (selector && selectorText !== selector)) continue;\n variables.push({ name, value: style.getPropertyValue(propName).trim() });\n }\n }\n return variables;\n }, []);\n}\n","/** @internal */\nexport function getEnumValues<TEnum, TKeys extends string>(e: { [key in TKeys]: TEnum }): TEnum[] {\n const keys = Object.keys(e) as TKeys[];\n return keys.filter((key) => e[key] !== undefined).map((key) => e[key]);\n}\n","import { FormGroup } from '@angular/forms';\n\n/** @internal */\nexport function toggleFormDisabledState(form: FormGroup) {\n form.disabled ? form.enable() : form.disable();\n console.log('form', form);\n}\n","import { ElementRef, Type } from '@angular/core';\nimport { decoratorPropertyName } from '../helpers';\n\nexport const CSS_COMPONENT_NAME = decoratorPropertyName('CSSComponent', 'name');\n\n/** @internal */\nexport interface CSSComponent {\n readonly element: ElementRef<HTMLElement>;\n}\n\n/** @internal */\n/* istanbul ignore next */\nexport function CSSComponent(name: string, prefix = 'odx') {\n return (target: Type<CSSComponent>) => {\n const cssClass = `${prefix}-${name}`;\n Object.defineProperty(target.prototype, CSS_COMPONENT_NAME, {\n value: cssClass,\n });\n\n (function (this: unknown, ngOnInit?: () => void) {\n target.prototype.ngOnInit = function (this: CSSComponent) {\n this.element.nativeElement.classList.add(cssClass);\n ngOnInit?.call(this);\n };\n })(target.prototype.ngOnInit);\n };\n}\n","import { camelToKebabCase, decoratorPropertyName } from '../helpers';\nimport { CSSComponent, CSS_COMPONENT_NAME } from './css-component';\n\n/** @internal */\ninterface CSSModifierOptions {\n withComponentPrefix?: boolean;\n withPrefix?: boolean;\n}\n\ntype CSSComponentInstance = CSSComponent & Record<string, unknown>;\n\n/** @internal */\n/* istanbul ignore next */\nexport function CSSModifier(options?: CSSModifierOptions) {\n return (target: CSSComponent, propertyKey: PropertyKey) => {\n const propertyKeyName = propertyKey.toString();\n const propertyKeyKebabCase = camelToKebabCase(propertyKeyName);\n const propertySymbol = decoratorPropertyName('CSSModifier', propertyKeyName);\n const propertyDefaultValue = decoratorPropertyName('CSSModifier', `${propertyKeyName}_default`);\n\n function createModifierClass(this: CSSComponentInstance, value: unknown) {\n if (typeof value === 'boolean' || (typeof value === 'string' && value.length > 0)) {\n let modifier = typeof value === 'boolean' ? propertyKeyKebabCase : value;\n if (options?.withPrefix) {\n modifier = `${propertyKeyName}-${modifier}`;\n }\n if (options?.withComponentPrefix ?? true) {\n return `${this[CSS_COMPONENT_NAME]}--${modifier}`;\n }\n return modifier;\n }\n return null;\n }\n\n function getter(this: CSSComponentInstance) {\n return this[propertySymbol];\n }\n\n function setter(this: CSSComponentInstance, value: unknown) {\n this[propertyDefaultValue] ??= value;\n const currentValue = this[propertySymbol] ?? null;\n const nextValue = value ?? this[propertyDefaultValue] ?? null;\n\n if (nextValue !== currentValue) {\n const currentModifierClass = createModifierClass.call(this, currentValue);\n if (currentModifierClass !== null) {\n this.element.nativeElement.classList.remove(currentModifierClass);\n }\n const newModifierClass = createModifierClass.call(this, nextValue);\n if (newModifierClass !== null && (typeof nextValue === 'boolean' ? nextValue : true)) {\n this.element.nativeElement.classList.add(newModifierClass);\n }\n }\n this[propertySymbol] = nextValue;\n }\n Object.defineProperty(target, propertyKey, {\n get: getter,\n set: setter,\n });\n };\n}\n","import { isDevMode } from '@angular/core';\n\nexport class Logger {\n private isEnabled: boolean;\n private readonly name: string;\n private readonly prefix: string;\n\n constructor(name: string) {\n this.name = name;\n this.prefix = `[${this.name}]`;\n this.isEnabled = isDevMode();\n }\n\n public log(...data: unknown[]): void {\n this.handle('log', data);\n }\n\n public info(...data: unknown[]): void {\n this.handle('info', data);\n }\n\n public warn(...data: unknown[]): void {\n this.handle('warn', data);\n }\n\n public error(...data: unknown[]): void {\n this.handle('error', data);\n }\n\n public debug(...data: unknown[]): void {\n this.handle('debug', data);\n }\n\n public group(name: string, groupHandler: (this: Logger, log: (...data: unknown[]) => void) => void, collapsed = true): void {\n if (!this.isEnabled) return;\n console[collapsed ? 'groupCollapsed' : 'group'](this.prefix, name);\n groupHandler.apply(this, [console.info]);\n console.groupEnd();\n }\n\n public enable(): void {\n this.isEnabled = true;\n }\n\n public disable(): void {\n this.isEnabled = false;\n }\n\n protected handle(method: 'debug' | 'log' | 'info' | 'warn' | 'error', data: unknown[]): void {\n if (!this.isEnabled) return;\n console[method](this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AK,CAAC,IAAY,EAAE,YAAuE,EAAE,SAAS,GAAG,IAAI,EAAA;QAClH,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO;AAC5B,QAAA,OAAO,CAAC,SAAS,GAAG,gBAAgB,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACnE,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,OAAO,CAAC,QAAQ,EAAE,CAAC;KACpB;IAEM,MAAM,GAAA;AACX,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;KACvB;IAEM,OAAO,GAAA;AACZ,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;KACxB;IAES,MAAM,CAAC,MAAmD,EAAE,IAAe,EAAA;QACnF,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO;QAC5B,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;KACvC;AACF;;ACpDD;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-localization.mjs","sources":["../../../../libs/angular/localization/src/lib/localization.config.ts","../../../../libs/angular/localization/src/lib/localization.logger.ts","../../../../libs/angular/localization/src/lib/localization.service.ts","../../../../libs/angular/localization/src/lib/models/localization-feature.ts","../../../../libs/angular/localization/src/lib/features/with-http-language-header.ts","../../../../libs/angular/localization/src/lib/features/with-http-language-query-param.ts","../../../../libs/angular/localization/src/lib/loaders/browser-language-loader.ts","../../../../libs/angular/localization/src/odx-angular-localization.ts"],"sourcesContent":["import { APP_INITIALIZER, EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { createConfigTokens } from '@odx/angular/utils';\nimport { LocalizationService } from './localization.service';\nimport { LanguageLoaderFn, LocalizationFeature } from './models';\n\nexport const DEFAULT_AVAILABLE_LANGUAGES = ['en-US', 'en-GB', 'en', 'de-DE', 'de', 'es-ES', 'es', 'fr-FR', 'fr-CA', 'fr'];\n\n/**\n * Defines the structure for the localization configuration used throughout the application.\n * It allows specifying available languages, and includes an optional loader\n * function for dynamically determining the active language.\n *\n * @property {LanguageLoaderFn} [activeLanguageLoader] Optional function for loading the\n * active language dynamically, useful for scenarios where the application's language\n * needs to be determined based on user settings, browser settings, or external data.\n * @property {string[]} availableLanguages An array of language codes representing the\n * languages available in the application.\n */\nexport interface LocalizationConfig {\n activeLanguageLoader?: LanguageLoaderFn;\n availableLanguages: string[];\n}\n\n/**\n * Utilizes `createConfigTokens` to generate configuration tokens and related utilities for the\n * localization settings within the application. It defines a structured and type-safe approach\n * for managing localization configurations, such as available languages, and potentially\n * a dynamic loader for the active language. The generated tokens and utilities facilitate accessing\n * and providing these configurations throughout the application.\n *\n * @const {InjectionToken<LocalizationConfig>} LocalizationConfig - An InjectionToken for accessing\n * the localization configuration within Angular's dependency injection framework. Use this token to inject\n * localization configurations into services, components, or other tokens.\n *\n * @const {LocalizationConfig} LocalizationDefaultConfig - The default configuration values for localization,\n * based on the provided settings. Includes the default available languages.\n *\n * @const {Function} injectLocalizationConfig - A utility function that returns the injected value of\n * `LocalizationConfig` token. Use this function to access the current localization configuration in\n * a type-safe manner.\n *\n * @const {Function} provideLocalizationConfig - A utility function to provide the `LocalizationConfig` token\n * with specific values. Use this function to configure and override default localization settings within\n * an Angular module or component.\n *\n * @example\n * ```ts\n * // Providing localization settings in an Angular module\n * @NgModule({\n * providers: [\n * provideLocalizationConfig({\n * availableLanguages: ['en', 'es', 'fr'],\n * })\n * ]\n * })\n * export class AppModule { }\n *\n * // Injecting and using the localization configuration in a service\n * @Injectable({ providedIn: 'root' })\n * export class MyLocalizationService {\n * constructor(@Inject(LocalizationConfig) private config: LocalizationConfig) {\n * console.log('Available languages:', config.availableLanguages);\n * }\n * }\n * ```\n */\nexport const { LocalizationConfig, LocalizationDefaultConfig, injectLocalizationConfig, provideLocalizationConfig } = createConfigTokens(\n 'Localization',\n '@odx/angular/internal/translate',\n {\n availableLanguages: DEFAULT_AVAILABLE_LANGUAGES,\n } as LocalizationConfig,\n);\n\n/**\n * Sets up the localization configuration for the application and initializes the localization\n * system with the provided configuration and features. This function is typically called\n * within the main module or a core module of the application to ensure localization settings\n * are available and active as early as possible.\n *\n * @param {Partial<LocalizationConfig>} config The localization configuration settings, including\n * available languages and optionally, a custom loader for the active language.\n * @param {...LocalizationFeature[]} features Additional localization features or configurations\n * to be registered as part of the application's environment providers.\n * @returns {EnvironmentProviders} A collection of providers for setting up the application's\n * localization environment, to be used with Angular's environment-specific injector configuration.\n * @example\n * ```ts\n * // Example of providing localization settings in an Angular module\n * @NgModule({\n * imports: [...],\n * providers: [\n * provideLocalization({\n * availableLanguages: ['en', 'es', 'fr'],\n * activeLanguageLoader: () => fetch('/api/user/language').then(res => res.text()),\n * }),\n * ],\n * })\n * export class AppModule {}\n * ```\n */\nexport function provideLocalization(config: Partial<LocalizationConfig>, ...features: LocalizationFeature[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideLocalizationConfig(config),\n {\n provide: APP_INITIALIZER,\n useFactory: (localizationService: LocalizationService) => () => localizationService.loadActiveLanguage(),\n deps: [LocalizationService],\n multi: true,\n },\n features,\n ]);\n}\n","import { Logger } from '@odx/angular/internal';\n\nexport default new Logger('@odx/angular/localization');\n","import { Injectable, Injector, inject, runInInjectionContext } from '@angular/core';\nimport { BehaviorSubject, Observable, distinctUntilChanged, filter, firstValueFrom, from, isObservable, map, of, shareReplay } from 'rxjs';\nimport { injectLocalizationConfig } from './localization.config';\nimport logger from './localization.logger';\n\n@Injectable({ providedIn: 'root' })\nexport class LocalizationService {\n private readonly localizationConfig = injectLocalizationConfig();\n private readonly injector = inject(Injector);\n private readonly localeState$ = new BehaviorSubject<Intl.Locale | undefined>(new Intl.Locale(this.localizationConfig.availableLanguages[0]));\n\n /**\n * Represents an observable stream of the active language in the localization service.\n * The active language is determined by the locale state.\n *\n * @emits {string} The active language.\n */\n public readonly activeLanguage$ = this.localeState$.pipe(\n filter(Boolean),\n map((x) => x.baseName),\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n /**\n * Gets the list of available languages for localization.\n *\n * @type {string[]} The list of available languages.\n */\n public readonly availableLanguages = this.localizationConfig.availableLanguages;\n\n /** Default language derived from the first entry in the available languages list.\n *\n * @type {string}\n */\n public readonly defaultLanguage = this.availableLanguages[0];\n\n /**\n * Retrieves the currently active language. Falls back to the default language if\n * no active language is set.\n *\n * @returns {string} Full locale name e.g. 'en-US' or just 'en' if no region info is attached.\n */\n public getActiveLanguage(): string {\n return this.localeState$.getValue()?.baseName ?? new Intl.Locale(this.defaultLanguage).baseName;\n }\n\n /**\n * Retrieves the active language subtag.\n *\n * @returns {string} The two-digit language subtag, e.g. 'en', 'fr'.\n */\n public getActiveLanguageSubtag(): string {\n return this.localeState$.getValue()?.language ?? new Intl.Locale(this.defaultLanguage).language;\n }\n\n /**\n * Sets the active language based on the provided language code. If the language is not\n * recognized, it logs an error and does not change the active language.\n *\n * @param {string} language The language code to set as the active language.\n */\n public setActiveLanguage(language: string): void {\n try {\n const locale = new Intl.Locale(language);\n if (this.availableLanguages.includes(locale.baseName) || this.availableLanguages.includes(locale.language)) {\n this.localeState$.next(locale);\n } else {\n throw new Error(`Unrecognizable language '${language}'. Make sure it's a part of availableLanguages inside LocalizationService config.`);\n }\n } catch (error) {\n logger.error(error);\n }\n }\n\n /**\n * Loads the active language for the localization service.\n * This method runs in an injection context and sets the active language based on the result of the active language loader.\n * If the active language loader fails, the default language is set as the active language.\n *\n * @returns {Promise<void>} A promise that resolves when the active language is loaded and set.\n */\n public async loadActiveLanguage(): Promise<void> {\n return runInInjectionContext(this.injector, async () => {\n const activeLanguageLoader$ = this.createActiveLanguageLoader$();\n const activeLanguage = await firstValueFrom(activeLanguageLoader$).catch(() => null);\n this.setActiveLanguage(activeLanguage ?? this.defaultLanguage);\n });\n }\n\n private createActiveLanguageLoader$(): Observable<string | undefined> {\n const language = this.localizationConfig.activeLanguageLoader?.();\n if (isObservable(language)) {\n return language;\n }\n if (language instanceof Promise) {\n return from(language);\n }\n return of(language);\n }\n}\n","import { EnvironmentProviders, Provider } from '@angular/core';\n\nexport type LocalizationFeature = EnvironmentProviders & { ɵodxBrand: '@odx/angular/localization::LocalizationFeature' };\n\n/**\n * @internal\n * Creates a feature provider for the localization module.\n *\n * @param {Provider[] | EnvironmentProviders} provider - The providers to be used for the localization feature.\n * @returns {LocalizationFeature} The localization feature provider.\n */\nexport function makeLocalizationFeature(provider: Provider[] | EnvironmentProviders): LocalizationFeature {\n return provider as never as LocalizationFeature;\n}\n","import { HttpInterceptorFn, provideHttpClient, withInterceptors } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { matchUrl } from '@odx/angular/utils';\nimport { switchMap, take } from 'rxjs';\nimport { LocalizationService } from '../localization.service';\nimport { LocalizationFeature, makeLocalizationFeature } from '../models';\n\nexport const HTTP_LANGUAGE_HEADER = 'Accept-Language';\n\n/**\n * Configuration object for the HTTP language header interceptor. It specifies which URLs\n * the interceptor should apply to and allows customizing the name of the header used to transmit\n * the current language setting.\n *\n * @property {Array<string | RegExp>} allowedUrls - An array of strings or RegExp patterns\n * indicating the URLs to which the language header should be added.\n * @property {string} [headerName=HTTP_LANGUAGE_HEADER] - Optional. The name of the HTTP header\n * through which the current language setting will be transmitted. Defaults to 'Accept-Language'.\n */\nexport interface HttpLanguageHeaderInterceptorConfig {\n allowedUrls: Array<string | RegExp>;\n headerName?: string;\n}\n\n/**\n * Creates an HTTP interceptor function that adds a language header to outgoing HTTP requests,\n * but only for URLs matching the provided criteria. This allows the server to respond with\n * resources localized in the user's current language.\n *\n * @param {HttpLanguageHeaderInterceptorConfig} config - The configuration for the interceptor,\n * including the list of allowed URLs and optionally a custom header name.\n * @returns {HttpInterceptorFn} An Angular HTTP interceptor function that conditionally adds\n * the current language as an HTTP header based on the request URL.\n *\n * @example\n * ```ts\n * // Use in HTTP client module setup\n * import { HttpClientModule } from '@angular/common/http';\n * import { httpLanguageHeaderInterceptor, HTTP_LANGUAGE_HEADER } from '@odx/angular/localization';\n *\n * @NgModule({\n * imports: [HttpClientModule],\n * providers: [\n * provideHttpClient(withInterceptors([\n * httpLanguageHeaderInterceptor({ allowedUrls: ['/api'], headerName: HTTP_LANGUAGE_HEADER })\n * ]))\n * ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function httpLanguageHeaderInterceptor({ allowedUrls, headerName }: HttpLanguageHeaderInterceptorConfig): HttpInterceptorFn {\n return (req, next) => {\n const language$ = inject(LocalizationService).activeLanguage$.pipe(take(1));\n for (const allowedUrl of allowedUrls) {\n if (!matchUrl(req.url, allowedUrl)) continue;\n return language$.pipe(switchMap((language) => next(req.clone({ setHeaders: { [headerName ?? HTTP_LANGUAGE_HEADER]: language } }))));\n }\n return next(req);\n };\n}\n\n/**\n * Provides a localization feature that automatically adds a language header to HTTP requests\n * for specified URLs, using the current active language. This function simplifies setting up\n * the HTTP language header interceptor by wrapping it into a LocalizationFeature, making it easy\n * to integrate with the application's localization infrastructure.\n *\n * @param {HttpLanguageHeaderInterceptorConfig} config - The configuration for the language header\n * interceptor, specifying which URLs should include the language header and optionally defining a\n * custom header name.\n * @returns {LocalizationFeature} A localization feature object that can be used to configure\n * the application's localization settings to include automatic language header addition for HTTP requests.\n *\n * @example\n * ```ts\n * // Example usage with the localization provider\n * import { provideLocalization, LocalizationModule, withHttpLanguageHeader } from '@odx/angular/localization';\n *\n * @NgModule({\n * imports: [LocalizationModule],\n * providers: [\n * provideLocalization({}, withHttpLanguageHeader({ allowedUrls: ['/api'] }))\n * ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function withHttpLanguageHeader(config: HttpLanguageHeaderInterceptorConfig): LocalizationFeature {\n const providers = provideHttpClient(withInterceptors([httpLanguageHeaderInterceptor(config)]));\n\n return makeLocalizationFeature(providers);\n}\n","import { HttpInterceptorFn, provideHttpClient, withInterceptors } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { matchUrl } from '@odx/angular/utils';\nimport { switchMap, take } from 'rxjs';\nimport { LocalizationService } from '../localization.service';\nimport { LocalizationFeature, makeLocalizationFeature } from '../models';\n\nexport const HTTP_LANGUAGE_QUERY = 'language';\n\n/**\n * Defines the configuration options for the HTTP interceptor that appends the current\n * language setting as a query parameter to outgoing requests. This configuration specifies\n * which requests should have the language parameter appended based on their URLs.\n *\n * @property {Array<string | RegExp>} allowedUrls - URLs (or patterns matching URLs) to which\n * the language query parameter should be appended.\n * @property {string} [queryParamName=HTTP_LANGUAGE_QUERY] - The name of the query parameter\n * used to transmit the current language. Defaults to 'language'.\n */\nexport interface HttpLanguageQueryParamInterceptorConfig {\n allowedUrls: Array<string | RegExp>;\n queryParamName?: string;\n}\n\n/**\n * Creates an HTTP interceptor function that appends the current language as a query parameter\n * to outgoing HTTP requests that match specified URLs. This interceptor enables dynamic content\n * localization by informing the backend of the user's preferred language.\n *\n * @param {HttpLanguageQueryParamInterceptorConfig} config - Configuration for the interceptor,\n * including allowed URLs and an optional custom name for the query parameter.\n * @returns {HttpInterceptorFn} The interceptor function ready to be applied to the HTTP client.\n *\n * @example\n * ```ts\n * // Applying the interceptor in an Angular module\n * import { HttpClientModule } from '@angular/common/http';\n * import { withHttpLanguageQueryParam } from '@odx/angular/localization';\n *\n * @NgModule({\n * imports: [HttpClientModule],\n * providers: [\n * provideHttpClient(withInterceptors([\n * withHttpLanguageQueryParam({ allowedUrls: ['/api/resources'] })\n * ]))\n * ]\n * })\n * export class ApiModule {}\n * ```\n */\nexport function withHttpLanguageQueryParamInterceptor({ allowedUrls, queryParamName }: HttpLanguageQueryParamInterceptorConfig): HttpInterceptorFn {\n return (req, next) => {\n const language$ = inject(LocalizationService).activeLanguage$.pipe(take(1));\n for (const allowedUrl of allowedUrls) {\n if (!matchUrl(req.url, allowedUrl)) continue;\n return language$.pipe(switchMap((language) => next(req.clone({ setParams: { [queryParamName ?? HTTP_LANGUAGE_QUERY]: language } }))));\n }\n return next(req);\n };\n}\n\n/**\n * Registers the HTTP interceptor that appends the current language as a query parameter to\n * outgoing requests for configured URLs as a localization feature. This utility function\n * simplifies the setup by bundling the interceptor into a feature that can be easily integrated\n * with localization configurations.\n *\n * @param {HttpLanguageQueryParamInterceptorConfig} config - Configuration for appending the\n * language query parameter, including allowed URLs and an optional parameter name.\n * @returns {LocalizationFeature} A localization feature encapsulating the interceptor, ready\n * for integration with the application's localization setup.\n *\n * @example\n * ```ts\n * // Integrating the localization feature in an Angular module\n * import { provideLocalization } from '@angular/core';\n * import { withHttpLanguageQueryParam } from '@odx/angular/localization';\n *\n * @NgModule({\n * providers: [\n * provideLocalization({}, withHttpLanguageQueryParam({ allowedUrls: ['/api'] }))\n * ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function withHttpLanguageQueryParam(config: HttpLanguageQueryParamInterceptorConfig): LocalizationFeature {\n const providers = provideHttpClient(withInterceptors([withHttpLanguageQueryParamInterceptor(config)]));\n\n return makeLocalizationFeature(providers);\n}\n","import { inject } from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { LanguageLoaderFn } from '../models';\n\n/**\n * Asynchronously loads the browser's current language setting by utilizing the `WindowRef` service.\n * This function is intended to be used as a dynamic language loader within a localization configuration,\n * allowing applications to automatically adapt to the user's preferred language as specified in their\n * browser settings.\n *\n * The `WindowRef` service abstracts window-related operations, making it easier to interact with global\n * browser properties and methods in a testable and platform-agnostic way. This function makes use of\n * `WindowRef` to access the navigator's language setting in a safe and Angular-friendly manner.\n *\n * @returns {Promise<string>} A promise that resolves to the language code (e.g., 'en', 'fr') of the\n * browser's currently configured language. This can then be used to set the active language in a\n * localization configuration.\n *\n * @example\n * ```ts\n * // Example usage in a localization configuration\n * import { provideLocalization } from '@odx/angular/utils';\n * import { browserLanguageLoader } from '@odx/angular/localization';\n *\n * @NgModule({\n * providers: [\n * provideLocalization({\n * activeLanguageLoader: browserLanguageLoader,\n * availableLanguages: ['en', 'es', 'fr'],\n * availableLocales: ['en-US', 'es-ES', 'fr-FR']\n * })\n * ]\n * })\n * export class AppModule { }\n * ```\n */\nexport const browserLanguageLoader: LanguageLoaderFn = async () => {\n return inject(WindowRef).getLanguage();\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAKa,MAAA,2BAA2B,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI;AAkBxH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CG;AACU,MAAA,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,GAAG,kBAAkB,CACtI,cAAc,EACd,iCAAiC,EACjC;AACE,IAAA,kBAAkB,EAAE,2BAA2B;AAC1B,CAAA;AAGzB;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,mBAAmB,CAAC,MAAmC,EAAE,GAAG,QAA+B,EAAA;AACzG,IAAA,OAAO,wBAAwB,CAAC;QAC9B,yBAAyB,CAAC,MAAM,CAAC;AACjC,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,UAAU,EAAE,CAAC,mBAAwC,KAAK,MAAM,mBAAmB,CAAC,kBAAkB,EAAE;YACxG,IAAI,EAAE,CAAC,mBAAmB,CAAC;AAC3B,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;QACD,QAAQ;AACT,KAAA,CAAC;AACJ;;AC9GA,aAAe,IAAI,MAAM,CAAC,2BAA2B,CAAC;;MCIzC,mBAAmB,CAAA;AADhC,IAAA,WAAA,GAAA;QAEmB,IAAkB,CAAA,kBAAA,GAAG,wBAAwB,EAAE;AAC/C,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,e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ACnB,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC3E,QAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC;gBAAE;AACpC,YAAA,OAAO,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,cAAc,IAAI,mBAAmB,GAAG,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;;AAEvI,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC;AAClB,KAAC;AACH;AAEA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AACG,SAAU,0BAA0B,CAAC,MAA+C,EAAA;AACxF,IAAA,MAAM,SAAS,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,qCAAqC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEtG,IAAA,OAAO,uBAAuB,CAAC,SAAS,CAAC;AAC3C;;ACtFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACU,MAAA,qBAAqB,GAAqB,YAAW;AAChE,IAAA,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;AACxC;;ACtCA;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-localization.mjs","sources":["../../../../libs/angular/localization/src/lib/localization.config.ts","../../../../libs/angular/localization/src/lib/localization.logger.ts","../../../../libs/angular/localization/src/lib/localization.service.ts","../../../../libs/angular/localization/src/lib/models/localization-feature.ts","../../../../libs/angular/localization/src/lib/features/with-http-language-header.ts","../../../../libs/angular/localization/src/lib/features/with-http-language-query-param.ts","../../../../libs/angular/localization/src/lib/loaders/browser-language-loader.ts","../../../../libs/angular/localization/src/odx-angular-localization.ts"],"sourcesContent":["import { APP_INITIALIZER, EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { createConfigTokens } from '@odx/angular/utils';\nimport { LocalizationService } from './localization.service';\nimport { LanguageLoaderFn, LocalizationFeature } from './models';\n\nexport const DEFAULT_AVAILABLE_LANGUAGES = ['en-US', 'en-GB', 'en', 'de-DE', 'de', 'es-ES', 'es', 'fr-FR', 'fr-CA', 'fr'];\n\n/**\n * Defines the structure for the localization configuration used throughout the application.\n * It allows specifying available languages, and includes an optional loader\n * function for dynamically determining the active language.\n *\n * @property {LanguageLoaderFn} [activeLanguageLoader] Optional function for loading the\n * active language dynamically, useful for scenarios where the application's language\n * needs to be determined based on user settings, browser settings, or external data.\n * @property {string[]} availableLanguages An array of language codes representing the\n * languages available in the application.\n */\nexport interface LocalizationConfig {\n activeLanguageLoader?: LanguageLoaderFn;\n availableLanguages: string[];\n}\n\n/**\n * Utilizes `createConfigTokens` to generate configuration tokens and related utilities for the\n * localization settings within the application. It defines a structured and type-safe approach\n * for managing localization configurations, such as available languages, and potentially\n * a dynamic loader for the active language. The generated tokens and utilities facilitate accessing\n * and providing these configurations throughout the application.\n *\n * @const {InjectionToken<LocalizationConfig>} LocalizationConfig - An InjectionToken for accessing\n * the localization configuration within Angular's dependency injection framework. Use this token to inject\n * localization configurations into services, components, or other tokens.\n *\n * @const {LocalizationConfig} LocalizationDefaultConfig - The default configuration values for localization,\n * based on the provided settings. Includes the default available languages.\n *\n * @const {Function} injectLocalizationConfig - A utility function that returns the injected value of\n * `LocalizationConfig` token. Use this function to access the current localization configuration in\n * a type-safe manner.\n *\n * @const {Function} provideLocalizationConfig - A utility function to provide the `LocalizationConfig` token\n * with specific values. Use this function to configure and override default localization settings within\n * an Angular module or component.\n *\n * @example\n * ```ts\n * // Providing localization settings in an Angular module\n * @NgModule({\n * providers: [\n * provideLocalizationConfig({\n * availableLanguages: ['en', 'es', 'fr'],\n * })\n * ]\n * })\n * export class AppModule { }\n *\n * // Injecting and using the localization configuration in a service\n * @Injectable({ providedIn: 'root' })\n * export class MyLocalizationService {\n * constructor(@Inject(LocalizationConfig) private config: LocalizationConfig) {\n * console.log('Available languages:', config.availableLanguages);\n * }\n * }\n * ```\n */\nexport const { LocalizationConfig, LocalizationDefaultConfig, injectLocalizationConfig, provideLocalizationConfig } = createConfigTokens(\n 'Localization',\n '@odx/angular/internal/translate',\n {\n availableLanguages: DEFAULT_AVAILABLE_LANGUAGES,\n } as LocalizationConfig,\n);\n\n/**\n * Sets up the localization configuration for the application and initializes the localization\n * system with the provided configuration and features. This function is typically called\n * within the main module or a core module of the application to ensure localization settings\n * are available and active as early as possible.\n *\n * @param {Partial<LocalizationConfig>} config The localization configuration settings, including\n * available languages and optionally, a custom loader for the active language.\n * @param {...LocalizationFeature[]} features Additional localization features or configurations\n * to be registered as part of the application's environment providers.\n * @returns {EnvironmentProviders} A collection of providers for setting up the application's\n * localization environment, to be used with Angular's environment-specific injector configuration.\n * @example\n * ```ts\n * // Example of providing localization settings in an Angular module\n * @NgModule({\n * imports: [...],\n * providers: [\n * provideLocalization({\n * availableLanguages: ['en', 'es', 'fr'],\n * activeLanguageLoader: () => fetch('/api/user/language').then(res => res.text()),\n * }),\n * ],\n * })\n * export class AppModule {}\n * ```\n */\nexport function provideLocalization(config: Partial<LocalizationConfig>, ...features: LocalizationFeature[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideLocalizationConfig(config),\n {\n provide: APP_INITIALIZER,\n useFactory: (localizationService: LocalizationService) => () => localizationService.loadActiveLanguage(),\n deps: [LocalizationService],\n multi: true,\n },\n features,\n ]);\n}\n","import { Logger } from '@odx/angular/internal';\n\nexport default new Logger('@odx/angular/localization');\n","import { Injectable, Injector, inject, runInInjectionContext } from '@angular/core';\nimport { BehaviorSubject, Observable, distinctUntilChanged, filter, firstValueFrom, from, isObservable, map, of, shareReplay } from 'rxjs';\nimport { injectLocalizationConfig } from './localization.config';\nimport logger from './localization.logger';\n\n@Injectable({ providedIn: 'root' })\nexport class LocalizationService {\n private readonly localizationConfig = injectLocalizationConfig();\n private readonly injector = inject(Injector);\n private readonly localeState$ = new BehaviorSubject<Intl.Locale | undefined>(new Intl.Locale(this.localizationConfig.availableLanguages[0]));\n\n /**\n * Represents an observable stream of the active language in the localization service.\n * The active language is determined by the locale state.\n *\n * @emits {string} The active language.\n */\n public readonly activeLanguage$ = this.localeState$.pipe(\n filter(Boolean),\n map((x) => x.baseName),\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n /**\n * Gets the list of available languages for localization.\n *\n * @type {string[]} The list of available languages.\n */\n public readonly availableLanguages = this.localizationConfig.availableLanguages;\n\n /** Default language derived from the first entry in the available languages list.\n *\n * @type {string}\n */\n public readonly defaultLanguage = this.availableLanguages[0];\n\n /**\n * Retrieves the currently active language. Falls back to the default language if\n * no active language is set.\n *\n * @returns {string} Full locale name e.g. 'en-US' or just 'en' if no region info is attached.\n */\n public getActiveLanguage(): string {\n return this.localeState$.getValue()?.baseName ?? new Intl.Locale(this.defaultLanguage).baseName;\n }\n\n /**\n * Retrieves the active language subtag.\n *\n * @returns {string} The two-digit language subtag, e.g. 'en', 'fr'.\n */\n public getActiveLanguageSubtag(): string {\n return this.localeState$.getValue()?.language ?? new Intl.Locale(this.defaultLanguage).language;\n }\n\n /**\n * Sets the active language based on the provided language code. If the language is not\n * recognized, it logs an error and does not change the active language.\n *\n * @param {string} language The language code to set as the active language.\n */\n public setActiveLanguage(language: string): void {\n try {\n const locale = new Intl.Locale(language);\n if (this.availableLanguages.includes(locale.baseName) || this.availableLanguages.includes(locale.language)) {\n this.localeState$.next(locale);\n } else {\n throw new Error(`Unrecognizable language '${language}'. Make sure it's a part of availableLanguages inside LocalizationService config.`);\n }\n } catch (error) {\n logger.error(error);\n }\n }\n\n /**\n * Loads the active language for the localization service.\n * This method runs in an injection context and sets the active language based on the result of the active language loader.\n * If the active language loader fails, the default language is set as the active language.\n *\n * @returns {Promise<void>} A promise that resolves when the active language is loaded and set.\n */\n public async loadActiveLanguage(): Promise<void> {\n return runInInjectionContext(this.injector, async () => {\n const activeLanguageLoader$ = this.createActiveLanguageLoader$();\n const activeLanguage = await firstValueFrom(activeLanguageLoader$).catch(() => null);\n this.setActiveLanguage(activeLanguage ?? this.defaultLanguage);\n });\n }\n\n private createActiveLanguageLoader$(): Observable<string | undefined> {\n const language = this.localizationConfig.activeLanguageLoader?.();\n if (isObservable(language)) {\n return language;\n }\n if (language instanceof Promise) {\n return from(language);\n }\n return of(language);\n }\n}\n","import { EnvironmentProviders, Provider } from '@angular/core';\n\nexport type LocalizationFeature = EnvironmentProviders & { ɵodxBrand: '@odx/angular/localization::LocalizationFeature' };\n\n/**\n * @internal\n * Creates a feature provider for the localization module.\n *\n * @param {Provider[] | EnvironmentProviders} provider - The providers to be used for the localization feature.\n * @returns {LocalizationFeature} The localization feature provider.\n */\nexport function makeLocalizationFeature(provider: Provider[] | EnvironmentProviders): LocalizationFeature {\n return provider as never as LocalizationFeature;\n}\n","import { HttpInterceptorFn, provideHttpClient, withInterceptors } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { matchUrl } from '@odx/angular/utils';\nimport { switchMap, take } from 'rxjs';\nimport { LocalizationService } from '../localization.service';\nimport { LocalizationFeature, makeLocalizationFeature } from '../models';\n\nexport const HTTP_LANGUAGE_HEADER = 'Accept-Language';\n\n/**\n * Configuration object for the HTTP language header interceptor. It specifies which URLs\n * the interceptor should apply to and allows customizing the name of the header used to transmit\n * the current language setting.\n *\n * @property {Array<string | RegExp>} allowedUrls - An array of strings or RegExp patterns\n * indicating the URLs to which the language header should be added.\n * @property {string} [headerName=HTTP_LANGUAGE_HEADER] - Optional. The name of the HTTP header\n * through which the current language setting will be transmitted. Defaults to 'Accept-Language'.\n */\nexport interface HttpLanguageHeaderInterceptorConfig {\n allowedUrls: Array<string | RegExp>;\n headerName?: string;\n}\n\n/**\n * Creates an HTTP interceptor function that adds a language header to outgoing HTTP requests,\n * but only for URLs matching the provided criteria. This allows the server to respond with\n * resources localized in the user's current language.\n *\n * @param {HttpLanguageHeaderInterceptorConfig} config - The configuration for the interceptor,\n * including the list of allowed URLs and optionally a custom header name.\n * @returns {HttpInterceptorFn} An Angular HTTP interceptor function that conditionally adds\n * the current language as an HTTP header based on the request URL.\n *\n * @example\n * ```ts\n * // Use in HTTP client module setup\n * import { HttpClientModule } from '@angular/common/http';\n * import { httpLanguageHeaderInterceptor, HTTP_LANGUAGE_HEADER } from '@odx/angular/localization';\n *\n * @NgModule({\n * imports: [HttpClientModule],\n * providers: [\n * provideHttpClient(withInterceptors([\n * httpLanguageHeaderInterceptor({ allowedUrls: ['/api'], headerName: HTTP_LANGUAGE_HEADER })\n * ]))\n * ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function httpLanguageHeaderInterceptor({ allowedUrls, headerName }: HttpLanguageHeaderInterceptorConfig): HttpInterceptorFn {\n return (req, next) => {\n const language$ = inject(LocalizationService).activeLanguage$.pipe(take(1));\n for (const allowedUrl of allowedUrls) {\n if (!matchUrl(req.url, allowedUrl)) continue;\n return language$.pipe(switchMap((language) => next(req.clone({ setHeaders: { [headerName ?? HTTP_LANGUAGE_HEADER]: language } }))));\n }\n return next(req);\n };\n}\n\n/**\n * Provides a localization feature that automatically adds a language header to HTTP requests\n * for specified URLs, using the current active language. This function simplifies setting up\n * the HTTP language header interceptor by wrapping it into a LocalizationFeature, making it easy\n * to integrate with the application's localization infrastructure.\n *\n * @param {HttpLanguageHeaderInterceptorConfig} config - The configuration for the language header\n * interceptor, specifying which URLs should include the language header and optionally defining a\n * custom header name.\n * @returns {LocalizationFeature} A localization feature object that can be used to configure\n * the application's localization settings to include automatic language header addition for HTTP requests.\n *\n * @example\n * ```ts\n * // Example usage with the localization provider\n * import { provideLocalization, LocalizationModule, withHttpLanguageHeader } from '@odx/angular/localization';\n *\n * @NgModule({\n * imports: [LocalizationModule],\n * providers: [\n * provideLocalization({}, withHttpLanguageHeader({ allowedUrls: ['/api'] }))\n * ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function withHttpLanguageHeader(config: HttpLanguageHeaderInterceptorConfig): LocalizationFeature {\n const providers = provideHttpClient(withInterceptors([httpLanguageHeaderInterceptor(config)]));\n\n return makeLocalizationFeature(providers);\n}\n","import { HttpInterceptorFn, provideHttpClient, withInterceptors } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { matchUrl } from '@odx/angular/utils';\nimport { switchMap, take } from 'rxjs';\nimport { LocalizationService } from '../localization.service';\nimport { LocalizationFeature, makeLocalizationFeature } from '../models';\n\nexport const HTTP_LANGUAGE_QUERY = 'language';\n\n/**\n * Defines the configuration options for the HTTP interceptor that appends the current\n * language setting as a query parameter to outgoing requests. This configuration specifies\n * which requests should have the language parameter appended based on their URLs.\n *\n * @property {Array<string | RegExp>} allowedUrls - URLs (or patterns matching URLs) to which\n * the language query parameter should be appended.\n * @property {string} [queryParamName=HTTP_LANGUAGE_QUERY] - The name of the query parameter\n * used to transmit the current language. Defaults to 'language'.\n */\nexport interface HttpLanguageQueryParamInterceptorConfig {\n allowedUrls: Array<string | RegExp>;\n queryParamName?: string;\n}\n\n/**\n * Creates an HTTP interceptor function that appends the current language as a query parameter\n * to outgoing HTTP requests that match specified URLs. This interceptor enables dynamic content\n * localization by informing the backend of the user's preferred language.\n *\n * @param {HttpLanguageQueryParamInterceptorConfig} config - Configuration for the interceptor,\n * including allowed URLs and an optional custom name for the query parameter.\n * @returns {HttpInterceptorFn} The interceptor function ready to be applied to the HTTP client.\n *\n * @example\n * ```ts\n * // Applying the interceptor in an Angular module\n * import { HttpClientModule } from '@angular/common/http';\n * import { withHttpLanguageQueryParam } from '@odx/angular/localization';\n *\n * @NgModule({\n * imports: [HttpClientModule],\n * providers: [\n * provideHttpClient(withInterceptors([\n * withHttpLanguageQueryParam({ allowedUrls: ['/api/resources'] })\n * ]))\n * ]\n * })\n * export class ApiModule {}\n * ```\n */\nexport function withHttpLanguageQueryParamInterceptor({ allowedUrls, queryParamName }: HttpLanguageQueryParamInterceptorConfig): HttpInterceptorFn {\n return (req, next) => {\n const language$ = inject(LocalizationService).activeLanguage$.pipe(take(1));\n for (const allowedUrl of allowedUrls) {\n if (!matchUrl(req.url, allowedUrl)) continue;\n return language$.pipe(switchMap((language) => next(req.clone({ setParams: { [queryParamName ?? HTTP_LANGUAGE_QUERY]: language } }))));\n }\n return next(req);\n };\n}\n\n/**\n * Registers the HTTP interceptor that appends the current language as a query parameter to\n * outgoing requests for configured URLs as a localization feature. This utility function\n * simplifies the setup by bundling the interceptor into a feature that can be easily integrated\n * with localization configurations.\n *\n * @param {HttpLanguageQueryParamInterceptorConfig} config - Configuration for appending the\n * language query parameter, including allowed URLs and an optional parameter name.\n * @returns {LocalizationFeature} A localization feature encapsulating the interceptor, ready\n * for integration with the application's localization setup.\n *\n * @example\n * ```ts\n * // Integrating the localization feature in an Angular module\n * import { provideLocalization } from '@angular/core';\n * import { withHttpLanguageQueryParam } from '@odx/angular/localization';\n *\n * @NgModule({\n * providers: [\n * provideLocalization({}, withHttpLanguageQueryParam({ allowedUrls: ['/api'] }))\n * ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function withHttpLanguageQueryParam(config: HttpLanguageQueryParamInterceptorConfig): LocalizationFeature {\n const providers = provideHttpClient(withInterceptors([withHttpLanguageQueryParamInterceptor(config)]));\n\n return makeLocalizationFeature(providers);\n}\n","import { inject } from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { LanguageLoaderFn } from '../models';\n\n/**\n * Asynchronously loads the browser's current language setting by utilizing the `WindowRef` service.\n * This function is intended to be used as a dynamic language loader within a localization configuration,\n * allowing applications to automatically adapt to the user's preferred language as specified in their\n * browser settings.\n *\n * The `WindowRef` service abstracts window-related operations, making it easier to interact with global\n * browser properties and methods in a testable and platform-agnostic way. This function makes use of\n * `WindowRef` to access the navigator's language setting in a safe and Angular-friendly manner.\n *\n * @returns {Promise<string>} A promise that resolves to the language code (e.g., 'en', 'fr') of the\n * browser's currently configured language. This can then be used to set the active language in a\n * localization configuration.\n *\n * @example\n * ```ts\n * // Example usage in a localization configuration\n * import { provideLocalization } from '@odx/angular/utils';\n * import { browserLanguageLoader } from '@odx/angular/localization';\n *\n * @NgModule({\n * providers: [\n * provideLocalization({\n * activeLanguageLoader: browserLanguageLoader,\n * availableLanguages: ['en', 'es', 'fr'],\n * availableLocales: ['en-US', 'es-ES', 'fr-FR']\n * })\n * ]\n * })\n * export class AppModule { }\n * ```\n */\nexport const browserLanguageLoader: LanguageLoaderFn = async () => {\n return inject(WindowRef).getLanguage();\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAKa,MAAA,2BAA2B,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAkB1H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CG;AACU,MAAA,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,GAAG,kBAAkB,CACtI,cAAc,EACd,iCAAiC,EACjC;AACE,IAAA,kBAAkB,EAAE,2BAA2B;AAC1B,CAAA,EACvB;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,mBAAmB,CAAC,MAAmC,EAAE,GAAG,QAA+B,EAAA;AACzG,IAAA,OAAO,wBAAwB,CAAC;QAC9B,yBAAyB,CAAC,MAAM,CAAC;AACjC,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,UAAU,EAAE,CAAC,mBAAwC,KAAK,MAAM,mBAAmB,CAAC,kBAAkB,EAAE;YACxG,IAAI,EAAE,CAAC,mBAAmB,CAAC;AAC3B,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;QACD,QAAQ;AACT,KAAA,CAAC,CAAC;AACL;;AC9GA,aAAe,IAAI,M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