@ellie-software/ui 0.0.1
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/fesm2022/ellie-software-ui.mjs +84 -0
- package/fesm2022/ellie-software-ui.mjs.map +1 -0
- package/index.d.ts +35 -0
- package/package.json +29 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, ViewChild, Output, Input, Component } from '@angular/core';
|
|
3
|
+
import { NgClass } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
class EllieModal {
|
|
6
|
+
title = '';
|
|
7
|
+
titleIcon = '';
|
|
8
|
+
bannerClass = 'bg-primary';
|
|
9
|
+
size = 'md';
|
|
10
|
+
buttons = [];
|
|
11
|
+
buttonClick = new EventEmitter();
|
|
12
|
+
closed = new EventEmitter();
|
|
13
|
+
ellieModal;
|
|
14
|
+
static instanceCount = 0;
|
|
15
|
+
backdropId;
|
|
16
|
+
constructor() {
|
|
17
|
+
EllieModal.instanceCount++;
|
|
18
|
+
this.backdropId = `ellie-modal-backdrop-${EllieModal.instanceCount}`;
|
|
19
|
+
}
|
|
20
|
+
get sizeClass() {
|
|
21
|
+
const map = { sm: 'modal-sm', lg: 'modal-lg', xl: 'modal-xl', md: '' };
|
|
22
|
+
return map[this.size] ?? '';
|
|
23
|
+
}
|
|
24
|
+
openModal() {
|
|
25
|
+
const el = this.ellieModal.nativeElement;
|
|
26
|
+
el.classList.add('show');
|
|
27
|
+
el.style.display = 'block';
|
|
28
|
+
document.body.classList.add('modal-open');
|
|
29
|
+
const backdrop = document.createElement('div');
|
|
30
|
+
backdrop.classList.add('modal-backdrop', 'fade', 'show');
|
|
31
|
+
backdrop.id = this.backdropId;
|
|
32
|
+
document.body.appendChild(backdrop);
|
|
33
|
+
}
|
|
34
|
+
closeModal() {
|
|
35
|
+
const el = this.ellieModal.nativeElement;
|
|
36
|
+
el.classList.remove('show');
|
|
37
|
+
el.style.display = 'none';
|
|
38
|
+
document.body.classList.remove('modal-open');
|
|
39
|
+
const backdrop = document.getElementById(this.backdropId);
|
|
40
|
+
if (backdrop)
|
|
41
|
+
backdrop.remove();
|
|
42
|
+
}
|
|
43
|
+
onButtonClick(btn) {
|
|
44
|
+
this.buttonClick.emit(btn.action);
|
|
45
|
+
}
|
|
46
|
+
onCloseX() {
|
|
47
|
+
this.closeModal();
|
|
48
|
+
this.closed.emit();
|
|
49
|
+
}
|
|
50
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EllieModal, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
51
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: EllieModal, isStandalone: true, selector: "app-ellie-modal", inputs: { title: "title", titleIcon: "titleIcon", bannerClass: "bannerClass", size: "size", buttons: "buttons" }, outputs: { buttonClick: "buttonClick", closed: "closed" }, viewQueries: [{ propertyName: "ellieModal", first: true, predicate: ["ellieModal"], descendants: true }], ngImport: i0, template: "<div class=\"modal fade\" #ellieModal tabindex=\"-1\" role=\"dialog\">\n <div class=\"modal-dialog modal-dialog-centered\" [ngClass]=\"sizeClass\" role=\"document\">\n <div class=\"modal-content\">\n\n <div class=\"modal-header text-white\" [ngClass]=\"bannerClass\">\n <h5 class=\"modal-title\">\n @if (titleIcon) {\n <i [class]=\"titleIcon\"></i>\n }\n {{ title }}\n </h5>\n <button type=\"button\" class=\"close text-white\" (click)=\"onCloseX()\">×</button>\n </div>\n\n <div class=\"modal-body\">\n <ng-content></ng-content>\n </div>\n\n <div class=\"modal-footer\">\n @for (btn of buttons; track btn.action) {\n <button\n type=\"button\"\n class=\"btn\"\n [ngClass]=\"btn.colorClass\"\n [disabled]=\"btn.disabled || btn.loading\"\n (click)=\"onButtonClick(btn)\">\n @if (btn.loading) {\n <span class=\"spinner-border spinner-border-sm\" role=\"status\"></span>\n {{ btn.loadingLabel || btn.label }}\n } @else {\n @if (btn.icon) {\n <i [class]=\"btn.icon\"></i>\n }\n {{ btn.label }}\n }\n </button>\n }\n </div>\n\n </div>\n </div>\n</div>\n", styles: [".modal-header .close{background:transparent;border:none;font-size:1.5rem;line-height:1;opacity:.8;cursor:pointer}.modal-header .close:hover{opacity:1}.modal-content{max-height:90vh;display:flex;flex-direction:column}.modal-body{overflow-y:auto;flex:1 1 auto}@media(max-width:576px){.modal-dialog{margin:.5rem}.modal-content{max-height:95vh}}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EllieModal, decorators: [{
|
|
54
|
+
type: Component,
|
|
55
|
+
args: [{ selector: 'app-ellie-modal', imports: [NgClass], template: "<div class=\"modal fade\" #ellieModal tabindex=\"-1\" role=\"dialog\">\n <div class=\"modal-dialog modal-dialog-centered\" [ngClass]=\"sizeClass\" role=\"document\">\n <div class=\"modal-content\">\n\n <div class=\"modal-header text-white\" [ngClass]=\"bannerClass\">\n <h5 class=\"modal-title\">\n @if (titleIcon) {\n <i [class]=\"titleIcon\"></i>\n }\n {{ title }}\n </h5>\n <button type=\"button\" class=\"close text-white\" (click)=\"onCloseX()\">×</button>\n </div>\n\n <div class=\"modal-body\">\n <ng-content></ng-content>\n </div>\n\n <div class=\"modal-footer\">\n @for (btn of buttons; track btn.action) {\n <button\n type=\"button\"\n class=\"btn\"\n [ngClass]=\"btn.colorClass\"\n [disabled]=\"btn.disabled || btn.loading\"\n (click)=\"onButtonClick(btn)\">\n @if (btn.loading) {\n <span class=\"spinner-border spinner-border-sm\" role=\"status\"></span>\n {{ btn.loadingLabel || btn.label }}\n } @else {\n @if (btn.icon) {\n <i [class]=\"btn.icon\"></i>\n }\n {{ btn.label }}\n }\n </button>\n }\n </div>\n\n </div>\n </div>\n</div>\n", styles: [".modal-header .close{background:transparent;border:none;font-size:1.5rem;line-height:1;opacity:.8;cursor:pointer}.modal-header .close:hover{opacity:1}.modal-content{max-height:90vh;display:flex;flex-direction:column}.modal-body{overflow-y:auto;flex:1 1 auto}@media(max-width:576px){.modal-dialog{margin:.5rem}.modal-content{max-height:95vh}}\n"] }]
|
|
56
|
+
}], ctorParameters: () => [], propDecorators: { title: [{
|
|
57
|
+
type: Input
|
|
58
|
+
}], titleIcon: [{
|
|
59
|
+
type: Input
|
|
60
|
+
}], bannerClass: [{
|
|
61
|
+
type: Input
|
|
62
|
+
}], size: [{
|
|
63
|
+
type: Input
|
|
64
|
+
}], buttons: [{
|
|
65
|
+
type: Input
|
|
66
|
+
}], buttonClick: [{
|
|
67
|
+
type: Output
|
|
68
|
+
}], closed: [{
|
|
69
|
+
type: Output
|
|
70
|
+
}], ellieModal: [{
|
|
71
|
+
type: ViewChild,
|
|
72
|
+
args: ['ellieModal']
|
|
73
|
+
}] } });
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* @ellie-software/ui — Public API Surface
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Generated bundle index. Do not edit.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
export { EllieModal };
|
|
84
|
+
//# sourceMappingURL=ellie-software-ui.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellie-software-ui.mjs","sources":["../../../projects/ui/src/lib/ellie-modal/ellie-modal.ts","../../../projects/ui/src/lib/ellie-modal/ellie-modal.html","../../../projects/ui/src/public-api.ts","../../../projects/ui/src/ellie-software-ui.ts"],"sourcesContent":["import { Component, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core';\nimport { NgClass } from '@angular/common';\n\nexport interface EllieModalButton {\n label: string;\n colorClass: string; // 'btn-danger', 'btn-secondary', 'btn-success', etc.\n action: string; // identificador emitido al padre\n icon?: string; // 'fa fa-save', 'icon-trash', etc.\n loading?: boolean;\n loadingLabel?: string;\n disabled?: boolean;\n}\n\n@Component({\n selector: 'app-ellie-modal',\n imports: [NgClass],\n templateUrl: './ellie-modal.html',\n styleUrl: './ellie-modal.css'\n})\nexport class EllieModal {\n @Input() title: string = '';\n @Input() titleIcon: string = '';\n @Input() bannerClass: string = 'bg-primary';\n @Input() size: 'sm' | 'md' | 'lg' | 'xl' = 'md';\n @Input() buttons: EllieModalButton[] = [];\n\n @Output() buttonClick = new EventEmitter<string>();\n @Output() closed = new EventEmitter<void>();\n\n @ViewChild('ellieModal') ellieModal!: ElementRef;\n\n private static instanceCount = 0;\n private backdropId: string;\n\n constructor() {\n EllieModal.instanceCount++;\n this.backdropId = `ellie-modal-backdrop-${EllieModal.instanceCount}`;\n }\n\n get sizeClass(): string {\n const map: Record<string, string> = { sm: 'modal-sm', lg: 'modal-lg', xl: 'modal-xl', md: '' };\n return map[this.size] ?? '';\n }\n\n openModal(): void {\n const el = this.ellieModal.nativeElement;\n el.classList.add('show');\n el.style.display = 'block';\n document.body.classList.add('modal-open');\n const backdrop = document.createElement('div');\n backdrop.classList.add('modal-backdrop', 'fade', 'show');\n backdrop.id = this.backdropId;\n document.body.appendChild(backdrop);\n }\n\n closeModal(): void {\n const el = this.ellieModal.nativeElement;\n el.classList.remove('show');\n el.style.display = 'none';\n document.body.classList.remove('modal-open');\n const backdrop = document.getElementById(this.backdropId);\n if (backdrop) backdrop.remove();\n }\n\n onButtonClick(btn: EllieModalButton): void {\n this.buttonClick.emit(btn.action);\n }\n\n onCloseX(): void {\n this.closeModal();\n this.closed.emit();\n }\n}\n","<div class=\"modal fade\" #ellieModal tabindex=\"-1\" role=\"dialog\">\n <div class=\"modal-dialog modal-dialog-centered\" [ngClass]=\"sizeClass\" role=\"document\">\n <div class=\"modal-content\">\n\n <div class=\"modal-header text-white\" [ngClass]=\"bannerClass\">\n <h5 class=\"modal-title\">\n @if (titleIcon) {\n <i [class]=\"titleIcon\"></i>\n }\n {{ title }}\n </h5>\n <button type=\"button\" class=\"close text-white\" (click)=\"onCloseX()\">×</button>\n </div>\n\n <div class=\"modal-body\">\n <ng-content></ng-content>\n </div>\n\n <div class=\"modal-footer\">\n @for (btn of buttons; track btn.action) {\n <button\n type=\"button\"\n class=\"btn\"\n [ngClass]=\"btn.colorClass\"\n [disabled]=\"btn.disabled || btn.loading\"\n (click)=\"onButtonClick(btn)\">\n @if (btn.loading) {\n <span class=\"spinner-border spinner-border-sm\" role=\"status\"></span>\n {{ btn.loadingLabel || btn.label }}\n } @else {\n @if (btn.icon) {\n <i [class]=\"btn.icon\"></i>\n }\n {{ btn.label }}\n }\n </button>\n }\n </div>\n\n </div>\n </div>\n</div>\n","/*\n * @ellie-software/ui — Public API Surface\n */\n\nexport { EllieModal, EllieModalButton } from './lib/ellie-modal/ellie-modal';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAmBa,UAAU,CAAA;IACZ,KAAK,GAAW,EAAE;IAClB,SAAS,GAAW,EAAE;IACtB,WAAW,GAAW,YAAY;IAClC,IAAI,GAA8B,IAAI;IACtC,OAAO,GAAuB,EAAE;AAE/B,IAAA,WAAW,GAAG,IAAI,YAAY,EAAU;AACxC,IAAA,MAAM,GAAG,IAAI,YAAY,EAAQ;AAElB,IAAA,UAAU;AAE3B,IAAA,OAAO,aAAa,GAAG,CAAC;AACxB,IAAA,UAAU;AAElB,IAAA,WAAA,GAAA;QACE,UAAU,CAAC,aAAa,EAAE;QAC1B,IAAI,CAAC,UAAU,GAAG,CAAA,qBAAA,EAAwB,UAAU,CAAC,aAAa,EAAE;IACtE;AAEA,IAAA,IAAI,SAAS,GAAA;AACX,QAAA,MAAM,GAAG,GAA2B,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE;QAC9F,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;IAC7B;IAEA,SAAS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V,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,OAAA,EAAA,SAAA,EAAA,WAAA,EAAA,WAAA,EAAA,aAAA,EAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,aAAA,EAAA,MAAA,EAAA,QAAA,EAAA,EAAA,WAAA,EAAA,CAAA,EAAA,YAAA,EAAA,YAAA,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,YAAA,CAAA,EAAA,WAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECnBvB,+0CA0CA,EAAA,MAAA,EAAA,CAAA,yVAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,ED3BY,OAAO,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAIN,UAAU,EAAA,UAAA,EAAA,CAAA;kBANtB,SAAS;+BACE,iBAAiB,EAAA,OAAA,EAClB,CAAC,OAAO,CAAC,EAAA,QAAA,EAAA,+0CAAA,EAAA,MAAA,EAAA,CAAA,yVAAA,CAAA,EAAA;;sBAKjB;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA;;sBACA;;sBAEA,SAAS;uBAAC,YAAY;;;AE7BzB;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, ElementRef } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
interface EllieModalButton {
|
|
5
|
+
label: string;
|
|
6
|
+
colorClass: string;
|
|
7
|
+
action: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
loadingLabel?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare class EllieModal {
|
|
14
|
+
title: string;
|
|
15
|
+
titleIcon: string;
|
|
16
|
+
bannerClass: string;
|
|
17
|
+
size: 'sm' | 'md' | 'lg' | 'xl';
|
|
18
|
+
buttons: EllieModalButton[];
|
|
19
|
+
buttonClick: EventEmitter<string>;
|
|
20
|
+
closed: EventEmitter<void>;
|
|
21
|
+
ellieModal: ElementRef;
|
|
22
|
+
private static instanceCount;
|
|
23
|
+
private backdropId;
|
|
24
|
+
constructor();
|
|
25
|
+
get sizeClass(): string;
|
|
26
|
+
openModal(): void;
|
|
27
|
+
closeModal(): void;
|
|
28
|
+
onButtonClick(btn: EllieModalButton): void;
|
|
29
|
+
onCloseX(): void;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EllieModal, never>;
|
|
31
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EllieModal, "app-ellie-modal", never, { "title": { "alias": "title"; "required": false; }; "titleIcon": { "alias": "titleIcon"; "required": false; }; "bannerClass": { "alias": "bannerClass"; "required": false; }; "size": { "alias": "size"; "required": false; }; "buttons": { "alias": "buttons"; "required": false; }; }, { "buttonClick": "buttonClick"; "closed": "closed"; }, never, ["*"], true, never>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { EllieModal };
|
|
35
|
+
export type { EllieModalButton };
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ellie-software/ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Ellie shared UI components library",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Ellie-System/ts-lib-ellie-ui.git"
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"@angular/common": "^20.0.0",
|
|
12
|
+
"@angular/core": "^20.0.0"
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"module": "fesm2022/ellie-software-ui.mjs",
|
|
16
|
+
"typings": "index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": {
|
|
19
|
+
"default": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./index.d.ts",
|
|
23
|
+
"default": "./fesm2022/ellie-software-ui.mjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"tslib": "^2.3.0"
|
|
28
|
+
}
|
|
29
|
+
}
|