sn-badge 0.0.1 → 0.0.2
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/sn-badge.mjs +40 -0
- package/fesm2022/sn-badge.mjs.map +1 -0
- package/package.json +14 -3
- package/types/sn-badge.d.ts +13 -0
- package/ng-package.json +0 -7
- package/src/lib/sn-badge.component.spec.ts +0 -33
- package/src/lib/sn-badge.component.ts +0 -24
- package/src/lib/sn-badge.html +0 -3
- package/src/lib/sn-badge.scss +0 -20
- package/src/public-api.ts +0 -1
- package/tsconfig.lib.json +0 -11
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -8
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { booleanAttribute, Input, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule, NgClass } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
class SnBadgeComponent {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.scheme = 'default';
|
|
9
|
+
this.pill = false;
|
|
10
|
+
this.size = 'md';
|
|
11
|
+
}
|
|
12
|
+
get classes() {
|
|
13
|
+
return {
|
|
14
|
+
'sn-badge': true,
|
|
15
|
+
[`scheme-${this.scheme}`]: true,
|
|
16
|
+
[`size-${this.size}`]: true,
|
|
17
|
+
'pill': this.pill,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SnBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
21
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "21.2.0", type: SnBadgeComponent, isStandalone: true, selector: "sn-badge", inputs: { scheme: "scheme", pill: ["pill", "pill", booleanAttribute], size: "size" }, ngImport: i0, template: "<span [ngClass]=\"classes\">\n <ng-content></ng-content>\n</span>\n", styles: ["@tailwind base;@tailwind components;@tailwind utilities;.sn-badge{@apply inline-flex items-center font-medium leading-none;}.sn-badge.size-sm{@apply px-2 py-0.5 text-xs;}.sn-badge.size-md{@apply px-2.5 py-1 text-sm;}.sn-badge.size-lg{@apply px-3 py-1.5 text-base;}.sn-badge.pill{@apply rounded-full;}.sn-badge:not(.pill){@apply rounded;}.sn-badge.scheme-default{@apply bg-gray-100 text-gray-800;}.sn-badge.scheme-primary{@apply bg-blue-100 text-blue-800;}.sn-badge.scheme-warn{@apply bg-yellow-100 text-yellow-800;}.sn-badge.scheme-danger{@apply bg-red-100 text-red-800;}.sn-badge.scheme-success{@apply bg-green-100 text-green-800;}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
22
|
+
}
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SnBadgeComponent, decorators: [{
|
|
24
|
+
type: Component,
|
|
25
|
+
args: [{ selector: 'sn-badge', standalone: true, imports: [CommonModule, NgClass], template: "<span [ngClass]=\"classes\">\n <ng-content></ng-content>\n</span>\n", styles: ["@tailwind base;@tailwind components;@tailwind utilities;.sn-badge{@apply inline-flex items-center font-medium leading-none;}.sn-badge.size-sm{@apply px-2 py-0.5 text-xs;}.sn-badge.size-md{@apply px-2.5 py-1 text-sm;}.sn-badge.size-lg{@apply px-3 py-1.5 text-base;}.sn-badge.pill{@apply rounded-full;}.sn-badge:not(.pill){@apply rounded;}.sn-badge.scheme-default{@apply bg-gray-100 text-gray-800;}.sn-badge.scheme-primary{@apply bg-blue-100 text-blue-800;}.sn-badge.scheme-warn{@apply bg-yellow-100 text-yellow-800;}.sn-badge.scheme-danger{@apply bg-red-100 text-red-800;}.sn-badge.scheme-success{@apply bg-green-100 text-green-800;}\n"] }]
|
|
26
|
+
}], propDecorators: { scheme: [{
|
|
27
|
+
type: Input
|
|
28
|
+
}], pill: [{
|
|
29
|
+
type: Input,
|
|
30
|
+
args: [{ transform: booleanAttribute }]
|
|
31
|
+
}], size: [{
|
|
32
|
+
type: Input
|
|
33
|
+
}] } });
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Generated bundle index. Do not edit.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
export { SnBadgeComponent };
|
|
40
|
+
//# sourceMappingURL=sn-badge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-badge.mjs","sources":["../../../projects/sn-badge/src/lib/sn-badge.component.ts","../../../projects/sn-badge/src/lib/sn-badge.html","../../../projects/sn-badge/src/sn-badge.ts"],"sourcesContent":["import { Component, Input, booleanAttribute } from '@angular/core';\nimport { CommonModule, NgClass } from '@angular/common';\n\n@Component({\n selector: 'sn-badge',\n standalone: true,\n imports: [CommonModule, NgClass],\n templateUrl: './sn-badge.html',\n styleUrl: 'sn-badge.scss',\n})\nexport class SnBadgeComponent {\n @Input() scheme: string = 'default';\n @Input({ transform: booleanAttribute }) pill: boolean = false;\n @Input() size: string = 'md';\n\n get classes(): Record<string, boolean> {\n return {\n 'sn-badge': true,\n [`scheme-${this.scheme}`]: true,\n [`size-${this.size}`]: true,\n 'pill': this.pill,\n };\n }\n}\n","<span [ngClass]=\"classes\">\n <ng-content></ng-content>\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAUa,gBAAgB,CAAA;AAP7B,IAAA,WAAA,GAAA;QAQW,IAAA,CAAA,MAAM,GAAW,SAAS;QACK,IAAA,CAAA,IAAI,GAAY,KAAK;QACpD,IAAA,CAAA,IAAI,GAAW,IAAI;AAU7B,IAAA;AARC,IAAA,IAAI,OAAO,GAAA;QACT,OAAO;AACL,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,CAAC,UAAU,IAAI,CAAC,MAAM,CAAA,CAA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0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "SnBadge is an Angular 21 standalone badge/pill component",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Swapnil Nakate",
|
|
@@ -24,5 +24,16 @@
|
|
|
24
24
|
"type": "git",
|
|
25
25
|
"directory": "projects/sn-badge"
|
|
26
26
|
},
|
|
27
|
-
"license": "MIT"
|
|
28
|
-
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"module": "fesm2022/sn-badge.mjs",
|
|
29
|
+
"typings": "types/sn-badge.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
"./package.json": {
|
|
32
|
+
"default": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./types/sn-badge.d.ts",
|
|
36
|
+
"default": "./fesm2022/sn-badge.mjs"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
|
|
3
|
+
declare class SnBadgeComponent {
|
|
4
|
+
scheme: string;
|
|
5
|
+
pill: boolean;
|
|
6
|
+
size: string;
|
|
7
|
+
get classes(): Record<string, boolean>;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SnBadgeComponent, never>;
|
|
9
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SnBadgeComponent, "sn-badge", never, { "scheme": { "alias": "scheme"; "required": false; }; "pill": { "alias": "pill"; "required": false; }; "size": { "alias": "size"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
10
|
+
static ngAcceptInputType_pill: unknown;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { SnBadgeComponent };
|
package/ng-package.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { SnBadgeComponent } from './sn-badge.component';
|
|
3
|
-
|
|
4
|
-
describe('SnBadgeComponent', () => {
|
|
5
|
-
let component: SnBadgeComponent;
|
|
6
|
-
let fixture: ComponentFixture<SnBadgeComponent>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [SnBadgeComponent],
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(SnBadgeComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should default scheme to "default"', () => {
|
|
23
|
-
expect(component.scheme).toBe('default');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should default size to "md"', () => {
|
|
27
|
-
expect(component.size).toBe('md');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should default pill to false', () => {
|
|
31
|
-
expect(component.pill).toBeFalse();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Component, Input, booleanAttribute } from '@angular/core';
|
|
2
|
-
import { CommonModule, NgClass } from '@angular/common';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'sn-badge',
|
|
6
|
-
standalone: true,
|
|
7
|
-
imports: [CommonModule, NgClass],
|
|
8
|
-
templateUrl: './sn-badge.html',
|
|
9
|
-
styleUrl: 'sn-badge.scss',
|
|
10
|
-
})
|
|
11
|
-
export class SnBadgeComponent {
|
|
12
|
-
@Input() scheme: string = 'default';
|
|
13
|
-
@Input({ transform: booleanAttribute }) pill: boolean = false;
|
|
14
|
-
@Input() size: string = 'md';
|
|
15
|
-
|
|
16
|
-
get classes(): Record<string, boolean> {
|
|
17
|
-
return {
|
|
18
|
-
'sn-badge': true,
|
|
19
|
-
[`scheme-${this.scheme}`]: true,
|
|
20
|
-
[`size-${this.size}`]: true,
|
|
21
|
-
'pill': this.pill,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/lib/sn-badge.html
DELETED
package/src/lib/sn-badge.scss
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
@tailwind base;
|
|
2
|
-
@tailwind components;
|
|
3
|
-
@tailwind utilities;
|
|
4
|
-
|
|
5
|
-
.sn-badge {
|
|
6
|
-
@apply inline-flex items-center font-medium leading-none;
|
|
7
|
-
|
|
8
|
-
&.size-sm { @apply px-2 py-0.5 text-xs; }
|
|
9
|
-
&.size-md { @apply px-2.5 py-1 text-sm; }
|
|
10
|
-
&.size-lg { @apply px-3 py-1.5 text-base; }
|
|
11
|
-
|
|
12
|
-
&.pill { @apply rounded-full; }
|
|
13
|
-
&:not(.pill) { @apply rounded; }
|
|
14
|
-
|
|
15
|
-
&.scheme-default { @apply bg-gray-100 text-gray-800; }
|
|
16
|
-
&.scheme-primary { @apply bg-blue-100 text-blue-800; }
|
|
17
|
-
&.scheme-warn { @apply bg-yellow-100 text-yellow-800; }
|
|
18
|
-
&.scheme-danger { @apply bg-red-100 text-red-800; }
|
|
19
|
-
&.scheme-success { @apply bg-green-100 text-green-800; }
|
|
20
|
-
}
|
package/src/public-api.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib/sn-badge.component';
|
package/tsconfig.lib.json
DELETED
package/tsconfig.lib.prod.json
DELETED