ngwr 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/button/button.component.ts +132 -0
- package/button/button.module.ts +11 -0
- package/button/index.ts +2 -0
- package/core/types/convert-input.ts +2 -0
- package/core/types/index.ts +3 -0
- package/core/types/indexable.ts +3 -0
- package/core/types/ng-class.ts +11 -0
- package/core/util/convert.ts +63 -0
- package/core/util/index.ts +1 -0
- package/divider/divider.component.ts +13 -0
- package/divider/divider.module.ts +10 -0
- package/divider/index.ts +2 -0
- package/extended-input/extended-input.component.html +13 -0
- package/extended-input/extended-input.component.ts +77 -0
- package/extended-input/extended-input.module.ts +17 -0
- package/extended-input/index.ts +2 -0
- package/form/form-error.component.ts +20 -0
- package/form/form-item.component.ts +60 -0
- package/form/form.module.ts +17 -0
- package/form/index.ts +3 -0
- package/icon/icon.component.ts +45 -0
- package/icon/icons.ts +229 -0
- package/icon/index.ts +3 -0
- package/icon/walrus-icons-registry.service.ts +20 -0
- package/icon/walrus-icons.module.ts +8 -0
- package/index.ts +1 -0
- package/input/index.ts +2 -0
- package/input/input.directive.ts +65 -0
- package/input/input.module.ts +16 -0
- package/ng-package.json +11 -0
- package/package.json +27 -0
- package/password-input/index.ts +2 -0
- package/password-input/password-input.component.html +10 -0
- package/password-input/password-input.component.ts +56 -0
- package/password-input/password-input.module.ts +28 -0
- package/public-api.ts +10 -0
- package/skeleton/index.ts +2 -0
- package/skeleton/skeleton.component.ts +38 -0
- package/skeleton/skeleton.module.ts +11 -0
- package/spinner/index.ts +2 -0
- package/spinner/spinner.component.ts +11 -0
- package/spinner/spinner.module.ts +10 -0
- package/styles/components/_index.scss +15 -0
- package/styles/components/alert.scss +28 -0
- package/styles/components/button.scss +115 -0
- package/styles/components/card.scss +41 -0
- package/styles/components/divider.scss +19 -0
- package/styles/components/dropdown.scss +128 -0
- package/styles/components/extended-input.scss +64 -0
- package/styles/components/form.scss +85 -0
- package/styles/components/heading.scss +25 -0
- package/styles/components/icon.scss +32 -0
- package/styles/components/input.scss +43 -0
- package/styles/components/password-input.scss +31 -0
- package/styles/components/skeleton.scss +58 -0
- package/styles/components/spinner.scss +44 -0
- package/styles/components/tag.scss +70 -0
- package/styles/components/tooltip.scss +60 -0
- package/styles/functions.scss +184 -0
- package/styles/grid.scss +177 -0
- package/styles/index.scss +165 -0
- package/styles/mixins/_index.scss +22 -0
- package/styles/mixins/alert.scss +7 -0
- package/styles/mixins/button.scss +56 -0
- package/styles/mixins/reset-component.scss +13 -0
- package/styles/mixins/tag.scss +68 -0
- package/styles/reset.scss +104 -0
- package/styles/root.scss +31 -0
- package/styles/vars.scss +1075 -0
- package/tag/index.ts +2 -0
- package/tag/tag.component.ts +92 -0
- package/tag/tag.module.ts +11 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
package/tag/index.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
ElementRef,
|
|
5
|
+
Input, OnChanges,
|
|
6
|
+
OnDestroy,
|
|
7
|
+
OnInit,
|
|
8
|
+
Renderer2, SimpleChanges,
|
|
9
|
+
ViewEncapsulation
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import { Subject } from 'rxjs';
|
|
12
|
+
import { InputBoolean } from '../core/util';
|
|
13
|
+
|
|
14
|
+
export type WalrusTagColor = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'dark';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'wr-tag',
|
|
18
|
+
exportAs: 'wrTag',
|
|
19
|
+
preserveWhitespaces: false,
|
|
20
|
+
template: '<wr-spin *ngIf="loading"></wr-spin><ng-content></ng-content>',
|
|
21
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
22
|
+
encapsulation: ViewEncapsulation.None
|
|
23
|
+
})
|
|
24
|
+
export class WalrusTagComponent implements OnInit, OnDestroy, OnChanges {
|
|
25
|
+
// add color class
|
|
26
|
+
@Input() color: WalrusTagColor = 'default';
|
|
27
|
+
|
|
28
|
+
// Is tag transparent
|
|
29
|
+
@Input() @InputBoolean() transparent = false;
|
|
30
|
+
|
|
31
|
+
@Input() @InputBoolean() loading = false;
|
|
32
|
+
|
|
33
|
+
// Is tag outlined
|
|
34
|
+
@Input() @InputBoolean() outline = false;
|
|
35
|
+
|
|
36
|
+
// Is tag outlined
|
|
37
|
+
@Input() @InputBoolean() round = false;
|
|
38
|
+
|
|
39
|
+
// Is tag hoverable
|
|
40
|
+
@Input() @InputBoolean() hoverable = false;
|
|
41
|
+
|
|
42
|
+
private destroy$ = new Subject<void>();
|
|
43
|
+
|
|
44
|
+
constructor(
|
|
45
|
+
private readonly elementRef: ElementRef,
|
|
46
|
+
private readonly r2: Renderer2
|
|
47
|
+
) {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ngOnInit(): void {
|
|
51
|
+
this.setClasses();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
ngOnDestroy(): void {
|
|
55
|
+
this.destroy$.next();
|
|
56
|
+
this.destroy$.complete();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
60
|
+
if (changes) {
|
|
61
|
+
this.setClasses();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private setClasses(): void {
|
|
66
|
+
const baseClass = 'wr-tag';
|
|
67
|
+
const el = this.elementRef.nativeElement;
|
|
68
|
+
const add = (klass: string) => this.r2.addClass(el, `${baseClass}-${klass}`);
|
|
69
|
+
const rm = (klass: string) => this.r2.removeClass(el, `${baseClass}-${klass}`);
|
|
70
|
+
|
|
71
|
+
el.classList = [];
|
|
72
|
+
|
|
73
|
+
this.r2.addClass(el, baseClass);
|
|
74
|
+
add(this.color);
|
|
75
|
+
|
|
76
|
+
if (this.round) {
|
|
77
|
+
add(`-round`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (this.transparent) {
|
|
81
|
+
add(`-transparent`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (this.hoverable) {
|
|
85
|
+
add(`-hoverable`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (this.outline) {
|
|
89
|
+
add(`-outline`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { WalrusTagComponent } from './tag.component';
|
|
4
|
+
import { WalrusSpinnerModule } from '../spinner';
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
imports: [CommonModule, WalrusSpinnerModule],
|
|
8
|
+
declarations: [WalrusTagComponent],
|
|
9
|
+
exports: [WalrusTagComponent]
|
|
10
|
+
})
|
|
11
|
+
export class WalrusTagModule {}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
+
{
|
|
3
|
+
"extends": "../../tsconfig.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"outDir": "../../out-tsc/lib",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"inlineSources": true,
|
|
9
|
+
"types": []
|
|
10
|
+
},
|
|
11
|
+
"exclude": [
|
|
12
|
+
"src/test.ts",
|
|
13
|
+
"**/*.spec.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|