<cd-motd></cd-motd>
</div>
<cd-context></cd-context>
- <cd-breadcrumbs></cd-breadcrumbs>
+ <div class="breadcrumbs--padding">
+ <cd-breadcrumbs></cd-breadcrumbs>
+ </div>
<router-outlet></router-outlet>
<cds-placeholder></cds-placeholder>
</div>
.container-fluid {
overflow: auto;
padding-top: 48px;
+
+ &:has(.tearsheet--full) {
+ padding-left: 0;
+ padding-right: 0;
+ overflow: hidden;
+
+ .breadcrumbs--padding {
+ padding-left: var(--cds-spacing-07);
+ }
+ }
}
.rgw-dashboard {
<cd-form-button-panel (submitActionEvent)="onSubmit(confirmationForm.value)"
[form]="confirmationForm"
[submitText]="buttonText"
+ [cancelText]="cancelText"
[showCancel]="showCancel"
[showSubmit]="showSubmit"
+ [submitBtnType]="submitBtnType"
[modalForm]="true"></cd-form-button-panel>
</cds-modal>
constructor(
@Optional() @Inject('titleText') public titleText: string,
@Optional() @Inject('buttonText') public buttonText: string,
+ @Optional() @Inject('cancelText') public cancelText: string = $localize`Cancel`,
@Optional() @Inject('onSubmit') public onSubmit: Function,
// One of them is needed
@Optional() @Inject('bodyData') public bodyData?: object,
@Optional() @Inject('onCancel') public onCancel?: Function,
@Optional() @Inject('bodyContext') public bodyContext?: object,
+ @Optional() @Inject('submitBtnType') public submitBtnType: string = 'primary',
@Optional() @Inject('showSubmit') public showSubmit = true,
@Optional() @Inject('showCancel') public showCancel = true
) {
+<!-- Full Tearsheet -->
+ @if(type === 'full') {
+<div
+ cdsGrid
+ class="tearsheet--full"
+ [useCssGrid]="true"
+ [fullWidth]="true">
+ <div cdsCol
+ class="tearsheet-cols--full"
+ [columnNumbers]="{'lg': 16, 'md': 16, 'sm': 16}">
+ <!-- Tearsheet Header -->
+ <header
+ class="tearsheet-header tearsheet-header--full">
+ <h4 class="cds--type-heading-04 tearsheet-header-title">
+ {{title}}
+ </h4>
+ <p class="cds--type-body-02 tearsheet-header-description">
+ {{description}}
+ </p>
+ </header>
+ <section cdsGrid
+ class="tearsheet-body"
+ [useCssGrid]="true"
+ [fullWidth]="true">
+ <!-- Tearsheet Influencer-->
+ <div cdsCol
+ [columnNumbers]="{'lg': 3, 'md': 3, 'sm': 3}"
+ class="tearsheet-influencer">
+ <cds-progress-indicator
+ orientation="vertical"
+ [steps]="steps"
+ [current]="currentStep"
+ spacing="equal"
+ (stepSelected)="onStepSelect($event)">
+ </cds-progress-indicator>
+ </div>
+ <div cdsCol
+ [columnNumbers]="{'lg': 13, 'md': 13, 'sm': 13}"
+ class="tearsheet-main">
+ <!-- Tearsheet Content Area -->
+ <div class="tearsheet-content tearsheet-content--full">
+ <ng-container
+ *ngTemplateOutlet="activeStepTemplate">
+ </ng-container>
+ </div>
+ <!-- Tearsheet Footer -->
+ <cds-modal-footer class="tearsheet-footer tearsheet-footer--full">
+ <button cdsButton="ghost"
+ class="tearsheet-footer-cancel"
+ (click)="closeTearsheet()"
+ size="xl"
+ i18n>Cancel</button>
+ <button cdsButton="secondary"
+ size="xl"
+ [disabled]="currentStep === 0"
+ (click)="onPrevious()"
+ i18n>Previous</button>
+ @if (currentStep === lastStep) {
+ <button cdsButton="primary"
+ size="xl"
+ (click)="onSubmit()"
+ i18n>{{submitButtonLabel}}</button>
+ }
+ @else {
+ <button cdsButton="primary"
+ size="xl"
+ (click)="onNext()"
+ i18n>Next</button>
+ }
+ </cds-modal-footer>
+ </div>
+ </section>
+ </div>
+</div>
+}
+@else {
<!-- Wide Tearsheet -->
<cds-modal
size="lg"
[open]="isOpen"
- (overlaySelected)="closeWizard()">
+ (overlaySelected)="closeTearsheet()">
<!-- Tearsheet Header -->
<header
class="tearsheet-header">
<h4 cdsModalHeaderHeading
- class="cds--type-heading-04 tearsheet-title">
+ class="cds--type-heading-04 tearsheet-header-title">
{{title}}
</h4>
- <p class="cds--type-body-02 tearsheet-description">
+ <p class="cds--type-body-02 tearsheet-header-description">
{{description}}
</p>
</header>
<cds-modal-footer class="tearsheet-footer">
<button cdsButton="ghost"
class="tearsheet-footer-cancel"
- (click)="closeWizard()"
+ (click)="closeTearsheet()"
size="xl"
i18n>Cancel</button>
<button cdsButton="secondary"
</div>
</section>
</cds-modal>
+}
+// WIDE TEARSHEET
// No css variable to apply css to modal div hence using css ngdeep
// This is needed to set the width of tearsheet as per carbon standards.
:host ::ng-deep .cds--modal-container {
max-block-size: calc(100% - 5.5rem);
}
+// FULL TEARSHEET
+.tearsheet--full {
+ height: 100%;
+ width: 100%;
+ margin: 0;
+ padding: 0;
+}
+
+.tearsheet-cols--full {
+ margin: 0;
+ padding: 0;
+}
+
+// HEADER
.tearsheet-header {
fill: var(--cds-icon-primary);
background-color: var(--cds-layer-01);
padding: var(--cds-spacing-06) var(--cds-spacing-07);
border-block-end: 1px solid var(--cds-border-subtle-01);
- .tearsheet-title {
+ &-title {
color: var(--cds-text-primary);
}
- .tearsheet-description {
+ &-description {
margin-top: var(--cds-spacing-04);
color: var(--cds-text-secondary);
}
+
+ &--full {
+ position: sticky;
+ padding: 0 0 var(--cds-spacing-05) var(--cds-spacing-07);
+ }
}
+// BODY
.tearsheet-body {
padding-block: 0;
padding-inline: 0;
padding: var(--cds-spacing-06) var(--cds-spacing-07);
flex: 1;
overflow-y: auto;
+
+ &--full {
+ padding-left: 0;
+ }
}
}
}
+//FOOTER
.tearsheet-footer {
border-top: 1px solid var(--cds-border-subtle);
background: var(--cds-background);
- .tearsheet-footer-cancel {
+ &-cancel {
margin-left: var(--cds-spacing-05);
}
+
+ &--full {
+ position: sticky;
+ bottom: 0;
+ }
}
import { ModalCdsService } from '../../services/modal-cds.service';
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
+import { ConfirmationModalComponent } from '../confirmation-modal/confirmation-modal.component';
@Component({
selector: 'cd-tearsheet',
@Input() title!: string;
@Input() steps!: Array<Step>;
@Input() description!: string;
+ @Input() submitButtonLabel: string = $localize`Create`;
+ @Input() type: 'full' | 'wide' = 'wide';
@Output() submitRequested = new EventEmitter<void>();
this.currentStep = event.index;
}
- closeWizard() {
+ closeTearsheet() {
+ if (this.type === 'full') {
+ this.closeFullTearsheet();
+ } else {
+ this.closeWideTearsheet();
+ }
+ }
+
+ closeWideTearsheet() {
this.isOpen = false;
if (this.hasModalOutlet) {
this.location.back();
}
}
+ closeFullTearsheet() {
+ this.cdsModalService.show(ConfirmationModalComponent, {
+ titleText: $localize`Are you sure you want to cancel ?`,
+ description: $localize`If you cancel, the information you have entered won't be saved.`,
+ buttonText: $localize`Cancel`,
+ cancelText: $localize`Return to form`,
+ onSubmit: () => {
+ this.isOpen = false;
+ this.cdsModalService.dismissAll();
+ this.location.back();
+ },
+ submitBtnType: 'danger',
+ showCancel: true
+ });
+ }
+
ngAfterViewChecked() {
this.changeDetectorRef.detectChanges();
}