carbon-components-angular
Version:
Next generation components
115 lines (109 loc) • 4.97 kB
JavaScript
import * as i0 from '@angular/core';
import { Directive, HostBinding, Input, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
/**
* Applies list styling to the item it is used on. Best used with `li`s.
*/
class ListItemDirective {
constructor() {
this.wrapper = true;
}
}
ListItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ListItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
ListItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: ListItemDirective, selector: "[cdsListItem], [ibmListItem]", host: { properties: { "class.cds--list__item": "this.wrapper" } }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ListItemDirective, decorators: [{
type: Directive,
args: [{
selector: "[cdsListItem], [ibmListItem]"
}]
}], propDecorators: { wrapper: [{
type: HostBinding,
args: ["class.cds--list__item"]
}] } });
/**
* Applies either ordered or unordered styling to the list container it is applied to.
*
* For `ul`s it will apply unordered list styles, and for `ol`s it will apply ordered list styles.
*
* If a `ul` or `ol` is nested within a `li` the directive will apply nested list styling.
*
* Get started with importing the module:
*
* ```typescript
* import { ListModule } from 'carbon-components-angular';
* ```
*
* [See demo](../../?path=/story/components-list--basic)
*/
class List {
constructor(elementRef) {
this.elementRef = elementRef;
/**
* Set to `true` to make list expressive
*/
this.isExpressive = false;
}
get ordered() {
if (this.nested) {
return false;
}
return this.elementRef.nativeElement.tagName === "OL";
}
get unordered() {
if (this.nested) {
return false;
}
return this.elementRef.nativeElement.tagName === "UL";
}
get nested() {
return !!(this.elementRef.nativeElement.parentElement && this.elementRef.nativeElement.parentElement.tagName === "LI");
}
}
List.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: List, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
List.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: List, selector: "[cdsList], [ibmList]", inputs: { isExpressive: "isExpressive" }, host: { properties: { "class.cds--list--ordered": "this.ordered", "class.cds--list--unordered": "this.unordered", "class.cds--list--nested": "this.nested", "class.cds--list--expressive": "this.isExpressive" } }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: List, decorators: [{
type: Directive,
args: [{
selector: "[cdsList], [ibmList]"
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { ordered: [{
type: HostBinding,
args: ["class.cds--list--ordered"]
}], unordered: [{
type: HostBinding,
args: ["class.cds--list--unordered"]
}], nested: [{
type: HostBinding,
args: ["class.cds--list--nested"]
}], isExpressive: [{
type: Input
}, {
type: HostBinding,
args: ["class.cds--list--expressive"]
}] } });
class ListModule {
}
ListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
ListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ListModule, declarations: [ListItemDirective,
List], imports: [CommonModule], exports: [ListItemDirective,
List] });
ListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ListModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ListModule, decorators: [{
type: NgModule,
args: [{
declarations: [
ListItemDirective,
List
],
exports: [
ListItemDirective,
List
],
imports: [CommonModule]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { List, ListItemDirective, ListModule };
//# sourceMappingURL=carbon-components-angular-list.mjs.map