-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25c56e4
commit b71fa6d
Showing
21 changed files
with
819 additions
and
63 deletions.
There are no files selected for viewing
132 changes: 132 additions & 0 deletions
132
angular/demo/src/app/samples/accordion/customHeaders.route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
import {AgnosUIAngularModule} from '@agnos-ui/angular'; | ||
import {Component} from '@angular/core'; | ||
import {NgIf} from '@angular/common'; | ||
import BODY from '!raw-loader!@agnos-ui/common/samples/accordion/body.txt'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [AgnosUIAngularModule, NgIf], | ||
template: ` | ||
<div auAccordion #accordion="auAccordion"> | ||
<div au-accordion-item> | ||
<ng-template auAccordionItemStructure let-state="state" let-widget="widget"> | ||
<div | ||
class="{{ state.itemHeaderClass }} accordion-button accordion-header custom-header justify-content-between" | ||
[class.collapsed]="state.itemCollapsed" | ||
role="heading" | ||
aria-level="2" | ||
> | ||
<p class="m-0">First panel - {{ state.itemCollapsed ? 'collapsed' : 'opened' }}</p> | ||
<button | ||
type="button" | ||
id="{{ state.itemId }}-toggle" | ||
(click)="widget.actions.click()" | ||
class="btn btn-link p-0 {{ state.itemButtonClass }}" | ||
[class.collapsed]="state.itemCollapsed" | ||
[disabled]="state.itemDisabled" | ||
attr.aria-controls="{{ state.itemId }}-collapse" | ||
[attr.aria-disabled]="state.itemDisabled" | ||
[attr.aria-expanded]="!state.itemCollapsed" | ||
> | ||
Toggle first | ||
</button> | ||
</div> | ||
<div | ||
*ngIf="state!.shouldBeInDOM" | ||
[auUse]="widget!.directives.collapseDirective" | ||
attr.aria-labelledby="{{ state!.itemId }}-toggle" | ||
id="{{ state!.itemId }}-collapse" | ||
class="accordion-collapse {{ state!.itemCollapseClass }}" | ||
> | ||
<div class="accordion-body {{ state!.itemBodyClass }}"> | ||
{{ BODY }} | ||
</div> | ||
</div> | ||
</ng-template> | ||
</div> | ||
<div au-accordion-item> | ||
<ng-template auAccordionItemStructure let-state="state" let-widget="widget"> | ||
<div | ||
class="{{ state.itemHeaderClass }} accordion-button accordion-header custom-header justify-content-between" | ||
[class.collapsed]="state.itemCollapsed" | ||
role="heading" | ||
aria-level="2" | ||
> | ||
<p class="m-0">Second panel</p> | ||
<div> | ||
<button | ||
type="button" | ||
class="btn btn-sm btn-outline-primary me-2 {{ state.itemButtonClass }}" | ||
[class.collapsed]="state.itemCollapsed" | ||
id="{{ state.itemId }}-toggle" | ||
(click)="widget.actions.click()" | ||
[disabled]="state.itemDisabled" | ||
[attr.aria-disabled]="state.itemDisabled" | ||
[attr.aria-expanded]="!state.itemCollapsed" | ||
attr.aria-controls="{{ state.itemId }}-collapse" | ||
> | ||
Toggle second | ||
</button> | ||
<button type="button" class="btn btn-sm btn-outline-secondary me-2" (click)="thirdDisabled = !thirdDisabled"> | ||
{{ thirdDisabled ? 'En' : 'Dis' }}able third | ||
</button> | ||
<button type="button" class="btn btn-sm btn-outline-danger me-2" (click)="accordion.api.collapseAll()">Collapse all</button> | ||
</div> | ||
</div> | ||
<div | ||
*ngIf="state!.shouldBeInDOM" | ||
[auUse]="widget!.directives.collapseDirective" | ||
attr.aria-labelledby="{{ state!.itemId }}-toggle" | ||
id="{{ state!.itemId }}-collapse" | ||
class="accordion-collapse {{ state!.itemCollapseClass }}" | ||
> | ||
<div class="accordion-body {{ state!.itemBodyClass }}"> | ||
{{ BODY }} | ||
</div> | ||
</div> | ||
</ng-template> | ||
</div> | ||
<div au-accordion-item [itemDisabled]="thirdDisabled"> | ||
<ng-template auAccordionItemStructure let-state="state" let-widget="widget"> | ||
<div | ||
class="{{ state.itemHeaderClass }} accordion-button accordion-header custom-header justify-content-between" | ||
[class.collapsed]="state.itemCollapsed" | ||
role="heading" | ||
aria-level="2" | ||
> | ||
<button | ||
type="button" | ||
class="p-0 btn btn-link container-fluid text-start {{ state.itemButtonClass }}" | ||
[class.collapsed]="state.itemCollapsed" | ||
id="{{ state.itemId }}-toggle" | ||
(click)="widget.actions.click()" | ||
[disabled]="state.itemDisabled" | ||
[attr.aria-disabled]="state.itemDisabled" | ||
attr.aria-controls="{{ state.itemId }}-collapse" | ||
[attr.aria-expanded]="!state.itemCollapsed" | ||
> | ||
Third panel | ||
</button> | ||
<p *ngIf="thirdDisabled" class="text-muted m-0 small">[I'm disabled]</p> | ||
</div> | ||
<div | ||
*ngIf="state!.shouldBeInDOM" | ||
[auUse]="widget!.directives.collapseDirective" | ||
attr.aria-labelledby="{{ state!.itemId }}-toggle" | ||
id="{{ state!.itemId }}-collapse" | ||
class="accordion-collapse {{ state!.itemCollapseClass }}" | ||
> | ||
<div class="accordion-body {{ state!.itemBodyClass }}"> | ||
{{ BODY }} | ||
</div> | ||
</div> | ||
</ng-template> | ||
</div> | ||
</div> | ||
`, | ||
styles: ["@import '@agnos-ui/common/samples/accordion/custom.scss';"], | ||
}) | ||
export default class AccordionComponent { | ||
thirdDisabled = false; | ||
BODY = BODY; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
angular/demo/src/app/samples/accordion/togglePanels.route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {AgnosUIAngularModule} from '@agnos-ui/angular'; | ||
import {Component} from '@angular/core'; | ||
import {NgFor} from '@angular/common'; | ||
import BODY from '!raw-loader!@agnos-ui/common/samples/accordion/body.txt'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [AgnosUIAngularModule, NgFor], | ||
template: ` | ||
<div auAccordion #accordion="auAccordion"> | ||
<div au-accordion-item [itemId]="'first'"> | ||
<ng-template auAccordionItemHeader>First panel</ng-template> | ||
<ng-template auAccordionItemBody>{{ BODY }} </ng-template> | ||
</div> | ||
<div au-accordion-item [itemId]="'second'" #itemTwo> | ||
<ng-template auAccordionItemHeader>Second panel</ng-template> | ||
<ng-template auAccordionItemBody>{{ BODY }} </ng-template> | ||
</div> | ||
</div> | ||
<hr /> | ||
<button class="btn btn-sm btn-outline-primary me-2" (click)="accordion.api.toggle('first')">Toggle first</button> | ||
<button class="btn btn-sm btn-outline-primary me-2" (click)="itemTwo.api.toggle()">Toggle second</button> | ||
<button class="btn btn-sm btn-outline-primary me-2" (click)="accordion.api.expandAll()">Expand all</button> | ||
<button class="btn btn-sm btn-outline-primary me-2" (click)="accordion.api.collapseAll()">Collapse all</button> | ||
`, | ||
}) | ||
export default class AccordionComponent { | ||
BODY = BODY; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.custom-header::after { | ||
content: none !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
demo/src/routes/[framework]/components/accordion/examples/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.