@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
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allsorter/ui-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.330",
|
|
4
4
|
"description": "Starter template to get up and running quickly with Angular and Storybook",
|
|
5
5
|
"author": "Chromatic <https://chromatic.com/>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://
|
|
8
|
+
"url": "https://bitbucket.org/allsorter/allsorter-components/src/master/"
|
|
9
9
|
},
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://
|
|
11
|
+
"url": "https://bitbucket.org/allsorter/allsorter-components/src/master/issues"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"ng": "ng",
|
|
16
16
|
"start": "ng serve",
|
|
17
|
-
"build": "ng build",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
17
|
+
"build": "ng build allsorter-lib",
|
|
18
|
+
"build-lib": "ng build allsorter-lib",
|
|
19
|
+
"watch": "ng build allsorter-lib --watch --configuration development",
|
|
20
|
+
"storybook": "ng run allsorter-lib:storybook",
|
|
21
|
+
"build-storybook": "ng run allsorter-lib:build-storybook",
|
|
21
22
|
"init-msw": "msw init src/"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"@storybook/addon-essentials": "^8.3.3",
|
|
44
45
|
"@storybook/addon-interactions": "^8.3.3",
|
|
45
46
|
"@storybook/addon-links": "^8.3.3",
|
|
47
|
+
"@storybook/addon-mdx-gfm": "^8.6.14",
|
|
46
48
|
"@storybook/angular": "^8.3.3",
|
|
47
49
|
"@storybook/blocks": "^8.3.3",
|
|
48
50
|
"@storybook/test": "^8.3.3",
|
|
@@ -55,7 +57,8 @@
|
|
|
55
57
|
"karma-jasmine-html-reporter": "~2.0.0",
|
|
56
58
|
"msw": "^2.3.0",
|
|
57
59
|
"msw-storybook-addon": "^2.0.3",
|
|
60
|
+
"ng-packagr": "^19.0.0",
|
|
58
61
|
"storybook": "^8.3.3",
|
|
59
62
|
"typescript": "^5.6.3"
|
|
60
63
|
}
|
|
61
|
-
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
stories: [
|
|
3
|
+
'../src/lib/**/*.stories.@(js|jsx|ts|tsx)'
|
|
4
|
+
],
|
|
5
|
+
addons: [
|
|
6
|
+
'@storybook/addon-links',
|
|
7
|
+
'@storybook/addon-essentials',
|
|
8
|
+
'@storybook/addon-interactions',
|
|
9
|
+
'@storybook/addon-mdx-gfm',
|
|
10
|
+
],
|
|
11
|
+
framework: {
|
|
12
|
+
name: '@storybook/angular',
|
|
13
|
+
options: {},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# AllsorterLib
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.0.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build allsorter-lib
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/allsorter-lib
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running unit tests
|
|
44
|
+
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Running end-to-end tests
|
|
52
|
+
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
+
|
|
61
|
+
## Additional Resources
|
|
62
|
+
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { AllsorterLibComponent } from './allsorter-lib.component';
|
|
4
|
+
|
|
5
|
+
describe('AllsorterLibComponent', () => {
|
|
6
|
+
let component: AllsorterLibComponent;
|
|
7
|
+
let fixture: ComponentFixture<AllsorterLibComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [AllsorterLibComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(AllsorterLibComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { AllsorterLibService } from './allsorter-lib.service';
|
|
4
|
+
|
|
5
|
+
describe('AllsorterLibService', () => {
|
|
6
|
+
let service: AllsorterLibService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(AllsorterLibService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import url("https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined");
|
|
2
|
-
@import "
|
|
3
|
-
|
|
2
|
+
@import "../styles/typography-classes.scss";
|
|
3
|
+
|
|
4
4
|
.material-icons-outlined {
|
|
5
5
|
font-family: 'Material Icons Outlined';
|
|
6
6
|
font-weight: normal;
|
|
@@ -224,10 +224,10 @@ mat-icon.mat-icon {
|
|
|
224
224
|
/* Reuse .size-xl for xl */
|
|
225
225
|
|
|
226
226
|
/* Icon sizes for new naming */
|
|
227
|
-
.size-header .mat-icon {
|
|
228
|
-
.size-xs .mat-icon {
|
|
229
|
-
.size-sm .mat-icon, .size-base .mat-icon {
|
|
230
|
-
.size-l .mat-icon, .size-xl .mat-icon {
|
|
227
|
+
.size-header .mat-icon { font-size:20px; }
|
|
228
|
+
.size-xs .mat-icon { font-size:16px; }
|
|
229
|
+
.size-sm .mat-icon, .size-base .mat-icon { font-size:16px; }
|
|
230
|
+
.size-l .mat-icon, .size-xl .mat-icon { font-size:20px; }
|
|
231
231
|
|
|
232
232
|
/* Adjust gap for header size */
|
|
233
233
|
.btn.size-header { gap:4px !important; padding: 4px 12px !important;}
|
|
@@ -355,19 +355,19 @@ button.icon-circle {
|
|
|
355
355
|
.size-header.icon-circle .mat-icon { width:10px; height:10px; font-size:10px; }
|
|
356
356
|
|
|
357
357
|
.size-xs.icon-circle { padding:4px !important; }
|
|
358
|
-
.size-xs.icon-circle .mat-icon {
|
|
358
|
+
.size-xs.icon-circle .mat-icon { font-size:12px; }
|
|
359
359
|
|
|
360
360
|
.size-sm.icon-circle { padding:8px !important; }
|
|
361
|
-
.size-sm.icon-circle .mat-icon {
|
|
361
|
+
.size-sm.icon-circle .mat-icon { font-size:12px; }
|
|
362
362
|
|
|
363
363
|
.size-base.icon-circle { padding:10px !important; }
|
|
364
|
-
.size-base.icon-circle .mat-icon {
|
|
364
|
+
.size-base.icon-circle .mat-icon { font-size:14px; }
|
|
365
365
|
|
|
366
366
|
.size-l.icon-circle { padding:12px !important; }
|
|
367
|
-
.size-l.icon-circle .mat-icon {
|
|
367
|
+
.size-l.icon-circle .mat-icon { font-size:16px; }
|
|
368
368
|
|
|
369
369
|
.size-xl.icon-circle { padding:14px !important; }
|
|
370
|
-
.size-xl.icon-circle .mat-icon {
|
|
370
|
+
.size-xl.icon-circle .mat-icon { font-size:16px; }
|
|
371
371
|
|
|
372
372
|
/* icon-label and two-icon-label just rely on default flex behaviour */
|
|
373
373
|
.icon-xs {
|
|
@@ -459,4 +459,8 @@ button.icon-circle {
|
|
|
459
459
|
|
|
460
460
|
::ng-deep .mat-mdc-menu-item:hover {
|
|
461
461
|
background-color: #f5f5f5 !important;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.mat-mdc-unelevated-button>.mat-icon{
|
|
465
|
+
line-height:18px !important
|
|
462
466
|
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { ButtonComponent } from '../button.component';
|
|
3
|
+
|
|
4
|
+
type Story = StoryObj<ButtonComponent>;
|
|
5
|
+
|
|
6
|
+
const meta: Meta<ButtonComponent> = {
|
|
7
|
+
title: 'Components/Button/Gallery',
|
|
8
|
+
component: ButtonComponent,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
label: { control: 'text' },
|
|
12
|
+
category: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: [
|
|
15
|
+
'blue', 'green', 'grey', 'error', 'gradient',
|
|
16
|
+
'blue-no-outline', 'green-no-outline', 'grey-no-outline', 'error-no-outline',
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
control: 'select',
|
|
21
|
+
options: ['header', 'xs', 'sm', 'base', 'l', 'xl'],
|
|
22
|
+
},
|
|
23
|
+
buttonType: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['icon-circle', 'icon-label', 'two-icon-label', 'dropdown'],
|
|
26
|
+
},
|
|
27
|
+
outlined: { control: 'boolean' },
|
|
28
|
+
showLeftIcon: { control: 'boolean' },
|
|
29
|
+
showRightIcon: { control: 'boolean' },
|
|
30
|
+
leftIcon: { control: 'text' },
|
|
31
|
+
rightIcon: { control: 'text' },
|
|
32
|
+
dropdownOptions: { control: 'object' },
|
|
33
|
+
color: { control: 'text' },
|
|
34
|
+
},
|
|
35
|
+
args: {
|
|
36
|
+
size: 'sm',
|
|
37
|
+
category: 'blue',
|
|
38
|
+
outlined: false,
|
|
39
|
+
buttonType: 'icon-label',
|
|
40
|
+
label: 'Button text',
|
|
41
|
+
showLeftIcon: true,
|
|
42
|
+
showRightIcon: true,
|
|
43
|
+
leftIcon: 'circle',
|
|
44
|
+
rightIcon: 'circle',
|
|
45
|
+
dropdownOptions: [
|
|
46
|
+
{ label: 'Create a merge commit', value: 'merge' },
|
|
47
|
+
{ label: 'Squash and merge', value: 'squash' },
|
|
48
|
+
{ label: 'Rebase and merge', value: 'rebase' },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
parameters: { controls: { expanded: true } },
|
|
52
|
+
};
|
|
53
|
+
export default meta;
|
|
54
|
+
|
|
55
|
+
export const Default: Story = {
|
|
56
|
+
name: 'Default',
|
|
57
|
+
render: (args: any) => ({
|
|
58
|
+
props: {
|
|
59
|
+
...args,
|
|
60
|
+
leftIcon: args.showLeftIcon ? args.leftIcon : '',
|
|
61
|
+
rightIcon: args.showRightIcon ? args.rightIcon : '',
|
|
62
|
+
},
|
|
63
|
+
template: `
|
|
64
|
+
<al-button
|
|
65
|
+
[category]="category"
|
|
66
|
+
[buttonType]="buttonType"
|
|
67
|
+
[label]="label"
|
|
68
|
+
[leftIcon]="leftIcon"
|
|
69
|
+
[rightIcon]="rightIcon"
|
|
70
|
+
[size]="size"
|
|
71
|
+
[outlined]="outlined"
|
|
72
|
+
[color]="color"
|
|
73
|
+
[dropdownOptions]="dropdownOptions"
|
|
74
|
+
></al-button>
|
|
75
|
+
`,
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const Variation: Story = {
|
|
80
|
+
name: 'Variation',
|
|
81
|
+
args: {
|
|
82
|
+
category: 'blue',
|
|
83
|
+
buttonType: 'icon-label',
|
|
84
|
+
label: 'Button text',
|
|
85
|
+
leftIcon: 'circle',
|
|
86
|
+
rightIcon: 'circle',
|
|
87
|
+
outlined: false,
|
|
88
|
+
dropdownOptions: [
|
|
89
|
+
{ label: 'Create a merge commit', value: 'merge' },
|
|
90
|
+
{ label: 'Squash and merge', value: 'squash' },
|
|
91
|
+
{ label: 'Rebase and merge', value: 'rebase' },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
argTypes: {
|
|
95
|
+
category: {
|
|
96
|
+
control: 'select',
|
|
97
|
+
options: [
|
|
98
|
+
'blue', 'green', 'grey', 'error', 'gradient',
|
|
99
|
+
'blue-no-outline', 'green-no-outline', 'grey-no-outline', 'error-no-outline',
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
buttonType: {
|
|
103
|
+
control: 'select',
|
|
104
|
+
options: ['icon-label', 'two-icon-label', 'dropdown', 'icon-circle'],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
parameters: {
|
|
108
|
+
docs: { disable: true }
|
|
109
|
+
},
|
|
110
|
+
render: (args: any) => ({
|
|
111
|
+
props: {
|
|
112
|
+
...args,
|
|
113
|
+
sizes: ['header', 'xs', 'sm', 'base', 'l', 'xl'],
|
|
114
|
+
circleSizes: ['xs', 'sm', 'base', 'l', 'xl'],
|
|
115
|
+
},
|
|
116
|
+
template: `
|
|
117
|
+
<div style="display: flex; flex-direction: column; gap: 24px;">
|
|
118
|
+
<div>
|
|
119
|
+
<div style="font-weight: bold; margin-bottom: 8px;">All Sizes ({{ category }}, {{ buttonType }})</div>
|
|
120
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
121
|
+
<ng-container *ngFor="let sz of sizes">
|
|
122
|
+
<al-button
|
|
123
|
+
[category]="category"
|
|
124
|
+
[buttonType]="buttonType"
|
|
125
|
+
[label]="sz === 'header' ? '' : label"
|
|
126
|
+
[leftIcon]="leftIcon"
|
|
127
|
+
[rightIcon]="rightIcon"
|
|
128
|
+
[size]="sz"
|
|
129
|
+
[outlined]="outlined"
|
|
130
|
+
[dropdownOptions]="dropdownOptions"
|
|
131
|
+
style="margin-right: 8px;"
|
|
132
|
+
></al-button>
|
|
133
|
+
</ng-container>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
<hr />
|
|
137
|
+
<div>
|
|
138
|
+
<div style="font-weight: bold; margin-bottom: 8px;">Circular Buttons (icon-circle)</div>
|
|
139
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
140
|
+
<ng-container *ngFor="let sz of circleSizes">
|
|
141
|
+
<al-button
|
|
142
|
+
[category]="category"
|
|
143
|
+
[buttonType]="'icon-circle'"
|
|
144
|
+
[leftIcon]="'add'"
|
|
145
|
+
[size]="sz"
|
|
146
|
+
[outlined]="outlined"
|
|
147
|
+
style="margin-right: 8px;"
|
|
148
|
+
></al-button>
|
|
149
|
+
</ng-container>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
`,
|
|
154
|
+
}),
|
|
155
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
-
import { ButtonComponent } from '../
|
|
2
|
+
import { ButtonComponent } from '../button.component';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<ButtonComponent> = {
|
|
5
5
|
title: 'Components/Button/Playground',
|
|
@@ -13,10 +13,7 @@ const meta: Meta<ButtonComponent> = {
|
|
|
13
13
|
'blue-no-outline', 'green-no-outline', 'grey-no-outline', 'error-no-outline',
|
|
14
14
|
],
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
control: 'select',
|
|
18
|
-
options: ['default', 'hover', 'pressed', 'disabled'],
|
|
19
|
-
},
|
|
16
|
+
|
|
20
17
|
buttonType: {
|
|
21
18
|
control: 'select',
|
|
22
19
|
options: ['icon-circle', 'icon-label', 'two-icon-label', 'dropdown'],
|
|
@@ -25,8 +22,16 @@ const meta: Meta<ButtonComponent> = {
|
|
|
25
22
|
control: 'select',
|
|
26
23
|
options: ['header','xs','sm','base','l','xl'],
|
|
27
24
|
},
|
|
28
|
-
leftIcon: {
|
|
29
|
-
|
|
25
|
+
leftIcon: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
if: { arg: 'showLeftIcon', truthy: true },
|
|
28
|
+
ifDisabled: { arg: 'showLeftIcon', truthy: false },
|
|
29
|
+
},
|
|
30
|
+
rightIcon: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
if: { arg: 'showRightIcon', truthy: true },
|
|
33
|
+
ifDisabled: { arg: 'showRightIcon', truthy: false },
|
|
34
|
+
},
|
|
30
35
|
outlined: { control: 'boolean' },
|
|
31
36
|
iconOnly: { control: 'boolean' },
|
|
32
37
|
showLeftIcon: { control: 'boolean' },
|
|
@@ -36,7 +41,6 @@ const meta: Meta<ButtonComponent> = {
|
|
|
36
41
|
args: {
|
|
37
42
|
size: 'sm',
|
|
38
43
|
category: 'blue',
|
|
39
|
-
state: 'default',
|
|
40
44
|
outlined: true,
|
|
41
45
|
buttonType: 'icon-label',
|
|
42
46
|
label: 'Button text',
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined");
|
|
2
|
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
|
|
3
|
+
|
|
4
|
+
/* Material Icons */
|
|
5
|
+
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
|
|
6
|
+
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined');
|
|
7
|
+
|
|
8
|
+
/* Roboto Font */
|
|
9
|
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');
|
|
10
|
+
|
|
11
|
+
/* Angular Material Theme (Indigo Pink) */
|
|
12
|
+
@import url('https://cdn.jsdelivr.net/npm/@angular/material@19.2.3/prebuilt-themes/indigo-pink.css');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/* ===== BASE STYLES ===== */
|
|
17
|
+
.al-input-field {
|
|
18
|
+
width: 100%;
|
|
19
|
+
margin-bottom: 16px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Global background color for all input fields */
|
|
23
|
+
::ng-deep .al-input-field .mat-mdc-form-field-flex,
|
|
24
|
+
::ng-deep .al-input-field .mat-mdc-text-field-wrapper,
|
|
25
|
+
::ng-deep .al-input-field .mat-mdc-form-field-infix {
|
|
26
|
+
background-color: #F7F9FE !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
::ng-deep .al-input-field .mat-mdc-form-field-subscript-wrapper {
|
|
30
|
+
background-color: transparent !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
::ng-deep .al-input-field .mat-mdc-form-field-focus-overlay {
|
|
34
|
+
background-color: #F7F9FE !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ===== CATEGORY STYLES ===== */
|
|
38
|
+
|
|
39
|
+
/* Common border width for most categories */
|
|
40
|
+
::ng-deep .al-input-category-primary,
|
|
41
|
+
::ng-deep .al-input-category-success,
|
|
42
|
+
::ng-deep .al-input-category-warn,
|
|
43
|
+
::ng-deep .al-input-category-disabled {
|
|
44
|
+
--mdc-outlined-text-field-outline-width: 1px !important;
|
|
45
|
+
--mdc-outlined-text-field-focus-outline-width: 1px !important;
|
|
46
|
+
--mdc-outlined-text-field-hover-outline-width: 1px !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Simple category */
|
|
50
|
+
::ng-deep .al-input-category-simple {
|
|
51
|
+
--mdc-outlined-text-field-outline-color: #C3C5D1 !important;
|
|
52
|
+
--mdc-outlined-text-field-focus-outline-color: #C3C5D1 !important;
|
|
53
|
+
--mdc-outlined-text-field-hover-outline-color: #C3C5D1 !important;
|
|
54
|
+
--mdc-outlined-text-field-label-text-color: #5473E8 !important;
|
|
55
|
+
--mdc-outlined-text-field-focus-label-text-color: #5473E8 !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Success category */
|