@rededor/site-front-end-lib 20.0.10 → 20.0.11
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.
|
@@ -13,6 +13,7 @@ declare class SidebarNavigationComponent implements AfterViewInit {
|
|
|
13
13
|
readonly activeSection: _angular_core.WritableSignal<string>;
|
|
14
14
|
selectedIndex: _angular_core.WritableSignal<number>;
|
|
15
15
|
defaultAnchorAdjustment: _angular_core.WritableSignal<number>;
|
|
16
|
+
readonly isStarTheme: _angular_core.InputSignal<boolean>;
|
|
16
17
|
private menuHeaderHeight;
|
|
17
18
|
readonly anchorAdjustment: _angular_core.InputSignal<number>;
|
|
18
19
|
readonly title: _angular_core.InputSignal<string>;
|
|
@@ -25,6 +26,7 @@ declare class SidebarNavigationComponent implements AfterViewInit {
|
|
|
25
26
|
onWindowScroll(): void;
|
|
26
27
|
styleBinding: {
|
|
27
28
|
'--font-family': string;
|
|
29
|
+
'--primary-base': string;
|
|
28
30
|
};
|
|
29
31
|
ngAfterViewInit(): void;
|
|
30
32
|
private windowScroll;
|
|
@@ -32,7 +34,7 @@ declare class SidebarNavigationComponent implements AfterViewInit {
|
|
|
32
34
|
getPath(sectionId: string): string;
|
|
33
35
|
onSectionClick(event: SectionNavigationData): void;
|
|
34
36
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SidebarNavigationComponent, never>;
|
|
35
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SidebarNavigationComponent, "nav[rdsite-sidebar-navigation]", never, { "anchorAdjustment": { "alias": "anchorAdjustment"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "navigationSections": { "alias": "navigationSections"; "required": true; }; "navigationConfig": { "alias": "navigationConfig"; "required": false; }; }, { "sectionChange": "sectionChange"; }, never, never, true, never>;
|
|
37
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SidebarNavigationComponent, "nav[rdsite-sidebar-navigation]", never, { "isStarTheme": { "alias": "isStarTheme"; "required": false; "isSignal": true; }; "anchorAdjustment": { "alias": "anchorAdjustment"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "navigationSections": { "alias": "navigationSections"; "required": true; }; "navigationConfig": { "alias": "navigationConfig"; "required": false; }; }, { "sectionChange": "sectionChange"; }, never, never, true, never>;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export { SidebarNavigationComponent };
|
|
@@ -19,6 +19,7 @@ class SidebarNavigationComponent {
|
|
|
19
19
|
this.activeSection = signal('', ...(ngDevMode ? [{ debugName: "activeSection" }] : []));
|
|
20
20
|
this.selectedIndex = signal(0, ...(ngDevMode ? [{ debugName: "selectedIndex" }] : []));
|
|
21
21
|
this.defaultAnchorAdjustment = signal(0, ...(ngDevMode ? [{ debugName: "defaultAnchorAdjustment" }] : []));
|
|
22
|
+
this.isStarTheme = input(false, ...(ngDevMode ? [{ debugName: "isStarTheme" }] : []));
|
|
22
23
|
this.menuHeaderHeight = 0;
|
|
23
24
|
this.anchorAdjustment = input(0, ...(ngDevMode ? [{ debugName: "anchorAdjustment" }] : []));
|
|
24
25
|
this.title = input('Nesta página', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
@@ -28,6 +29,7 @@ class SidebarNavigationComponent {
|
|
|
28
29
|
this.sectionChange = output();
|
|
29
30
|
this.styleBinding = {
|
|
30
31
|
'--font-family': this.curaApiService.theme.fonts.getFamily(''),
|
|
32
|
+
'--primary-base': this.curaApiService.theme.colors.getColor('primary-base'),
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
set navigationSections(value) {
|
|
@@ -81,12 +83,12 @@ class SidebarNavigationComponent {
|
|
|
81
83
|
this.sectionChange.emit(event);
|
|
82
84
|
}
|
|
83
85
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SidebarNavigationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
84
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: SidebarNavigationComponent, isStandalone: true, selector: "nav[rdsite-sidebar-navigation]", inputs: { anchorAdjustment: { classPropertyName: "anchorAdjustment", publicName: "anchorAdjustment", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, padding: { classPropertyName: "padding", publicName: "padding", isSignal: true, isRequired: false, transformFunction: null }, navigationSections: { classPropertyName: "navigationSections", publicName: "navigationSections", isSignal: false, isRequired: true, transformFunction: null }, navigationConfig: { classPropertyName: "navigationConfig", publicName: "navigationConfig", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { sectionChange: "sectionChange" }, host: { listeners: { "window:scroll": "onWindowScroll()" }, properties: { "style": "this.styleBinding" } }, viewQueries: [{ propertyName: "anchorsEl", predicate: ["anchorEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<nav class=\"rdsite-sidebar-navigation\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n <cura-card
|
|
86
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: SidebarNavigationComponent, isStandalone: true, selector: "nav[rdsite-sidebar-navigation]", inputs: { isStarTheme: { classPropertyName: "isStarTheme", publicName: "isStarTheme", isSignal: true, isRequired: false, transformFunction: null }, anchorAdjustment: { classPropertyName: "anchorAdjustment", publicName: "anchorAdjustment", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, padding: { classPropertyName: "padding", publicName: "padding", isSignal: true, isRequired: false, transformFunction: null }, navigationSections: { classPropertyName: "navigationSections", publicName: "navigationSections", isSignal: false, isRequired: true, transformFunction: null }, navigationConfig: { classPropertyName: "navigationConfig", publicName: "navigationConfig", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { sectionChange: "sectionChange" }, host: { listeners: { "window:scroll": "onWindowScroll()" }, properties: { "style": "this.styleBinding" } }, viewQueries: [{ propertyName: "anchorsEl", predicate: ["anchorEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<nav class=\"rdsite-sidebar-navigation\" [class.starTheme]=\"isStarTheme()\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n <cura-card\n class=\"only-mobile\"\n [type]=\"isStarTheme() ? 'transparent' : 'solid'\"\n [hasPadding]=\"isStarTheme() ? false : true\"\n marginBlock=\"8px\"\n [hasShadow]=\"false\"\n type=\"solid\"\n colorMode=\"light\"\n target=\"_self\"\n >\n @if (title()) {\n <cura-paragraph size=\"small\" color=\"neutral-black\" marginBlock=\"8px\">\n <b>{{ title() }}</b>\n </cura-paragraph>\n }\n <ul role=\"menubar\">\n @for (section of sections(); track section.id) {\n <li role=\"none\">\n <cura-paragraph size=\"xsmall\" marginBlock=\"8px\" [color]=\"activeSection() === section.id ? 'neutral-black' : 'primary-base'\">\n <a\n #anchorEl\n id=\"anchor-{{ section.id }}\"\n class=\"rdsite-sidebar-link\"\n role=\"menuitem\"\n [href]=\"getPath(section.id)\"\n (click)=\"onSectionClick({ id: section.id, title: section.title })\"\n rdsitelink\n [anchorAdjustment]=\"anchorAdjustment() || defaultAnchorAdjustment()\"\n [attr.aria-current]=\"activeSection() === section.id ? 'page' : null\"\n [attr.aria-label]=\"'Navegar para ' + section.title\"\n >\n <b>\n {{ section.title }}\n </b>\n </a>\n </cura-paragraph>\n </li>\n }\n </ul>\n </cura-card>\n</nav>\n", styles: ["nav *{font-family:var(--font-family)}nav ul{display:flex;flex-direction:column}nav ul li{width:100%}nav ul li cura-paragraph,nav ul li a{text-align:left}nav ul li a{color:unset;text-decoration:none}nav.starTheme{border-right:1px solid var(--primary-base)}\n"], dependencies: [{ kind: "directive", type: RdsiteLinkDirective, selector: "[rdsitelink]", inputs: ["anchorAdjustment", "anchorExtraAdjustment", "phonemodal"] }, { kind: "component", type: CuraCardComponent, selector: "cura-card", inputs: ["hasPadding", "hasShadow", "type", "colorMode", "href", "target"] }, { kind: "component", type: CuraParagraphComponent, selector: "cura-paragraph", inputs: ["size", "spotColor", "color", "marginBlock", "lineHeight", "textOverflow"] }] }); }
|
|
85
87
|
}
|
|
86
88
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SidebarNavigationComponent, decorators: [{
|
|
87
89
|
type: Component,
|
|
88
|
-
args: [{ selector: 'nav[rdsite-sidebar-navigation]', imports: [RdsiteLinkDirective, CuraCardComponent, CuraParagraphComponent], template: "<nav class=\"rdsite-sidebar-navigation\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n <cura-card
|
|
89
|
-
}], propDecorators: { anchorAdjustment: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorAdjustment", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], padding: [{ type: i0.Input, args: [{ isSignal: true, alias: "padding", required: false }] }], navigationSections: [{
|
|
90
|
+
args: [{ selector: 'nav[rdsite-sidebar-navigation]', imports: [RdsiteLinkDirective, CuraCardComponent, CuraParagraphComponent], template: "<nav class=\"rdsite-sidebar-navigation\" [class.starTheme]=\"isStarTheme()\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n <cura-card\n class=\"only-mobile\"\n [type]=\"isStarTheme() ? 'transparent' : 'solid'\"\n [hasPadding]=\"isStarTheme() ? false : true\"\n marginBlock=\"8px\"\n [hasShadow]=\"false\"\n type=\"solid\"\n colorMode=\"light\"\n target=\"_self\"\n >\n @if (title()) {\n <cura-paragraph size=\"small\" color=\"neutral-black\" marginBlock=\"8px\">\n <b>{{ title() }}</b>\n </cura-paragraph>\n }\n <ul role=\"menubar\">\n @for (section of sections(); track section.id) {\n <li role=\"none\">\n <cura-paragraph size=\"xsmall\" marginBlock=\"8px\" [color]=\"activeSection() === section.id ? 'neutral-black' : 'primary-base'\">\n <a\n #anchorEl\n id=\"anchor-{{ section.id }}\"\n class=\"rdsite-sidebar-link\"\n role=\"menuitem\"\n [href]=\"getPath(section.id)\"\n (click)=\"onSectionClick({ id: section.id, title: section.title })\"\n rdsitelink\n [anchorAdjustment]=\"anchorAdjustment() || defaultAnchorAdjustment()\"\n [attr.aria-current]=\"activeSection() === section.id ? 'page' : null\"\n [attr.aria-label]=\"'Navegar para ' + section.title\"\n >\n <b>\n {{ section.title }}\n </b>\n </a>\n </cura-paragraph>\n </li>\n }\n </ul>\n </cura-card>\n</nav>\n", styles: ["nav *{font-family:var(--font-family)}nav ul{display:flex;flex-direction:column}nav ul li{width:100%}nav ul li cura-paragraph,nav ul li a{text-align:left}nav ul li a{color:unset;text-decoration:none}nav.starTheme{border-right:1px solid var(--primary-base)}\n"] }]
|
|
91
|
+
}], propDecorators: { isStarTheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "isStarTheme", required: false }] }], anchorAdjustment: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorAdjustment", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], padding: [{ type: i0.Input, args: [{ isSignal: true, alias: "padding", required: false }] }], navigationSections: [{
|
|
90
92
|
type: Input,
|
|
91
93
|
args: [{ required: true }]
|
|
92
94
|
}], navigationConfig: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rededor-site-front-end-lib-components-sidebar-navigation.mjs","sources":["../../../projects/site-front-end-lib/components/sidebar-navigation/sidebar-navigation.component.ts","../../../projects/site-front-end-lib/components/sidebar-navigation/sidebar-navigation.component.html","../../../projects/site-front-end-lib/components/sidebar-navigation/rededor-site-front-end-lib-components-sidebar-navigation.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n Input,\n signal,\n HostListener,\n HostBinding,\n inject,\n input,\n output,\n viewChildren,\n DOCUMENT,\n PLATFORM_ID,\n AfterViewInit,\n} from '@angular/core';\nimport { RdsiteLinkDirective, SectionNavigationConfig, SectionNavigationData } from '@rededor/site-front-end-lib/core';\nimport { CuraCardComponent } from '@rededor/site-front-end-lib/cura/cards/cura-card';\nimport { CuraParagraphComponent } from '@rededor/site-front-end-lib/cura/texts/cura-paragraph';\nimport { CuraApiService } from '@rededor/site-front-end-lib/cura/api';\nimport { Router } from '@angular/router';\nimport { isPlatformBrowser, Location } from '@angular/common';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'nav[rdsite-sidebar-navigation]',\n imports: [RdsiteLinkDirective, CuraCardComponent, CuraParagraphComponent],\n templateUrl: './sidebar-navigation.component.html',\n styleUrl: './sidebar-navigation.component.scss',\n})\nexport class SidebarNavigationComponent implements AfterViewInit {\n private readonly curaApiService = inject(CuraApiService);\n private router = inject(Router);\n private location = inject(Location);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n\n readonly sections = signal<SectionNavigationData[]>([]);\n readonly config = signal<SectionNavigationConfig | undefined>(undefined);\n readonly activeSection = signal<string>('');\n public selectedIndex = signal<number>(0);\n public defaultAnchorAdjustment = signal(0);\n\n private menuHeaderHeight = 0;\n\n readonly anchorAdjustment = input(0);\n readonly title = input('Nesta página');\n readonly ariaLabel = input('Navegação da página');\n readonly padding = input(-50);\n\n @Input({ required: true })\n set navigationSections(value: SectionNavigationData[]) {\n if (!value?.length) {\n throw new Error('O SectionNavigationComponent requer pelo menos uma seção.');\n }\n this.sections.set(value);\n\n if (!this.activeSection()) {\n this.activeSection.set(value[0].id);\n }\n }\n\n @Input()\n set navigationConfig(value: SectionNavigationConfig) {\n this.config.set(value);\n }\n\n readonly anchorsEl = viewChildren<ElementRef<HTMLAnchorElement>>('anchorEl');\n readonly sectionChange = output<SectionNavigationData>();\n\n @HostListener('window:scroll')\n onWindowScroll(): void {\n this.windowScroll();\n }\n\n @HostBinding('style') styleBinding = {\n '--font-family': this.curaApiService.theme.fonts.getFamily(''),\n };\n\n ngAfterViewInit(): void {\n if (isPlatformBrowser(this.platformId)) {\n setTimeout(() => {\n this.menuHeaderHeight = this.document.querySelector<HTMLElement>('header[sl-hdr]')?.offsetHeight || 0;\n this.defaultAnchorAdjustment.set(this.menuHeaderHeight + (this.padding() - 1));\n }, 200);\n }\n }\n\n private windowScroll(): void {\n this.selectedIndex.set(-1);\n\n this.sections()?.forEach((section, index) => {\n const element = document.querySelector<HTMLElement>(`#${section.id}`);\n if (!element) return;\n\n const elementTop = element.getBoundingClientRect().top + window.scrollY;\n const currentScroll = window.scrollY + this.menuHeaderHeight + this.padding();\n if (currentScroll >= elementTop) {\n this.selectedIndex.set(index);\n if (this.sections()?.[this.selectedIndex()]) {\n this.activeSection.set(this.sections()?.[this.selectedIndex()]?.id);\n }\n }\n });\n }\n\n getBasePath(): string {\n const base = this.location.prepareExternalUrl('');\n const normalized = base.replace(/\\/$/, '');\n\n return normalized === '' || normalized === '/' ? '' : normalized;\n }\n\n getPath(sectionId: string): string {\n return `${this.getBasePath}${this.router.url}#${sectionId}`;\n }\n\n onSectionClick(event: SectionNavigationData) {\n this.sectionChange.emit(event);\n }\n}\n","<nav class=\"rdsite-sidebar-navigation\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n <cura-card class=\"only-mobile\" [hasPadding]=\"true\" marginBlock=\"8px\" [hasShadow]=\"false\" type=\"solid\" colorMode=\"light\" target=\"_self\">\n @if (title()) {\n <cura-paragraph size=\"small\" color=\"neutral-black\" marginBlock=\"8px\">\n <b>{{ title() }}</b>\n </cura-paragraph>\n }\n <ul role=\"menubar\">\n @for (section of sections(); track section.id) {\n <li role=\"none\">\n <cura-paragraph size=\"xsmall\" marginBlock=\"8px\" [color]=\"activeSection() === section.id ? 'neutral-black' : 'primary-base'\">\n <a\n #anchorEl\n id=\"anchor-{{ section.id }}\"\n class=\"rdsite-sidebar-link\"\n role=\"menuitem\"\n [href]=\"getPath(section.id)\"\n (click)=\"onSectionClick({ id: section.id, title: section.title })\"\n rdsitelink\n [anchorAdjustment]=\"anchorAdjustment() || defaultAnchorAdjustment()\"\n [attr.aria-current]=\"activeSection() === section.id ? 'page' : null\"\n [attr.aria-label]=\"'Navegar para ' + section.title\"\n >\n <b>\n {{ section.title }}\n </b>\n </a>\n </cura-paragraph>\n </li>\n }\n </ul>\n </cura-card>\n</nav>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MA6Ba,0BAA0B,CAAA;AAPvC,IAAA,WAAA,GAAA;AAQmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAChD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAW,QAAQ,CAAC;AAEpC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAA0B,EAAE,oDAAC;AAC9C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAsC,SAAS,kDAAC;AAC/D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAS,EAAE,y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,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAPtC,SAAS;AAEE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gCAAgC,WACjC,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,CAAC,EAAA,QAAA,EAAA,86CAAA,EAAA,MAAA,EAAA,CAAA,0MAAA,CAAA,EAAA;;sBAwBxE,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAYxB;4DAKgE,UAAU,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,eAAA,CAAA,EAAA,CAAA,EAAA,cAAA,EAAA,CAAA;sBAG1E,YAAY;uBAAC,eAAe;;sBAK5B,WAAW;uBAAC,OAAO;;;AE1EtB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"rededor-site-front-end-lib-components-sidebar-navigation.mjs","sources":["../../../projects/site-front-end-lib/components/sidebar-navigation/sidebar-navigation.component.ts","../../../projects/site-front-end-lib/components/sidebar-navigation/sidebar-navigation.component.html","../../../projects/site-front-end-lib/components/sidebar-navigation/rededor-site-front-end-lib-components-sidebar-navigation.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n Input,\n signal,\n HostListener,\n HostBinding,\n inject,\n input,\n output,\n viewChildren,\n DOCUMENT,\n PLATFORM_ID,\n AfterViewInit,\n} from '@angular/core';\nimport { RdsiteLinkDirective, SectionNavigationConfig, SectionNavigationData } from '@rededor/site-front-end-lib/core';\nimport { CuraCardComponent } from '@rededor/site-front-end-lib/cura/cards/cura-card';\nimport { CuraParagraphComponent } from '@rededor/site-front-end-lib/cura/texts/cura-paragraph';\nimport { CuraApiService } from '@rededor/site-front-end-lib/cura/api';\nimport { Router } from '@angular/router';\nimport { isPlatformBrowser, Location } from '@angular/common';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'nav[rdsite-sidebar-navigation]',\n imports: [RdsiteLinkDirective, CuraCardComponent, CuraParagraphComponent],\n templateUrl: './sidebar-navigation.component.html',\n styleUrl: './sidebar-navigation.component.scss',\n})\nexport class SidebarNavigationComponent implements AfterViewInit {\n private readonly curaApiService = inject(CuraApiService);\n private router = inject(Router);\n private location = inject(Location);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n\n readonly sections = signal<SectionNavigationData[]>([]);\n readonly config = signal<SectionNavigationConfig | undefined>(undefined);\n readonly activeSection = signal<string>('');\n public selectedIndex = signal<number>(0);\n public defaultAnchorAdjustment = signal(0);\n readonly isStarTheme = input(false);\n\n private menuHeaderHeight = 0;\n\n readonly anchorAdjustment = input(0);\n readonly title = input('Nesta página');\n readonly ariaLabel = input('Navegação da página');\n readonly padding = input(-50);\n\n @Input({ required: true })\n set navigationSections(value: SectionNavigationData[]) {\n if (!value?.length) {\n throw new Error('O SectionNavigationComponent requer pelo menos uma seção.');\n }\n this.sections.set(value);\n\n if (!this.activeSection()) {\n this.activeSection.set(value[0].id);\n }\n }\n\n @Input()\n set navigationConfig(value: SectionNavigationConfig) {\n this.config.set(value);\n }\n\n readonly anchorsEl = viewChildren<ElementRef<HTMLAnchorElement>>('anchorEl');\n readonly sectionChange = output<SectionNavigationData>();\n\n @HostListener('window:scroll')\n onWindowScroll(): void {\n this.windowScroll();\n }\n\n @HostBinding('style') styleBinding = {\n '--font-family': this.curaApiService.theme.fonts.getFamily(''),\n '--primary-base': this.curaApiService.theme.colors.getColor('primary-base'),\n };\n\n ngAfterViewInit(): void {\n if (isPlatformBrowser(this.platformId)) {\n setTimeout(() => {\n this.menuHeaderHeight = this.document.querySelector<HTMLElement>('header[sl-hdr]')?.offsetHeight || 0;\n this.defaultAnchorAdjustment.set(this.menuHeaderHeight + (this.padding() - 1));\n }, 200);\n }\n }\n\n private windowScroll(): void {\n this.selectedIndex.set(-1);\n\n this.sections()?.forEach((section, index) => {\n const element = document.querySelector<HTMLElement>(`#${section.id}`);\n if (!element) return;\n\n const elementTop = element.getBoundingClientRect().top + window.scrollY;\n const currentScroll = window.scrollY + this.menuHeaderHeight + this.padding();\n if (currentScroll >= elementTop) {\n this.selectedIndex.set(index);\n if (this.sections()?.[this.selectedIndex()]) {\n this.activeSection.set(this.sections()?.[this.selectedIndex()]?.id);\n }\n }\n });\n }\n\n getBasePath(): string {\n const base = this.location.prepareExternalUrl('');\n const normalized = base.replace(/\\/$/, '');\n\n return normalized === '' || normalized === '/' ? '' : normalized;\n }\n\n getPath(sectionId: string): string {\n return `${this.getBasePath}${this.router.url}#${sectionId}`;\n }\n\n onSectionClick(event: SectionNavigationData) {\n this.sectionChange.emit(event);\n }\n}\n","<nav class=\"rdsite-sidebar-navigation\" [class.starTheme]=\"isStarTheme()\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n <cura-card\n class=\"only-mobile\"\n [type]=\"isStarTheme() ? 'transparent' : 'solid'\"\n [hasPadding]=\"isStarTheme() ? false : true\"\n marginBlock=\"8px\"\n [hasShadow]=\"false\"\n type=\"solid\"\n colorMode=\"light\"\n target=\"_self\"\n >\n @if (title()) {\n <cura-paragraph size=\"small\" color=\"neutral-black\" marginBlock=\"8px\">\n <b>{{ title() }}</b>\n </cura-paragraph>\n }\n <ul role=\"menubar\">\n @for (section of sections(); track section.id) {\n <li role=\"none\">\n <cura-paragraph size=\"xsmall\" marginBlock=\"8px\" [color]=\"activeSection() === section.id ? 'neutral-black' : 'primary-base'\">\n <a\n #anchorEl\n id=\"anchor-{{ section.id }}\"\n class=\"rdsite-sidebar-link\"\n role=\"menuitem\"\n [href]=\"getPath(section.id)\"\n (click)=\"onSectionClick({ id: section.id, title: section.title })\"\n rdsitelink\n [anchorAdjustment]=\"anchorAdjustment() || defaultAnchorAdjustment()\"\n [attr.aria-current]=\"activeSection() === section.id ? 'page' : null\"\n [attr.aria-label]=\"'Navegar para ' + section.title\"\n >\n <b>\n {{ section.title }}\n </b>\n </a>\n </cura-paragraph>\n </li>\n }\n </ul>\n </cura-card>\n</nav>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MA6Ba,0BAA0B,CAAA;AAPvC,IAAA,WAAA,GAAA;AAQmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAChD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAW,QAAQ,CAAC;AAEpC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAA0B,EAAE,oDAAC;AAC9C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAsC,SAAS,kDAAC;AAC/D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAS,EAAE,yDAAC;AACpC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAS,CAAC,yDAAC;AACjC,QAAA,IAAA,CAAA,uBAAuB,GAAG,MAAM,CAAC,CAAC,mEAAC;AACjC,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,KAAK,uDAAC;QAE3B,IAAA,CAAA,gBAAgB,GAAG,CAAC;AAEnB,QAAA,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAC,CAAC,4DAAC;AAC3B,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,cAAc,iDAAC;AAC7B,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,qBAAqB,qDAAC;AACxC,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE,mDAAC;AAmBpB,QAAA,IAAA,CAAA,SAAS,GAAG,YAAY,CAAgC,UA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