sn-spinner-x 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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/sn-spinner",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "sn-spinner-x",
3
+ "version": "0.0.1",
4
+ "description": "SnSpinner is an Angular 21 standalone loading spinner component",
5
+ "author": {
6
+ "name": "Swapnil Nakate",
7
+ "email": "nakate.swapnil7@gmail.com",
8
+ "url": "https://swapnilnakate.in"
9
+ },
10
+ "peerDependencies": {
11
+ "@angular/common": "^21.0.0",
12
+ "@angular/core": "^21.0.0"
13
+ },
14
+ "dependencies": {
15
+ "tslib": "^2.3.0"
16
+ },
17
+ "sideEffects": false,
18
+ "bugs": {
19
+ "url": "https://github.com/swapnilnakate7/sn-ui/issues",
20
+ "email": "nakate.swapnil7@gmail.com"
21
+ },
22
+ "repository": {
23
+ "url": "https://github.com/swapnilnakate7/sn-ui",
24
+ "type": "git",
25
+ "directory": "projects/sn-spinner"
26
+ },
27
+ "license": "MIT"
28
+ }
@@ -0,0 +1,33 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { SnSpinnerXComponent } from './sn-spinner-x.component';
3
+
4
+ describe('SnSpinnerXComponent', () => {
5
+ let component: SnSpinnerXComponent;
6
+ let fixture: ComponentFixture<SnSpinnerXComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SnSpinnerXComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(SnSpinnerXComponent);
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 "primary"', () => {
23
+ expect(component.scheme).toBe('primary');
24
+ });
25
+
26
+ it('should default size to "md"', () => {
27
+ expect(component.size).toBe('md');
28
+ });
29
+
30
+ it('should default label to "Loading..."', () => {
31
+ expect(component.label).toBe('Loading...');
32
+ });
33
+ });
@@ -0,0 +1,23 @@
1
+ import { Component, Input } from '@angular/core';
2
+ import { CommonModule, NgClass } from '@angular/common';
3
+
4
+ @Component({
5
+ selector: 'sn-spinner-x',
6
+ standalone: true,
7
+ imports: [CommonModule, NgClass],
8
+ templateUrl: './sn-spinner-x.html',
9
+ styleUrl: 'sn-spinner-x.scss',
10
+ })
11
+ export class SnSpinnerXComponent {
12
+ @Input() scheme: string = 'primary';
13
+ @Input() size: string = 'md';
14
+ @Input() label: string = 'Loading...';
15
+
16
+ get classes(): Record<string, boolean> {
17
+ return {
18
+ 'sn-spinner': true,
19
+ [`scheme-${this.scheme}`]: true,
20
+ [`size-${this.size}`]: true,
21
+ };
22
+ }
23
+ }
@@ -0,0 +1,3 @@
1
+ <span [ngClass]="classes" role="status" [attr.aria-label]="label">
2
+ <span class="sr-only">{{ label }}</span>
3
+ </span>
@@ -0,0 +1,51 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @keyframes sn-spin {
6
+ to { transform: rotate(360deg); }
7
+ }
8
+
9
+ .sn-spinner {
10
+ display: inline-block;
11
+ border-style: solid;
12
+ border-radius: 50%;
13
+ animation: sn-spin 0.75s linear infinite;
14
+
15
+ &.size-sm { width: 1rem; height: 1rem; border-width: 2px; }
16
+ &.size-md { width: 1.5rem; height: 1.5rem; border-width: 3px; }
17
+ &.size-lg { width: 2.5rem; height: 2.5rem; border-width: 4px; }
18
+
19
+ &.scheme-primary {
20
+ border-color: #3b82f6;
21
+ border-top-color: transparent;
22
+ }
23
+ &.scheme-warn {
24
+ border-color: #f59e0b;
25
+ border-top-color: transparent;
26
+ }
27
+ &.scheme-danger {
28
+ border-color: #ef4444;
29
+ border-top-color: transparent;
30
+ }
31
+ &.scheme-success {
32
+ border-color: #22c55e;
33
+ border-top-color: transparent;
34
+ }
35
+ &.scheme-default {
36
+ border-color: #6b7280;
37
+ border-top-color: transparent;
38
+ }
39
+
40
+ .sr-only {
41
+ position: absolute;
42
+ width: 1px;
43
+ height: 1px;
44
+ padding: 0;
45
+ margin: -1px;
46
+ overflow: hidden;
47
+ clip: rect(0, 0, 0, 0);
48
+ white-space: nowrap;
49
+ border-width: 0;
50
+ }
51
+ }
@@ -0,0 +1 @@
1
+ export * from './lib/sn-spinner-x.component';
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/lib",
5
+ "declaration": true,
6
+ "declarationMap": true,
7
+ "inlineSources": true,
8
+ "types": []
9
+ },
10
+ "exclude": ["**/*.spec.ts"]
11
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "declarationMap": false
5
+ },
6
+ "angularCompilerOptions": {
7
+ "compilationMode": "partial"
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/spec",
5
+ "types": ["jasmine"]
6
+ },
7
+ "include": ["**/*.spec.ts", "**/*.d.ts"]
8
+ }