@naveenkumarp/custom-button 0.0.3
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.
Potentially problematic release.
This version of @naveenkumarp/custom-button might be problematic. Click here for more details.
- package/README.md +24 -0
- package/esm2022/custom-button.mjs +5 -0
- package/esm2022/lib/custom-button/custom-button.component.mjs +60 -0
- package/esm2022/lib/custom-button.component.mjs +19 -0
- package/esm2022/lib/custom-button.module.mjs +21 -0
- package/esm2022/lib/custom-button.service.mjs +14 -0
- package/esm2022/public-api.mjs +8 -0
- package/fesm2022/custom-button.mjs +118 -0
- package/fesm2022/custom-button.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/custom-button/custom-button.component.d.ts +22 -0
- package/lib/custom-button.component.d.ts +5 -0
- package/lib/custom-button.module.d.ts +7 -0
- package/lib/custom-button.service.d.ts +6 -0
- package/package.json +25 -0
- package/public-api.d.ts +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# CustomButton
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project custom-button` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project custom-button`.
|
|
8
|
+
> Note: Don't forget to add `--project custom-button` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build custom-button` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build custom-button`, go to the dist folder `cd dist/custom-button` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test custom-button` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VzdG9tLWJ1dHRvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2N1c3RvbS1idXR0b24vc3JjL2N1c3RvbS1idXR0b24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Component, ContentChild, ElementRef, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "@angular/common";
|
|
5
|
+
export class ButtonComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.label = 'Button';
|
|
8
|
+
this.variant = 'primary';
|
|
9
|
+
this.size = 'md';
|
|
10
|
+
this.appearance = 'fill';
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
this.loading = false;
|
|
13
|
+
this.fullWidth = false;
|
|
14
|
+
this.btnClick = new EventEmitter();
|
|
15
|
+
this.hasCustomLoader = false;
|
|
16
|
+
}
|
|
17
|
+
ngAfterContentInit() {
|
|
18
|
+
this.hasCustomLoader = !!this.loaderContent;
|
|
19
|
+
}
|
|
20
|
+
handleClick() {
|
|
21
|
+
if (this.disabled || this.loading)
|
|
22
|
+
return;
|
|
23
|
+
this.btnClick.emit();
|
|
24
|
+
}
|
|
25
|
+
get classes() {
|
|
26
|
+
return [
|
|
27
|
+
'btn',
|
|
28
|
+
`btn-${this.variant}`,
|
|
29
|
+
`btn-${this.appearance}`,
|
|
30
|
+
`btn-${this.size}`,
|
|
31
|
+
this.fullWidth ? 'btn-flex' : ''
|
|
32
|
+
].join(' ');
|
|
33
|
+
}
|
|
34
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
35
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ButtonComponent, isStandalone: true, selector: "lib-custom-button", inputs: { label: "label", variant: "variant", size: "size", appearance: "appearance", disabled: "disabled", loading: "loading", fullWidth: "fullWidth" }, outputs: { btnClick: "btnClick" }, queries: [{ propertyName: "loaderContent", first: true, predicate: ["[loading]"], descendants: true, read: ElementRef }], ngImport: i0, template: "<button\n [class]=\"classes\"\n [disabled]=\"disabled || loading\"\n (click)=\"handleClick()\"\n>\n\n <!-- Loading Slot -->\n <ng-container *ngIf=\"loading; else content\">\n <span class=\"spinner-slot\">\n <ng-content select=\"[loading]\"></ng-content>\n\n <!-- Fallback spinner -->\n <span class=\"spinner-default\" *ngIf=\"!hasCustomLoader\"></span>\n </span>\n </ng-container>\n\n <!-- Normal Content -->\n <ng-template #content>\n\n <!-- Left -->\n <span class=\"icon-left\">\n <ng-content select=\"[left]\"></ng-content>\n </span>\n\n <!-- Label -->\n <span *ngIf=\"label\">\n {{ label }}\n </span>\n\n <!-- Right -->\n <span class=\"icon-right\">\n <ng-content select=\"[right]\"></ng-content>\n </span>\n\n </ng-template>\n\n</button>", styles: [".btn{border-radius:6px;font-weight:500;display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;transition:all .2s ease;border:1px solid transparent;white-space:nowrap}.btn:active{transform:scale(.96)}.btn-sm{font-size:12px;padding:6px 10px}.btn-md{font-size:14px;padding:8px 16px}.btn-lg{font-size:16px;padding:10px 20px}.btn-fill.btn-primary{background:#034a46;color:#fff}.btn-fill.btn-danger{background:#dc3545;color:#fff}.btn-fill.btn-success{background:#28a745;color:#fff}.btn-fill.btn-secondary{background:#6c757d;color:#fff}.btn-fill.btn-warning{background:#ffc107;color:#000}.btn-outline.btn-primary{background:transparent;color:#034a46;border:1px solid #034a46}.btn-outline.btn-danger{background:transparent;color:#dc3545;border:1px solid #dc3545}.btn-outline.btn-success{background:transparent;color:#28a745;border:1px solid #28a745}.btn-outline.btn-secondary{background:transparent;color:#6c757d;border:1px solid #6c757d}.btn-outline.btn-warning{background:transparent;color:#ffc107;border:1px solid #ffc107}@media (hover: hover){.btn-fill.btn-primary:hover{background:#02605b}.btn-outline.btn-primary:hover{background:#034a46;color:#fff}.btn-fill.btn-danger:hover{background:#b52a37}.btn-outline.btn-danger:hover{background:#dc3545;color:#fff}.btn-fill.btn-success:hover{background:#218838}.btn-outline.btn-success:hover{background:#28a745;color:#fff}.btn-fill.btn-secondary:hover{background:#5a6268}.btn-outline.btn-secondary:hover{background:#6c757d;color:#fff}.btn-fill.btn-warning:hover{background:#e0a800}.btn-outline.btn-warning:hover{background:#ffc107;color:#000}.btn:hover .icon-left{transform:translate(-3px)}.btn:hover .icon-right{transform:translate(3px)}}.icon-left,.icon-right{display:inline-flex;align-items:center;justify-content:center}.icon-left:empty,.icon-right:empty{display:none}.btn .icon-left,.btn .icon-right{transition:transform .2s ease}.spinner-slot{display:inline-flex;align-items:center;justify-content:center;min-height:16px}.spinner-default{width:16px;height:16px;border:2px solid currentColor;border-top:2px solid transparent;border-radius:50%;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.btn-flex{width:100%}button:disabled{opacity:.6;cursor:not-allowed;pointer-events:none}.btn{min-height:36px}.btn span{display:inline-flex;align-items:center}.icon-left ::ng-deep ion-icon,.icon-right ::ng-deep ion-icon{font-size:18px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
36
|
+
}
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
38
|
+
type: Component,
|
|
39
|
+
args: [{ selector: 'lib-custom-button', standalone: true, imports: [CommonModule], template: "<button\n [class]=\"classes\"\n [disabled]=\"disabled || loading\"\n (click)=\"handleClick()\"\n>\n\n <!-- Loading Slot -->\n <ng-container *ngIf=\"loading; else content\">\n <span class=\"spinner-slot\">\n <ng-content select=\"[loading]\"></ng-content>\n\n <!-- Fallback spinner -->\n <span class=\"spinner-default\" *ngIf=\"!hasCustomLoader\"></span>\n </span>\n </ng-container>\n\n <!-- Normal Content -->\n <ng-template #content>\n\n <!-- Left -->\n <span class=\"icon-left\">\n <ng-content select=\"[left]\"></ng-content>\n </span>\n\n <!-- Label -->\n <span *ngIf=\"label\">\n {{ label }}\n </span>\n\n <!-- Right -->\n <span class=\"icon-right\">\n <ng-content select=\"[right]\"></ng-content>\n </span>\n\n </ng-template>\n\n</button>", styles: [".btn{border-radius:6px;font-weight:500;display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;transition:all .2s ease;border:1px solid transparent;white-space:nowrap}.btn:active{transform:scale(.96)}.btn-sm{font-size:12px;padding:6px 10px}.btn-md{font-size:14px;padding:8px 16px}.btn-lg{font-size:16px;padding:10px 20px}.btn-fill.btn-primary{background:#034a46;color:#fff}.btn-fill.btn-danger{background:#dc3545;color:#fff}.btn-fill.btn-success{background:#28a745;color:#fff}.btn-fill.btn-secondary{background:#6c757d;color:#fff}.btn-fill.btn-warning{background:#ffc107;color:#000}.btn-outline.btn-primary{background:transparent;color:#034a46;border:1px solid #034a46}.btn-outline.btn-danger{background:transparent;color:#dc3545;border:1px solid #dc3545}.btn-outline.btn-success{background:transparent;color:#28a745;border:1px solid #28a745}.btn-outline.btn-secondary{background:transparent;color:#6c757d;border:1px solid #6c757d}.btn-outline.btn-warning{background:transparent;color:#ffc107;border:1px solid #ffc107}@media (hover: hover){.btn-fill.btn-primary:hover{background:#02605b}.btn-outline.btn-primary:hover{background:#034a46;color:#fff}.btn-fill.btn-danger:hover{background:#b52a37}.btn-outline.btn-danger:hover{background:#dc3545;color:#fff}.btn-fill.btn-success:hover{background:#218838}.btn-outline.btn-success:hover{background:#28a745;color:#fff}.btn-fill.btn-secondary:hover{background:#5a6268}.btn-outline.btn-secondary:hover{background:#6c757d;color:#fff}.btn-fill.btn-warning:hover{background:#e0a800}.btn-outline.btn-warning:hover{background:#ffc107;color:#000}.btn:hover .icon-left{transform:translate(-3px)}.btn:hover .icon-right{transform:translate(3px)}}.icon-left,.icon-right{display:inline-flex;align-items:center;justify-content:center}.icon-left:empty,.icon-right:empty{display:none}.btn .icon-left,.btn .icon-right{transition:transform .2s ease}.spinner-slot{display:inline-flex;align-items:center;justify-content:center;min-height:16px}.spinner-default{width:16px;height:16px;border:2px solid currentColor;border-top:2px solid transparent;border-radius:50%;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.btn-flex{width:100%}button:disabled{opacity:.6;cursor:not-allowed;pointer-events:none}.btn{min-height:36px}.btn span{display:inline-flex;align-items:center}.icon-left ::ng-deep ion-icon,.icon-right ::ng-deep ion-icon{font-size:18px}\n"] }]
|
|
40
|
+
}], propDecorators: { label: [{
|
|
41
|
+
type: Input
|
|
42
|
+
}], variant: [{
|
|
43
|
+
type: Input
|
|
44
|
+
}], size: [{
|
|
45
|
+
type: Input
|
|
46
|
+
}], appearance: [{
|
|
47
|
+
type: Input
|
|
48
|
+
}], disabled: [{
|
|
49
|
+
type: Input
|
|
50
|
+
}], loading: [{
|
|
51
|
+
type: Input
|
|
52
|
+
}], fullWidth: [{
|
|
53
|
+
type: Input
|
|
54
|
+
}], btnClick: [{
|
|
55
|
+
type: Output
|
|
56
|
+
}], loaderContent: [{
|
|
57
|
+
type: ContentChild,
|
|
58
|
+
args: ['[loading]', { read: ElementRef }]
|
|
59
|
+
}] } });
|
|
60
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VzdG9tLWJ1dHRvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jdXN0b20tYnV0dG9uL3NyYy9saWIvY3VzdG9tLWJ1dHRvbi9jdXN0b20tYnV0dG9uLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2N1c3RvbS1idXR0b24vc3JjL2xpYi9jdXN0b20tYnV0dG9uL2N1c3RvbS1idXR0b24uY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUVMLFNBQVMsRUFDVCxZQUFZLEVBQ1osVUFBVSxFQUNWLFlBQVksRUFDWixLQUFLLEVBQ0wsTUFBTSxFQUNQLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQzs7O0FBbUIvQyxNQUFNLE9BQU8sZUFBZTtJQVA1QjtRQVNXLFVBQUssR0FBVyxRQUFRLENBQUM7UUFDekIsWUFBTyxHQUFrQixTQUFTLENBQUM7UUFDbkMsU0FBSSxHQUFlLElBQUksQ0FBQztRQUN4QixlQUFVLEdBQXFCLE1BQU0sQ0FBQztRQUV0QyxhQUFRLEdBQVksS0FBSyxDQUFDO1FBQzFCLFlBQU8sR0FBWSxLQUFLLENBQUM7UUFDekIsY0FBUyxHQUFZLEtBQUssQ0FBQztRQUUxQixhQUFRLEdBQUcsSUFBSSxZQUFZLEVB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import { Component } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class CustomButtonComponent {
|
|
4
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CustomButtonComponent, selector: "lib-custom-button", ngImport: i0, template: `
|
|
6
|
+
<p>
|
|
7
|
+
custom-button works!
|
|
8
|
+
</p>
|
|
9
|
+
`, isInline: true }); }
|
|
10
|
+
}
|
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonComponent, decorators: [{
|
|
12
|
+
type: Component,
|
|
13
|
+
args: [{ selector: 'lib-custom-button', template: `
|
|
14
|
+
<p>
|
|
15
|
+
custom-button works!
|
|
16
|
+
</p>
|
|
17
|
+
` }]
|
|
18
|
+
}] });
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VzdG9tLWJ1dHRvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9jdXN0b20tYnV0dG9uL3NyYy9saWIvY3VzdG9tLWJ1dHRvbi5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFZMUMsTUFBTSxPQUFPLHFCQUFxQjsrR0FBckIscUJBQXFCO21HQUFyQixxQkFBcUIseURBUnRCOzs7O0dBSVQ7OzRGQUlVLHFCQUFxQjtrQkFWakMsU0FBUzsrQkFDRSxtQkFBbUIsWUFDbkI7Ozs7R0FJVCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IENvbXBvbmVudCB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5AQ29tcG9uZW50KHtcbiAgc2VsZWN0b3I6ICdsaWItY3VzdG9tLWJ1dHRvbicsXG4gIHRlbXBsYXRlOiBgXG4gICAgPHA+XG4gICAgICBjdXN0b20tYnV0dG9uIHdvcmtzIVxuICAgIDwvcD5cbiAgYCxcbiAgc3R5bGVzOiBbXG4gIF1cbn0pXG5leHBvcnQgY2xhc3MgQ3VzdG9tQnV0dG9uQ29tcG9uZW50IHtcblxufVxuIl19
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CustomButtonComponent } from './custom-button.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class CustomButtonModule {
|
|
5
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
6
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonModule, declarations: [CustomButtonComponent], exports: [CustomButtonComponent] }); }
|
|
7
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonModule }); }
|
|
8
|
+
}
|
|
9
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonModule, decorators: [{
|
|
10
|
+
type: NgModule,
|
|
11
|
+
args: [{
|
|
12
|
+
declarations: [
|
|
13
|
+
CustomButtonComponent
|
|
14
|
+
],
|
|
15
|
+
imports: [],
|
|
16
|
+
exports: [
|
|
17
|
+
CustomButtonComponent
|
|
18
|
+
]
|
|
19
|
+
}]
|
|
20
|
+
}] });
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJz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 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class CustomButtonService {
|
|
4
|
+
constructor() { }
|
|
5
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonService, providedIn: 'root' }); }
|
|
7
|
+
}
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonService, decorators: [{
|
|
9
|
+
type: Injectable,
|
|
10
|
+
args: [{
|
|
11
|
+
providedIn: 'root'
|
|
12
|
+
}]
|
|
13
|
+
}], ctorParameters: function () { return []; } });
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VzdG9tLWJ1dHRvbi5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvY3VzdG9tLWJ1dHRvbi9zcmMvbGliL2N1c3RvbS1idXR0b24uc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDOztBQUszQyxNQUFNLE9BQU8sbUJBQW1CO0lBRTlCLGdCQUFnQixDQUFDOytHQUZOLG1CQUFtQjttSEFBbkIsbUJBQW1CLGNBRmxCLE1BQU07OzRGQUVQLG1CQUFtQjtrQkFIL0IsVUFBVTttQkFBQztvQkFDVixVQUFVLEVBQUUsTUFBTTtpQkFDbkIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBJbmplY3RhYmxlIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5cbkBJbmplY3RhYmxlKHtcbiAgcHJvdmlkZWRJbjogJ3Jvb3QnXG59KVxuZXhwb3J0IGNsYXNzIEN1c3RvbUJ1dHRvblNlcnZpY2Uge1xuXG4gIGNvbnN0cnVjdG9yKCkgeyB9XG59XG4iXX0=
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of custom-button
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/custom-button.service';
|
|
5
|
+
export * from './lib/custom-button.component';
|
|
6
|
+
export * from './lib/custom-button.module';
|
|
7
|
+
export * from './lib/custom-button/custom-button.component';
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2N1c3RvbS1idXR0b24vc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLDZCQUE2QixDQUFDO0FBQzVDLGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYyw0QkFBNEIsQ0FBQztBQUMzQyxjQUFjLDZDQUE2QyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBjdXN0b20tYnV0dG9uXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvY3VzdG9tLWJ1dHRvbi5zZXJ2aWNlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2N1c3RvbS1idXR0b24uY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2N1c3RvbS1idXR0b24ubW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2N1c3RvbS1idXR0b24vY3VzdG9tLWJ1dHRvbi5jb21wb25lbnQnOyJdfQ==
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, NgModule, EventEmitter, ElementRef, Input, Output, ContentChild } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
class CustomButtonService {
|
|
7
|
+
constructor() { }
|
|
8
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonService, providedIn: 'root' }); }
|
|
10
|
+
}
|
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonService, decorators: [{
|
|
12
|
+
type: Injectable,
|
|
13
|
+
args: [{
|
|
14
|
+
providedIn: 'root'
|
|
15
|
+
}]
|
|
16
|
+
}], ctorParameters: function () { return []; } });
|
|
17
|
+
|
|
18
|
+
class CustomButtonComponent {
|
|
19
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
20
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CustomButtonComponent, selector: "lib-custom-button", ngImport: i0, template: `
|
|
21
|
+
<p>
|
|
22
|
+
custom-button works!
|
|
23
|
+
</p>
|
|
24
|
+
`, isInline: true }); }
|
|
25
|
+
}
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonComponent, decorators: [{
|
|
27
|
+
type: Component,
|
|
28
|
+
args: [{ selector: 'lib-custom-button', template: `
|
|
29
|
+
<p>
|
|
30
|
+
custom-button works!
|
|
31
|
+
</p>
|
|
32
|
+
` }]
|
|
33
|
+
}] });
|
|
34
|
+
|
|
35
|
+
class CustomButtonModule {
|
|
36
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
37
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonModule, declarations: [CustomButtonComponent], exports: [CustomButtonComponent] }); }
|
|
38
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonModule }); }
|
|
39
|
+
}
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomButtonModule, decorators: [{
|
|
41
|
+
type: NgModule,
|
|
42
|
+
args: [{
|
|
43
|
+
declarations: [
|
|
44
|
+
CustomButtonComponent
|
|
45
|
+
],
|
|
46
|
+
imports: [],
|
|
47
|
+
exports: [
|
|
48
|
+
CustomButtonComponent
|
|
49
|
+
]
|
|
50
|
+
}]
|
|
51
|
+
}] });
|
|
52
|
+
|
|
53
|
+
class ButtonComponent {
|
|
54
|
+
constructor() {
|
|
55
|
+
this.label = 'Button';
|
|
56
|
+
this.variant = 'primary';
|
|
57
|
+
this.size = 'md';
|
|
58
|
+
this.appearance = 'fill';
|
|
59
|
+
this.disabled = false;
|
|
60
|
+
this.loading = false;
|
|
61
|
+
this.fullWidth = false;
|
|
62
|
+
this.btnClick = new EventEmitter();
|
|
63
|
+
this.hasCustomLoader = false;
|
|
64
|
+
}
|
|
65
|
+
ngAfterContentInit() {
|
|
66
|
+
this.hasCustomLoader = !!this.loaderContent;
|
|
67
|
+
}
|
|
68
|
+
handleClick() {
|
|
69
|
+
if (this.disabled || this.loading)
|
|
70
|
+
return;
|
|
71
|
+
this.btnClick.emit();
|
|
72
|
+
}
|
|
73
|
+
get classes() {
|
|
74
|
+
return [
|
|
75
|
+
'btn',
|
|
76
|
+
`btn-${this.variant}`,
|
|
77
|
+
`btn-${this.appearance}`,
|
|
78
|
+
`btn-${this.size}`,
|
|
79
|
+
this.fullWidth ? 'btn-flex' : ''
|
|
80
|
+
].join(' ');
|
|
81
|
+
}
|
|
82
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
83
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ButtonComponent, isStandalone: true, selector: "lib-custom-button", inputs: { label: "label", variant: "variant", size: "size", appearance: "appearance", disabled: "disabled", loading: "loading", fullWidth: "fullWidth" }, outputs: { btnClick: "btnClick" }, queries: [{ propertyName: "loaderContent", first: true, predicate: ["[loading]"], descendants: true, read: ElementRef }], ngImport: i0, template: "<button\n [class]=\"classes\"\n [disabled]=\"disabled || loading\"\n (click)=\"handleClick()\"\n>\n\n <!-- Loading Slot -->\n <ng-container *ngIf=\"loading; else content\">\n <span class=\"spinner-slot\">\n <ng-content select=\"[loading]\"></ng-content>\n\n <!-- Fallback spinner -->\n <span class=\"spinner-default\" *ngIf=\"!hasCustomLoader\"></span>\n </span>\n </ng-container>\n\n <!-- Normal Content -->\n <ng-template #content>\n\n <!-- Left -->\n <span class=\"icon-left\">\n <ng-content select=\"[left]\"></ng-content>\n </span>\n\n <!-- Label -->\n <span *ngIf=\"label\">\n {{ label }}\n </span>\n\n <!-- Right -->\n <span class=\"icon-right\">\n <ng-content select=\"[right]\"></ng-content>\n </span>\n\n </ng-template>\n\n</button>", styles: [".btn{border-radius:6px;font-weight:500;display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;transition:all .2s ease;border:1px solid transparent;white-space:nowrap}.btn:active{transform:scale(.96)}.btn-sm{font-size:12px;padding:6px 10px}.btn-md{font-size:14px;padding:8px 16px}.btn-lg{font-size:16px;padding:10px 20px}.btn-fill.btn-primary{background:#034a46;color:#fff}.btn-fill.btn-danger{background:#dc3545;color:#fff}.btn-fill.btn-success{background:#28a745;color:#fff}.btn-fill.btn-secondary{background:#6c757d;color:#fff}.btn-fill.btn-warning{background:#ffc107;color:#000}.btn-outline.btn-primary{background:transparent;color:#034a46;border:1px solid #034a46}.btn-outline.btn-danger{background:transparent;color:#dc3545;border:1px solid #dc3545}.btn-outline.btn-success{background:transparent;color:#28a745;border:1px solid #28a745}.btn-outline.btn-secondary{background:transparent;color:#6c757d;border:1px solid #6c757d}.btn-outline.btn-warning{background:transparent;color:#ffc107;border:1px solid #ffc107}@media (hover: hover){.btn-fill.btn-primary:hover{background:#02605b}.btn-outline.btn-primary:hover{background:#034a46;color:#fff}.btn-fill.btn-danger:hover{background:#b52a37}.btn-outline.btn-danger:hover{background:#dc3545;color:#fff}.btn-fill.btn-success:hover{background:#218838}.btn-outline.btn-success:hover{background:#28a745;color:#fff}.btn-fill.btn-secondary:hover{background:#5a6268}.btn-outline.btn-secondary:hover{background:#6c757d;color:#fff}.btn-fill.btn-warning:hover{background:#e0a800}.btn-outline.btn-warning:hover{background:#ffc107;color:#000}.btn:hover .icon-left{transform:translate(-3px)}.btn:hover .icon-right{transform:translate(3px)}}.icon-left,.icon-right{display:inline-flex;align-items:center;justify-content:center}.icon-left:empty,.icon-right:empty{display:none}.btn .icon-left,.btn .icon-right{transition:transform .2s ease}.spinner-slot{display:inline-flex;align-items:center;justify-content:center;min-height:16px}.spinner-default{width:16px;height:16px;border:2px solid currentColor;border-top:2px solid transparent;border-radius:50%;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.btn-flex{width:100%}button:disabled{opacity:.6;cursor:not-allowed;pointer-events:none}.btn{min-height:36px}.btn span{display:inline-flex;align-items:center}.icon-left ::ng-deep ion-icon,.icon-right ::ng-deep ion-icon{font-size:18px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
84
|
+
}
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
86
|
+
type: Component,
|
|
87
|
+
args: [{ selector: 'lib-custom-button', standalone: true, imports: [CommonModule], template: "<button\n [class]=\"classes\"\n [disabled]=\"disabled || loading\"\n (click)=\"handleClick()\"\n>\n\n <!-- Loading Slot -->\n <ng-container *ngIf=\"loading; else content\">\n <span class=\"spinner-slot\">\n <ng-content select=\"[loading]\"></ng-content>\n\n <!-- Fallback spinner -->\n <span class=\"spinner-default\" *ngIf=\"!hasCustomLoader\"></span>\n </span>\n </ng-container>\n\n <!-- Normal Content -->\n <ng-template #content>\n\n <!-- Left -->\n <span class=\"icon-left\">\n <ng-content select=\"[left]\"></ng-content>\n </span>\n\n <!-- Label -->\n <span *ngIf=\"label\">\n {{ label }}\n </span>\n\n <!-- Right -->\n <span class=\"icon-right\">\n <ng-content select=\"[right]\"></ng-content>\n </span>\n\n </ng-template>\n\n</button>", styles: [".btn{border-radius:6px;font-weight:500;display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;transition:all .2s ease;border:1px solid transparent;white-space:nowrap}.btn:active{transform:scale(.96)}.btn-sm{font-size:12px;padding:6px 10px}.btn-md{font-size:14px;padding:8px 16px}.btn-lg{font-size:16px;padding:10px 20px}.btn-fill.btn-primary{background:#034a46;color:#fff}.btn-fill.btn-danger{background:#dc3545;color:#fff}.btn-fill.btn-success{background:#28a745;color:#fff}.btn-fill.btn-secondary{background:#6c757d;color:#fff}.btn-fill.btn-warning{background:#ffc107;color:#000}.btn-outline.btn-primary{background:transparent;color:#034a46;border:1px solid #034a46}.btn-outline.btn-danger{background:transparent;color:#dc3545;border:1px solid #dc3545}.btn-outline.btn-success{background:transparent;color:#28a745;border:1px solid #28a745}.btn-outline.btn-secondary{background:transparent;color:#6c757d;border:1px solid #6c757d}.btn-outline.btn-warning{background:transparent;color:#ffc107;border:1px solid #ffc107}@media (hover: hover){.btn-fill.btn-primary:hover{background:#02605b}.btn-outline.btn-primary:hover{background:#034a46;color:#fff}.btn-fill.btn-danger:hover{background:#b52a37}.btn-outline.btn-danger:hover{background:#dc3545;color:#fff}.btn-fill.btn-success:hover{background:#218838}.btn-outline.btn-success:hover{background:#28a745;color:#fff}.btn-fill.btn-secondary:hover{background:#5a6268}.btn-outline.btn-secondary:hover{background:#6c757d;color:#fff}.btn-fill.btn-warning:hover{background:#e0a800}.btn-outline.btn-warning:hover{background:#ffc107;color:#000}.btn:hover .icon-left{transform:translate(-3px)}.btn:hover .icon-right{transform:translate(3px)}}.icon-left,.icon-right{display:inline-flex;align-items:center;justify-content:center}.icon-left:empty,.icon-right:empty{display:none}.btn .icon-left,.btn .icon-right{transition:transform .2s ease}.spinner-slot{display:inline-flex;align-items:center;justify-content:center;min-height:16px}.spinner-default{width:16px;height:16px;border:2px solid currentColor;border-top:2px solid transparent;border-radius:50%;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.btn-flex{width:100%}button:disabled{opacity:.6;cursor:not-allowed;pointer-events:none}.btn{min-height:36px}.btn span{display:inline-flex;align-items:center}.icon-left ::ng-deep ion-icon,.icon-right ::ng-deep ion-icon{font-size:18px}\n"] }]
|
|
88
|
+
}], propDecorators: { label: [{
|
|
89
|
+
type: Input
|
|
90
|
+
}], variant: [{
|
|
91
|
+
type: Input
|
|
92
|
+
}], size: [{
|
|
93
|
+
type: Input
|
|
94
|
+
}], appearance: [{
|
|
95
|
+
type: Input
|
|
96
|
+
}], disabled: [{
|
|
97
|
+
type: Input
|
|
98
|
+
}], loading: [{
|
|
99
|
+
type: Input
|
|
100
|
+
}], fullWidth: [{
|
|
101
|
+
type: Input
|
|
102
|
+
}], btnClick: [{
|
|
103
|
+
type: Output
|
|
104
|
+
}], loaderContent: [{
|
|
105
|
+
type: ContentChild,
|
|
106
|
+
args: ['[loading]', { read: ElementRef }]
|
|
107
|
+
}] } });
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
* Public API Surface of custom-button
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Generated bundle index. Do not edit.
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
export { ButtonComponent, CustomButtonComponent, CustomButtonModule, CustomButtonService };
|
|
118
|
+
//# sourceMappingURL=custom-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-button.mjs","sources":["../../../projects/custom-button/src/lib/custom-button.service.ts","../../../projects/custom-button/src/lib/custom-button.component.ts","../../../projects/custom-button/src/lib/custom-button.module.ts","../../../projects/custom-button/src/lib/custom-button/custom-button.component.ts","../../../projects/custom-button/src/lib/custom-button/custom-button.component.html","../../../projects/custom-button/src/public-api.ts","../../../projects/custom-button/src/custom-button.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class CustomButtonService {\n\n constructor() { }\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'lib-custom-button',\n template: `\n <p>\n custom-button works!\n </p>\n `,\n styles: [\n ]\n})\nexport class CustomButtonComponent {\n\n}\n","import { NgModule } from '@angular/core';\nimport { CustomButtonComponent } from './custom-button.component';\n\n\n\n@NgModule({\n declarations: [\n CustomButtonComponent\n ],\n imports: [\n ],\n exports: [\n CustomButtonComponent\n ]\n})\nexport class CustomButtonModule { }\n","\nimport {\n AfterContentInit,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n Input,\n Output\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'danger'\n | 'success'\n | 'warning';\n\nexport type ButtonSize = 'sm' | 'md' | 'lg';\nexport type ButtonAppearance = 'fill' | 'outline';\n\n@Component({\n selector: 'lib-custom-button',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './custom-button.component.html',\n styleUrls: ['./custom-button.component.scss']\n})\nexport class ButtonComponent implements AfterContentInit {\n\n @Input() label: string = 'Button';\n @Input() variant: ButtonVariant = 'primary';\n @Input() size: ButtonSize = 'md';\n @Input() appearance: ButtonAppearance = 'fill';\n\n @Input() disabled: boolean = false;\n @Input() loading: boolean = false;\n @Input() fullWidth: boolean = false;\n\n @Output() btnClick = new EventEmitter<void>();\n\n @ContentChild('[loading]', { read: ElementRef })\n loaderContent!: ElementRef;\n\n hasCustomLoader = false;\n\n ngAfterContentInit(): void {\n this.hasCustomLoader = !!this.loaderContent;\n }\n\n handleClick(): void {\n if (this.disabled || this.loading) return;\n this.btnClick.emit();\n }\n\n get classes(): string {\n return [\n 'btn',\n `btn-${this.variant}`,\n `btn-${this.appearance}`,\n `btn-${this.size}`,\n this.fullWidth ? 'btn-flex' : ''\n ].join(' ');\n }\n}","<button\n [class]=\"classes\"\n [disabled]=\"disabled || loading\"\n (click)=\"handleClick()\"\n>\n\n <!-- Loading Slot -->\n <ng-container *ngIf=\"loading; else content\">\n <span class=\"spinner-slot\">\n <ng-content select=\"[loading]\"></ng-content>\n\n <!-- Fallback spinner -->\n <span class=\"spinner-default\" *ngIf=\"!hasCustomLoader\"></span>\n </span>\n </ng-container>\n\n <!-- Normal Content -->\n <ng-template #content>\n\n <!-- Left -->\n <span class=\"icon-left\">\n <ng-content select=\"[left]\"></ng-content>\n </span>\n\n <!-- Label -->\n <span *ngIf=\"label\">\n {{ label }}\n </span>\n\n <!-- Right -->\n <span class=\"icon-right\">\n <ng-content select=\"[right]\"></ng-content>\n </span>\n\n </ng-template>\n\n</button>","/*\n * Public API Surface of custom-button\n */\n\nexport * from './lib/custom-button.service';\nexport * from './lib/custom-button.component';\nexport * from './lib/custom-button.module';\nexport * from './lib/custom-button/custom-button.component';","/**\n * Generated bundle index. Do not edit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EAAA,CAAA;kBAP3B,SAAS;AACC,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,EAChB,UAAA,EAAA,IAAI,EACP,OAAA,EAAA,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,gzBAAA,EAAA,MAAA,EAAA,CAAA,k4EAAA,CAAA,EAAA,CAAA;8BAMd,KAAK,EAAA,CAAA;sBAAb,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,IAAI,EAAA,CAAA;sBAAZ,KAAK;gBACG,UAAU,EAAA,CAAA;sBAAlB,KAAK;gBAEG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,SAAS,EAAA,CAAA;sBAAjB,KAAK;gBAEI,QAAQ,EAAA,CAAA;sBAAjB,MAAM;gBAGP,aAAa,EAAA,CAAA;sBADZ,YAAY;AAAC,gBAAA,IAAA,EAAA,CAAA,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;;;AE1CjD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AfterContentInit, ElementRef, EventEmitter } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'success' | 'warning';
|
|
4
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export type ButtonAppearance = 'fill' | 'outline';
|
|
6
|
+
export declare class ButtonComponent implements AfterContentInit {
|
|
7
|
+
label: string;
|
|
8
|
+
variant: ButtonVariant;
|
|
9
|
+
size: ButtonSize;
|
|
10
|
+
appearance: ButtonAppearance;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
fullWidth: boolean;
|
|
14
|
+
btnClick: EventEmitter<void>;
|
|
15
|
+
loaderContent: ElementRef;
|
|
16
|
+
hasCustomLoader: boolean;
|
|
17
|
+
ngAfterContentInit(): void;
|
|
18
|
+
handleClick(): void;
|
|
19
|
+
get classes(): string;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ButtonComponent, never>;
|
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ButtonComponent, "lib-custom-button", never, { "label": { "alias": "label"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; }, { "btnClick": "btnClick"; }, ["loaderContent"], ["[loading]", "[left]", "[right]"], true, never>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class CustomButtonComponent {
|
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CustomButtonComponent, never>;
|
|
4
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CustomButtonComponent, "lib-custom-button", never, {}, {}, never, never, false, never>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./custom-button.component";
|
|
3
|
+
export declare class CustomButtonModule {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CustomButtonModule, never>;
|
|
5
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<CustomButtonModule, [typeof i1.CustomButtonComponent], never, [typeof i1.CustomButtonComponent]>;
|
|
6
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<CustomButtonModule>;
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@naveenkumarp/custom-button",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^16.2.0",
|
|
6
|
+
"@angular/core": "^16.2.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/custom-button.mjs",
|
|
13
|
+
"typings": "index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"esm2022": "./esm2022/custom-button.mjs",
|
|
21
|
+
"esm": "./esm2022/custom-button.mjs",
|
|
22
|
+
"default": "./fesm2022/custom-button.mjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/public-api.d.ts
ADDED