diff --git a/src/accordion/accordion-item.component.ts b/src/accordion/accordion-item.component.ts index 89e75330f4..5f94f15919 100644 --- a/src/accordion/accordion-item.component.ts +++ b/src/accordion/accordion-item.component.ts @@ -18,27 +18,27 @@ import { (click)="toggleExpanded()" class="cds--accordion__heading"> -

- {{!skeleton ? title : null}} -

- - + @if (isTemplate(title)) { + + } @else { +

+ {{!skeleton ? title : null}} +

+ }
- - + @if (skeleton) {

-
+ } @else { + + }
`, diff --git a/src/accordion/accordion.component.ts b/src/accordion/accordion.component.ts index 67b2499208..2fb9c39171 100644 --- a/src/accordion/accordion.component.ts +++ b/src/accordion/accordion.component.ts @@ -31,7 +31,7 @@ import { AccordionItem } from "./accordion-item.component"; 'cds--layout--size-lg': size === 'lg' }" role="list"> - + ` }) diff --git a/src/breadcrumb/breadcrumb-item.component.ts b/src/breadcrumb/breadcrumb-item.component.ts index b6a451ed17..ecff651c79 100644 --- a/src/breadcrumb/breadcrumb-item.component.ts +++ b/src/breadcrumb/breadcrumb-item.component.ts @@ -12,17 +12,18 @@ import { Router } from "@angular/router"; @Component({ selector: "cds-breadcrumb-item, ibm-breadcrumb-item", template: ` - - - - - - ` + @if (useTemplate()) { + + + + } @else { + + } + ` }) export class BreadcrumbItemComponent { @Input() set href(v: string) { diff --git a/src/breadcrumb/breadcrumb.component.ts b/src/breadcrumb/breadcrumb.component.ts index a7cb378d75..5e7f3f41cf 100644 --- a/src/breadcrumb/breadcrumb.component.ts +++ b/src/breadcrumb/breadcrumb.component.ts @@ -29,102 +29,99 @@ const MINIMUM_OVERFLOW_THRESHOLD = 4; @Component({ selector: "cds-breadcrumb, ibm-breadcrumb", template: ` - ` + + ` }) export class Breadcrumb implements AfterContentInit { @ContentChildren(BreadcrumbItemComponent) children: QueryList; diff --git a/src/button/button-set.component.ts b/src/button/button-set.component.ts index dee0e39fa2..238a4586c0 100644 --- a/src/button/button-set.component.ts +++ b/src/button/button-set.component.ts @@ -11,7 +11,7 @@ import { Component, HostBinding } from "@angular/core"; */ @Component({ selector: "cds-button-set, ibm-button-set", - template: "" + template: "" }) export class ButtonSet { @HostBinding("class.cds--btn-set") buttonSetClass = true; diff --git a/src/button/icon-button.component.ts b/src/button/icon-button.component.ts index 1661b36b4a..340c1c93ad 100644 --- a/src/button/icon-button.component.ts +++ b/src/button/icon-button.component.ts @@ -50,7 +50,7 @@ import { ButtonSize, ButtonType } from "./button.types"; (click)="emitClickEvent($event)" (focus)="focus.emit($event)" (blur)="blur.emit($event)"> - + ` diff --git a/src/checkbox/checkbox.component.ts b/src/checkbox/checkbox.component.ts index c064e27a6b..5dbdd29c69 100644 --- a/src/checkbox/checkbox.component.ts +++ b/src/checkbox/checkbox.component.ts @@ -57,7 +57,7 @@ export enum CheckboxState { 'cds--skeleton' : skeleton }"> - + diff --git a/src/code-snippet/code-snippet.component.ts b/src/code-snippet/code-snippet.component.ts index 21cce3b540..75a8be48b0 100644 --- a/src/code-snippet/code-snippet.component.ts +++ b/src/code-snippet/code-snippet.component.ts @@ -33,24 +33,21 @@ export enum SnippetType { @Component({ selector: "cds-code-snippet, ibm-code-snippet", template: ` - - - - - + @if (display === 'inline') { + @if (!hideCopyButton) { + + } @else { - + - - - - + } + } @else {
- - - + @if (skeleton) { + @if (display === 'single') { + } @else { - - -
+ + } + } + @if (!skeleton) { +
+						
+					
+ }
-
-
- - - - -
+ @if (hasLeft) { +
+ } + @if (hasRight) { +
+ } + @if (!hideCopyButton) { + + } + @if (isExpandable) { + + } + } - - - - - - - - - - + @if (!skeleton) { + + @if (display === 'inline') { + + + + } @else { + + } + + } - + ` }) diff --git a/src/combobox/combobox.component.spec.ts b/src/combobox/combobox.component.spec.ts index 9203d24054..cfafcbfa22 100644 --- a/src/combobox/combobox.component.spec.ts +++ b/src/combobox/combobox.component.spec.ts @@ -155,7 +155,11 @@ describe("Combo box", () => { wrapper = fixture.componentInstance; fixture.detectChanges(); element = fixture.debugElement.query(By.css("cds-combo-box")); - expect(element.nativeElement.textContent).toBe("label"); + /** + * @todo + * Verify if new control flow syntax still requires `space` preceding and succeeding label + */ + expect(element.nativeElement.textContent).toBe(" label "); }); it("should set placeholder to 'placeholder'", () => { diff --git a/src/combobox/combobox.component.ts b/src/combobox/combobox.component.ts index 11202d96cc..e3ca91c244 100644 --- a/src/combobox/combobox.component.ts +++ b/src/combobox/combobox.component.ts @@ -47,18 +47,22 @@ import { Observable } from "rxjs"; 'cds--list-box__wrapper--fluid--invalid': fluid && invalid, 'cds--list-box__wrapper--fluid--focus': fluid && _isFocused }"> - + @if (label) { + + }
-
- {{ pills.length }} - -
+ @if (type === 'multi' && pills.length > 0) { +
+ {{ pills.length }} + +
+ } - - - - -
- -
+ @if (invalid) { + + + } @else if (warn) { + + + } + @if (showClearButton) { +
+ +
+ }
-
-
- {{helperText}} - -
-
- {{ invalidText }} - -
-
- {{warnText}} - -
+ @if (fluid) { +
+ } + @if (invalid) { +
+ @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + } +
+ } @else if (warn) { +
+ @if (isTemplate(warnText)) { + + } @else { + {{warnText}} + } +
+ } @else if(helperText && !fluid) { +
+ @if (isTemplate(helperText)) { + + } @else { + {{helperText}} + } +
+ } `, providers: [ diff --git a/src/combobox/stories/app-reactive-combobox.component.ts b/src/combobox/stories/app-reactive-combobox.component.ts index 28e0553b15..3ec23e2885 100644 --- a/src/combobox/stories/app-reactive-combobox.component.ts +++ b/src/combobox/stories/app-reactive-combobox.component.ts @@ -26,7 +26,7 @@ import isEqual from "lodash-es/isEqual"; [warn]="warn" [warnText]="warnText" [items]="_items"> - + selected: {{ sampleForm.get("combobox").value | json }} - + selected: {{ sampleForm.get("multibox").value | json }} diff --git a/src/contained-list/contained-list-item.component.ts b/src/contained-list/contained-list-item.component.ts index dd9cb92d36..21babf94da 100644 --- a/src/contained-list/contained-list-item.component.ts +++ b/src/contained-list/contained-list-item.component.ts @@ -11,27 +11,33 @@ import { @Component({ selector: "cds-contained-list-item, ibm-contained-list-item", template: ` - + @if (clickable) { - - + } @else {
-
- - -
- + @if (icon) { +
+ @if (isTemplate(icon)) { + + } @else { + + } +
+ } +
-
-
- -
+ } + @if (action) { +
+ +
+ } `, changeDetection: ChangeDetectionStrategy.OnPush }) diff --git a/src/contained-list/contained-list.component.ts b/src/contained-list/contained-list.component.ts index 2d8f0028d0..6ea127cb6c 100644 --- a/src/contained-list/contained-list.component.ts +++ b/src/contained-list/contained-list.component.ts @@ -36,16 +36,21 @@ import { ContainedListKind, ContainedListSize } from "./contained-list.enums"; }">
- {{ label }} - + @if (isTemplate(label)) { + + } @else { + {{ label }} + }
-
- -
+ @if (action) { +
+ +
+ }
- +
`, diff --git a/src/content-switcher/content-switcher.component.ts b/src/content-switcher/content-switcher.component.ts index eea49c96f6..28fb4de04a 100644 --- a/src/content-switcher/content-switcher.component.ts +++ b/src/content-switcher/content-switcher.component.ts @@ -44,7 +44,7 @@ import { isFocusInLastItem, isFocusInFirstItem } from "carbon-components-angular 'cds--content-switcher--lg': size === 'lg' }" role="tablist"> - + ` }) diff --git a/src/context-menu/context-menu-group.component.ts b/src/context-menu/context-menu-group.component.ts index 2c72a71732..98f173aaee 100644 --- a/src/context-menu/context-menu-group.component.ts +++ b/src/context-menu/context-menu-group.component.ts @@ -15,7 +15,7 @@ import { ContextMenuSelectionService } from "./context-menu-selection.service"; @Component({ selector: "cds-context-menu-group, ibm-context-menu-group", template: ` - + `, providers: [ContextMenuSelectionService] }) diff --git a/src/context-menu/context-menu-item.component.ts b/src/context-menu/context-menu-item.component.ts index 13baee9153..a9518a1db3 100644 --- a/src/context-menu/context-menu-item.component.ts +++ b/src/context-menu/context-menu-item.component.ts @@ -20,15 +20,22 @@ import { ContextMenuComponent } from "./context-menu.component"; selector: "cds-context-menu-item, ibm-context-menu-item", template: `
- - + @if (selectable && checked) { + + } @else if (!selectable && icon) { + + }
{{label}}
- {{info}} - + @if (info) { + {{info}} + } + @if (hasChildren) { + + }
- + `, styles: [` :host { diff --git a/src/context-menu/context-menu.component.ts b/src/context-menu/context-menu.component.ts index 4f4ac292d5..6002de63f3 100644 --- a/src/context-menu/context-menu.component.ts +++ b/src/context-menu/context-menu.component.ts @@ -20,7 +20,7 @@ import { @Component({ selector: "cds-context-menu, ibm-context-menu", template: ` - + `, styles: [` :host { diff --git a/src/datepicker-input/datepicker-input.component.spec.ts b/src/datepicker-input/datepicker-input.component.spec.ts index 2be17ec98a..dd4eb45800 100644 --- a/src/datepicker-input/datepicker-input.component.spec.ts +++ b/src/datepicker-input/datepicker-input.component.spec.ts @@ -68,7 +68,11 @@ describe("Select", () => { fixture = TestBed.createComponent(DatePickerInputTest); fixture.detectChanges(); element = fixture.debugElement.query(By.css("cds-date-picker-input")); - expect(element.nativeElement.querySelector(".cds--label").textContent).toBe("label"); + /** + * @todo + * Verify if new control flow syntax still requires `space` preceding and succeeding label + */ + expect(element.nativeElement.querySelector(".cds--label").textContent).toBe(" label "); }); it("should set placeholder to mm/dd/yyyy", () => { @@ -94,7 +98,7 @@ describe("Select", () => { fixture.detectChanges(); element = fixture.debugElement.query(By.css("cds-date-picker-input")); expect(element.nativeElement.querySelector(".cds--form-requirement")).toBeTruthy(); - expect(element.nativeElement.querySelector(".cds--form-requirement").textContent).toBe("invalid text"); + expect(element.nativeElement.querySelector(".cds--form-requirement").textContent).toBe(" invalid text "); }); it("should set theme to dark", () => { diff --git a/src/datepicker-input/datepicker-input.component.ts b/src/datepicker-input/datepicker-input.component.ts index 503c848e9a..f1b562438d 100644 --- a/src/datepicker-input/datepicker-input.component.ts +++ b/src/datepicker-input/datepicker-input.component.ts @@ -12,92 +12,111 @@ import { NG_VALUE_ACCESSOR } from "@angular/forms"; @Component({ selector: "cds-date-picker-input, ibm-date-picker-input", template: ` -
-
-
- - - -
-
- -
- - +
+
+ + @if (skeleton) { + +
+ } @else { + @if (label) { + + } +
- - - - - - - -
-
- {{helperText}} - -
-
- {{invalidText}} - -
-
- {{warnText}} - + 'cds--date-picker-input__wrapper--invalid': invalid, + 'cds--date-picker-input__wrapper--warn': warn + }"> + + + @if (type !== 'simple' && !warn && !invalid) { + + + } + @if (invalid) { + + + } @else if (warn) { + + + } + +
+ } + + @if (invalid) { +
+ @if (isTemplate(invalidText)) { + + } @else { + {{invalidText}} + } +
+ } @else if (warn) { +
+ @if (isTemplate(warnText)) { + + } @else { + {{warnText}} + } +
+ } @else if(helperText) { +
+ @if (isTemplate(helperText)) { + + } @else { + {{helperText}} + } +
+ }
-
`, providers: [ { diff --git a/src/datepicker/datepicker.component.spec.ts b/src/datepicker/datepicker.component.spec.ts index 6cfccf4cbb..ab936862e3 100644 --- a/src/datepicker/datepicker.component.spec.ts +++ b/src/datepicker/datepicker.component.spec.ts @@ -57,7 +57,11 @@ describe("DatePicker", () => { fixture = TestBed.createComponent(DatePickerTest); element = fixture.debugElement.query(By.css("cds-date-picker")); fixture.detectChanges(); - expect(element.nativeElement.textContent).toEqual("Date picker label"); + /** + * @todo + * Verify if new control flow syntax still requires `space` preceding and succeeding label + */ + expect(element.nativeElement.textContent).toEqual(" Date picker label "); }); it("should set the value of the component to be the value specified in the wrapper", async() => { @@ -114,7 +118,7 @@ describe("DatePicker", () => { fixture.detectChanges(); expect(element.componentInstance.invalid).toBe(true); expect(element.nativeElement.getAttribute("invalidText")).toEqual("invalid text"); - expect(element.nativeElement.querySelector(".cds--form-requirement").textContent).toEqual("invalid text"); + expect(element.nativeElement.querySelector(".cds--form-requirement").textContent).toEqual(" invalid text "); }); it("should call onValueChange on valueChange event", () => { diff --git a/src/datepicker/datepicker.component.ts b/src/datepicker/datepicker.component.ts index 2e53e3e306..9eb345e6e7 100644 --- a/src/datepicker/datepicker.component.ts +++ b/src/datepicker/datepicker.component.ts @@ -86,28 +86,30 @@ if (languages.default?.default["en"]?.weekdays) {
-
- - -
+ @if (range) { +
+ + +
+ }
`, diff --git a/src/dialog/overflow-menu/overflow-menu-custom-pane.component.ts b/src/dialog/overflow-menu/overflow-menu-custom-pane.component.ts index 4afd8d0673..37cb218d3d 100644 --- a/src/dialog/overflow-menu/overflow-menu-custom-pane.component.ts +++ b/src/dialog/overflow-menu/overflow-menu-custom-pane.component.ts @@ -23,10 +23,7 @@ import { Dialog } from "../dialog.component"; (click)="onClick($event)" #dialog [attr.aria-label]="dialogConfig.menuLabel"> - - + ` }) diff --git a/src/dialog/overflow-menu/overflow-menu-option.component.ts b/src/dialog/overflow-menu/overflow-menu-option.component.ts index f640bc2088..df383e26ad 100644 --- a/src/dialog/overflow-menu/overflow-menu-option.component.ts +++ b/src/dialog/overflow-menu/overflow-menu-option.component.ts @@ -38,38 +38,38 @@ const REL = "noreferrer noopener"; @Component({ selector: "cds-overflow-menu-option, ibm-overflow-menu-option", template: ` - - - - - + @if (href) { + + + + } @else { + + }
- +
` diff --git a/src/dialog/overflow-menu/overflow-menu-pane.component.ts b/src/dialog/overflow-menu/overflow-menu-pane.component.ts index 73cbb4821d..8cef480572 100644 --- a/src/dialog/overflow-menu/overflow-menu-pane.component.ts +++ b/src/dialog/overflow-menu/overflow-menu-pane.component.ts @@ -32,10 +32,7 @@ import { closestAttr } from "carbon-components-angular/utils"; class="cds--overflow-menu-options cds--overflow-menu-options--open" (click)="onClose($event)" [attr.aria-label]="dialogConfig.menuLabel"> - - + ` }) diff --git a/src/dialog/overflow-menu/overflow-menu.component.ts b/src/dialog/overflow-menu/overflow-menu.component.ts index 4da1cabb1d..834db6c905 100644 --- a/src/dialog/overflow-menu/overflow-menu.component.ts +++ b/src/dialog/overflow-menu/overflow-menu.component.ts @@ -59,15 +59,20 @@ import { BaseIconButton } from "carbon-components-angular/button"; aria-haspopup="true" type="button" [placement]="placement"> - + @if (customTrigger) { + + } @else { + + + } - - - - + `, styles: [` diff --git a/src/dropdown/dropdown.component.ts b/src/dropdown/dropdown.component.ts index 1fa5a48235..7a4dc62d3a 100644 --- a/src/dropdown/dropdown.component.ts +++ b/src/dropdown/dropdown.component.ts @@ -55,128 +55,153 @@ import { hasScrollableParents } from "carbon-components-angular/utils"; @Component({ selector: "cds-dropdown, ibm-dropdown", template: ` - -
-
- + @if (invalid) { -
- {{getDisplayStringValue() | async}} - - - + } @else if(warn) { + class="cds--list-box__invalid-icon cds--list-box__invalid-icon--warning"> - - - - - - -
- + } +
+ @if (!menuIsClosed) { + + } +
- -
-
- {{helperText}} - -
-
- {{ invalidText }} - -
-
- {{warnText}} - -
+ @if (fluid) { +
+ } + @if (invalid) { +
+ @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + } +
+ } @else if (warn) { +
+ @if (isTemplate(warnText)) { + + } @else { + {{warnText}} + } +
+ } @else if(helperText && !fluid) { +
+ @if (isTemplate(helperText)) { + + } @else { + {{helperText}} + } +
+ } `, providers: [ { diff --git a/src/dropdown/list/dropdown-list.component.ts b/src/dropdown/list/dropdown-list.component.ts index 6461e70282..f178a0151d 100644 --- a/src/dropdown/list/dropdown-list.component.ts +++ b/src/dropdown/list/dropdown-list.component.ts @@ -60,54 +60,54 @@ import { ScrollCustomEvent } from "./scroll-custom-event.interface"; tabindex="-1" [attr.aria-label]="ariaLabel" [attr.aria-activedescendant]="highlightedItem"> -
  • -
    + @for (item of displayItems; track item; let i = $index) { +
  • - + #listItem + tabindex="-1" + class="cds--list-box__menu-item__option"> + @if (!listTpl && type === 'multi') { +
    + +
    + } + @if (!listTpl && type === 'single') { + {{item.content}} + + + } + @if (listTpl) { + + }
    - {{item.content}} - - - - - -
  • - `, + + } + + `, providers: [ { provide: AbstractDropdownView, diff --git a/src/file-uploader/file-uploader.component.ts b/src/file-uploader/file-uploader.component.ts index 66ccdf5a05..1346ea605c 100644 --- a/src/file-uploader/file-uploader.component.ts +++ b/src/file-uploader/file-uploader.component.ts @@ -25,40 +25,48 @@ const noop = () => { }; @Component({ selector: "cds-file-uploader, ibm-file-uploader", template: ` - + @if (skeleton) { +
    +
    + + } @else {
    - - + [size]="size" + [disabled]="disabled"> + {{buttonText}} + + } { }; (change)="onFilesAdded()" [disabled]="disabled"/>
    - + @for (fileItem of files; track fileItem) { - + }
    -
    - - -
    -
    - -
    + } `, providers: [ { diff --git a/src/file-uploader/file.component.ts b/src/file-uploader/file.component.ts index e5837daf8c..32422166c2 100644 --- a/src/file-uploader/file.component.ts +++ b/src/file-uploader/file.component.ts @@ -14,43 +14,52 @@ import { FileItem } from "./file-item.interface"; selector: "cds-file, ibm-file", template: `

    {{fileItem.file.name}}

    - - - - - - -
    - + @switch (fileItem.state) { + @case ('edit') { + + @if (isInvalidText) { + + + } + + + } + @case ('upload') { + +
    + +
    +
    + } + @case ('complete') { + + + + + } + } + @if (fileItem.invalid) { + - - - - - - + } ` }) export class FileComponent implements OnDestroy { diff --git a/src/file-uploader/stories/drag-drop.component.ts b/src/file-uploader/stories/drag-drop.component.ts index 952498d3fe..07add6779f 100644 --- a/src/file-uploader/stories/drag-drop.component.ts +++ b/src/file-uploader/stories/drag-drop.component.ts @@ -21,13 +21,14 @@ import * as fileType from "file-type"; (filesChange)="onDropped($event)" [disabled]="disabled"> - + @if (files && files.size > 0) { + + } ` }) export class DragAndDropStory { diff --git a/src/file-uploader/stories/uploader-form.component.ts b/src/file-uploader/stories/uploader-form.component.ts index e6f9e5b9dd..3e89474611 100644 --- a/src/file-uploader/stories/uploader-form.component.ts +++ b/src/file-uploader/stories/uploader-form.component.ts @@ -17,13 +17,14 @@ import { FileItem } from "../"; [(ngModel)]="model" [disabled]="disabled"> - + @if (model && model.size > 0) { + + } ` }) diff --git a/src/file-uploader/stories/uploader-reactive-form.component.ts b/src/file-uploader/stories/uploader-reactive-form.component.ts index 918debf866..941a95d78f 100644 --- a/src/file-uploader/stories/uploader-reactive-form.component.ts +++ b/src/file-uploader/stories/uploader-reactive-form.component.ts @@ -29,13 +29,14 @@ import { [disabled]="disabled" formControlName="files"> - + @if (formGroup.get('files').value && formGroup.get('files').value.size > 0) { + + }
    - + @if (disabledFormGroup.get('files').value && disabledFormGroup.get('files').value.size > 0) { + + }
    ` }) diff --git a/src/file-uploader/stories/uploader.component.ts b/src/file-uploader/stories/uploader.component.ts index 3571532ae1..dfdb2e8a15 100644 --- a/src/file-uploader/stories/uploader.component.ts +++ b/src/file-uploader/stories/uploader.component.ts @@ -18,9 +18,11 @@ import { FileItem } from "../"; [fileItemSize]="fileItemSize" [disabled]="disabled"> - + @if (files && files.size > 0) { + + } ` }) export class FileUploaderStory { diff --git a/src/icon/stories/many-icons-demo.component.ts b/src/icon/stories/many-icons-demo.component.ts index 5bcbc15d90..5923dcbf03 100644 --- a/src/icon/stories/many-icons-demo.component.ts +++ b/src/icon/stories/many-icons-demo.component.ts @@ -7,13 +7,17 @@ import { IconService } from "../"; selector: "app-demo-many-icon", template: ` - - - + @for (group of groupedIcons; track group) { + + @for (icon of group; track icon) { + + } + + }
    - -
    name: {{icon.name}}
    -
    size: {{icon.size}}
    -
    + +
    name: {{icon.name}}
    +
    size: {{icon.size}}
    +
    `, styles: [ diff --git a/src/inline-loading/inline-loading.component.ts b/src/inline-loading/inline-loading.component.ts index d9f19f36e2..580598dc24 100644 --- a/src/inline-loading/inline-loading.component.ts +++ b/src/inline-loading/inline-loading.component.ts @@ -31,37 +31,49 @@ export enum InlineLoadingState { @Component({ selector: "cds-inline-loading, ibm-inline-loading", template: ` -
    -
    - - - - + @if (state !== InlineLoadingState.Hidden) { +
    + @switch (state) { + @case (InlineLoadingState.Inactive || InlineLoadingState.Active) { +
    + + + + +
    + } + @case (InlineLoadingState.Finished) { + + + } + @case (InlineLoadingState.Error) { + + + } + }
    - - - - -
    -

    {{loadingText}}

    -

    {{successText}}

    -

    {{errorText}}

    + } + @switch(state) { + @case(InlineLoadingState.Inactive || InlineLoadingState.Active) { +

    {{loadingText}}

    + } + @case(InlineLoadingState.Finished) { +

    {{successText}}

    + } + @case(InlineLoadingState.Error) { +

    {{errorText}}

    + } + } ` }) export class InlineLoading { diff --git a/src/input/label.component.ts b/src/input/label.component.ts index b5f74d327e..fb684586eb 100644 --- a/src/input/label.component.ts +++ b/src/input/label.component.ts @@ -37,15 +37,16 @@ import { PasswordInput } from "./password.directive"; selector: "cds-label, ibm-label", template: ` - + - + - - + + @switch (type) { + @case ('TextArea') { - - + } + @case ('TextInput') { - - + } + @case ('PasswordInput') { + - - - - - + } + @default { + + } + }
    - - - - - -
    -
    - {{helperText}} - -
    -
    - {{invalidText}} - -
    -
    - {{warnText}} - + @if (invalid) { + + + } @else if (warn) { + + + } +
    + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{invalidText}} + } +
    + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{warnText}} + } +
    + } @else if(helperText && !skeleton) { +
    + @if (isTemplate(helperText)) { + + } @else { + {{helperText}} + } +
    + }
    ` }) diff --git a/src/input/password-input-label.component.ts b/src/input/password-input-label.component.ts index ff26b75128..cf2843e9e3 100644 --- a/src/input/password-input-label.component.ts +++ b/src/input/password-input-label.component.ts @@ -31,103 +31,125 @@ import { BaseIconButton } from "carbon-components-angular/button"; @Component({ selector: "cds-password-label, ibm-password-label", template: ` - + @if (skeleton) {
    -
    - - -
    -
    - - - - - - -
    - -
    -
    - - -
    -
    - {{ invalidText }} - -
    -
    - {{ warnText }} - -
    -
    -
    - + } @else { + +
    - {{ helperText }} - -
    - -
    - {{ invalidText }} - -
    + class="cds--text-input__field-wrapper" + [ngClass]="{ + 'cds--text-input__field-wrapper--warning': warn + }" + [attr.data-invalid]="invalid ? true : null" + #wrapper> + @if (invalid) { + + + } @else if (warn) { + + + } + + +
    + +
    +
    -
    - {{ warnText }} - + @if (fluid) { +
    + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + } +
    + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{ warnText }} + } +
    + } + }
    - -
    - ` + @if (!fluid) { + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + } +
    + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{ warnText }} + } +
    + } @else if(helperText && !skeleton) { +
    + @if (isTemplate(helperText)) { + + } @else { + {{ helperText }} + } +
    + } + } +
    + } + ` }) /** * Represents the Password Input Label Component. diff --git a/src/input/text-input-label.component.ts b/src/input/text-input-label.component.ts index 6d1c761641..0c43bd358a 100644 --- a/src/input/text-input-label.component.ts +++ b/src/input/text-input-label.component.ts @@ -29,78 +29,101 @@ import { @Component({ selector: "cds-text-label, ibm-text-label", template: ` - + @if (skeleton) {
    -
    - -
    -
    - - - - - - - - - - -
    -
    - {{invalidText}} - -
    -
    - {{warnText}} - -
    -
    -
    - + 'cds--label--disabled': disabled + }"> + @if (labelTemplate) { + + } @else { + + } + +
    - {{helperText}} - -
    -
    - {{invalidText}} - + class="cds--text-input__field-wrapper" + [ngClass]="{ + 'cds--text-input__field-wrapper--warning': warn + }" + [attr.data-invalid]="(invalid ? true : null)" + #wrapper> + @if (invalid) { + + + } @else if(warn) { + + + } + @if (textInputTemplate) { + + } @else { + + } + @if (fluid) { +
    + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + } +
    + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{ warnText }} + } +
    + } + }
    -
    - {{warnText}} - -
    - + @if (!fluid) { + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + } +
    + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{ warnText }} + } +
    + } @else if(helperText) { +
    + @if (isTemplate(helperText)) { + + } @else { + {{ helperText }} + } +
    + } + }
    + } ` }) export class TextInputLabelComponent implements AfterViewInit, AfterContentInit { diff --git a/src/input/textarea-label.component.ts b/src/input/textarea-label.component.ts index 3221fe07c3..470e2b4fbc 100644 --- a/src/input/textarea-label.component.ts +++ b/src/input/textarea-label.component.ts @@ -31,11 +31,10 @@ import { TextArea } from "./text-area.directive"; @Component({ selector: "cds-textarea-label, ibm-textarea-label", template: ` - + @if (skeleton) {
    -
    - + } @else {
    - - - - - - - - - - -
    -
    - {{invalidText}} - + @if(!fluid) { + @if (invalid) { -
    -
    - {{warnText}} - + } @else if (warn) { -
    -
    + } + } + @if (textAreaTemplate) { + + } @else { + + } + + @if (fluid) { +
    + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + } + + +
    + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{ warnText }} + } + + +
    + } + }
    - -
    - {{helperText}} - -
    -
    - {{invalidText}} - -
    -
    - {{warnText}} - -
    -
    -
    + @if (!fluid) { + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + } +
    + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{ warnText }} + } +
    + } @else if(helperText) { +
    + @if (isTemplate(helperText)) { + + } @else { + {{ helperText }} + } +
    + } + } + } ` }) export class TextareaLabelComponent implements AfterViewInit { diff --git a/src/layer/layer.spec.ts b/src/layer/layer.spec.ts index aedd9ef449..51c7cac64e 100644 --- a/src/layer/layer.spec.ts +++ b/src/layer/layer.spec.ts @@ -51,7 +51,6 @@ describe("Layer", () => { it("should have additional user provided classes", () => { let fixture: ComponentFixture = TestBed.createComponent(TestNestedLayerComponent); - console.log(fixture.debugElement); fixture.detectChanges(); const directiveEl = fixture.debugElement.query(By.directive(LayerDirective)).nativeElement; diff --git a/src/modal/alert-modal.component.ts b/src/modal/alert-modal.component.ts index c11ad3b40b..8a43d03bbf 100644 --- a/src/modal/alert-modal.component.ts +++ b/src/modal/alert-modal.component.ts @@ -62,17 +62,19 @@ import { BaseModal } from "./base-modal.class";

    - - - - - + @if (buttons.length > 0) { + + @for (button of buttons; track button.id; let i = $index) { + + } + + } ` }) diff --git a/src/modal/modal-footer.component.ts b/src/modal/modal-footer.component.ts index 88ab6b2f28..909508d4b9 100644 --- a/src/modal/modal-footer.component.ts +++ b/src/modal/modal-footer.component.ts @@ -4,7 +4,7 @@ import { Component } from "@angular/core"; selector: "cds-modal-footer, ibm-modal-footer", template: `
    - +
    ` }) diff --git a/src/modal/modal-header.component.ts b/src/modal/modal-header.component.ts index bf035b2648..6944dadf55 100644 --- a/src/modal/modal-header.component.ts +++ b/src/modal/modal-header.component.ts @@ -21,18 +21,19 @@ import { I18n } from "carbon-components-angular/i18n"; selector: "cds-modal-header, ibm-modal-header", template: `
    - +
    - - - + @if (showCloseButton) { + + + + }
    diff --git a/src/modal/modal.component.ts b/src/modal/modal.component.ts index 8a8249b6f8..b2c926525b 100644 --- a/src/modal/modal.component.ts +++ b/src/modal/modal.component.ts @@ -95,7 +95,7 @@ export class ModalDemo { style="z-index:1;" [attr.aria-label]="ariaLabel" #modal> - +
    ` diff --git a/src/modal/overlay.component.ts b/src/modal/overlay.component.ts index 5aadda9258..b48ad8ed31 100644 --- a/src/modal/overlay.component.ts +++ b/src/modal/overlay.component.ts @@ -25,7 +25,7 @@ import { }" (click)="overlayClick($event)" #overlay> - + ` }) diff --git a/src/notification/actionable-notification.component.ts b/src/notification/actionable-notification.component.ts index 804b63a73a..d1a2364d06 100644 --- a/src/notification/actionable-notification.component.ts +++ b/src/notification/actionable-notification.component.ts @@ -19,48 +19,53 @@ import { BaseNotification } from "./base-notification.component"; selector: "cds-actionable-notification, ibm-actionable-notification", template: `
    - - + @if (notificationObj.type) { + + + }
    -
    -
    - - - {{link.text}} - -
    - + @if (!notificationObj.template) { +
    +
    + + @for (link of notificationObj.links; track link.href) { + {{link.text}} + } +
    + } +
    - + @if (!notificationObj.actionsTemplate) { + @for (action of notificationObj.actions; track action) { + + } + } + + @if (!isCloseHidden) { - - - + } ` }) export class ActionableNotification extends BaseNotification { diff --git a/src/notification/notification.component.ts b/src/notification/notification.component.ts index 9c7ed7f3c7..80907246e6 100644 --- a/src/notification/notification.component.ts +++ b/src/notification/notification.component.ts @@ -19,28 +19,32 @@ import { BaseNotification } from "./base-notification.component"; selector: "cds-notification, cds-inline-notification, ibm-notification, ibm-inline-notification", template: `
    - - + @if (notificationObj.type) { + + + }
    -
    -
    - -
    - + @if (!notificationObj.template) { +
    +
    + +
    + } +
    - + @if (!isCloseHidden) { + + } ` }) export class Notification extends BaseNotification { diff --git a/src/notification/toast.component.ts b/src/notification/toast.component.ts index 88c92b0b0d..fb1e7beacd 100644 --- a/src/notification/toast.component.ts +++ b/src/notification/toast.component.ts @@ -19,28 +19,32 @@ import { BaseNotification } from "./base-notification.component"; @Component({ selector: "cds-toast, ibm-toast", template: ` - - + @if (notificationObj.type) { + + + }
    -

    -
    - -
    -

    - + @if (!notificationObj.template) { +

    +
    + +
    +

    + } +
    - + @if (!isCloseHidden) { + + } ` }) export class Toast extends BaseNotification implements OnInit { diff --git a/src/number-input/number.component.ts b/src/number-input/number.component.ts index 8f6642eb06..125e5f6896 100644 --- a/src/number-input/number.component.ts +++ b/src/number-input/number.component.ts @@ -38,7 +38,9 @@ export class NumberChange { @Component({ selector: "cds-number, ibm-number", template: ` - + @if (skeleton && label) { + + }
    - + @if (!skeleton && label) { + + }
    - - - - -
    - -
    - -
    -
    -
    -
    -
    - {{helperText}} - -
    -
    - {{invalidText}} - -
    -
    - {{warnText}} - + @if(!skeleton) { + @if (invalid) { + + + } @else if(warn) { + + + } +
    + +
    + +
    +
    + }
    + @if (fluid) { +
    + } + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{invalidText}} + } +
    + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{warnText}} + } +
    + } @else if(helperText && !fluid) { +
    + @if (isTemplate(helperText)) { + + } @else { + {{helperText}} + } +
    + }
    `, providers: [ diff --git a/src/pagination/pagination-nav/pagination-nav.component.ts b/src/pagination/pagination-nav/pagination-nav.component.ts index 7fc4f2814c..fc0d658b74 100644 --- a/src/pagination/pagination-nav/pagination-nav.component.ts +++ b/src/pagination/pagination-nav/pagination-nav.component.ts @@ -7,7 +7,7 @@ import { HostBinding } from "@angular/core"; -import { I18n, Overridable } from "carbon-components-angular/i18n"; +import { I18n } from "carbon-components-angular/i18n"; import { ExperimentalService } from "carbon-components-angular/experimental"; import { merge } from "carbon-components-angular/utils"; import { range } from "carbon-components-angular/common"; @@ -63,36 +63,41 @@ export interface PaginationNavTranslations { - - - - - - - - - - + @if (this.numOfItemsToShow >= 5 || (this.numOfItemsToShow <= 4 && currentPage <= 1)) { + + + } + @if (frontCuts) { + + + } + @for (page of getPages(); track page) { + + + } + @if (backCuts) { + + + } + @if (totalDataLength > 1) { + + + }
  • -
    - -
    - - -
    -
    -
  • - + @if (count === 1) { + + } @else if (count > 1) { +
  • +
    + +
    + + +
    +
    +
  • + } ` }) export class PaginationOverflow { @@ -58,7 +63,8 @@ export class PaginationOverflow { @Output() change = new EventEmitter(); get countAsArray() { - return [...Array(this.count)]; + const rangeArray = range((this.count >= 0 ? this.count + 1 : 0), 1); + return rangeArray; } constructor(protected i18n: I18n) {} diff --git a/src/pagination/pagination.component.spec.ts b/src/pagination/pagination.component.spec.ts index c9f9c07645..244a86ea27 100644 --- a/src/pagination/pagination.component.spec.ts +++ b/src/pagination/pagination.component.spec.ts @@ -163,16 +163,16 @@ describe("Pagination", () => { model.totalDataLength = 9; wrapper.model = model; fixture.detectChanges(); - expect(wrapper.pageOptions).toEqual(Array(2)); + expect(wrapper.pageOptions.length).toEqual(2); model.totalDataLength = 2; fixture.detectChanges(); - expect(wrapper.pageOptions).toEqual(Array(1)); + expect(wrapper.pageOptions.length).toEqual(1); model.totalDataLength = 20; fixture.detectChanges(); - expect(wrapper.pageOptions).toEqual(Array(4)); + expect(wrapper.pageOptions.length).toEqual(4); model.totalDataLength = 0; fixture.detectChanges(); - expect(wrapper.pageOptions).toEqual(Array(1)); + expect(wrapper.pageOptions.length).toEqual(1); }); it("should replace the select with a number input when the pagination threshold is reached", () => { diff --git a/src/pagination/pagination.component.ts b/src/pagination/pagination.component.ts index 4d16fbe4c2..ac6f2b969d 100644 --- a/src/pagination/pagination.component.ts +++ b/src/pagination/pagination.component.ts @@ -6,9 +6,10 @@ import { EventEmitter } from "@angular/core"; -import { I18n, Overridable } from "carbon-components-angular/i18n"; +import { I18n } from "carbon-components-angular/i18n"; import { ExperimentalService } from "carbon-components-angular/experimental"; import { merge } from "carbon-components-angular/utils"; +import { range } from "carbon-components-angular/common"; export interface PaginationTranslations { ITEMS_PER_PAGE: string; @@ -51,143 +52,165 @@ export interface PaginationTranslations { @Component({ selector: "cds-pagination, ibm-pagination", template: ` -
    - -
    -

    -

    -

    -
    - -
    - - -
    - - +
    + + @if (skeleton) { +
    +

    +

    +

    - - - {{totalItemText.subject | i18nReplace:{start: startItemIndex, end: endItemIndex, total: totalDataLength } | async}} - - - {{totalItemsText.subject | i18nReplace:{start: startItemIndex, end: endItemIndex, total: totalDataLength } | async}} - - - {{totalItemsUnknownText.subject | i18nReplace:{start: startItemIndex, end: endItemIndex } | async}} - -
    - - -
    -

    -
    + } @else { +
    + @if (showPageInput) { + +
    + + +
    + } + @if (!pagesUnknown && totalDataLength <= 1) { + + {{totalItemText.subject | i18nReplace:{start: startItemIndex, end: endItemIndex, total: totalDataLength } | async}} + + } + @if (!pagesUnknown && totalDataLength > 1) { + + {{totalItemsText.subject | i18nReplace:{start: startItemIndex, end: endItemIndex, total: totalDataLength } | async}} + + } + @if (pagesUnknown) { + + {{totalItemsUnknownText.subject | i18nReplace:{start: startItemIndex, end: endItemIndex } | async}} + + } +
    + } -
    - - {{currentPage}} - {{pageText.subject | async}} - - -
    - - - - - + + @if (skeleton) { +
    +

    - + } @else { +
    + @if (pagesUnknown) { + + @if (!showPageInput) { + {{currentPage}} + } + {{pageText.subject | async}} + + } + @if (showPageInput) { +
    + + @if (pageOptions.length > pageSelectThreshold) { + + } + @if (pageOptions.length <= pageSelectThreshold) { + + + + } +
    + } - - {{currentPage}} - {{ofLastPageText.subject | i18nReplace: {last: lastPage} | async}} - - - {{currentPage}} - {{ofLastPagesText.subject | i18nReplace: {last: lastPage} | async}} - -
    - + @if (!pagesUnknown && lastPage <= 1) { + + @if (!showPageInput) { + {{currentPage}} + } + {{ofLastPageText.subject | i18nReplace: {last: lastPage} | async}} + + } + @if (!pagesUnknown && lastPage > 1) { + + @if (!showPageInput) { + {{currentPage}} + } + {{ofLastPagesText.subject | i18nReplace: {last: lastPage} | async}} + + } +
    + - -
    + +
    +
    + }
    -
    ` }) export class Pagination { @@ -202,7 +225,7 @@ export class Pagination { */ @Input() model: PaginationModel; /** - * Set to `true` to disable the backward/forward buttons. + * Set to `true` to disable the backward/forward buttons. */ @Input() disabled = false; /** @@ -236,7 +259,7 @@ export class Pagination { * ``` */ @Input() - set translations (value: PaginationTranslations) { + set translations(value: PaginationTranslations) { const valueWithDefaults = merge(this.i18n.getMultiple("PAGINATION"), value); this.itemsPerPageText.override(valueWithDefaults.ITEMS_PER_PAGE); this.optionsListText.override(valueWithDefaults.OPEN_LIST_OF_OPTIONS); @@ -327,7 +350,7 @@ export class Pagination { */ const numberOfPages = Math.max(Math.ceil(this.totalDataLength / this.itemsPerPage), 1); if (this._pageOptions.length !== numberOfPages) { - this._pageOptions = Array(numberOfPages); + this._pageOptions = range(numberOfPages + 1, 1); } return this._pageOptions; } diff --git a/src/patterns/filtering/multiple-categories.stories.ts b/src/patterns/filtering/multiple-categories.stories.ts index 78c92a132c..51b3c08ac4 100644 --- a/src/patterns/filtering/multiple-categories.stories.ts +++ b/src/patterns/filtering/multiple-categories.stories.ts @@ -32,11 +32,13 @@ import { UIShellModule } from "../../ui-shell"; labelPlacement="right" [(ngModel)]="radio" (change)="onRadioChange($event)"> - - {{radio.color}} - + @for (radio of radios; track radio) { + + {{radio.color}} + + }
    @@ -45,21 +47,22 @@ import { UIShellModule } from "../../ui-shell"; Type
    - - {{checkBoxFilters.size}} - + @if (checkBoxFilters.size > 0) { + + {{checkBoxFilters.size}} + + }
    - - {{ listItem.value }} - + @for (listItem of checkboxList; track listItem) { + + {{ listItem.value }} + + }
    diff --git a/src/patterns/forms/multi-step-form.stories.ts b/src/patterns/forms/multi-step-form.stories.ts index 4a16a26488..ae6da09787 100644 --- a/src/patterns/forms/multi-step-form.stories.ts +++ b/src/patterns/forms/multi-step-form.stories.ts @@ -52,64 +52,66 @@ import {
    -
    - -
    +
    + @switch (currentStep) { + @case (1) { + +
    +
    +

    Create a new workspace

    + +
    +
    + + Workspace name + + +
    +
    + + + +
    +
    + + Description (optional) + + +
    +
    + +
    +
    + + } + @case (2) {
    -

    Create a new workspace

    - -
    -
    - - Workspace name - - -
    -
    - - - + Step 3 form!
    - - Description (optional) - - +
    -
    - -
    -
    - - - -
    -
    - Step 3 form! -
    -
    -
    -
    -
    + } + }
    diff --git a/src/patterns/loading/large-loading.stories.ts b/src/patterns/loading/large-loading.stories.ts index 5bd20b3566..46e62998a7 100644 --- a/src/patterns/loading/large-loading.stories.ts +++ b/src/patterns/loading/large-loading.stories.ts @@ -80,12 +80,13 @@ import { - - + @if (isLoading) { + + + } `, styles: [` .header { diff --git a/src/popover/popover-content.component.ts b/src/popover/popover-content.component.ts index 09d6ea2969..8e2da3ee1f 100644 --- a/src/popover/popover-content.component.ts +++ b/src/popover/popover-content.component.ts @@ -15,11 +15,15 @@ import { template: `
    - +
    - + @if (autoAlign) { + + }
    - + @if (!autoAlign) { + + } ` }) export class PopoverContent implements AfterViewInit { diff --git a/src/progress-bar/progress-bar.component.ts b/src/progress-bar/progress-bar.component.ts index 950f05bc23..e9bc5835f1 100644 --- a/src/progress-bar/progress-bar.component.ts +++ b/src/progress-bar/progress-bar.component.ts @@ -17,27 +17,32 @@ import { @Component({ selector: "cds-progress-bar, ibm-progress-bar", template: ` -
    - - {{label}} - - - - - - -
    + @if (label) { +
    + + @if (isTemplate(label)) { + + } @else { + {{label}} + } + + @if (isFinished) { + + + } @else if (isError) { + + + } +
    + }
    -
    - {{helperText}} - -
    + @if (helperText) { +
    + @if (isTemplate(helperText)) { + + } @else { + {{helperText}} + } +
    + } ` }) export class ProgressBar { diff --git a/src/progress-indicator/progress-indicator.component.ts b/src/progress-indicator/progress-indicator.component.ts index 4d95a108c0..faa952cd19 100644 --- a/src/progress-indicator/progress-indicator.component.ts +++ b/src/progress-indicator/progress-indicator.component.ts @@ -19,54 +19,59 @@ import { Step } from "./progress-indicator-step.interface"; @Component({ selector: "cds-progress-indicator, ibm-progress-indicator", template: ` -
      -
    • - -
    • -
    + + + } + ` }) export class ProgressIndicator { diff --git a/src/radio/radio-group.component.ts b/src/radio/radio-group.component.ts index 9ee2b6129e..96648ac573 100644 --- a/src/radio/radio-group.component.ts +++ b/src/radio/radio-group.component.ts @@ -55,43 +55,57 @@ import { RadioChange } from "./radio-change.class"; 'cds--radio-button-group--warning': !invalid && warn }" [attr.data-invalid]="invalid ? true : null"> - - - {{legend}} - - + @if (legend) { + + @if (isTemplate(legend)) { + + } @else { + {{legend}} + } + + } +
    - + @if (invalid) {
    - {{ invalidText }} - + @if (isTemplate(invalidText)) { + + } @else { + {{ invalidText }} + }
    -
    - + } @else if (warn) {
    - {{warnText}} - + @if (isTemplate(warnText)) { + + } @else { + {{ warnText }} + }
    -
    -
    -
    - {{helperText}} - + }
    + @if (helperText && !invalid && !warn) { +
    + @if (isTemplate(helperText)) { + + } @else { + {{helperText}} + } +
    + } `, providers: [ { diff --git a/src/radio/radio.component.spec.ts b/src/radio/radio.component.spec.ts index c721a9ad59..9dc0a59b7a 100644 --- a/src/radio/radio.component.spec.ts +++ b/src/radio/radio.component.spec.ts @@ -9,11 +9,14 @@ import { RadioGroup } from "./radio-group.component"; @Component({ selector: "test-component", template: ` - - Radio {{one}} - - ` + + @for (one of manyRadios; track one) { + + Radio {{one}} + + } + + ` }) class RadioTest { manyRadios = ["one", "two", "three", "four", "five", "six"]; diff --git a/src/radio/radio.component.ts b/src/radio/radio.component.ts index 799b561540..f33ffe199f 100644 --- a/src/radio/radio.component.ts +++ b/src/radio/radio.component.ts @@ -24,20 +24,22 @@ import { RadioChange } from "./radio-change.class"; @Component({ selector: "cds-radio, ibm-radio", template: ` - -
    + @if (skeleton) { +
    + } @else { + + } `, providers: [ diff --git a/src/radio/stories/app-reactive-forms.component.ts b/src/radio/stories/app-reactive-forms.component.ts index 39b52db07e..a39340d321 100644 --- a/src/radio/stories/app-reactive-forms.component.ts +++ b/src/radio/stories/app-reactive-forms.component.ts @@ -20,11 +20,13 @@ import { value="radio"> zero - - {{radio.num}} - + @for (radio of manyRadios; track radio) { + + {{radio.num}} + + } diff --git a/src/search/search.component.html b/src/search/search.component.html index 97ba0bf06b..2580898fe5 100644 --- a/src/search/search.component.html +++ b/src/search/search.component.html @@ -26,8 +26,9 @@ {{ !skeleton ? label : ''}} -
    - + @if (skeleton) { +
    + } @else { + @if (!tableSearch && toolbar) { + + } + @if (tableSearch || !toolbar) { + + + } + } + + @if (tableSearch || !toolbar) { - - -
    - - + } diff --git a/src/select/select.component.spec.ts b/src/select/select.component.spec.ts index 1a70d4c331..fb23c6cec6 100644 --- a/src/select/select.component.spec.ts +++ b/src/select/select.component.spec.ts @@ -62,7 +62,11 @@ describe("Select", () => { }).createComponent(SelectTest); fixture.detectChanges(); element = fixture.debugElement.query(By.css("cds-select")).nativeElement; - expect(element.querySelector(".cds--label").textContent).toEqual("test"); + /** + * @todo + * Verify if new control flow syntax still requires `space` preceding and succeeding label + */ + expect(element.querySelector(".cds--label").textContent).toEqual(" test "); }); it("should set helperText to test", () => { @@ -73,7 +77,11 @@ describe("Select", () => { }).createComponent(SelectTest); fixture.detectChanges(); element = fixture.debugElement.query(By.css("cds-select")).nativeElement; - expect(element.querySelector(".cds--form__helper-text").textContent).toEqual("test"); + /** + * @todo + * Verify if new control flow syntax still requires `space` preceding and succeeding label + */ + expect(element.querySelector(".cds--form__helper-text").textContent).toEqual(" test "); }); it("should set display to inline", () => { @@ -101,7 +109,7 @@ describe("Select", () => { expect(element.querySelector("option").disabled).toBe(true); }); - it("should display cds-icon-warning-filled16 and display invalid text", () => { + it("should display warning filled icon and display invalid text", () => { fixture = TestBed.overrideComponent(SelectTest, { set: { template: `` @@ -110,7 +118,11 @@ describe("Select", () => { fixture.detectChanges(); element = fixture.debugElement.query(By.css("cds-select")).nativeElement; expect(element.querySelector(".cds--select__invalid-icon")).toBeTruthy(); - expect(element.querySelector(".cds--form-requirement").textContent).toEqual("test"); + /** + * @todo + * Verify if new control flow syntax still requires `space` preceding and succeeding label + */ + expect(element.querySelector(".cds--form-requirement").textContent).toEqual(" test "); }); it("should set class cds--skeleton", () => { diff --git a/src/select/select.component.ts b/src/select/select.component.ts index ef2b67fb46..34967bcc22 100644 --- a/src/select/select.component.ts +++ b/src/select/select.component.ts @@ -37,52 +37,67 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms"; 'cds--form-item': !skeleton, 'cds--select--fluid': fluid && !skeleton }"> - -
    + @if (skeleton && !fluid) { + @if (label) { +
    + }
    -
    - + } + @if (skeleton && fluid) {
    -
    -
    - -
    - -
    + } + @if (!skeleton) {
    - {{helperText}} - + @if (label) { + + } + @if (display === 'inline') { +
    + +
    + } @else { + + } + @if (helperText && !invalid && !warn && !skeleton && !fluid) { +
    + @if (isTemplate(helperText)) { + + } @else { + {{helperText}} + } +
    + }
    -
    + } @@ -106,7 +121,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms"; (keydown)="onKeyDown($event)" (focus)="fluid ? handleFocus($event) : null" (blur)="fluid ? handleFocus($event) : null"> - + - - - - - + @if (invalid) { + + + } @else if (warn) { + + + } + @if (fluid) {
    + @if (invalid) { + + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{warnText}} + } +
    + } + } + + @if (!fluid) { + @if (invalid) { -
    - {{warnText}} - + } @else if (warn) { +
    + @if (isTemplate(warnText)) { + + } @else { + {{warnText}} + }
    - -
    - - -
    - {{warnText}} - -
    -
    + } + }
    `, providers: [ diff --git a/src/skeleton/skeleton-text.component.ts b/src/skeleton/skeleton-text.component.ts index 026afa160f..d5430ea719 100644 --- a/src/skeleton/skeleton-text.component.ts +++ b/src/skeleton/skeleton-text.component.ts @@ -3,11 +3,9 @@ import { Component, Input, OnChanges } from "@angular/core"; @Component({ selector: "cds-skeleton-text, ibm-skeleton-text", template: ` -

    -

    + @for (width of lineWidths; track width) { +

    + } ` }) export class SkeletonText implements OnChanges { diff --git a/src/slider/slider.component.ts b/src/slider/slider.component.ts index 36c75bafaf..3ab40c7365 100644 --- a/src/slider/slider.component.ts +++ b/src/slider/slider.component.ts @@ -62,21 +62,38 @@ import { EventService } from "carbon-components-angular/utils"; @Component({ selector: "cds-slider, ibm-slider", template: ` - - + @if(skeleton) { + @if (label) { + + } +
    + +
    +
    +
    +
    +
    + +
    + } @else { + @if (label) { + + }
    - + @if (isRange()) { + @for (thumb of value; track trackThumbsBy(i, thumb); let i = $index) { +
    +
    +
    +
    + } + } @else {
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    + } +
    +
    - -
    -
    - - - -
    - -
    -
    -
    -
    -
    - +
    -
    + } `, providers: [ { diff --git a/src/structured-list/list-column.component.ts b/src/structured-list/list-column.component.ts index 3494d0065b..affbd658bd 100644 --- a/src/structured-list/list-column.component.ts +++ b/src/structured-list/list-column.component.ts @@ -13,8 +13,10 @@ import { Component, HostBinding, Input } from "@angular/core"; @Component({ selector: "cds-list-column, ibm-list-column", template: ` - - + @if (skeleton) { + + } + ` }) export class ListColumn { diff --git a/src/structured-list/list-header.component.ts b/src/structured-list/list-header.component.ts index 3f5ed03d38..e80d33bfd3 100644 --- a/src/structured-list/list-header.component.ts +++ b/src/structured-list/list-header.component.ts @@ -24,8 +24,10 @@ import { ListColumn } from "./list-column.component"; selector: "cds-list-header, ibm-list-header", template: `
    - -
    + + @if (selection) { +
    + }
    ` }) diff --git a/src/structured-list/list-row.component.ts b/src/structured-list/list-row.component.ts index 26cf6e1df2..90626fa220 100644 --- a/src/structured-list/list-row.component.ts +++ b/src/structured-list/list-row.component.ts @@ -34,8 +34,8 @@ import { ListColumn } from "./list-column.component"; @Component({ selector: "cds-list-row, ibm-list-row", template: ` - - + + @if (selection) { + [checked]="selected" />
    -
    + } ` }) export class ListRow implements AfterContentInit { diff --git a/src/structured-list/structured-list.component.ts b/src/structured-list/structured-list.component.ts index 944475219f..24150a2fa7 100644 --- a/src/structured-list/structured-list.component.ts +++ b/src/structured-list/structured-list.component.ts @@ -68,9 +68,9 @@ import { NG_VALUE_ACCESSOR, ControlValueAccessor } from "@angular/forms"; 'cds--structured-list--condensed': condensed, 'cds--skeleton': skeleton }"> - +
    - +
    `, diff --git a/src/table/body/table-body.component.ts b/src/table/body/table-body.component.ts index fc86decdb7..e727405a3d 100644 --- a/src/table/body/table-body.component.ts +++ b/src/table/body/table-body.component.ts @@ -13,58 +13,60 @@ import { TableRowSize } from "../table.types"; // tslint:disable-next-line: component-selector selector: "[cdsTableBody], [ibmTableBody]", template: ` - - - - - - - + @if (model) { + @for (row of model.data; track row; let i = $index) { + @if (!model.isRowFiltered(i)) { + + } + @if (model.isRowExpandable(i) && !shouldExpandAsTable(row) && !model.isRowFiltered(i)) { + - - - - + } + @if (model.isRowExpandable(i) && shouldExpandAsTable(row) && model.isRowExpanded(i) && !model.isRowFiltered(i)) { + @for (expandedDataRow of firstExpandedDataInRow(row); track expandedDataRow) { + + + } + } + } + } + ` }) export class TableBody { diff --git a/src/table/body/table-expanded-row.component.ts b/src/table/body/table-expanded-row.component.ts index 2073bd2d5e..6a5ea533d9 100644 --- a/src/table/body/table-expanded-row.component.ts +++ b/src/table/body/table-expanded-row.component.ts @@ -9,13 +9,10 @@ import { selector: "[cdsTableExpandedRow], [ibmTableExpandedRow]", template: ` - + @if (!firstExpandedTemplateInRow(row)) { {{firstExpandedDataInRow(row)}} - - - + } + ` }) diff --git a/src/table/body/table-row.component.ts b/src/table/body/table-row.component.ts index df7f83f433..466b84fc16 100644 --- a/src/table/body/table-row.component.ts +++ b/src/table/body/table-row.component.ts @@ -16,23 +16,23 @@ import { TableRowSize } from "../table.types"; // tslint:disable-next-line: component-selector selector: "[cdsTableRow], [ibmTableRow]", template: ` - - - - + @if (model) { + @if (model.hasExpandableRows()) { + cdsTableExpandButton + class="cds--table-expand-v2" + [expanded]="expanded" + [expandable]="expandable" + [skeleton]="skeleton" + [ariaLabel]="getExpandButtonAriaLabel()" + [headers]="model.getHeaderId('expand')" + (expandRow)="expandRow.emit()"> - + } + @if (!skeleton && showSelectionColumn && !enableSingleSelect) { + @if (!showSelectionColumnCheckbox) { + + } @else { - - - - - - - + } + } + @if (!skeleton && showSelectionColumn && enableSingleSelect) { + [headers]="model.getHeaderId('select')" + (change)="onSelectionChange()"> - - - + } + @for (item of row; track item; let j = $index) { + @if (item && model.getHeader(j) && model.getHeader(j).visible) { + + + } + @if (item && model.getHeader(j) == null) { + + + } + } + } + ` }) export class TableRowComponent { diff --git a/src/table/cell/table-checkbox.component.ts b/src/table/cell/table-checkbox.component.ts index 3a24a62ba3..8a0f65ee01 100644 --- a/src/table/cell/table-checkbox.component.ts +++ b/src/table/cell/table-checkbox.component.ts @@ -14,16 +14,17 @@ import { TableRowSize } from "../table.types"; // tslint:disable-next-line: component-selector selector: "[cdsTableCheckbox], [ibmTableCheckbox]", template: ` - - {{getLabel() | i18nReplace:getSelectionLabelValue(row) | async}} - + @if (!skeleton) { + + {{getLabel() | i18nReplace:getSelectionLabelValue(row) | async}} + + } ` }) export class TableCheckbox { diff --git a/src/table/cell/table-data.component.ts b/src/table/cell/table-data.component.ts index 01998a3cbe..ff79b6c129 100644 --- a/src/table/cell/table-data.component.ts +++ b/src/table/cell/table-data.component.ts @@ -8,12 +8,12 @@ import { TableItem } from "../table-item.class"; // tslint:disable-next-line: component-selector selector: "[cdsTableData], [ibmTableData]", template: ` - {{item.data}} - - + @if (!skeleton && !item.template) { + {{item.data}} + } + @if (!skeleton) { + + } ` }) export class TableData { diff --git a/src/table/cell/table-expand-button.component.ts b/src/table/cell/table-expand-button.component.ts index 74ae21060c..da5cac199e 100644 --- a/src/table/cell/table-expand-button.component.ts +++ b/src/table/cell/table-expand-button.component.ts @@ -12,13 +12,14 @@ import { Observable } from "rxjs"; // tslint:disable-next-line: component-selector selector: "[cdsTableExpandButton], [ibmTableExpandButton]", template: ` - + @if (expandable) { + + } ` }) export class TableExpandButton { diff --git a/src/table/cell/table-radio.component.ts b/src/table/cell/table-radio.component.ts index 7bbdf2d3d1..d8a41feebc 100644 --- a/src/table/cell/table-radio.component.ts +++ b/src/table/cell/table-radio.component.ts @@ -14,14 +14,15 @@ import { Observable } from "rxjs"; // tslint:disable-next-line: component-selector selector: "[cdsTableRadio], [ibmTableRadio]", template: ` - - + @if (!skeleton) { + + + } ` }) export class TableRadio { diff --git a/src/table/head/table-head-cell.component.ts b/src/table/head/table-head-cell.component.ts index e9d0538eb5..db397bc38a 100644 --- a/src/table/head/table-head-cell.component.ts +++ b/src/table/head/table-head-cell.component.ts @@ -15,68 +15,70 @@ import { TableHeaderItem } from "../table-header-item.class"; // tslint:disable-next-line: component-selector selector: "[cdsTableHeadCell], [ibmTableHeadCell]", template: ` - -
    - - - {{column.data}} - - - - -
    + @if (sortable && this.sort.observers.length > 0 && column.sortable) { + + } + @if (!skeleton && this.sort.observers.length === 0 || (this.sort.observers.length > 0 && !column.sortable) || !sortable) { +
    + @if (!column.template) { + + @if (!skeleton) { + {{column.data}} + } + + } + +
    + } ` }) export class TableHeadCell implements OnChanges { diff --git a/src/table/head/table-head-checkbox.component.ts b/src/table/head/table-head-checkbox.component.ts index 33797d31f7..f5cfb2e6d0 100644 --- a/src/table/head/table-head-checkbox.component.ts +++ b/src/table/head/table-head-checkbox.component.ts @@ -12,16 +12,16 @@ import { Observable } from "rxjs"; // tslint:disable-next-line: component-selector selector: "[cdsTableHeadCheckbox], [ibmTableHeadCheckbox]", template: ` - - {{getAriaLabel() | async}} - + @if (!skeleton) { + + {{getAriaLabel() | async}} + + } `, styles: [` :host { width: 10px; } diff --git a/src/table/head/table-head-expand.component.ts b/src/table/head/table-head-expand.component.ts index 2c0e94448b..14a4761d8b 100644 --- a/src/table/head/table-head-expand.component.ts +++ b/src/table/head/table-head-expand.component.ts @@ -12,16 +12,16 @@ import { Observable } from "rxjs"; // tslint:disable-next-line: component-selector selector: "[cdsTableHeadExpand], [ibmTableHeadExpand]", template: ` - - - - + @if (showExpandAllToggle) { + + } @else { + + } ` }) export class TableHeadExpand { diff --git a/src/table/head/table-head.component.ts b/src/table/head/table-head.component.ts index 569ae0872e..db77682ee4 100644 --- a/src/table/head/table-head.component.ts +++ b/src/table/head/table-head.component.ts @@ -25,64 +25,70 @@ import { TableRowSize } from "../table.types"; // tslint:disable-next-line:component-selector selector: "[cdsTableHead], [ibmTableHead]", template: ` - - - - - - - - - - - + @if (model.hasExpandableRows()) { + + + } + @if (!skeleton && showSelectionColumn && enableSingleSelect) { + + + + } + @if (!skeleton && showSelectionColumn && !enableSingleSelect) { + + + } + @for (column of model.header; track column; let i = $index) { + @if (column && column.visible) { + + + } + } + @if (!skeleton && stickyHeader && scrollbarWidth) { + + [ngStyle]="{'width': scrollbarWidth + 'px', 'padding': 0, 'border': 0}"> + - - - - - - - + } + + } + `, styles: [` .cds--table-expand-v2 { diff --git a/src/table/header/table-header.component.ts b/src/table/header/table-header.component.ts index 818794127b..e6160b1fef 100644 --- a/src/table/header/table-header.component.ts +++ b/src/table/header/table-header.component.ts @@ -3,7 +3,7 @@ import { Component, HostBinding } from "@angular/core"; @Component({ selector: "cds-table-header, ibm-table-header", template: ` - + ` }) export class TableHeader { diff --git a/src/table/stories/app-function-override-filter-table.component.ts b/src/table/stories/app-function-override-filter-table.component.ts index 0d8551db2b..7dbacbfe03 100644 --- a/src/table/stories/app-function-override-filter-table.component.ts +++ b/src/table/stories/app-function-override-filter-table.component.ts @@ -53,7 +53,7 @@ import Filter16 from "@carbon/icons/es/filter/16"; [stickyHeader]="stickyHeader" [striped]="striped" [isDataGrid]="isDataGrid"> - + diff --git a/src/table/stories/app-model-filter-table.component.ts b/src/table/stories/app-model-filter-table.component.ts index 208e7d02f4..2b5b0b4afd 100644 --- a/src/table/stories/app-model-filter-table.component.ts +++ b/src/table/stories/app-model-filter-table.component.ts @@ -53,7 +53,7 @@ import Filter16 from "@carbon/icons/es/filter/16"; [stickyHeader]="stickyHeader" [striped]="striped" [isDataGrid]="isDataGrid"> - + diff --git a/src/table/stories/app-no-data.component.ts b/src/table/stories/app-no-data.component.ts index 5bda3a5a9e..78daf362a3 100644 --- a/src/table/stories/app-no-data.component.ts +++ b/src/table/stories/app-no-data.component.ts @@ -18,7 +18,7 @@ import { TableHeaderItem } from "../table-header-item.class"; [showSelectionColumn]="showSelectionColumn" [striped]="striped" [isDataGrid]="isDataGrid"> - + ` }) diff --git a/src/table/stories/app-skeleton-table.component.ts b/src/table/stories/app-skeleton-table.component.ts index 272115f3fc..4cba51405a 100644 --- a/src/table/stories/app-skeleton-table.component.ts +++ b/src/table/stories/app-skeleton-table.component.ts @@ -15,7 +15,7 @@ import { Table } from "../index"; [skeleton]="skeleton" [size]="size" [striped]="striped"> - + ` }) diff --git a/src/table/stories/app-table.component.ts b/src/table/stories/app-table.component.ts index 1cee775741..00101dc7bd 100644 --- a/src/table/stories/app-table.component.ts +++ b/src/table/stories/app-table.component.ts @@ -25,7 +25,7 @@ import { TableItem } from "../table-item.class"; [isDataGrid]="isDataGrid" [ariaLabelledby]="ariaLabelledby" [ariaDescribedby]="ariaDescribedby"> - + ` }) diff --git a/src/table/table-container.component.ts b/src/table/table-container.component.ts index ec742a241f..ed2490cc8e 100644 --- a/src/table/table-container.component.ts +++ b/src/table/table-container.component.ts @@ -10,7 +10,7 @@ import { Table } from "./table.component"; @Component({ selector: "cds-table-container, ibm-table-container", - template: ``, + template: ``, styles: [` :host { display: block } `] diff --git a/src/table/table.component.ts b/src/table/table.component.ts index b804e50ff7..bffcc8cae8 100644 --- a/src/table/table.component.ts +++ b/src/table/table.component.ts @@ -203,45 +203,50 @@ import { TableRowSize } from "./table.types"; [sortDescendingLabel]="sortDescendingLabel" [stickyHeader]="stickyHeader"> - - - + @if (!noData) { + + + } @else { + + } + - - - - -
    - - - -
    - - - - -
    {{getEndOfDataText() | async}}
    - - - + + @if (this.model.isLoading) { + + +
    + + + +
    + + + } + @if (this.model.isEnd) { + + +
    {{getEndOfDataText() | async}}
    + + + + } `, diff --git a/src/table/toolbar/table-toolbar-actions.component.ts b/src/table/toolbar/table-toolbar-actions.component.ts index e22fc03e77..0708e8a9fa 100644 --- a/src/table/toolbar/table-toolbar-actions.component.ts +++ b/src/table/toolbar/table-toolbar-actions.component.ts @@ -2,6 +2,6 @@ import { Component, HostBinding } from "@angular/core"; @Component({ selector: "cds-table-toolbar-actions, ibm-table-toolbar-actions", - template: `` + template: `` }) export class TableToolbarActions {} diff --git a/src/table/toolbar/table-toolbar-content.component.ts b/src/table/toolbar/table-toolbar-content.component.ts index ea94de54a6..f2c1567298 100644 --- a/src/table/toolbar/table-toolbar-content.component.ts +++ b/src/table/toolbar/table-toolbar-content.component.ts @@ -2,7 +2,7 @@ import { Component, HostBinding } from "@angular/core"; @Component({ selector: "cds-table-toolbar-content, ibm-table-toolbar-content", - template: `` + template: `` }) export class TableToolbarContent { @HostBinding("class.cds--toolbar-content") class = true; diff --git a/src/table/toolbar/table-toolbar.component.ts b/src/table/toolbar/table-toolbar.component.ts index 62771ea8d8..a64ad4ac2e 100644 --- a/src/table/toolbar/table-toolbar.component.ts +++ b/src/table/toolbar/table-toolbar.component.ts @@ -46,40 +46,45 @@ import { TableRowSize } from "../table.types"; @Component({ selector: "cds-table-toolbar, ibm-table-toolbar", template: ` -
    -
    -
    -

    - - {{n}} {{legacyText}} - - - {{_batchTextSingle.subject | async}} - {{_batchTextMultiple.subject | i18nReplace: {count: n} | async}} - -

    -
    -
    - - -
    -
    - -
    +
    + @if (model) { +
    +
    + @if (count; as n) { +

    + @if (_batchTextLegacy.subject | async; as legacyText) { + {{n}} {{legacyText}} + } @else { + @if (n === 1) { + {{_batchTextSingle.subject | async}} + } @else if(n > 1) { + {{_batchTextMultiple.subject | i18nReplace: {count: n} | async}} + } + } +

    + } +
    +
    + + +
    +
    + } + +
    ` }) export class TableToolbar { diff --git a/src/tabs/tab-header-group.component.ts b/src/tabs/tab-header-group.component.ts index a17535cc1e..22702b164a 100644 --- a/src/tabs/tab-header-group.component.ts +++ b/src/tabs/tab-header-group.component.ts @@ -53,9 +53,9 @@ import { BaseTabHeader } from "./base-tab-header.component"; [attr.aria-label]="ariaLabel" (scroll)="handleScroll()" #tabList> - - - + + + - + + @for (tab of tabs; track tab; let i = $index) { + + } + - + } ` }) export class TagFilter extends Tag { diff --git a/src/tag/tag-operational.component.ts b/src/tag/tag-operational.component.ts index 31915c61be..e12475826f 100644 --- a/src/tag/tag-operational.component.ts +++ b/src/tag/tag-operational.component.ts @@ -9,12 +9,12 @@ import { Tag } from "./tag.component"; @Component({ selector: "cds-tag-operational, ibm-tag-operational", template: ` - - + @if (!skeleton) { + - + - + } `, changeDetection: ChangeDetectionStrategy.OnPush }) diff --git a/src/tag/tag-selectable.component.ts b/src/tag/tag-selectable.component.ts index dabda18ad0..ce10c0d4de 100644 --- a/src/tag/tag-selectable.component.ts +++ b/src/tag/tag-selectable.component.ts @@ -11,12 +11,12 @@ import { @Component({ selector: "cds-tag-selectable, ibm-tag-selectable", template: ` - - + @if (!skeleton) { + - + - + } `, changeDetection: ChangeDetectionStrategy.OnPush }) diff --git a/src/tag/tag.component.ts b/src/tag/tag.component.ts index f98415d8b7..9018e4d698 100644 --- a/src/tag/tag.component.ts +++ b/src/tag/tag.component.ts @@ -32,12 +32,12 @@ export type TagType = "red" | @Component({ selector: "cds-tag, ibm-tag", template: ` - - + @if (!skeleton) { + - + - + } ` }) export class Tag { diff --git a/src/tiles/clickable-tile.component.ts b/src/tiles/clickable-tile.component.ts index b2d2055cf0..2749bb3302 100644 --- a/src/tiles/clickable-tile.component.ts +++ b/src/tiles/clickable-tile.component.ts @@ -36,7 +36,7 @@ import { Router } from "@angular/router"; [attr.target]="target" [attr.rel]="rel ? rel : null" [attr.aria-disabled]="disabled"> - + ` }) export class ClickableTile { diff --git a/src/tiles/expandable-tile.component.ts b/src/tiles/expandable-tile.component.ts index 1184425c6c..d194cbbb06 100644 --- a/src/tiles/expandable-tile.component.ts +++ b/src/tiles/expandable-tile.component.ts @@ -25,32 +25,32 @@ export interface ExpandableTileTranslations { @Component({ selector: "cds-expandable-tile, ibm-expandable-tile", template: ` - - -
    - -
    + @if (interactive) { +
    + +
    + } @else { + + } @@ -59,22 +59,24 @@ export interface ExpandableTileTranslations {
    - -
    -
    - +
    - + @if (interactive) { + + } @else { +
    + +
    + }
    - +
    diff --git a/src/tiles/selection-tile.component.ts b/src/tiles/selection-tile.component.ts index 038480bad6..9fc420e7d0 100644 --- a/src/tiles/selection-tile.component.ts +++ b/src/tiles/selection-tile.component.ts @@ -38,7 +38,7 @@ import { I18n } from "carbon-components-angular/i18n";
    - +
    ` diff --git a/src/tiles/tile-group.component.ts b/src/tiles/tile-group.component.ts index 5d070e7f8a..690b84429b 100644 --- a/src/tiles/tile-group.component.ts +++ b/src/tiles/tile-group.component.ts @@ -29,11 +29,16 @@ import { takeUntil } from "rxjs/operators"; selector: "cds-tile-group, ibm-tile-group", template: `
    - - - {{legend}} - - + @if (legend) { + + @if (isTemplate(legend)) { + + } @else { + {{legend}} + } + + } +
    `, providers: [ { diff --git a/src/tiles/tile.component.ts b/src/tiles/tile.component.ts index 1e5ca753d2..d09abc5be3 100644 --- a/src/tiles/tile.component.ts +++ b/src/tiles/tile.component.ts @@ -21,7 +21,7 @@ import { */ @Component({ selector: "cds-tile, ibm-tile", - template: `` + template: `` }) export class Tile { @HostBinding("class.cds--tile") tileClass = true; diff --git a/src/timepicker-select/timepicker-select.component.ts b/src/timepicker-select/timepicker-select.component.ts index 39f859b93c..ce37adc419 100644 --- a/src/timepicker-select/timepicker-select.component.ts +++ b/src/timepicker-select/timepicker-select.component.ts @@ -21,7 +21,9 @@ import { NG_VALUE_ACCESSOR } from "@angular/forms"; @Component({ selector: "cds-timepicker-select, ibm-timepicker-select", template: ` - + @if (!skeleton && label) { + + }
    - + @if (!skeleton) { + + }
    `, providers: [ diff --git a/src/timepicker/timepicker.component.ts b/src/timepicker/timepicker.component.ts index d099c970b3..236a910b87 100644 --- a/src/timepicker/timepicker.component.ts +++ b/src/timepicker/timepicker.component.ts @@ -21,17 +21,21 @@ import { NG_VALUE_ACCESSOR, ControlValueAccessor } from "@angular/forms"; @Component({ selector: "cds-timepicker, ibm-timepicker", template: ` - + @if (!skeleton && label) { + + }
    - - -
    - {{invalidText}} - +
    + @if (invalid) { +
    + @if (isTemplate(invalidText)) { + + } @else { + {{invalidText}} + } +
    + } `, providers: [ { diff --git a/src/toggle/toggle.component.ts b/src/toggle/toggle.component.ts index 9f955fa495..2069dbb164 100644 --- a/src/toggle/toggle.component.ts +++ b/src/toggle/toggle.component.ts @@ -43,7 +43,10 @@ export enum ToggleState { @Component({ selector: "cds-toggle, ibm-toggle", template: ` - + @if (skeleton) { +
    +
    + } @else { - - - {{description}} - - + @if (description) { + + + @if (!isTemplate(description)) { + {{description}} + } + @if (isTemplate(description)) { + + } @else { + {{description}} + } + @if (autoAlign) { + + } + + @if (!autoAlign) { + + } - - + } ` }) export class TooltipDefinition extends PopoverContainer { diff --git a/src/tooltip/tooltip.component.ts b/src/tooltip/tooltip.component.ts index 4fa864d7f9..8c4845db63 100644 --- a/src/tooltip/tooltip.component.ts +++ b/src/tooltip/tooltip.component.ts @@ -30,23 +30,31 @@ import { PopoverContainer } from "carbon-components-angular/popover"; changeDetection: ChangeDetectionStrategy.OnPush, template: ` - - - - - - {{description}} - - - - - + + @if (description) { + + @if (!disabled) { + + @if (isTemplate(description)) { + + } @else { + {{description}} + } + @if (autoAlign) { + + } + + @if (!autoAlign) { + + } + } + + } ` }) export class Tooltip extends PopoverContainer implements OnChanges, AfterContentChecked { diff --git a/src/treeview/tree-node.component.ts b/src/treeview/tree-node.component.ts index 8519161fc7..009957e416 100644 --- a/src/treeview/tree-node.component.ts +++ b/src/treeview/tree-node.component.ts @@ -36,85 +36,83 @@ import { EventOnNode, Node } from "./tree-node.types"; (focus)="emitFocusEvent($event)" (blur)="emitBlurEvent($event)" (keydown)="navigateTree($event)"> -
    - - - - - - - {{label}} - - -
    -
    - - - - - + @if (children.length) { +
    + + + + + + + @if (isTemplate(icon)) { + + } @else if(icon) { + + + } + @if (isTemplate(label)) { + + } @else { + {{label}} + } + +
    + } @else { +
    - + @if (isTemplate(icon)) { + + } @else if(icon){ - - - - {{label}} - - - -
    -
    - - - - - - - -
    + } + @if (isTemplate(label)) { + + } @else { + {{label}} + } +
    + } + @if (expanded) { +
    + @if (isProjected()) { + + } @else { + @for (childNode of children; track childNode) { + + + } + } +
    + } ` }) diff --git a/src/treeview/treeview.component.ts b/src/treeview/treeview.component.ts index 955571ff73..32e561ac8e 100644 --- a/src/treeview/treeview.component.ts +++ b/src/treeview/treeview.component.ts @@ -28,17 +28,17 @@ import { TreeViewService } from "./treeview.service"; @Component({ selector: "cds-tree-view", template: ` - + @if (label) { + + }
    - - - - - - - + @if (isProjected()) { + + } @else { + @for (node of tree; track node) { + + + } + }
    `, providers: [TreeViewService] diff --git a/src/ui-shell/header/hamburger.component.ts b/src/ui-shell/header/hamburger.component.ts index 16c66d8d76..da436c68e7 100644 --- a/src/ui-shell/header/hamburger.component.ts +++ b/src/ui-shell/header/hamburger.component.ts @@ -19,8 +19,11 @@ import { I18n } from "carbon-components-angular/i18n"; class="cds--header__menu-trigger cds--header__action cds--header__menu-toggle" [attr.aria-label]="active ? activeTitle : inactiveTitle" [attr.title]="active ? activeTitle : inactiveTitle"> - - + @if (active) { + + } @else { + + } ` }) diff --git a/src/ui-shell/header/header-action.component.ts b/src/ui-shell/header/header-action.component.ts index 69e6bc49d8..25cd636afd 100644 --- a/src/ui-shell/header/header-action.component.ts +++ b/src/ui-shell/header/header-action.component.ts @@ -30,7 +30,7 @@ import { BaseIconButton } from "carbon-components-angular/button"; [buttonAttributes]="{ 'aria-label': ariaLabel }"> - + ` }) diff --git a/src/ui-shell/header/header-global.component.ts b/src/ui-shell/header/header-global.component.ts index 9e1b0daff8..ac286331d3 100644 --- a/src/ui-shell/header/header-global.component.ts +++ b/src/ui-shell/header/header-global.component.ts @@ -6,7 +6,7 @@ import { Component, HostBinding } from "@angular/core"; @Component({ selector: "cds-header-global, ibm-header-global", template: ` - + ` }) export class HeaderGlobal { diff --git a/src/ui-shell/header/header-item.component.ts b/src/ui-shell/header/header-item.component.ts index 7d3ac403bd..107c85a54e 100644 --- a/src/ui-shell/header/header-item.component.ts +++ b/src/ui-shell/header/header-item.component.ts @@ -15,28 +15,29 @@ import { Router } from "@angular/router"; @Component({ selector: "cds-header-item, ibm-header-item", template: ` - - + @if (useRouter) { + + + - + + } @else { - + - + } `, styles: [` :host { diff --git a/src/ui-shell/header/header-menu.component.ts b/src/ui-shell/header/header-menu.component.ts index 49efb7d544..7d2746007a 100644 --- a/src/ui-shell/header/header-menu.component.ts +++ b/src/ui-shell/header/header-menu.component.ts @@ -23,23 +23,24 @@ import { HeaderItemInterface } from "./header-navigation-items.interface"; [attr.aria-expanded]="expanded" (click)="navigate($event)"> {{title}} - - + @if (icon) { + + } @else { - + }
    - - + + @for (headerItem of headerItems; track headerItem) { {{ headerItem.content }} - + }
    `, styles: [` diff --git a/src/ui-shell/header/header-navigation.component.ts b/src/ui-shell/header/header-navigation.component.ts index c210100983..58e4b6798c 100644 --- a/src/ui-shell/header/header-navigation.component.ts +++ b/src/ui-shell/header/header-navigation.component.ts @@ -12,24 +12,26 @@ import { NavigationItem } from "./header-navigation-items.interface"; template: ` ` diff --git a/src/ui-shell/header/header.component.ts b/src/ui-shell/header/header.component.ts index e61c601758..2ba246351a 100644 --- a/src/ui-shell/header/header.component.ts +++ b/src/ui-shell/header/header.component.ts @@ -23,36 +23,36 @@ import { I18n } from "carbon-components-angular/i18n";
    - - {{ i18n.get("UI_SHELL.SKIP_TO") | async }} - - - - - + @if (skipTo) { - {{brand}}  - {{name}} + class="cds--skip-to-content" + [href]="skipTo" + tabindex="0"> + {{ i18n.get("UI_SHELL.SKIP_TO") | async }} - - {{brand}}  - {{name}} - - - + } + + @if (isTemplate(brand)) { + + } @else { + @if (useRouter) { + + {{brand}}  + {{name}} + + } @else { + + {{brand}}  + {{name}} + + } + } +
    ` }) diff --git a/src/ui-shell/panel/panel.component.ts b/src/ui-shell/panel/panel.component.ts index 0e883f8936..abfcfdb4dd 100644 --- a/src/ui-shell/panel/panel.component.ts +++ b/src/ui-shell/panel/panel.component.ts @@ -13,7 +13,7 @@ import { Component, Input } from "@angular/core"; [ngClass]="{ 'cds--header-panel--expanded': expanded }"> - + ` }) diff --git a/src/ui-shell/panel/switcher-list-item.component.ts b/src/ui-shell/panel/switcher-list-item.component.ts index f7a9a46c9b..45f6ad230f 100644 --- a/src/ui-shell/panel/switcher-list-item.component.ts +++ b/src/ui-shell/panel/switcher-list-item.component.ts @@ -23,7 +23,7 @@ import { Router } from "@angular/router"; [href]="href" [target]="target" (click)="navigate($event)"> - + ` }) diff --git a/src/ui-shell/panel/switcher-list.component.ts b/src/ui-shell/panel/switcher-list.component.ts index fd9a9283ea..8a535b630d 100644 --- a/src/ui-shell/panel/switcher-list.component.ts +++ b/src/ui-shell/panel/switcher-list.component.ts @@ -14,7 +14,7 @@ import { Component, HostBinding } from "@angular/core"; @Component({ selector: "cds-switcher-list, ibm-switcher-list", template: ` - + `, styles: [` :host { diff --git a/src/ui-shell/sidenav/side-nav.component.spec.ts b/src/ui-shell/sidenav/side-nav.component.spec.ts index f5a4bc6690..9e0ba91c23 100644 --- a/src/ui-shell/sidenav/side-nav.component.spec.ts +++ b/src/ui-shell/sidenav/side-nav.component.spec.ts @@ -7,6 +7,7 @@ import { I18nModule } from "./../../i18n/index"; import { SideNav } from "./sidenav.component"; import { SideNavItem } from "./sidenav-item.component"; import { SideNavMenu } from "./sidenav-menu.component"; +import { RouterLinkExtendedDirective } from "./routerlink-extended.directive"; import { RouterModule } from "@angular/router"; @Component({ @@ -46,22 +47,25 @@ describe("SideNav", () => { SideNav, SideNavItem, SideNavMenu, + RouterLinkExtendedDirective, SideNavTest, FooComponent ], imports: [ CommonModule, - I18nModule, - RouterModule.forRoot([ - { - path: "foo", - component: FooComponent - } - ], + RouterModule.forRoot( + [ + { + path: "foo", + component: FooComponent + } + ], { initialNavigation: "disabled", useHash: true - }) + } + ), + I18nModule ] }); }); diff --git a/src/ui-shell/sidenav/sidenav-item.component.ts b/src/ui-shell/sidenav/sidenav-item.component.ts index bbf027f2c4..380b228c27 100644 --- a/src/ui-shell/sidenav/sidenav-item.component.ts +++ b/src/ui-shell/sidenav/sidenav-item.component.ts @@ -17,19 +17,7 @@ import { Router } from "@angular/router"; @Component({ selector: "cds-sidenav-item, ibm-sidenav-item", template: ` - - - - - + @if (useRouter) { - + - + } @else { + + + + } -
    - -
    + @if (!isSubMenu) { +
    + +
    + } - +
    `, diff --git a/src/ui-shell/sidenav/sidenav-menu.component.ts b/src/ui-shell/sidenav/sidenav-menu.component.ts index 5318648b48..d379120a80 100644 --- a/src/ui-shell/sidenav/sidenav-menu.component.ts +++ b/src/ui-shell/sidenav/sidenav-menu.component.ts @@ -24,7 +24,7 @@ import { SideNavItemInterface } from "./sidenav-item.interface"; [attr.aria-expanded]="expanded" type="button">
    - +
    {{title}}
    @@ -42,8 +42,8 @@ import { SideNavItemInterface } from "./sidenav-item.interface";
    - - + + @for (menuItem of menuItems; track menuItem) { {{ menuItem.content }} - + }
    ` }) diff --git a/src/ui-shell/sidenav/sidenav.component.ts b/src/ui-shell/sidenav/sidenav.component.ts index 139431e6bd..d4baef6616 100644 --- a/src/ui-shell/sidenav/sidenav.component.ts +++ b/src/ui-shell/sidenav/sidenav.component.ts @@ -16,66 +16,69 @@ import { NavigationItem } from "../header/header-navigation-items.interface"; selector: "cds-sidenav, ibm-sidenav", template: ` `, diff --git a/src/ui-shell/stories/header-fluid.component.ts b/src/ui-shell/stories/header-fluid.component.ts index e4fddff289..527da8a8fd 100644 --- a/src/ui-shell/stories/header-fluid.component.ts +++ b/src/ui-shell/stories/header-fluid.component.ts @@ -21,10 +21,9 @@ export class FooComponent { } (selected)="hasHamburger = !hasHamburger" class="cds--header__menu-toggle__hidden"> - + @if (hasHamburger) { + + } ` })