Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stepper): separate header panel from accordion, update icons and number positions #1583

Merged
merged 15 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions projects/angular/src/accordion/_accordion.clarity.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@
}
}

.clr-accordion-number {
padding: 0 tokens.$cds-global-space-7;
display: none !important;
}

.clr-accordion-header-button {
display: flex;
flex-flow: row wrap;
Expand Down Expand Up @@ -144,7 +139,7 @@
}

&.ng-trigger {
padding: 0; // inner element/padding to prevent extra hight in ng animation
padding: 0; // inner element/padding to prevent extra height in ng animation
}

@media (min-width: accordion-variables.$clr-accordion-responsive-breakpoint) {
Expand All @@ -165,14 +160,6 @@
transform: rotate(90deg);
}

.clr-accordion-error-icon,
.clr-accordion-complete-icon {
@include mixins.equilateral(tokens.$cds-global-space-9);
display: none;
padding: 0;
margin: 0 tokens.$cds-global-space-6;
}

// panel states
.clr-accordion-panel-open {
.clr-accordion-header {
Expand Down Expand Up @@ -229,9 +216,6 @@
.clr-accordion-panel-error {
& > .clr-accordion-header {
box-shadow: inset tokens.$cds-global-space-5 0 0 accordion-variables.$clr-accordion-border-left-color-error;
border-color: accordion-variables.$clr-accordion-error-color;
border-bottom: tokens.$cds-global-space-1 solid accordion-variables.$clr-accordion-border-left-color-error;
background-color: accordion-variables.$clr-accordion-active-background-color;
}

& > .clr-accordion-error-icon {
Expand Down
9 changes: 0 additions & 9 deletions projects/angular/src/accordion/accordion-panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,10 @@
>
<span class="clr-accordion-status">
<cds-icon shape="angle" direction="right" class="clr-accordion-angle"></cds-icon>
<span class="clr-accordion-number">{{panelNumber}}.</span>
<cds-icon status="danger" shape="exclamation-circle" class="clr-accordion-error-icon"></cds-icon>
<cds-icon status="success" shape="check-circle" class="clr-accordion-complete-icon"></cds-icon>
</span>
<ng-content select="clr-accordion-title, clr-step-title"></ng-content>
<ng-content select="clr-accordion-description, clr-step-description"></ng-content>
</button>
<div class="clr-sr-only" role="status">
<ng-container *ngIf="panel.status === AccordionStatus.Error"> {{ stepErrorText(panelNumber)}} </ng-container>
<ng-container *ngIf="panel.status === AccordionStatus.Complete">
{{ stepCompleteText(panelNumber)}}
</ng-container>
</div>
</div>
<div
@skipInitialRender
Expand Down
153 changes: 76 additions & 77 deletions projects/angular/src/accordion/stepper/_stepper.clarity.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,95 +13,94 @@

@include mixins.exports('stepper.clarity') {
.clr-stepper-forms {
& > .clr-accordion-panel {
& > .clr-accordion-panel-open,
& > .clr-accordion-panel-inactive,
& > .clr-accordion-panel-error,
& > .clr-accordion-panel-complete {
& > .clr-accordion-header > .clr-accordion-header-button {
align-items: center;
gap: tokens.$cds-global-space-12;
min-height: mixins.baselinePx(56);
padding: tokens.$cds-global-space-5 tokens.$cds-global-space-9 tokens.$cds-global-space-5
tokens.$cds-global-space-10;

@include mixins.generate-typography-token('BODY-14-SB-STD');

.clr-accordion-description {
@include mixins.generate-typography-token('BODY-14-RG-STD');
}
.clr-stepper-header > .clr-accordion-header-button {
align-items: center;
gap: tokens.$cds-global-space-9;
min-height: mixins.baselinePx(56);
padding: tokens.$cds-global-space-5 tokens.$cds-global-space-8 tokens.$cds-global-space-5
tokens.$cds-global-space-9;

.clr-accordion-status {
min-width: tokens.$cds-global-space-14;
}
> .clr-step-status {
min-height: tokens.$cds-global-space-9;
height: tokens.$cds-global-space-9;
min-width: tokens.$cds-global-space-12;
width: tokens.$cds-global-space-12;
display: inline-flex;
gap: tokens.$cds-global-space-5;
align-items: center;

@media (max-width: accordion-variables.$clr-accordion-responsive-breakpoint) {
gap: tokens.$cds-global-space-9;
}
> .clr-step-error-icon,
> .clr-step-complete-icon {
@include mixins.equilateral(tokens.$cds-global-space-9);
padding: 0;
}

> .clr-step-error-icon {
color: accordion-variables.$clr-accordion-error-color;
}

> .clr-step-complete-icon {
color: accordion-variables.$clr-accordion-complete-color;
}
}
}

&
> .clr-accordion-panel
> .clr-accordion-panel-inactive
> .clr-accordion-header
> .clr-accordion-header-button
> .clr-accordion-status
> .clr-accordion-number {
padding: 0 tokens.$cds-global-space-7;
display: inline-block !important;
}
> .clr-step-title {
min-width: accordion-variables.$clr-accordion-step-title-min-width;
max-width: calc(264 * (1rem / var(--cds-global-base)));
width: 100%;
display: inline-flex;
gap: tokens.$cds-global-space-3;
align-items: center;

&
> .clr-accordion-panel
> .clr-accordion-panel-error
> .clr-accordion-header
> .clr-accordion-header-button
> .clr-accordion-status
> .clr-accordion-error-icon {
display: inline-block;
color: accordion-variables.$clr-accordion-error-color;
}
@include mixins.generate-typography-token('BODY-14-SB-STD');

&
> .clr-accordion-panel
> .clr-accordion-panel-complete
> .clr-accordion-header
> .clr-accordion-header-button
> .clr-accordion-status
> .clr-accordion-complete-icon {
display: inline-block;
color: accordion-variables.$clr-accordion-complete-color;
}
> .clr-step-number {
min-width: tokens.$cds-global-space-9;
}

&
> .clr-accordion-panel
> .clr-accordion-panel-inactive
> .clr-accordion-header
> .clr-accordion-header-button
> .clr-accordion-status
> .clr-accordion-angle {
visibility: hidden;
}
> .clr-accordion-title {
min-width: initial;
max-width: initial;
width: initial;
margin-left: 0;
}
}
valentin-mladenov marked this conversation as resolved.
Show resolved Hide resolved

&
> .clr-accordion-panel
> .clr-accordion-panel-open
> .clr-accordion-header
> .clr-accordion-header-button
> .clr-accordion-status
> .clr-accordion-angle {
visibility: visible;
}
> .clr-accordion-description,
> .clr-step-description {
margin-left: tokens.$cds-global-space-9;
@include mixins.generate-typography-token('BODY-14-RG-STD');
}

@media (max-width: accordion-variables.$clr-accordion-responsive-breakpoint) {
gap: tokens.$cds-global-space-3;

.clr-accordion-number {
padding: 0 tokens.$cds-global-space-7;
display: inline-block;
> .clr-step-status {
min-width: initial;
width: initial;
}

> .clr-step-title {
width: initial;

> .clr-step-number {
min-width: initial;
}
}

> .clr-accordion-description,
> .clr-step-description {
margin-left: 0;
}
}
}

.clr-accordion-description {
display: inline-block;
.clr-accordion-panel-inactive:not(.clr-accordion-panel-open) > .clr-stepper-header .clr-step-angle {
visibility: hidden;

@media (max-width: accordion-variables.$clr-accordion-responsive-breakpoint) {
display: none;
}
}

.clr-step-button {
Expand Down
64 changes: 64 additions & 0 deletions projects/angular/src/accordion/stepper/stepper-panel.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<ng-container *ngIf="panel | async; let panel">
<div [ngClass]="getPanelStateClasses(panel)">
<div class="clr-accordion-header clr-stepper-header">
kevinbuhmann marked this conversation as resolved.
Show resolved Hide resolved
<button
type="button"
class="clr-accordion-header-button"
(click)="togglePanel()"
[id]="getAccordionHeaderId(panel.templateId)"
[disabled]="isAccordion && panel.disabled"
[attr.aria-disabled]="!isAccordion && panel.disabled"
kevinbuhmann marked this conversation as resolved.
Show resolved Hide resolved
[attr.aria-controls]="getAccordionContentId(panel.templateId)"
[attr.aria-expanded]="panel.open"
[class.clr-accordion-header-has-description]="(accordionDescription.changes | async)?.length || accordionDescription.length"
#headerButton
>
<span class="clr-step-status">
<cds-icon shape="angle" direction="right" class="clr-accordion-angle clr-step-angle"></cds-icon>
<cds-icon
status="danger"
*ngIf="panel.status === AccordionStatus.Error"
shape="exclamation-circle"
class="clr-step-error-icon"
></cds-icon>
<cds-icon
status="success"
*ngIf="panel.status === AccordionStatus.Complete"
shape="check-circle"
class="clr-step-complete-icon"
></cds-icon>
</span>
<span class="clr-step-title">
<span class="clr-step-number">{{panelNumber}}.</span>
<ng-content select="clr-accordion-title, clr-step-title"></ng-content>
kevinbuhmann marked this conversation as resolved.
Show resolved Hide resolved
</span>
valentin-mladenov marked this conversation as resolved.
Show resolved Hide resolved
<ng-content select="clr-accordion-description, clr-step-description"></ng-content>
</button>
<div class="clr-sr-only" role="status">
<ng-container *ngIf="panel.status === AccordionStatus.Error"> {{ stepErrorText(panelNumber)}} </ng-container>
kevinbuhmann marked this conversation as resolved.
Show resolved Hide resolved
<ng-container *ngIf="panel.status === AccordionStatus.Complete">
{{ stepCompleteText(panelNumber)}}
</ng-container>
</div>
</div>
<div
@skipInitialRender
role="region"
class="clr-accordion-content-region"
[id]="getAccordionContentId(panel.templateId)"
[attr.aria-hidden]="!panel.open"
[attr.aria-labelledby]="getAccordionHeaderId(panel.templateId)"
>
<div
*ngIf="panel.open"
@toggle
(@toggle.done)="collapsePanelOnAnimationDone(panel)"
class="clr-accordion-content"
>
<div class="clr-accordion-inner-content">
<ng-content></ng-content>
</div>
</div>
</div>
</div>
</ng-container>
4 changes: 2 additions & 2 deletions projects/angular/src/accordion/stepper/stepper-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import { StepperService } from './providers/stepper.service';

@Component({
selector: 'clr-stepper-panel',
templateUrl: '../accordion-panel.html',
host: { '[class.clr-accordion-panel]': 'true' },
templateUrl: 'stepper-panel.html',
host: { '[class.clr-stepper-panel]': 'true' },
changeDetection: ChangeDetectionStrategy.OnPush,
animations: stepAnimation,
providers: [IfExpandService],
Expand Down
Loading