Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions libs/design/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = {
style: 'camelCase'
}
],
'custom-rules/docs-private-hostbinding-lifecycle': 'error',
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class DaffBreadcrumbComponent implements AfterContentInit {
*/
@ContentChildren(DaffBreadcrumbItemDirective) breadcrumbItems!: QueryList<DaffBreadcrumbItemDirective>;

/**
* @docs-private
*/
ngAfterContentInit() {
this.updateActiveState();

Expand Down
3 changes: 3 additions & 0 deletions libs/design/card/src/card/basic/basic.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ import { DaffCardBaseDirective } from '../../card-base.directive';
})

export class DaffCardComponent extends DaffCardBaseDirective {
/**
* @docs-private
*/
@HostBinding('class.daff-card') class = true;
}
3 changes: 3 additions & 0 deletions libs/design/card/src/card/raised/raised.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ import { DaffCardBaseDirective } from '../../card-base.directive';
})

export class DaffRaisedCardComponent extends DaffCardBaseDirective {
/**
* @docs-private
*/
@HostBinding('class.daff-raised-card') class = true;
}
3 changes: 3 additions & 0 deletions libs/design/card/src/card/stroked/stroked.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ import { DaffCardBaseDirective } from '../../card-base.directive';
})

export class DaffStrokedCardComponent extends DaffCardBaseDirective {
/**
* @docs-private
*/
@HostBinding('class.daff-stroked-card') class = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import { DaffButtonComponent } from '@daffodil/design/button';
export class BasicCheckboxComponent implements OnInit {
checkboxExample = new UntypedFormControl();

/**
* @docs-private
*/
ngOnInit() {
this.checkboxExample.setValue(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export class CheckboxSetComponent implements OnInit {
checkboxArray = new UntypedFormArray([new UntypedFormControl(), new UntypedFormControl(), new UntypedFormControl()]);
selectedValues = [];

/**
* @docs-private
*/
ngOnInit() {
this.checkboxArray.setValue([false, false, false]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export class DaffMenuActivatorDirective implements OnDestroy {
private _destroyed$ = new Subject<boolean>();
private _open: boolean;

/**
* @docs-private
*/
@HostBinding('class.open') get openClass() {
return this._open;
}
Expand Down
15 changes: 15 additions & 0 deletions libs/design/menu/src/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ import { DaffMenuService } from '../services/menu.service';
],
})
export class DaffMenuComponent implements AfterContentInit, AfterViewInit {
/**
* @docs-private
*/
@HostBinding('class.daff-menu') class = true;
/**
* @docs-private
*/
@HostBinding('tabindex') tabindex = 0;
/**
* @docs-private
*/
@HostBinding('attr.role') role = 'menu';

private _focusTrap: ConfigurableFocusTrap;
Expand Down Expand Up @@ -62,12 +71,18 @@ export class DaffMenuComponent implements AfterContentInit, AfterViewInit {
});
}

/**
* @docs-private
*/
ngAfterContentInit() {
this._focusTrap = this._focusTrapFactory.create(
this._elementRef.nativeElement,
);
}

/**
* @docs-private
*/
ngAfterViewInit() {
const focusableChild = (<HTMLElement>this._elementRef.nativeElement.querySelector(
daffFocusableElementsSelector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ import {
standalone: true,
})
export class DaffModalActionsComponent {
/**
* @docs-private
*/
@HostBinding('class.daff-modal-actions') class = true;
}
3 changes: 3 additions & 0 deletions libs/design/modal/src/modal-close/modal-close.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@ export class DaffModalCloseDirective {
/**
* Sets the button type attribute to button.
*/
/**
* @docs-private
*/
@HostBinding('attr.type') typeAttribute = 'button';
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ import {
standalone: true,
})
export class DaffModalContentComponent {
/**
* @docs-private
*/
@HostBinding('class.daff-modal-content') class = true;
}
3 changes: 3 additions & 0 deletions libs/design/modal/src/modal-title/modal-title.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class DaffModalTitleDirective {
/**
* The html `id` of the modal title.
*/
/**
* @docs-private
*/
@HostBinding('attr.id') get uniqueId() {
return this._id;
}
Expand Down
21 changes: 21 additions & 0 deletions libs/design/modal/src/modal/modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,25 @@ export class DaffModalComponent implements AfterContentInit, AfterViewInit, Daff
/**
* Sets a class of .daff-modal to the host element.
*/
/**
* @docs-private
*/
@HostBinding('class.daff-modal') modalClass = true;

/**
* Sets the role to dialog.
*/
/**
* @docs-private
*/
@HostBinding('attr.role') role = 'dialog';

/**
* Sets aria-modal to true.
*/
/**
* @docs-private
*/
@HostBinding('attr.aria-modal') ariaModal = true;

private _ariaLabelledBy = null;
Expand All @@ -71,6 +80,9 @@ export class DaffModalComponent implements AfterContentInit, AfterViewInit, Daff
* {@link DaffModalTitleDirective} when it is used.
*
*/
/**
* @docs-private
*/
@HostBinding('attr.aria-labelledby') get ariaLabelledBy() {
return this._ariaLabelledBy;
} set ariaLabelledBy(value: string) {
Expand Down Expand Up @@ -113,12 +125,18 @@ export class DaffModalComponent implements AfterContentInit, AfterViewInit, Daff
this.openDirective.stateless = false;
}

/**
* @docs-private
*/
ngAfterContentInit() {
this._focusTrap = this._focusTrapFactory.create(
this.elementRef.nativeElement,
);
}

/**
* @docs-private
*/
ngAfterViewInit() {
const focusableChild = (<HTMLElement>this.elementRef.nativeElement.querySelector(
daffFocusableElementsSelector)
Expand Down Expand Up @@ -151,6 +169,9 @@ export class DaffModalComponent implements AfterContentInit, AfterViewInit, Daff
}

/** Animation hook that controls the entrance and exit animations of the modal. */
/**
* @docs-private
*/
@HostBinding('@fade') get fadeState(): string {
return getAnimationState(this.openDirective.open);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {

export class DaffNotificationActionsDirective {

/**
* @docs-private
*/
@HostBinding('class.daff-notification__actions') class = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {

export class DaffNotificationMessageDirective {

/**
* @docs-private
*/
@HostBinding('class.daff-notification__message') class = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {

export class DaffNotificationSubtitleDirective {

/**
* @docs-private
*/
@HostBinding('class.daff-notification__subtitle') class = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {

export class DaffNotificationTitleDirective {

/**
* @docs-private
*/
@HostBinding('class.daff-notification__title') class = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,37 @@ export class DaffNotificationComponent {

@ContentChild(DaffNotificationActionsDirective) _actions: DaffNotificationActionsDirective;

/**
* @docs-private
*/
@HostBinding('class.daff-notification') class = true;

/**
* @docs-private
*/
@HostBinding('attr.tabindex') tabindex = '0';

/**
* Sets role to alert when `status="warn"` or `status="critical"`.
* Sets role to status on all other instances.
*/
/**
* @docs-private
*/
@HostBinding('attr.role') get role() {
return this.statusDirective.status === DaffStatusEnum.Warn || this.statusDirective.status === DaffStatusEnum.Critical ? 'alert' : 'status';
};

/**
* @docs-private
*/
@HostBinding('class.vertical') get verticalOrientation() {
return this.orientation === DaffNotificationOrientationEnum.Vertical;
}

/**
* @docs-private
*/
@HostBinding('class.horizontal') get horizontalOrientation() {
return this.orientation === DaffNotificationOrientationEnum.Horizontal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ import {
standalone: true,
})
export class DaffProgressBarLabelDirective {
/**
* @docs-private
*/
@HostBinding('class.daff-progress-bar__label') class = true;
}
15 changes: 15 additions & 0 deletions libs/design/progress-bar/src/progress-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,31 @@ export class DaffProgressBarComponent {
return this._indeterminate;
}

/**
* @docs-private
*/
@HostBinding('role') get role() {
return 'progressbar';
}

/**
* @docs-private
*/
@HostBinding('attr.aria-label') get ariaLabel() {
return this._indeterminate ? 'loading' : null;
}

/**
* @docs-private
*/
@HostBinding('attr.aria-valuemin') ariaValueMin = '0';
/**
* @docs-private
*/
@HostBinding('attr.aria-valuemax') ariaValueMax = '100';
/**
* @docs-private
*/
@HostBinding('attr.aria-valuenow') get ariaValueNow() {
return this.percentage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class CheckboxEmbeddedComponent implements OnInit {

selectedValues = [];

/**
* @docs-private
*/
ngOnInit() {
this.checkboxArray.setValue([false, true, true]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class DaffCheckboxControlValueAccessorDirective implements OnInit, Contro
/**
* A lifecycle method called when the directive is initialized.
*/
/**
* @docs-private
*/
ngOnInit(): void {
// See the note about `writeValue` usage.
this.writeValue(this._control.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ import {
standalone: false,
})
export class DaffErrorMessageComponent {
/**
* @docs-private
*/
@HostBinding('class.daff-error-message') class = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ import {
standalone: false,
})
export class DaffFormLabelDirective {
/**
* @docs-private
*/
@HostBinding('class.daff-form-label') class = true;
}
3 changes: 3 additions & 0 deletions libs/design/src/atoms/form/hint/hint.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ import {
standalone: true,
})
export class DaffHintComponent {
/**
* @docs-private
*/
@HostBinding('class.daff-hint') class = true;
}
1 change: 1 addition & 0 deletions libs/design/src/atoms/form/input/input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class DaffInputComponent extends DaffFormFieldControl<string> implements
super(ngControl);
}

/** @docs-private */
ngOnInit() {
this.stateChanges = merge(
this._stateChanges.asObservable(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export class DaffQuantityInputComponent implements OnInit, OnDestroy {
private changeDetectorRef: ChangeDetectorRef,
) {}

/**
* @docs-private
*/
ngOnInit() {
this._inputControl.patchValue(this.ngControl.control.value);
this.setInputDisabled();
Expand Down
Loading