@cuby-ui/core 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/dialog/dialog.component.d.ts +22 -4
- package/esm2020/components/dialog/dialog.component.mjs +36 -6
- package/fesm2015/cuby-ui-core.mjs +35 -6
- package/fesm2015/cuby-ui-core.mjs.map +1 -1
- package/fesm2020/cuby-ui-core.mjs +35 -6
- package/fesm2020/cuby-ui-core.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -1,12 +1,30 @@
|
|
|
1
|
-
import type { Type } from '@angular/core';
|
|
1
|
+
import type { OnDestroy, OnInit, Type } from '@angular/core';
|
|
2
2
|
import { TemplateRef } from '@angular/core';
|
|
3
|
+
import type { CuiValueOf } from '@cuby-ui/cdk';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare
|
|
5
|
+
export declare const ContentType: {
|
|
6
|
+
readonly String: "string";
|
|
7
|
+
readonly Template: "template";
|
|
8
|
+
readonly Component: "component";
|
|
9
|
+
};
|
|
10
|
+
export type IContentType = CuiValueOf<typeof ContentType>;
|
|
11
|
+
export declare class CuiDialogComponent implements OnInit, OnDestroy {
|
|
12
|
+
protected readonly document: Document;
|
|
5
13
|
protected readonly context: import("@cuby-ui/cdk").CuiPopover<import("./dialog.interfaces").CuiDialogOptions>;
|
|
6
|
-
protected
|
|
14
|
+
protected readonly ContentType: {
|
|
15
|
+
readonly String: "string";
|
|
16
|
+
readonly Template: "template";
|
|
17
|
+
readonly Component: "component";
|
|
18
|
+
};
|
|
19
|
+
protected contentType: IContentType;
|
|
20
|
+
ngOnInit(): void;
|
|
21
|
+
ngOnDestroy(): void;
|
|
7
22
|
protected get contentTemplateRef(): TemplateRef<unknown>;
|
|
8
|
-
protected get
|
|
23
|
+
protected get componentType(): Type<unknown>;
|
|
9
24
|
protected onClose(): void;
|
|
25
|
+
private initContentType;
|
|
26
|
+
private initBodyScrollHiding;
|
|
27
|
+
private destroyBodyScrollHiding;
|
|
10
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<CuiDialogComponent, never>;
|
|
11
29
|
static ɵcmp: i0.ɵɵComponentDeclaration<CuiDialogComponent, "cui-dialog", never, {}, {}, never, never, false, never>;
|
|
12
30
|
}
|
|
@@ -1,29 +1,59 @@
|
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
1
2
|
import { ChangeDetectionStrategy, Component, inject, TemplateRef } from '@angular/core';
|
|
2
3
|
import { CUI_DIALOG_CONTEXT } from './dialog.tokens';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
import * as i1 from "@angular/common";
|
|
5
6
|
import * as i2 from "../button/button.component";
|
|
7
|
+
export const ContentType = {
|
|
8
|
+
String: 'string',
|
|
9
|
+
Template: 'template',
|
|
10
|
+
Component: 'component'
|
|
11
|
+
};
|
|
6
12
|
export class CuiDialogComponent {
|
|
7
13
|
constructor() {
|
|
14
|
+
this.document = inject(DOCUMENT);
|
|
8
15
|
this.context = inject(CUI_DIALOG_CONTEXT);
|
|
16
|
+
this.ContentType = ContentType;
|
|
17
|
+
this.contentType = ContentType.Component;
|
|
9
18
|
}
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
ngOnInit() {
|
|
20
|
+
this.initBodyScrollHiding();
|
|
21
|
+
this.initContentType();
|
|
22
|
+
}
|
|
23
|
+
ngOnDestroy() {
|
|
24
|
+
this.destroyBodyScrollHiding();
|
|
12
25
|
}
|
|
13
26
|
get contentTemplateRef() {
|
|
14
27
|
return this.context.content;
|
|
15
28
|
}
|
|
16
|
-
get
|
|
29
|
+
get componentType() {
|
|
17
30
|
return this.context.content;
|
|
18
31
|
}
|
|
19
32
|
onClose() {
|
|
20
33
|
this.context.$implicit.complete();
|
|
21
34
|
}
|
|
35
|
+
initContentType() {
|
|
36
|
+
const content = this.context.content;
|
|
37
|
+
switch (true) {
|
|
38
|
+
case (typeof content === 'string'):
|
|
39
|
+
this.contentType = ContentType.String;
|
|
40
|
+
return;
|
|
41
|
+
case (content instanceof TemplateRef):
|
|
42
|
+
this.contentType = ContentType.Template;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
initBodyScrollHiding() {
|
|
47
|
+
this.document.body.style.overflow = 'hidden';
|
|
48
|
+
}
|
|
49
|
+
destroyBodyScrollHiding() {
|
|
50
|
+
this.document.body.style.overflow = '';
|
|
51
|
+
}
|
|
22
52
|
}
|
|
23
53
|
CuiDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
24
|
-
CuiDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiDialogComponent, selector: "cui-dialog", ngImport: i0, template: "<header *ngIf=\"context.label\" class=\"c-header\">\n <h2 class=\"c-heading\">{{ context.label }}</h2>\n <button\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n (click)=\"onClose()\"\n ></button>\n</header>\n<div
|
|
54
|
+
CuiDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiDialogComponent, selector: "cui-dialog", ngImport: i0, template: "<header *ngIf=\"context.label\" class=\"c-header\">\n <h2 class=\"c-heading\">{{ context.label }}</h2>\n <button\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n (click)=\"onClose()\"\n ></button>\n</header>\n<div\n [ngSwitch]=\"contentType\"\n class=\"\u0441-content\"\n>\n <ng-container *ngSwitchCase=\"ContentType.String\">\n {{ context.content }}\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.Template\">\n <ng-container *ngTemplateOutlet=\"contentTemplateRef; context: context\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.Component\">\n <ng-container *ngComponentOutlet=\"componentType\"></ng-container>\n </ng-container>\n</div>\n", styles: ["@charset \"UTF-8\";:host{box-shadow:0 2px 4px -1px #0000000f,0 4px 6px -1px #0000001a;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:12px;background:var(--cui-base-0);font-family:var(--cui-main-font)}.c-header{padding:24px 24px 16px;display:flex;justify-content:space-between;gap:8px}.c-heading{font-weight:500;font-size:20px;line-height:30px;min-height:36px;margin:0;overflow-wrap:anywhere}.\\441-content{padding:16px 24px}\n"], dependencies: [{ kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { 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: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i2.CuiButtonComponent, selector: "button[cuiButton], a[cuiButton]", inputs: ["shape", "disabled", "isLoaderShown", "icon", "iconRight", "appearance", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
25
55
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogComponent, decorators: [{
|
|
26
56
|
type: Component,
|
|
27
|
-
args: [{ selector: 'cui-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<header *ngIf=\"context.label\" class=\"c-header\">\n <h2 class=\"c-heading\">{{ context.label }}</h2>\n <button\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n (click)=\"onClose()\"\n ></button>\n</header>\n<div
|
|
57
|
+
args: [{ selector: 'cui-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<header *ngIf=\"context.label\" class=\"c-header\">\n <h2 class=\"c-heading\">{{ context.label }}</h2>\n <button\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n (click)=\"onClose()\"\n ></button>\n</header>\n<div\n [ngSwitch]=\"contentType\"\n class=\"\u0441-content\"\n>\n <ng-container *ngSwitchCase=\"ContentType.String\">\n {{ context.content }}\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.Template\">\n <ng-container *ngTemplateOutlet=\"contentTemplateRef; context: context\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.Component\">\n <ng-container *ngComponentOutlet=\"componentType\"></ng-container>\n </ng-container>\n</div>\n", styles: ["@charset \"UTF-8\";:host{box-shadow:0 2px 4px -1px #0000000f,0 4px 6px -1px #0000001a;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:12px;background:var(--cui-base-0);font-family:var(--cui-main-font)}.c-header{padding:24px 24px 16px;display:flex;justify-content:space-between;gap:8px}.c-heading{font-weight:500;font-size:20px;line-height:30px;min-height:36px;margin:0;overflow-wrap:anywhere}.\\441-content{padding:16px 24px}\n"] }]
|
|
28
58
|
}] });
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvcmUvY29tcG9uZW50cy9kaWFsb2cvZGlhbG9nLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvcmUvY29tcG9uZW50cy9kaWFsb2cvZGlhbG9nLnRlbXBsYXRlLmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQix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G9uZW50VHlwZVwiPjwvbmctY29udGFpbmVyPlxuICA8L25nLWNvbnRhaW5lcj5cbjwvZGl2PlxuIl19
|
|
@@ -856,28 +856,57 @@ const CUI_DIALOG_DEFAULT_OPTIONS = {
|
|
|
856
856
|
const CUI_DIALOG_OPTIONS = cuiCreateToken(CUI_DIALOG_DEFAULT_OPTIONS);
|
|
857
857
|
const CUI_DIALOG_CONTEXT = new InjectionToken('');
|
|
858
858
|
|
|
859
|
+
const ContentType = {
|
|
860
|
+
String: 'string',
|
|
861
|
+
Template: 'template',
|
|
862
|
+
Component: 'component'
|
|
863
|
+
};
|
|
859
864
|
class CuiDialogComponent {
|
|
860
865
|
constructor() {
|
|
866
|
+
this.document = inject(DOCUMENT);
|
|
861
867
|
this.context = inject(CUI_DIALOG_CONTEXT);
|
|
868
|
+
this.ContentType = ContentType;
|
|
869
|
+
this.contentType = ContentType.Component;
|
|
870
|
+
}
|
|
871
|
+
ngOnInit() {
|
|
872
|
+
this.initBodyScrollHiding();
|
|
873
|
+
this.initContentType();
|
|
862
874
|
}
|
|
863
|
-
|
|
864
|
-
|
|
875
|
+
ngOnDestroy() {
|
|
876
|
+
this.destroyBodyScrollHiding();
|
|
865
877
|
}
|
|
866
878
|
get contentTemplateRef() {
|
|
867
879
|
return this.context.content;
|
|
868
880
|
}
|
|
869
|
-
get
|
|
881
|
+
get componentType() {
|
|
870
882
|
return this.context.content;
|
|
871
883
|
}
|
|
872
884
|
onClose() {
|
|
873
885
|
this.context.$implicit.complete();
|
|
874
886
|
}
|
|
887
|
+
initContentType() {
|
|
888
|
+
const content = this.context.content;
|
|
889
|
+
switch (true) {
|
|
890
|
+
case (typeof content === 'string'):
|
|
891
|
+
this.contentType = ContentType.String;
|
|
892
|
+
return;
|
|
893
|
+
case (content instanceof TemplateRef):
|
|
894
|
+
this.contentType = ContentType.Template;
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
initBodyScrollHiding() {
|
|
899
|
+
this.document.body.style.overflow = 'hidden';
|
|
900
|
+
}
|
|
901
|
+
destroyBodyScrollHiding() {
|
|
902
|
+
this.document.body.style.overflow = '';
|
|
903
|
+
}
|
|
875
904
|
}
|
|
876
905
|
CuiDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
877
|
-
CuiDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiDialogComponent, selector: "cui-dialog", ngImport: i0, template: "<header *ngIf=\"context.label\" class=\"c-header\">\n <h2 class=\"c-heading\">{{ context.label }}</h2>\n <button\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n (click)=\"onClose()\"\n ></button>\n</header>\n<div
|
|
906
|
+
CuiDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiDialogComponent, selector: "cui-dialog", ngImport: i0, template: "<header *ngIf=\"context.label\" class=\"c-header\">\n <h2 class=\"c-heading\">{{ context.label }}</h2>\n <button\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n (click)=\"onClose()\"\n ></button>\n</header>\n<div\n [ngSwitch]=\"contentType\"\n class=\"\u0441-content\"\n>\n <ng-container *ngSwitchCase=\"ContentType.String\">\n {{ context.content }}\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.Template\">\n <ng-container *ngTemplateOutlet=\"contentTemplateRef; context: context\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.Component\">\n <ng-container *ngComponentOutlet=\"componentType\"></ng-container>\n </ng-container>\n</div>\n", styles: ["@charset \"UTF-8\";:host{box-shadow:0 2px 4px -1px #0000000f,0 4px 6px -1px #0000001a;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:12px;background:var(--cui-base-0);font-family:var(--cui-main-font)}.c-header{padding:24px 24px 16px;display:flex;justify-content:space-between;gap:8px}.c-heading{font-weight:500;font-size:20px;line-height:30px;min-height:36px;margin:0;overflow-wrap:anywhere}.\\441-content{padding:16px 24px}\n"], dependencies: [{ kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { 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: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: CuiButtonComponent, selector: "button[cuiButton], a[cuiButton]", inputs: ["shape", "disabled", "isLoaderShown", "icon", "iconRight", "appearance", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
878
907
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogComponent, decorators: [{
|
|
879
908
|
type: Component,
|
|
880
|
-
args: [{ selector: 'cui-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<header *ngIf=\"context.label\" class=\"c-header\">\n <h2 class=\"c-heading\">{{ context.label }}</h2>\n <button\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n (click)=\"onClose()\"\n ></button>\n</header>\n<div
|
|
909
|
+
args: [{ selector: 'cui-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<header *ngIf=\"context.label\" class=\"c-header\">\n <h2 class=\"c-heading\">{{ context.label }}</h2>\n <button\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n (click)=\"onClose()\"\n ></button>\n</header>\n<div\n [ngSwitch]=\"contentType\"\n class=\"\u0441-content\"\n>\n <ng-container *ngSwitchCase=\"ContentType.String\">\n {{ context.content }}\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.Template\">\n <ng-container *ngTemplateOutlet=\"contentTemplateRef; context: context\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.Component\">\n <ng-container *ngComponentOutlet=\"componentType\"></ng-container>\n </ng-container>\n</div>\n", styles: ["@charset \"UTF-8\";:host{box-shadow:0 2px 4px -1px #0000000f,0 4px 6px -1px #0000001a;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:12px;background:var(--cui-base-0);font-family:var(--cui-main-font)}.c-header{padding:24px 24px 16px;display:flex;justify-content:space-between;gap:8px}.c-heading{font-weight:500;font-size:20px;line-height:30px;min-height:36px;margin:0;overflow-wrap:anywhere}.\\441-content{padding:16px 24px}\n"] }]
|
|
881
910
|
}] });
|
|
882
911
|
|
|
883
912
|
class CuiDialogsComponent {
|
|
@@ -2138,5 +2167,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2138
2167
|
* Generated bundle index. Do not edit.
|
|
2139
2168
|
*/
|
|
2140
2169
|
|
|
2141
|
-
export { CUI_ALERTS, CUI_ALERT_CONTEXT, CUI_ALERT_DEFAULT_OPTIONS, CUI_ALERT_OPTIONS, CUI_BANNER_DEFAULT_OPTIONS, CUI_BANNER_OPTIONS, CUI_BUTTON_DEFAULT_OPTIONS, CUI_BUTTON_OPTIONS, CUI_DEFAULT_THEME, CUI_NOTIFICATION_DEFAULT_OPTIONS, CUI_NOTIFICATION_OPTIONS, CUI_TEXT_FIELD_CONTROLLER, CUI_TEXT_FIELD_ICON_LEFT, CUI_TEXT_FIELD_ID, CUI_TEXT_FIELD_IS_ERROR, CUI_TEXT_FIELD_PLACEHOLDER, CUI_TEXT_FIELD_SIZE, CUI_TEXT_FILED_CONTROLLER_PROVIDER, CUI_THEME, CUI_THEME_STORAGE_DEFAULT_KEY, CUI_THEME_STORAGE_KEY, CuiAccordionComponent, CuiAccordionItemComponent, CuiAccordionModule, CuiAlertComponent, CuiAlertModule, CuiAlertService, CuiAlertsComponent, CuiBadgeComponent, CuiBadgeModule, CuiBannerComponent, CuiBannerModule, CuiBreadcrumbComponent, CuiBreadcrumbsComponent, CuiBreadcrumbsModule, CuiButtonComponent, CuiButtonGroupComponent, CuiButtonGroupModule, CuiButtonModule, CuiCheckboxComponent, CuiCheckboxModule, CuiContextMenuComponent, CuiContextMenuModule, CuiDialogComponent, CuiDialogModule, CuiDialogService, CuiDialogsComponent, CuiEditorComponent, CuiEditorModule, CuiFormFieldComponent, CuiFormFieldModule, CuiHintComponent, CuiHintModule, CuiIconButtonComponent, CuiIconButtonModule, CuiInputModule, CuiInputNumberComponent, CuiInputNumberModule, CuiInputPasswordComponent, CuiInputPasswordModule, CuiInputTextComponent, CuiLabelComponent, CuiLabelModule, CuiNotificationComponent, CuiNotificationModule, CuiRadioComponent, CuiRadioModule, CuiRootComponent, CuiRootModule, CuiSelectComponent, CuiSelectModule, CuiSvgComponent, CuiSvgModule, CuiTextFieldController, CuiTextFieldControllerModule, CuiTextFieldIconLeftDirective, CuiTextFieldIdDirective, CuiTextFieldIsErrorDirective, CuiTextFieldPlaceholderDirective, CuiTextFieldSizeDirective, CuiTextareaComponent, CuiTextareaModule, CuiThemeService, CuiToggleComponent, CuiToggleModule, cuiRemoveSpaces, cuiReplace };
|
|
2170
|
+
export { CUI_ALERTS, CUI_ALERT_CONTEXT, CUI_ALERT_DEFAULT_OPTIONS, CUI_ALERT_OPTIONS, CUI_BANNER_DEFAULT_OPTIONS, CUI_BANNER_OPTIONS, CUI_BUTTON_DEFAULT_OPTIONS, CUI_BUTTON_OPTIONS, CUI_DEFAULT_THEME, CUI_NOTIFICATION_DEFAULT_OPTIONS, CUI_NOTIFICATION_OPTIONS, CUI_TEXT_FIELD_CONTROLLER, CUI_TEXT_FIELD_ICON_LEFT, CUI_TEXT_FIELD_ID, CUI_TEXT_FIELD_IS_ERROR, CUI_TEXT_FIELD_PLACEHOLDER, CUI_TEXT_FIELD_SIZE, CUI_TEXT_FILED_CONTROLLER_PROVIDER, CUI_THEME, CUI_THEME_STORAGE_DEFAULT_KEY, CUI_THEME_STORAGE_KEY, ContentType, CuiAccordionComponent, CuiAccordionItemComponent, CuiAccordionModule, CuiAlertComponent, CuiAlertModule, CuiAlertService, CuiAlertsComponent, CuiBadgeComponent, CuiBadgeModule, CuiBannerComponent, CuiBannerModule, CuiBreadcrumbComponent, CuiBreadcrumbsComponent, CuiBreadcrumbsModule, CuiButtonComponent, CuiButtonGroupComponent, CuiButtonGroupModule, CuiButtonModule, CuiCheckboxComponent, CuiCheckboxModule, CuiContextMenuComponent, CuiContextMenuModule, CuiDialogComponent, CuiDialogModule, CuiDialogService, CuiDialogsComponent, CuiEditorComponent, CuiEditorModule, CuiFormFieldComponent, CuiFormFieldModule, CuiHintComponent, CuiHintModule, CuiIconButtonComponent, CuiIconButtonModule, CuiInputModule, CuiInputNumberComponent, CuiInputNumberModule, CuiInputPasswordComponent, CuiInputPasswordModule, CuiInputTextComponent, CuiLabelComponent, CuiLabelModule, CuiNotificationComponent, CuiNotificationModule, CuiRadioComponent, CuiRadioModule, CuiRootComponent, CuiRootModule, CuiSelectComponent, CuiSelectModule, CuiSvgComponent, CuiSvgModule, CuiTextFieldController, CuiTextFieldControllerModule, CuiTextFieldIconLeftDirective, CuiTextFieldIdDirective, CuiTextFieldIsErrorDirective, CuiTextFieldPlaceholderDirective, CuiTextFieldSizeDirective, CuiTextareaComponent, CuiTextareaModule, CuiThemeService, CuiToggleComponent, CuiToggleModule, cuiRemoveSpaces, cuiReplace };
|
|
2142
2171
|
//# sourceMappingURL=cuby-ui-core.mjs.map
|