oasys-lib 2.37.7 → 2.38.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.
@@ -3788,6 +3788,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
3788
3788
  }]
3789
3789
  }] });
3790
3790
 
3791
+ const THEME_VALUE = {
3792
+ DEFAULT: 'default',
3793
+ TIER_1: 'loyalty-tier-1',
3794
+ TIER_2: 'loyalty-tier-2',
3795
+ };
3796
+ const SCOPED_THEME_CLASSES = [THEME_VALUE.TIER_1, THEME_VALUE.TIER_2];
3797
+ class OasysThemeDirective {
3798
+ uiThemeDashed = input(THEME_VALUE.DEFAULT, ...(ngDevMode ? [{ debugName: "uiThemeDashed", alias: 'ui-theme' }] : [{ alias: 'ui-theme' }]));
3799
+ uiThemeCamel = input(undefined, ...(ngDevMode ? [{ debugName: "uiThemeCamel", alias: 'uiTheme' }] : [{ alias: 'uiTheme' }]));
3800
+ elementRef = inject(ElementRef);
3801
+ appliedDefaultBrandClass;
3802
+ appliedTheme;
3803
+ constructor() {
3804
+ effect(() => {
3805
+ const nextTheme = this.uiThemeCamel() ?? this.uiThemeDashed();
3806
+ this.applyTheme(nextTheme);
3807
+ });
3808
+ }
3809
+ applyTheme(nextTheme) {
3810
+ if (nextTheme === this.appliedTheme)
3811
+ return;
3812
+ const host = this.elementRef.nativeElement;
3813
+ const classList = host.classList;
3814
+ if (nextTheme !== THEME_VALUE.DEFAULT) {
3815
+ // Remove previously applied default reset class.
3816
+ if (this.appliedDefaultBrandClass) {
3817
+ classList.remove(this.appliedDefaultBrandClass);
3818
+ this.appliedDefaultBrandClass = undefined;
3819
+ }
3820
+ // Remove all scoped theme classes before applying the next one.
3821
+ SCOPED_THEME_CLASSES.forEach((themeClass) => {
3822
+ classList.remove(themeClass);
3823
+ });
3824
+ if (!classList.contains(nextTheme))
3825
+ classList.add(nextTheme);
3826
+ this.appliedTheme = nextTheme;
3827
+ return;
3828
+ }
3829
+ SCOPED_THEME_CLASSES.forEach((themeClass) => {
3830
+ classList.remove(themeClass);
3831
+ });
3832
+ const defaultBrandClass = this.findNearestBrandTokenClass(host);
3833
+ if (defaultBrandClass) {
3834
+ if (this.appliedDefaultBrandClass && this.appliedDefaultBrandClass !== defaultBrandClass) {
3835
+ classList.remove(this.appliedDefaultBrandClass);
3836
+ }
3837
+ classList.add(defaultBrandClass);
3838
+ this.appliedDefaultBrandClass = defaultBrandClass;
3839
+ }
3840
+ else if (this.appliedDefaultBrandClass) {
3841
+ classList.remove(this.appliedDefaultBrandClass);
3842
+ this.appliedDefaultBrandClass = undefined;
3843
+ }
3844
+ this.appliedTheme = nextTheme;
3845
+ }
3846
+ findNearestBrandTokenClass(host) {
3847
+ let node = host.parentElement;
3848
+ while (node) {
3849
+ const classList = node.classList;
3850
+ for (let i = 0; i < classList.length; i += 1) {
3851
+ const className = classList.item(i);
3852
+ if (className?.startsWith('brand-tokens-'))
3853
+ return className;
3854
+ }
3855
+ node = node.parentElement;
3856
+ }
3857
+ return undefined;
3858
+ }
3859
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OasysThemeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3860
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.25", type: OasysThemeDirective, isStandalone: true, selector: "[ui-theme], [uiTheme]", inputs: { uiThemeDashed: { classPropertyName: "uiThemeDashed", publicName: "ui-theme", isSignal: true, isRequired: false, transformFunction: null }, uiThemeCamel: { classPropertyName: "uiThemeCamel", publicName: "uiTheme", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
3861
+ }
3862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OasysThemeDirective, decorators: [{
3863
+ type: Directive,
3864
+ args: [{
3865
+ selector: '[ui-theme], [uiTheme]',
3866
+ standalone: true,
3867
+ }]
3868
+ }], ctorParameters: () => [], propDecorators: { uiThemeDashed: [{ type: i0.Input, args: [{ isSignal: true, alias: "ui-theme", required: false }] }], uiThemeCamel: [{ type: i0.Input, args: [{ isSignal: true, alias: "uiTheme", required: false }] }] } });
3869
+
3870
+ class OasysDirectivesModule {
3871
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OasysDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3872
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: OasysDirectivesModule, imports: [OasysHrefDirective, OasysAutofocusDirective, OasysThemeDirective], exports: [OasysHrefDirective, OasysAutofocusDirective, OasysThemeDirective] });
3873
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OasysDirectivesModule });
3874
+ }
3875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OasysDirectivesModule, decorators: [{
3876
+ type: NgModule,
3877
+ args: [{
3878
+ imports: [OasysHrefDirective, OasysAutofocusDirective, OasysThemeDirective],
3879
+ exports: [OasysHrefDirective, OasysAutofocusDirective, OasysThemeDirective],
3880
+ }]
3881
+ }] });
3882
+
3791
3883
  /*
3792
3884
  * Public API Surface of oasys-lib
3793
3885
  */
