@allsorter/ui-components 0.0.329 → 0.0.330
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/.storybook/main.ts +8 -1
- package/angular.json +36 -10
- package/bitbucket-pipelines.yml +15 -15
- package/documentation.json +540 -16
- package/ng-package.json +7 -0
- package/package.json +11 -8
- package/projects/allsorter-lib/.storybook/main.js +15 -0
- package/projects/allsorter-lib/README.md +63 -0
- package/projects/allsorter-lib/ng-package.json +7 -0
- package/projects/allsorter-lib/package.json +12 -0
- package/projects/allsorter-lib/src/lib/allsorter-lib.component.spec.ts +23 -0
- package/projects/allsorter-lib/src/lib/allsorter-lib.component.ts +15 -0
- package/projects/allsorter-lib/src/lib/allsorter-lib.service.spec.ts +16 -0
- package/projects/allsorter-lib/src/lib/allsorter-lib.service.ts +9 -0
- package/projects/allsorter-lib/src/lib/button/button.component.html +116 -0
- package/{src/app → projects/allsorter-lib/src/lib}/button/button.component.scss +15 -11
- package/{src/app → projects/allsorter-lib/src/lib}/button/button.module.ts +1 -1
- package/projects/allsorter-lib/src/lib/button/stories/button-gallery.stories.ts +155 -0
- package/{src → projects/allsorter-lib/src/lib/button}/stories/button-playground.stories.ts +12 -8
- package/projects/allsorter-lib/src/lib/input/input.component.css +58 -0
- package/projects/allsorter-lib/src/lib/input/input.component.spec.ts +60 -0
- package/{src → projects/allsorter-lib/src/lib/input}/stories/input-gallery.stories.ts +1 -1
- package/{src → projects/allsorter-lib/src/lib/input}/stories/input-playground.stories.ts +1 -1
- package/projects/allsorter-lib/src/public-api.ts +10 -0
- package/projects/allsorter-lib/tsconfig.lib.json +15 -0
- package/projects/allsorter-lib/tsconfig.lib.prod.json +11 -0
- package/projects/allsorter-lib/tsconfig.spec.json +15 -0
- package/tsconfig.json +5 -0
- package/src/app/button/button.component.html +0 -117
- package/src/app/input/input.component.css +0 -424
- package/src/app/input/input.component.spec.ts +0 -444
- package/src/public-api.ts +0 -9
- package/src/stories/button-gallery.stories.ts +0 -145
- package/src/styles/global-menu-overlay-styles.scss +0 -8
- /package/{src/app → projects/allsorter-lib/src/lib}/button/button.component.spec.ts +0 -0
- /package/{src/app → projects/allsorter-lib/src/lib}/button/button.component.ts +0 -0
- /package/{src/app → projects/allsorter-lib/src/lib}/input/input.component.html +0 -0
- /package/{src/app → projects/allsorter-lib/src/lib}/input/input.component.ts +0 -0
- /package/{src/app → projects/allsorter-lib/src/lib}/input/input.module.ts +0 -0
- /package/{src → projects/allsorter-lib/src/lib}/styles/typography-classes.scss +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { InputComponent } from './input.component';
|
|
3
|
+
import { ReactiveFormsModule, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
4
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
|
+
import { MatInputModule } from '@angular/material/input';
|
|
6
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
7
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
8
|
+
import { MatOptionModule } from '@angular/material/core';
|
|
9
|
+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
10
|
+
import { By } from '@angular/platform-browser';
|
|
11
|
+
|
|
12
|
+
describe('InputComponent', () => {
|
|
13
|
+
let component: InputComponent;
|
|
14
|
+
let fixture: ComponentFixture<InputComponent>;
|
|
15
|
+
let formBuilder: FormBuilder;
|
|
16
|
+
|
|
17
|
+
beforeEach(async () => {
|
|
18
|
+
await TestBed.configureTestingModule({
|
|
19
|
+
imports: [
|
|
20
|
+
InputComponent,
|
|
21
|
+
ReactiveFormsModule,
|
|
22
|
+
MatFormFieldModule,
|
|
23
|
+
MatInputModule,
|
|
24
|
+
MatIconModule,
|
|
25
|
+
MatSelectModule,
|
|
26
|
+
MatOptionModule,
|
|
27
|
+
NoopAnimationsModule
|
|
28
|
+
],
|
|
29
|
+
providers: [FormBuilder]
|
|
30
|
+
}).compileComponents();
|
|
31
|
+
|
|
32
|
+
fixture = TestBed.createComponent(InputComponent);
|
|
33
|
+
component = fixture.componentInstance;
|
|
34
|
+
formBuilder = TestBed.inject(FormBuilder);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Component Creation Tests
|
|
38
|
+
describe('Component Creation', () => {
|
|
39
|
+
it('should create the component', () => {
|
|
40
|
+
expect(component).toBeTruthy();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should have default values', () => {
|
|
44
|
+
expect(component.label).toBe('');
|
|
45
|
+
expect(component.placeholder).toBe('');
|
|
46
|
+
expect(component.value).toBe('');
|
|
47
|
+
expect(component.type).toBe('text');
|
|
48
|
+
expect(component.disabled).toBe(false);
|
|
49
|
+
expect(component.helperText).toBe(false);
|
|
50
|
+
expect(component.helperTextLabel).toBe('');
|
|
51
|
+
expect(component.leftIcon).toBe('');
|
|
52
|
+
expect(component.rightIcon).toBe('');
|
|
53
|
+
expect(component.dropDown).toBe(false);
|
|
54
|
+
expect(component.options).toEqual([]);
|
|
55
|
+
expect(component.size).toBe('base');
|
|
56
|
+
expect(component.inputTypes).toBe('simple');
|
|
57
|
+
expect(component.noBorder).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
-
import { InputComponent } from '../
|
|
2
|
+
import { InputComponent } from '../input.component'
|
|
3
3
|
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
|
|
5
5
|
const meta: Meta<InputComponent> = {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of allsorter-lib
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export * from './lib/allsorter-lib.service';
|
|
6
|
+
export * from './lib/allsorter-lib.component';
|
|
7
|
+
export * from './lib/button/button.component';
|
|
8
|
+
export * from './lib/button/button.module';
|
|
9
|
+
export * from './lib/input/input.component';
|
|
10
|
+
export * from './lib/input/input.module';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "../../tsconfig.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"outDir": "../../out-tsc/lib",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"inlineSources": true,
|
|
10
|
+
"types": []
|
|
11
|
+
},
|
|
12
|
+
"exclude": [
|
|
13
|
+
"**/*.spec.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "./tsconfig.lib.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"declarationMap": false
|
|
7
|
+
},
|
|
8
|
+
"angularCompilerOptions": {
|
|
9
|
+
"compilationMode": "partial"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "../../tsconfig.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"outDir": "../../out-tsc/spec",
|
|
7
|
+
"types": [
|
|
8
|
+
"jasmine"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"**/*.spec.ts",
|
|
13
|
+
"**/*.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
<!-- Regular button types -->
|
|
2
|
-
<ng-container *ngIf="buttonType !== 'dropdown'; else dropdownTpl">
|
|
3
|
-
<button
|
|
4
|
-
mat-flat-button
|
|
5
|
-
class="btn custom-button" [class]="effectiveFontClass"
|
|
6
|
-
[ngClass]="{
|
|
7
|
-
'size-header': size === 'header' && !fontClass,
|
|
8
|
-
'size-xs': size === 'xs' && !fontClass,
|
|
9
|
-
'size-sm': size === 'sm' && !fontClass,
|
|
10
|
-
'size-base': size === 'base' && !fontClass,
|
|
11
|
-
'size-l': size === 'l' && !fontClass,
|
|
12
|
-
'size-xl': size === 'xl' && !fontClass,
|
|
13
|
-
'mat-raised-button': variant === 'raised',
|
|
14
|
-
'mat-flat-button': variant === 'flat',
|
|
15
|
-
|
|
16
|
-
'mat-stroked-button': variant === 'stroked',
|
|
17
|
-
'mat-fab': variant === 'fab',
|
|
18
|
-
'mat-icon-button': variant === 'icon',
|
|
19
|
-
'icon-circle': buttonType === 'icon-circle',
|
|
20
|
-
'icon-label': buttonType === 'icon-label',
|
|
21
|
-
'two-icon-label': buttonType === 'two-icon-label',
|
|
22
|
-
'blue': category === 'blue',
|
|
23
|
-
'green': category === 'green',
|
|
24
|
-
'grey': category === 'grey',
|
|
25
|
-
'error': category === 'error',
|
|
26
|
-
'gradient': category === 'gradient',
|
|
27
|
-
'blue-no-outline': category === 'blue-no-outline',
|
|
28
|
-
'green-no-outline': category === 'green-no-outline',
|
|
29
|
-
'grey-no-outline': category === 'grey-no-outline',
|
|
30
|
-
'error-no-outline': category === 'error-no-outline',
|
|
31
|
-
'btn-default': state === 'default',
|
|
32
|
-
'btn-hover': state === 'hover',
|
|
33
|
-
'btn-pressed': state === 'pressed',
|
|
34
|
-
'btn-disabled': state === 'disabled'
|
|
35
|
-
}"
|
|
36
|
-
[ngStyle]="{ color: color }"
|
|
37
|
-
[disabled]="state === 'disabled'"
|
|
38
|
-
(click)="onClick.emit($event)"
|
|
39
|
-
(mouseenter)="onHover.emit($event)"
|
|
40
|
-
(mouseleave)="onMouseLeave.emit($event)"
|
|
41
|
-
[style.display]="'inline-flex'"
|
|
42
|
-
[style.align-items]="'center'"
|
|
43
|
-
[style.gap.px]="computeGap()"
|
|
44
|
-
>
|
|
45
|
-
<!-- Left Icon (Only shown if leftIcon is set and not empty) -->
|
|
46
|
-
<mat-icon *ngIf="leftIcon?.trim() as leftIconText"
|
|
47
|
-
[fontSet]="outlined ? 'material-icons-outlined' : 'material-icons'"
|
|
48
|
-
class="left-icon">{{ leftIconText }}</mat-icon>
|
|
49
|
-
<!-- Label (Only shown if iconOnly is false) -->
|
|
50
|
-
<span *ngIf="!iconOnly" class="button-label" [ngStyle]="{ color: color }">{{ label || '' }}</span>
|
|
51
|
-
|
|
52
|
-
<!-- Right Icon (Only shown if rightIcon is set and not empty) -->
|
|
53
|
-
<mat-icon *ngIf="rightIcon?.trim() as rightIconText"
|
|
54
|
-
[fontSet]="outlined ? 'material-icons-outlined' : 'material-icons'"
|
|
55
|
-
class="right-icon">{{ rightIconText }}</mat-icon>
|
|
56
|
-
</button>
|
|
57
|
-
</ng-container>
|
|
58
|
-
|
|
59
|
-
<!-- Dropdown button template -->
|
|
60
|
-
<ng-template #dropdownTpl>
|
|
61
|
-
<button
|
|
62
|
-
mat-flat-button
|
|
63
|
-
class="btn custom-button" [class]="effectiveFontClass"
|
|
64
|
-
[ngClass]="{
|
|
65
|
-
'size-header': size === 'header' && !fontClass,
|
|
66
|
-
'size-xs': size === 'xs' && !fontClass,
|
|
67
|
-
'size-sm': size === 'sm' && !fontClass,
|
|
68
|
-
'size-base': size === 'base' && !fontClass,
|
|
69
|
-
'size-l': size === 'l' && !fontClass,
|
|
70
|
-
'size-xl': size === 'xl' && !fontClass,
|
|
71
|
-
'mat-raised-button': variant === 'raised',
|
|
72
|
-
'mat-flat-button': variant === 'flat',
|
|
73
|
-
'mat-stroked-button': variant === 'stroked',
|
|
74
|
-
'mat-fab': variant === 'fab',
|
|
75
|
-
'mat-icon-button': variant === 'icon',
|
|
76
|
-
'icon-label': true,
|
|
77
|
-
'blue': category === 'blue',
|
|
78
|
-
'green': category === 'green',
|
|
79
|
-
'grey': category === 'grey',
|
|
80
|
-
'error': category === 'error',
|
|
81
|
-
'gradient': category === 'gradient',
|
|
82
|
-
'blue-no-outline': category === 'blue-no-outline',
|
|
83
|
-
'green-no-outline': category === 'green-no-outline',
|
|
84
|
-
'grey-no-outline': category === 'grey-no-outline',
|
|
85
|
-
'error-no-outline': category === 'error-no-outline',
|
|
86
|
-
'btn-default': state === 'default',
|
|
87
|
-
'btn-hover': state === 'hover',
|
|
88
|
-
'btn-pressed': state === 'pressed',
|
|
89
|
-
'btn-disabled': state === 'disabled',
|
|
90
|
-
|
|
91
|
-
}"
|
|
92
|
-
[ngStyle]="{ color: color }"
|
|
93
|
-
[disabled]="state === 'disabled'"
|
|
94
|
-
(mouseenter)="onHover.emit($event)"
|
|
95
|
-
(mouseleave)="onMouseLeave.emit($event)"
|
|
96
|
-
[style.display]="'inline-flex'"
|
|
97
|
-
[style.align-items]="'center'"
|
|
98
|
-
[style.gap.px]="computeGap()"
|
|
99
|
-
[matMenuTriggerFor]="menu"
|
|
100
|
-
>
|
|
101
|
-
<!-- Left Icon (optional) -->
|
|
102
|
-
<mat-icon *ngIf="leftIcon?.trim() as leftIconText"
|
|
103
|
-
[fontSet]="outlined ? 'material-icons-outlined' : 'material-icons'"
|
|
104
|
-
class="left-icon">{{ leftIconText }}</mat-icon>
|
|
105
|
-
<!-- Label -->
|
|
106
|
-
<span *ngIf="!iconOnly" class="button-label" [ngStyle]="{ color: color }">{{ label || '' }}</span>
|
|
107
|
-
<!-- Dropdown Arrow Icon -->
|
|
108
|
-
<mat-icon class="right-icon">arrow_drop_down</mat-icon>
|
|
109
|
-
</button>
|
|
110
|
-
<!-- Mat Menu -->
|
|
111
|
-
<mat-menu #menu="matMenu" panelClass="custom-dropdown-menu">
|
|
112
|
-
<button mat-menu-item *ngFor="let opt of dropdownOptions" (click)="selectOption(opt)" [ngClass]="effectiveFontClass">
|
|
113
|
-
{{ opt.label || opt }}
|
|
114
|
-
</button>
|
|
115
|
-
</mat-menu>
|
|
116
|
-
</ng-template>
|
|
117
|
-
|