@funnelback/ng-sds
Version:
`@funnelback/ng-sds` is Bootstrap 5 based library that aims to implement the [Squiz Design System specification](https://designsystem.squiz.net/) in Angular.
795 lines (769 loc) • 257 kB
JavaScript
import * as i0 from '@angular/core';
import { Component, ViewEncapsulation, Input, ChangeDetectionStrategy, NgModule, HostBinding, Directive, ContentChild, Host, Optional, Attribute, HostListener, EventEmitter, Output, PLATFORM_ID, Injectable, Inject, ContentChildren, ViewChild } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule, isPlatformBrowser } from '@angular/common';
import * as i2 from '@angular/router';
import { RouterModule, RouterLinkActive } from '@angular/router';
import * as i2$1 from '@angular/forms';
import { Validators, ReactiveFormsModule } from '@angular/forms';
import * as i2$2 from '@ng-bootstrap/ng-bootstrap';
import { NgbDropdownModule, NgbModal, NgbModalModule, NgbTooltipModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { BehaviorSubject, Subject, fromEvent, of, combineLatest, ReplaySubject } from 'rxjs';
import { debounceTime, map, startWith, distinctUntilKeyChanged, takeUntil, filter, distinctUntilChanged, delay } from 'rxjs/operators';
import { trigger, state, style, transition, animate, query, animateChild } from '@angular/animations';
import * as i3 from '@angular/cdk/stepper';
import { CdkStep, CdkStepper, CdkStepperModule } from '@angular/cdk/stepper';
import * as i1$1 from '@angular/cdk/bidi';
class SdsIconComponent {
constructor() {
this.size = 'md';
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsIconComponent, isStandalone: false, selector: "sds-icon", inputs: { size: "size" }, ngImport: i0, template: '<span class="material-icons-round sds-icon-{{size}}"><ng-content></ng-content></span>', isInline: true, styles: ["sds-icon{display:inline-flex}.sds-icon-sm{font-size:1.25rem}.sds-icon-xs{font-size:1.125rem}\n"], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsIconComponent, decorators: [{
type: Component,
args: [{ selector: 'sds-icon', template: '<span class="material-icons-round sds-icon-{{size}}"><ng-content></ng-content></span>', encapsulation: ViewEncapsulation.None, standalone: false, styles: ["sds-icon{display:inline-flex}.sds-icon-sm{font-size:1.25rem}.sds-icon-xs{font-size:1.125rem}\n"] }]
}], propDecorators: { size: [{
type: Input
}] } });
class SdsIconWrapperComponent {
constructor(elementRef, cdr) {
this.elementRef = elementRef;
this.cdr = cdr;
this.position = 'left';
this.positionSize = 3;
this.iconOnly = false;
}
set sdsIconWrapper(icon) {
this.icon = icon;
}
ngAfterViewInit() {
this.elementRef.nativeElement.classList.add('d-inline-flex', 'flex-row', 'align-items-center');
this.setIconClasses();
}
isIconOnly() {
let hasText = false;
this.elementRef.nativeElement.childNodes.forEach(el => {
if (el.nodeName === '#text') {
hasText = true;
}
});
return !hasText;
}
setIconClasses() {
this.iconOnly = this.isIconOnly();
if (this.elementRef.nativeElement.tagName.toUpperCase() === 'BUTTON'
|| this.elementRef.nativeElement.tagName.toUpperCase() === 'A') {
this.elementRef.nativeElement.classList.add(`${this.iconOnly ? 'btn-icon' : 'btn-icon-label'}`);
this.cdr.detectChanges();
}
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsIconWrapperComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsIconWrapperComponent, isStandalone: false, selector: "[sdsIconWrapper]", inputs: { position: "position", positionSize: "positionSize", iconSize: "iconSize", sdsIconWrapper: "sdsIconWrapper" }, ngImport: i0, template: "<ng-container *ngIf=\"position === 'left'\" [ngTemplateOutlet]=\"iconDisplay\"></ng-container>\n<ng-content></ng-content>\n<ng-container *ngIf=\"position === 'right'\" [ngTemplateOutlet]=\"iconDisplay\"></ng-container>\n\n<ng-template #iconDisplay>\n <sds-icon *ngIf=\"icon\" [size]=\"iconSize\" [ngClass]=\"iconOnly ? '' : (position === 'right' ? 'ms-' + positionSize :'me-' + positionSize )\">{{icon}}</sds-icon>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdsIconComponent, selector: "sds-icon", inputs: ["size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsIconWrapperComponent, decorators: [{
type: Component,
args: [{ selector: '[sdsIconWrapper]', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ng-container *ngIf=\"position === 'left'\" [ngTemplateOutlet]=\"iconDisplay\"></ng-container>\n<ng-content></ng-content>\n<ng-container *ngIf=\"position === 'right'\" [ngTemplateOutlet]=\"iconDisplay\"></ng-container>\n\n<ng-template #iconDisplay>\n <sds-icon *ngIf=\"icon\" [size]=\"iconSize\" [ngClass]=\"iconOnly ? '' : (position === 'right' ? 'ms-' + positionSize :'me-' + positionSize )\">{{icon}}</sds-icon>\n</ng-template>\n" }]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { position: [{
type: Input
}], positionSize: [{
type: Input
}], iconSize: [{
type: Input
}], sdsIconWrapper: [{
type: Input
}] } });
class SdsIconModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsIconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsIconModule, declarations: [SdsIconComponent, SdsIconWrapperComponent], imports: [CommonModule], exports: [SdsIconComponent, SdsIconWrapperComponent] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsIconModule, imports: [CommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsIconModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule],
declarations: [SdsIconComponent, SdsIconWrapperComponent],
exports: [SdsIconComponent, SdsIconWrapperComponent],
}]
}] });
class SdsAlertComponent {
constructor() {
this._color = 'info';
}
set color(color) {
this._color = color;
switch (this._color) {
case 'danger':
this.icon = 'warning';
break;
case 'warning':
this.icon = 'report';
break;
case 'info':
this.icon = 'info';
break;
case 'success':
this.icon = 'check_circle';
break;
case 'help':
this.icon = 'help';
break;
case 'assist':
this.icon = 'assistant';
break;
}
}
get color() { return this._color; }
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsAlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsAlertComponent, isStandalone: false, selector: "sds-alert", inputs: { title: "title", color: "color" }, ngImport: i0, template: "<div class=\"alert alert-{{color}} d-flex align-items-top\" [attr.role]=\"color === 'danger' || color === 'warning' ? 'alert' : 'status'\">\n <sds-icon *ngIf=\"icon\" class=\"alert-icon\">{{icon}}</sds-icon>\n <div>\n <h3 *ngIf=\"title\" class=\"alert-heading mb-1\">{{title}}</h3>\n <ng-content></ng-content>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SdsIconComponent, selector: "sds-icon", inputs: ["size"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsAlertComponent, decorators: [{
type: Component,
args: [{ selector: 'sds-alert', standalone: false, template: "<div class=\"alert alert-{{color}} d-flex align-items-top\" [attr.role]=\"color === 'danger' || color === 'warning' ? 'alert' : 'status'\">\n <sds-icon *ngIf=\"icon\" class=\"alert-icon\">{{icon}}</sds-icon>\n <div>\n <h3 *ngIf=\"title\" class=\"alert-heading mb-1\">{{title}}</h3>\n <ng-content></ng-content>\n </div>\n</div>\n" }]
}], propDecorators: { title: [{
type: Input
}], color: [{
type: Input
}] } });
class SdsAlertModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsAlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsAlertModule, declarations: [SdsAlertComponent], imports: [CommonModule, SdsIconModule], exports: [SdsAlertComponent] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsAlertModule, imports: [CommonModule, SdsIconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsAlertModule, decorators: [{
type: NgModule,
args: [{ declarations: [SdsAlertComponent], exports: [SdsAlertComponent], imports: [CommonModule, SdsIconModule] }]
}] });
class SdsBadgeComponent {
constructor() {
this.color = 'secondary';
}
set strong(val) {
this._strong = val === true || val === 'true' ? true : false;
}
get strong() { return this._strong; }
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsBadgeComponent, isStandalone: false, selector: "sds-badge", inputs: { label: "label", color: "color", strong: "strong" }, host: { properties: { "attr.strong": "this.strong" } }, ngImport: i0, template: "<div class=\"badge badge-{{color}}\" [class.badge-outline]=\"!strong\">{{label}}</div>\n", styles: ["sds-badge{display:inline-flex}sds-badge+sds-badge,sds-badge-combination+sds-badge-combination{margin-left:.25rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsBadgeComponent, decorators: [{
type: Component,
args: [{ selector: 'sds-badge', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"badge badge-{{color}}\" [class.badge-outline]=\"!strong\">{{label}}</div>\n", styles: ["sds-badge{display:inline-flex}sds-badge+sds-badge,sds-badge-combination+sds-badge-combination{margin-left:.25rem}\n"] }]
}], propDecorators: { label: [{
type: Input
}], color: [{
type: Input
}], strong: [{
type: Input
}, {
type: HostBinding,
args: ['attr.strong']
}] } });
class SdsBadgeCombinationComponent {
constructor() {
this.color = 'secondary';
this.strong = 'left';
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsBadgeCombinationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsBadgeCombinationComponent, isStandalone: false, selector: "sds-badge-combination", inputs: { labels: "labels", color: "color", strong: "strong" }, ngImport: i0, template: "<sds-badge [color]=\"color\" [label]=\"labels && labels[0]\" [strong]=\"strong === 'left'\"></sds-badge>\n<sds-badge [color]=\"color\" [label]=\"labels && labels[1]\" [strong]=\"strong === 'right'\"></sds-badge>\n", styles: [":host sds-badge:nth-child(1)>::ng-deep .badge{border-top-right-radius:0;border-bottom-right-radius:0}:host sds-badge:nth-child(2)>::ng-deep .badge{border-left:none;border-top-left-radius:0;border-bottom-left-radius:0}:host sds-badge+sds-badge{margin-left:0}\n"], dependencies: [{ kind: "component", type: SdsBadgeComponent, selector: "sds-badge", inputs: ["label", "color", "strong"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsBadgeCombinationComponent, decorators: [{
type: Component,
args: [{ selector: 'sds-badge-combination', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<sds-badge [color]=\"color\" [label]=\"labels && labels[0]\" [strong]=\"strong === 'left'\"></sds-badge>\n<sds-badge [color]=\"color\" [label]=\"labels && labels[1]\" [strong]=\"strong === 'right'\"></sds-badge>\n", styles: [":host sds-badge:nth-child(1)>::ng-deep .badge{border-top-right-radius:0;border-bottom-right-radius:0}:host sds-badge:nth-child(2)>::ng-deep .badge{border-left:none;border-top-left-radius:0;border-bottom-left-radius:0}:host sds-badge+sds-badge{margin-left:0}\n"] }]
}], propDecorators: { labels: [{
type: Input
}], color: [{
type: Input
}], strong: [{
type: Input
}] } });
const COMPONENTS$d = [
SdsBadgeComponent,
SdsBadgeCombinationComponent,
];
class SdsBadgeModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsBadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsBadgeModule, declarations: [SdsBadgeComponent,
SdsBadgeCombinationComponent], imports: [CommonModule], exports: [SdsBadgeComponent,
SdsBadgeCombinationComponent] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsBadgeModule, imports: [CommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsBadgeModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule],
declarations: COMPONENTS$d,
exports: COMPONENTS$d,
}]
}] });
function getElementAttr(el, attr) {
return attr ? el.nativeElement?.getAttribute(attr) : el.nativeElement.attributes;
}
function hasElementAttr(el, attr) {
return getElementAttr(el, attr) !== null;
}
/**
* Force a data-bound value (typically a string) to a boolean
*
* @param value value set via element property/attribute
*/
function forceBooleanType(value) {
return value !== null && `${value}` !== 'false';
}
class SdsButtonDirective {
constructor(host, _renderer) {
this.host = host;
this._renderer = _renderer;
this.PREFIX = 'sdsButton';
}
ngAfterViewInit() {
const tokens = ['btn'];
if (this.isTransparent()) {
tokens.push(`btn-link${this.btnColor === 'primary' ? `-${this.btnColor}` : ''}`);
}
else if (!this.btnColor || this.isDefault()) {
tokens.push('btn-outline-secondary');
if (this.isBrand()) {
tokens.push('btn-brand');
this.renderImg();
}
}
else if (this.isSoft()) {
tokens.push(`btn-outline-${this.btnColor}`);
}
else {
tokens.push(`btn-${this.btnColor}`);
}
if (this.btnSize) {
tokens.push(`btn-${this.btnSize}`);
}
this.host.nativeElement.classList.add(...tokens);
}
isBrand() {
return hasElementAttr(this.host, `${this.PREFIX}Brand`);
}
isDefault() {
return hasElementAttr(this.host, `${this.PREFIX}Default`);
}
isSoft() {
return hasElementAttr(this.host, `${this.PREFIX}Soft`);
}
isTransparent() {
return hasElementAttr(this.host, `${this.PREFIX}Transparent`);
}
renderImg() {
if (!this.btnImg) {
return;
}
const img = this._renderer.createElement('img');
this._renderer.setAttribute(img, 'src', this.btnImg);
this._renderer.setAttribute(img, 'class', 'btn-img me-2');
this._renderer.setAttribute(img, 'alt', '');
this._renderer.setAttribute(img, 'role', 'presentation');
this._renderer.insertBefore(this.host.nativeElement, img, this.host.nativeElement.childNodes.item(0));
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsButtonDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: SdsButtonDirective, isStandalone: false, selector: "button[sdsButtonStrong],\n button[sdsButtonSoft],\n button[sdsButtonTransparent],\n button[sdsButtonDefault],\n button[sdsButtonBrand],\n a[sdsButtonStrong],\n a[sdsButtonSoft],\n a[sdsButtonTransparent],\n a[sdsButtonDefault],\n a[sdsButtonBrand]", inputs: { btnColor: "btnColor", btnImg: "btnImg", btnSize: "btnSize" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsButtonDirective, decorators: [{
type: Directive,
args: [{
selector: `button[sdsButtonStrong],
button[sdsButtonSoft],
button[sdsButtonTransparent],
button[sdsButtonDefault],
button[sdsButtonBrand],
a[sdsButtonStrong],
a[sdsButtonSoft],
a[sdsButtonTransparent],
a[sdsButtonDefault],
a[sdsButtonBrand]`,
standalone: false,
}]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { btnColor: [{
type: Input
}], btnImg: [{
type: Input
}], btnSize: [{
type: Input
}] } });
class SdsButtonModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsButtonModule, declarations: [SdsButtonDirective], imports: [CommonModule], exports: [SdsButtonDirective] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsButtonModule, imports: [CommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsButtonModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule],
declarations: [SdsButtonDirective],
exports: [SdsButtonDirective],
}]
}] });
class NavigationComponent {
constructor() {
this.preserveFragment = false;
this.replaceUrl = false;
this.skipLocationChange = false;
this.routerLinkActiveOptions = { exact: false };
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: NavigationComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: NavigationComponent, isStandalone: true, inputs: { href: "href", rel: "rel", target: "target", fragment: "fragment", preserveFragment: "preserveFragment", queryParams: "queryParams", queryParamsHandling: "queryParamsHandling", replaceUrl: "replaceUrl", routeLink: "routeLink", skipLocationChange: "skipLocationChange", state: "state", routerLinkActiveOptions: "routerLinkActiveOptions" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: NavigationComponent, decorators: [{
type: Directive
}], propDecorators: { href: [{
type: Input
}], rel: [{
type: Input
}], target: [{
type: Input
}], fragment: [{
type: Input
}], preserveFragment: [{
type: Input
}], queryParams: [{
type: Input
}], queryParamsHandling: [{
type: Input
}], replaceUrl: [{
type: Input
}], routeLink: [{
type: Input
}], skipLocationChange: [{
type: Input
}], state: [{
type: Input
}], routerLinkActiveOptions: [{
type: Input
}] } });
class SdsCardComponent extends NavigationComponent {
constructor() {
super(...arguments);
this.color = 'muted';
this.isActive = false;
this.footerAlign = 'left'; // left | right | center
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCardComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsCardComponent, isStandalone: false, selector: "sds-card", inputs: { color: "color", isActive: "isActive", footerAlign: "footerAlign", title: "title", icon: "icon", subtitle: "subtitle" }, queries: [{ propertyName: "footer", first: true, predicate: ["sdsCardFooter"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"!href && !routeLink\" class=\"card\" [class.border-primary]=\"isActive\">\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n</div>\n\n<a *ngIf=\"!href && routeLink\" class=\"card card-link\" [class.border-primary]=\"isActive\" [routerLink]=\"routeLink\" [fragment]=\"fragment\" [preserveFragment]=\"preserveFragment\" [queryParams]=\"queryParams\" [queryParamsHandling]=\"queryParamsHandling\" [replaceUrl]=\"replaceUrl\" [skipLocationChange]=\"skipLocationChange\" [state]=\"state\">\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n</a>\n\n<a *ngIf=\"href\" class=\"card card-link\" [class.border-primary]=\"isActive\" [attr.href]=\"href\" [attr.rel]=\"rel\" [attr.target]=\"target\">\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n</a>\n\n<ng-template #cardContent>\n <div *ngIf=\"icon\" class=\"card-header\">\n <sds-icon class=\"text-{{color}}\">{{icon}}</sds-icon>\n </div>\n <div class=\"card-body\">\n <h2 class=\"card-title\">{{title}}</h2>\n <div *ngIf=\"subtitle\" class=\"card-subtitle\">{{subtitle}}</div>\n <div #cardText class=\"card-text\" [class.empty]=\"!cardText?.innerText?.trim()\"><ng-content></ng-content></div>\n </div>\n <div *ngIf=\"footer\" class=\"card-footer text-{{footerAlign}}\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: SdsIconComponent, selector: "sds-icon", inputs: ["size"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCardComponent, decorators: [{
type: Component,
args: [{ selector: 'sds-card', standalone: false, template: "<div *ngIf=\"!href && !routeLink\" class=\"card\" [class.border-primary]=\"isActive\">\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n</div>\n\n<a *ngIf=\"!href && routeLink\" class=\"card card-link\" [class.border-primary]=\"isActive\" [routerLink]=\"routeLink\" [fragment]=\"fragment\" [preserveFragment]=\"preserveFragment\" [queryParams]=\"queryParams\" [queryParamsHandling]=\"queryParamsHandling\" [replaceUrl]=\"replaceUrl\" [skipLocationChange]=\"skipLocationChange\" [state]=\"state\">\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n</a>\n\n<a *ngIf=\"href\" class=\"card card-link\" [class.border-primary]=\"isActive\" [attr.href]=\"href\" [attr.rel]=\"rel\" [attr.target]=\"target\">\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n</a>\n\n<ng-template #cardContent>\n <div *ngIf=\"icon\" class=\"card-header\">\n <sds-icon class=\"text-{{color}}\">{{icon}}</sds-icon>\n </div>\n <div class=\"card-body\">\n <h2 class=\"card-title\">{{title}}</h2>\n <div *ngIf=\"subtitle\" class=\"card-subtitle\">{{subtitle}}</div>\n <div #cardText class=\"card-text\" [class.empty]=\"!cardText?.innerText?.trim()\"><ng-content></ng-content></div>\n </div>\n <div *ngIf=\"footer\" class=\"card-footer text-{{footerAlign}}\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </div>\n</ng-template>\n" }]
}], propDecorators: { footer: [{
type: ContentChild,
args: ['sdsCardFooter', { static: true }]
}], color: [{
type: Input
}], isActive: [{
type: Input
}], footerAlign: [{
type: Input
}], title: [{
type: Input
}], icon: [{
type: Input
}], subtitle: [{
type: Input
}] } });
class SdsCardModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsCardModule, declarations: [SdsCardComponent], imports: [CommonModule, RouterModule, SdsIconModule], exports: [SdsCardComponent] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCardModule, imports: [CommonModule, RouterModule, SdsIconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCardModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule, RouterModule, SdsIconModule],
declarations: [SdsCardComponent],
exports: [SdsCardComponent],
}]
}] });
class SdsFormControlDirective {
// eslint-disable-next-line @angular-eslint/no-attribute-decorator
constructor(ngControl, isDisabled, isRequired) {
this.ngControl = ngControl;
this.disabled = false; // True if input is disabled via `[disabled]`
this.focus = false; // True if input is focused
this.setDisabled(isDisabled);
this.setRequired(isRequired);
}
onFocus() {
this.focus = true;
}
onBlur() {
this.focus = false;
}
ngOnInit() {
if (this.ngControl?.control) {
this.control = this.ngControl.control;
this.setRequired(this.control.hasValidator(Validators.required));
}
}
getState(state, currentState) {
if (typeof (currentState) === 'boolean') {
return state || currentState;
}
else {
return currentState !== null;
}
}
/**
* Check if input was disabled by setting `disabled` directive
*/
setDisabled(isDisabled) {
this.disabled = this.getState(this.disabled, isDisabled);
}
/**
* Check if input is required by setting `required` directive or validator
*/
setRequired(isRequired) {
this.required = this.getState(this.required, isRequired);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormControlDirective, deps: [{ token: i2$1.NgControl, host: true, optional: true }, { token: 'disabled', attribute: true }, { token: 'required', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: SdsFormControlDirective, isStandalone: true, inputs: { id: "id" }, host: { listeners: { "focus": "onFocus()", "blur": "onBlur()" }, properties: { "attr.id": "this.id" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormControlDirective, decorators: [{
type: Directive
}], ctorParameters: () => [{ type: i2$1.NgControl, decorators: [{
type: Host
}, {
type: Optional
}] }, { type: undefined, decorators: [{
type: Attribute,
args: ['disabled']
}] }, { type: undefined, decorators: [{
type: Attribute,
args: ['required']
}] }], propDecorators: { id: [{
type: Input
}, {
type: HostBinding,
args: ['attr.id']
}], onFocus: [{
type: HostListener,
args: ['focus']
}], onBlur: [{
type: HostListener,
args: ['blur']
}] } });
class SdsCheckboxControlDirective extends SdsFormControlDirective {
set checked(val) {
this.setChecked(forceBooleanType(val));
}
set indeterminate(val) {
if (this.elementRef) {
const indeterminate = forceBooleanType(val);
this.elementRef.nativeElement.indeterminate = indeterminate;
this.setAriaChecked(indeterminate);
}
}
// eslint-disable-next-line @angular-eslint/no-attribute-decorator
constructor(elementRef, ngControl, isDisabled, isRequired) {
super(ngControl, isDisabled, isRequired);
this.elementRef = elementRef;
this.classFormControl = true;
this.ariaChecked = false;
this.type = 'checkbox';
this._checked = false;
}
onChange(isChecked) {
this.setChecked(isChecked);
}
setAriaChecked(isIndeterminate) {
this.ariaChecked = isIndeterminate ? 'mixed' : this._checked;
}
setChecked(isChecked) {
this._checked = isChecked;
this.setAriaChecked();
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCheckboxControlDirective, deps: [{ token: i0.ElementRef }, { token: i2$1.NgControl, host: true, optional: true }, { token: 'disabled', attribute: true }, { token: 'required', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: SdsCheckboxControlDirective, isStandalone: false, selector: "[sdsCheckboxControl]", inputs: { checked: "checked", indeterminate: "indeterminate" }, host: { listeners: { "change": "onChange($event.currentTarget.checked)" }, properties: { "class.form-check-input": "this.classFormControl", "attr.aria-checked": "this.ariaChecked", "type": "this.type" } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCheckboxControlDirective, decorators: [{
type: Directive,
args: [{
selector: '[sdsCheckboxControl]',
standalone: false,
}]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i2$1.NgControl, decorators: [{
type: Host
}, {
type: Optional
}] }, { type: undefined, decorators: [{
type: Attribute,
args: ['disabled']
}] }, { type: undefined, decorators: [{
type: Attribute,
args: ['required']
}] }], propDecorators: { classFormControl: [{
type: HostBinding,
args: ['class.form-check-input']
}], ariaChecked: [{
type: HostBinding,
args: ['attr.aria-checked']
}], type: [{
type: HostBinding,
args: ['type']
}], checked: [{
type: Input
}], indeterminate: [{
type: Input
}], onChange: [{
type: HostListener,
args: ['change', ['$event.currentTarget.checked']]
}] } });
class SdsCheckboxComponent {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsCheckboxComponent, isStandalone: false, selector: "sds-checkbox", inputs: { label: "label", variant: "variant" }, queries: [{ propertyName: "checkbox", first: true, predicate: SdsCheckboxControlDirective, descendants: true, static: true }], ngImport: i0, template: "<div class=\"form-check\" [class.form-check-inline]=\"variant === 'inline'\">\n <ng-content></ng-content>\n <label class=\"form-check-label\" [attr.for]=\"checkbox?.id || undefined\">{{label}}</label>\n</div>\n", styles: ["sds-checkbox:last-of-type .form-check{margin-bottom:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCheckboxComponent, decorators: [{
type: Component,
args: [{ selector: 'sds-checkbox', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"form-check\" [class.form-check-inline]=\"variant === 'inline'\">\n <ng-content></ng-content>\n <label class=\"form-check-label\" [attr.for]=\"checkbox?.id || undefined\">{{label}}</label>\n</div>\n", styles: ["sds-checkbox:last-of-type .form-check{margin-bottom:0}\n"] }]
}], propDecorators: { checkbox: [{
type: ContentChild,
args: [SdsCheckboxControlDirective, { static: true }]
}], label: [{
type: Input
}], variant: [{
type: Input
}] } });
const COMPONENTS$c = [
SdsCheckboxComponent,
SdsCheckboxControlDirective,
];
class SdsCheckboxModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsCheckboxModule, declarations: [SdsCheckboxComponent,
SdsCheckboxControlDirective], imports: [CommonModule], exports: [SdsCheckboxComponent,
SdsCheckboxControlDirective] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCheckboxModule, imports: [CommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCheckboxModule, decorators: [{
type: NgModule,
args: [{ declarations: [...COMPONENTS$c], exports: [...COMPONENTS$c], imports: [CommonModule] }]
}] });
class SdsCounterDirective {
constructor(elementRef, renderer) {
this.elementRef = elementRef;
this.renderer = renderer;
this.counterColor = 'secondary';
this.counterOverlap = true;
this.counterPosition = 'after';
this.counterContainerClass = true;
}
ngOnChanges() {
this.updateCounter();
}
ngOnDestroy() {
if (this.counter) {
if (this.renderer.destroyNode) {
this.renderer.destroyNode(this.counter);
}
}
}
createCounter() {
this.counter = this.renderer.createElement('span');
this.counter.setAttribute('class', this.content
? 'position-absolute top-0 translate-middle badge rounded-pill'
: 'position-absolute top-0 translate-middle p-2 border border-light rounded-circle');
this.setContent();
if (this.counterColor) {
this.counter.classList.add(`bg-${this.counterColor}`);
}
if (this.counterPosition === 'before') {
this.counter.classList.add('start-0');
}
else {
this.counter.classList.add('start-100');
if (this.counterOverlap === 'false' || this.counterOverlap === false) {
this.counter.classList.add('ms-2');
}
}
this.elementRef.nativeElement.appendChild(this.counter);
}
updateCounter() {
if (!this.counter) {
this.createCounter();
}
else {
this.setContent();
}
}
setContent() {
if (this.content) {
this.counter.textContent = this.content;
this.counter.setAttribute('title', this.content);
}
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCounterDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: SdsCounterDirective, isStandalone: false, selector: "[sdsCounter]", inputs: { counterColor: "counterColor", counterOverlap: "counterOverlap", counterPosition: "counterPosition", content: ["sdsCounter", "content"] }, host: { properties: { "class.position-relative": "this.counterContainerClass" } }, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCounterDirective, decorators: [{
type: Directive,
args: [{
selector: '[sdsCounter]',
standalone: false,
}]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { counterColor: [{
type: Input
}], counterOverlap: [{
type: Input
}], counterPosition: [{
type: Input
}], content: [{
type: Input,
args: ['sdsCounter']
}], counterContainerClass: [{
type: HostBinding,
args: ['class.position-relative']
}] } });
class SdsCounterModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCounterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsCounterModule, declarations: [SdsCounterDirective], exports: [SdsCounterDirective] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCounterModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsCounterModule, decorators: [{
type: NgModule,
args: [{ declarations: [SdsCounterDirective], exports: [SdsCounterDirective] }]
}] });
class SdsDropdownModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsDropdownModule, exports: [NgbDropdownModule] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsDropdownModule, imports: [NgbDropdownModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsDropdownModule, decorators: [{
type: NgModule,
args: [{ exports: [NgbDropdownModule] }]
}] });
class SdsFormErrorComponent {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsFormErrorComponent, isStandalone: false, selector: "sds-form-error", ngImport: i0, template: "<div class=\"invalid-feedback\"><ng-content></ng-content></div>\n", styles: ["sds-form-error{width:100%}.was-validated :invalid~sds-form-error>.invalid-feedback,.was-validated :invalid~sds-form-error>.invalid-tooltip,.ng-touched.ng-invalid~sds-form-error>.invalid-feedback,.ng-touched.ng-invalid~sds-form-error>.invalid-tooltip{display:block}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormErrorComponent, decorators: [{
type: Component,
args: [{ selector: 'sds-form-error', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"invalid-feedback\"><ng-content></ng-content></div>\n", styles: ["sds-form-error{width:100%}.was-validated :invalid~sds-form-error>.invalid-feedback,.was-validated :invalid~sds-form-error>.invalid-tooltip,.ng-touched.ng-invalid~sds-form-error>.invalid-feedback,.ng-touched.ng-invalid~sds-form-error>.invalid-tooltip{display:block}\n"] }]
}] });
class SdsFormHelperComponent {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormHelperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: SdsFormHelperComponent, isStandalone: false, selector: "sds-form-helper", ngImport: i0, template: "<small class=\"form-text\"><ng-content></ng-content></small>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormHelperComponent, decorators: [{
type: Component,
args: [{ selector: 'sds-form-helper', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<small class=\"form-text\"><ng-content></ng-content></small>\n" }]
}] });
const COMPONENTS$b = [
SdsFormErrorComponent,
SdsFormHelperComponent,
];
class SdsFormModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: SdsFormModule, declarations: [SdsFormErrorComponent,
SdsFormHelperComponent], imports: [CommonModule], exports: [SdsFormErrorComponent,
SdsFormHelperComponent] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormModule, imports: [CommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFormModule, decorators: [{
type: NgModule,
args: [{ declarations: COMPONENTS$b, exports: COMPONENTS$b, imports: [CommonModule] }]
}] });
class SdsFileUploaderControlDirective {
get files$() {
return this._files.asObservable();
}
// eslint-disable-next-line @angular-eslint/no-attribute-decorator
constructor(ngControl, isRequired) {
this.ngControl = ngControl;
this.classFormControl = true;
this.type = 'file';
this._files = new BehaviorSubject(undefined);
this.setRequired(isRequired);
}
ngOnInit() {
if (this.ngControl?.control) {
this.control = this.ngControl.control;
this.setRequired(this.control.hasValidator(Validators.required));
if (this.control.value) {
this.onChange([{ name: this.control.value }]);
}
}
}
onChange(data) {
if (data?.length) {
const files = {};
for (const file of data) {
files[file.name] = typeof file.size !== 'undefined' ? this.formatFileSize(file.size, 3) : '';
}
this._files.next(files);
}
else {
this._files.next(undefined);
}
}
reset() {
if (this.control) {
this.control.reset();
}
this._files.next(undefined);
}
formatFileSize(bytes, decimalPoint) {
if (bytes === 0) {
return '0 Bytes';
}
const k = 1000;
const dm = decimalPoint || 2;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm)).toString()} ${sizes[i]}`;
}
/**
* Check if input is required by setting `required` directive or validator
*/
setRequired(isRequired) {
if (typeof (isRequired) === 'boolean') {
this.required = this.required || isRequired;
}
else {
this.required = isRequired !== null;
}
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFileUploaderControlDirective, deps: [{ token: i2$1.NgControl, host: true, optional: true }, { token: 'required', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: SdsFileUploaderControlDirective, isStandalone: false, selector: "input[sdsFileUploaderControl]", inputs: { id: "id" }, host: { listeners: { "change": "onChange($event.target.files)" }, properties: { "class.form-file-input": "this.classFormControl", "type": "this.type", "attr.id": "this.id" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SdsFileUploaderControlDirective, decorators: [{
type: Directive,
args: [{
selector: 'input[sdsFileUploaderControl]',
standalone: false,
}]
}], ctorParameters: () => [{ type: i2$1.NgControl, decorators: [{
type: Host
}, {
type: Optional
}] }, { type: undefined, decorators: [{
type: Attribute,
args: ['required']
}] }], propDecorators: { classFormControl: [{
type: HostBinding,
args: ['class.form-file-input']
}], type: [{
type: HostBinding,
args: ['type']
}], id: [{
type: Input
}, {
type: HostBinding,
args: ['attr.id']
}], onChange: [{
type: HostListener,
args: ['change', ['$event.target.files']]
}] } });
class SdsFileUploaderComponent {
constructor() {
this.hiddenLabel = false;
this.placeholder = 'Choose file';
this.remove = 'Remove file';
this.onRemove = new EventEmitter();
}
removeFile() {
const currentValue = this.input?.control ? this.input.control.value :