@@ -3796,5 +3888,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
3796
3888
  * Generated bundle index. Do not edit.
3797
3889
  */
3798
3890
 
3799
- export { BannerComponent, BreadcrumbsComponent, CardComponent, CheckboxComponent, ChipComponent, DividerComponent, FormErrorsComponent, FormGroupComponent, HeroComponent, IMAGE_BREAKPOINTS, IMAGE_URL_PROVIDER, IconComponent, ImageComponent, LayoutBoxComponent, LayoutContainerComponent, LayoutGridColumnComponent, LayoutGridComponent, LayoutStackComponent, OasysAlertCancelDirective, OasysAlertComponent, OasysAlertConfirmDirective, OasysAlertContentDirective, OasysAlertModule, OasysAlertTitleDirective, BannerComponent as OasysBannerComponent, OasysBannerModule, OasysBreadcrumbModule, BreadcrumbsComponent as OasysBreadcrumbsComponent, OasysButtonComponent, OasysButtonGroupComponent, OasysButtonGroupModule, OasysButtonModule, CardComponent as OasysCardComponent, OasysCardModule, CheckboxComponent as OasysCheckboxComponent, OasysCheckboxModule, ChipComponent as OasysChipComponent, OasysChipModule, OasysComboboxComponent, DividerComponent as OasysDividerComponent, OasysDividerModule, FormErrorsComponent as OasysFormErrorsComponent, OasysFormErrorsModule, OasysFormErrorsSummaryComponent, OasysFormErrorsSummaryItemComponent, OasysFormErrorsSummaryTitleComponent, FormGroupComponent as OasysFormGroupComponent, OasysFormGroupModule, OasysHeadingComponent, OasysHeadingModule, HeroComponent as OasysHeroComponent, OasysHeroModule, IconComponent as OasysIconComponent, OasysIconModule, ImageComponent as OasysImageComponent, OasysImageModule, LayoutBoxComponent as OasysLayoutBoxComponent, LayoutContainerComponent as OasysLayoutContainerComponent, LayoutGridColumnComponent as OasysLayoutGridColumnComponent, LayoutGridComponent as OasysLayoutGridComponent, OasysLayoutModule, LayoutStackComponent as OasysLayoutStackComponent, OasysPillComponent, OasysPillGroupComponent, OasysPillGroupModule, OasysPillModule, ProgressBarComponent as OasysProgressBarComponent, PromoCardComponent as OasysPromoCardComponent, OasysPromoCardModule, RadioComponent as OasysRadioComponent, OasysRadioModule, SectionComponent as OasysSectionComponent, SelectCardComponent as OasysSelectCardComponent, OasysSelectCardModule, OasysTabComponent, OasysTabGroupComponent, OasysTabsModule, TextComponent as OasysTextComponent, TextInputComponent as OasysTextInputComponent, OasysTextInputModule, OasysTextModule, TextareaComponent as OasysTextareaComponent, ProgressBarComponent, PromoCardComponent, ROUTING_HANDLER, RadioComponent, SWIPER_PROVIDER_TOKEN, SectionComponent, SectionModule, SelectCardComponent, SwiperProvider, TextComponent, TextareaComponent };
3891
+ export { BannerComponent, BreadcrumbsComponent, CardComponent, CheckboxComponent, ChipComponent, DividerComponent, FormErrorsComponent, FormGroupComponent, HeroComponent, IMAGE_BREAKPOINTS, IMAGE_URL_PROVIDER, IconComponent, ImageComponent, LayoutBoxComponent, LayoutContainerComponent, LayoutGridColumnComponent, LayoutGridComponent, LayoutStackComponent, OasysAlertCancelDirective, OasysAlertComponent, OasysAlertConfirmDirective, OasysAlertContentDirective, OasysAlertModule, OasysAlertTitleDirective, OasysAutofocusDirective, BannerComponent as OasysBannerComponent, OasysBannerModule, OasysBreadcrumbModule, BreadcrumbsComponent as OasysBreadcrumbsComponent, OasysButtonComponent, OasysButtonGroupComponent, OasysButtonGroupModule, OasysButtonModule, CardComponent as OasysCardComponent, OasysCardModule, CheckboxComponent as OasysCheckboxComponent, OasysCheckboxModule, ChipComponent as OasysChipComponent, OasysChipModule, OasysComboboxComponent, OasysDirectivesModule, DividerComponent as OasysDividerComponent, OasysDividerModule, FormErrorsComponent as OasysFormErrorsComponent, OasysFormErrorsModule, OasysFormErrorsSummaryComponent, OasysFormErrorsSummaryItemComponent, OasysFormErrorsSummaryTitleComponent, FormGroupComponent as OasysFormGroupComponent, OasysFormGroupModule, OasysHeadingComponent, OasysHeadingModule, HeroComponent as OasysHeroComponent, OasysHeroModule, OasysHrefDirective, IconComponent as OasysIconComponent, OasysIconModule, ImageComponent as OasysImageComponent, OasysImageModule, LayoutBoxComponent as OasysLayoutBoxComponent, LayoutContainerComponent as OasysLayoutContainerComponent, LayoutGridColumnComponent as OasysLayoutGridColumnComponent, LayoutGridComponent as OasysLayoutGridComponent, OasysLayoutModule, LayoutStackComponent as OasysLayoutStackComponent, OasysPillComponent, OasysPillGroupComponent, OasysPillGroupModule, OasysPillModule, ProgressBarComponent as OasysProgressBarComponent, PromoCardComponent as OasysPromoCardComponent, OasysPromoCardModule, RadioComponent as OasysRadioComponent, OasysRadioModule, SectionComponent as OasysSectionComponent, SelectCardComponent as OasysSelectCardComponent, OasysSelectCardModule, OasysTabComponent, OasysTabGroupComponent, OasysTabsModule, TextComponent as OasysTextComponent, TextInputComponent as OasysTextInputComponent, OasysTextInputModule, OasysTextModule, TextareaComponent as OasysTextareaComponent, OasysThemeDirective, ProgressBarComponent, PromoCardComponent, ROUTING_HANDLER, RadioComponent, SWIPER_PROVIDER_TOKEN, SectionComponent, SectionModule, SelectCardComponent, SwiperProvider, TextComponent, TextareaComponent };
3800
3892
  //# sourceMappingURL=oasys-lib.mjs.map