@allsorter/ui-components 0.0.330 → 0.0.335
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/README.md +40 -73
- package/fesm2022/allsorter-ui-components.mjs +329 -0
- package/fesm2022/allsorter-ui-components.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/allsorter-lib.component.d.ts +5 -0
- package/lib/allsorter-lib.service.d.ts +6 -0
- package/lib/button/button.component.d.ts +46 -0
- package/lib/button/button.module.d.ts +13 -0
- package/lib/input/input.component.d.ts +34 -0
- package/lib/input/input.module.d.ts +8 -0
- package/package.json +16 -57
- package/{projects/allsorter-lib/src/public-api.ts → public-api.d.ts} +0 -4
- package/.editorconfig +0 -16
- package/.gitignore copy +0 -44
- package/.storybook/main.ts +0 -21
- package/.storybook/preview.ts +0 -17
- package/.storybook/tsconfig.doc.json +0 -10
- package/.storybook/tsconfig.json +0 -11
- package/.storybook/typings.d.ts +0 -4
- package/.vscode/settings.json +0 -1
- package/LICENSE +0 -21
- package/angular.json +0 -135
- package/bitbucket-pipelines.yml +0 -108
- package/documentation.json +0 -1604
- package/ng-package.json +0 -7
- package/projects/allsorter-lib/.storybook/main.js +0 -15
- package/projects/allsorter-lib/README.md +0 -63
- package/projects/allsorter-lib/ng-package.json +0 -7
- package/projects/allsorter-lib/package.json +0 -12
- package/projects/allsorter-lib/src/lib/allsorter-lib.component.spec.ts +0 -23
- package/projects/allsorter-lib/src/lib/allsorter-lib.component.ts +0 -15
- package/projects/allsorter-lib/src/lib/allsorter-lib.service.spec.ts +0 -16
- package/projects/allsorter-lib/src/lib/allsorter-lib.service.ts +0 -9
- package/projects/allsorter-lib/src/lib/button/button.component.html +0 -116
- package/projects/allsorter-lib/src/lib/button/button.component.scss +0 -466
- package/projects/allsorter-lib/src/lib/button/button.component.spec.ts +0 -23
- package/projects/allsorter-lib/src/lib/button/button.component.ts +0 -105
- package/projects/allsorter-lib/src/lib/button/button.module.ts +0 -23
- package/projects/allsorter-lib/src/lib/button/stories/button-gallery.stories.ts +0 -155
- package/projects/allsorter-lib/src/lib/button/stories/button-playground.stories.ts +0 -63
- package/projects/allsorter-lib/src/lib/input/input.component.css +0 -58
- package/projects/allsorter-lib/src/lib/input/input.component.html +0 -27
- package/projects/allsorter-lib/src/lib/input/input.component.spec.ts +0 -60
- package/projects/allsorter-lib/src/lib/input/input.component.ts +0 -92
- package/projects/allsorter-lib/src/lib/input/input.module.ts +0 -9
- package/projects/allsorter-lib/src/lib/input/stories/input-gallery.stories.ts +0 -124
- package/projects/allsorter-lib/src/lib/input/stories/input-playground.stories.ts +0 -135
- package/projects/allsorter-lib/src/lib/styles/typography-classes.scss +0 -122
- package/projects/allsorter-lib/tsconfig.lib.json +0 -15
- package/projects/allsorter-lib/tsconfig.lib.prod.json +0 -11
- package/projects/allsorter-lib/tsconfig.spec.json +0 -15
- package/src/app/app.component.css +0 -0
- package/src/app/app.component.html +0 -328
- package/src/app/app.component.spec.ts +0 -31
- package/src/app/app.component.ts +0 -11
- package/src/app/app.module.ts +0 -16
- package/src/assets/.gitkeep +0 -0
- package/src/assets/font/OpenSans-Light-webfont.eot +0 -0
- package/src/assets/font/OpenSans-Light-webfont.svg +0 -252
- package/src/assets/font/OpenSans-Light-webfont.ttf +0 -0
- package/src/assets/font/OpenSans-Light-webfont.woff +0 -0
- package/src/assets/font/OpenSans-Regular-webfont.eot +0 -0
- package/src/assets/font/OpenSans-Regular-webfont.svg +0 -252
- package/src/assets/font/OpenSans-Regular-webfont.ttf +0 -0
- package/src/assets/font/OpenSans-Regular-webfont.woff +0 -0
- package/src/assets/icon/percolate.eot +0 -0
- package/src/assets/icon/percolate.svg +0 -139
- package/src/assets/icon/percolate.ttf +0 -0
- package/src/assets/icon/percolate.woff +0 -0
- package/src/environments/environment.prod.ts +0 -3
- package/src/environments/environment.ts +0 -16
- package/src/favicon.ico +0 -0
- package/src/index.html +0 -15
- package/src/main.ts +0 -7
- package/src/polyfills.ts +0 -63
- package/src/stories/.eslintrc.json +0 -8
- package/src/stories/Configure.mdx +0 -369
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -5
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -15
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -3
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -12
- package/src/stories/assets/youtube.svg +0 -4
- package/src/styles.css +0 -463
- package/tsconfig.app.json +0 -10
- package/tsconfig.json +0 -34
- package/tsconfig.spec.json +0 -10
|
@@ -1,155 +0,0 @@
|
|
|
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,63 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
-
import { ButtonComponent } from '../button.component';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<ButtonComponent> = {
|
|
5
|
-
title: 'Components/Button/Playground',
|
|
6
|
-
component: ButtonComponent,
|
|
7
|
-
argTypes: {
|
|
8
|
-
label: { control: 'text' },
|
|
9
|
-
category: {
|
|
10
|
-
control: 'select',
|
|
11
|
-
options: [
|
|
12
|
-
'blue', 'green', 'grey', 'error', 'gradient',
|
|
13
|
-
'blue-no-outline', 'green-no-outline', 'grey-no-outline', 'error-no-outline',
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
buttonType: {
|
|
18
|
-
control: 'select',
|
|
19
|
-
options: ['icon-circle', 'icon-label', 'two-icon-label', 'dropdown'],
|
|
20
|
-
},
|
|
21
|
-
size: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options: ['header','xs','sm','base','l','xl'],
|
|
24
|
-
},
|
|
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
|
-
},
|
|
35
|
-
outlined: { control: 'boolean' },
|
|
36
|
-
iconOnly: { control: 'boolean' },
|
|
37
|
-
showLeftIcon: { control: 'boolean' },
|
|
38
|
-
showRightIcon: { control: 'boolean' },
|
|
39
|
-
dropdownOptions: { control: 'object' },
|
|
40
|
-
},
|
|
41
|
-
args: {
|
|
42
|
-
size: 'sm',
|
|
43
|
-
category: 'blue',
|
|
44
|
-
outlined: true,
|
|
45
|
-
buttonType: 'icon-label',
|
|
46
|
-
label: 'Button text',
|
|
47
|
-
leftIcon: 'add',
|
|
48
|
-
rightIcon: 'add',
|
|
49
|
-
iconOnly: false,
|
|
50
|
-
showLeftIcon: true,
|
|
51
|
-
showRightIcon: true,
|
|
52
|
-
dropdownOptions: [
|
|
53
|
-
{ label: 'Create a merge commit', value: 'merge' },
|
|
54
|
-
{ label: 'Squash and merge', value: 'squash' },
|
|
55
|
-
{ label: 'Rebase and merge', value: 'rebase' },
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
export default meta;
|
|
60
|
-
|
|
61
|
-
type Story = StoryObj<ButtonComponent>;
|
|
62
|
-
|
|
63
|
-
|
|
@@ -1,58 +0,0 @@
|
|
|
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 */
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<mat-form-field appearance="outline" class="al-input-field" [ngClass]="[
|
|
2
|
-
helperText ? 'has-error' : '',
|
|
3
|
-
getSizeClass(),
|
|
4
|
-
getCategoryClass(),
|
|
5
|
-
noBorder ? 'al-input-no-border' : ''
|
|
6
|
-
]">
|
|
7
|
-
<mat-label *ngIf="label && !noBorder">{{ label }}</mat-label>
|
|
8
|
-
|
|
9
|
-
<span *ngIf="leftIcon" matPrefix class="material-symbols-outlined">
|
|
10
|
-
{{ leftIcon }}
|
|
11
|
-
</span>
|
|
12
|
-
|
|
13
|
-
<ng-container *ngIf="dropDown; else regularInput">
|
|
14
|
-
<mat-select [disabled]="isDisabled" [(ngModel)]="value" (selectionChange)="onSelectionChange($event.value)">
|
|
15
|
-
<mat-option *ngFor="let option of options" [value]="option">{{ option }}</mat-option>
|
|
16
|
-
</mat-select>
|
|
17
|
-
</ng-container>
|
|
18
|
-
<ng-template #regularInput>
|
|
19
|
-
<input matInput [placeholder]="placeholder" [type]="type" [disabled]="isDisabled" [(ngModel)]="value"
|
|
20
|
-
(input)="onInputChange($any($event.target).value)" (blur)="onTouched()" />
|
|
21
|
-
</ng-template>
|
|
22
|
-
|
|
23
|
-
<span *ngIf="rightIcon" matSuffix class="material-symbols-outlined">{{ rightIcon }}</span>
|
|
24
|
-
|
|
25
|
-
<mat-error *ngIf="helperText">{{ helperTextLabel }}</mat-error>
|
|
26
|
-
<mat-hint *ngIf="!helperText && helperTextLabel">{{ helperTextLabel }}</mat-hint>
|
|
27
|
-
</mat-form-field>
|
|
@@ -1,60 +0,0 @@
|
|
|
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,92 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, EventEmitter, Input, Output, forwardRef } from '@angular/core';
|
|
3
|
-
import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormsModule } 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
|
-
|
|
10
|
-
@Component({
|
|
11
|
-
selector: 'al-input',
|
|
12
|
-
templateUrl: './input.component.html',
|
|
13
|
-
styleUrl: './input.component.css',
|
|
14
|
-
imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatOptionModule],
|
|
15
|
-
standalone: true,
|
|
16
|
-
providers: [
|
|
17
|
-
{
|
|
18
|
-
provide: NG_VALUE_ACCESSOR,
|
|
19
|
-
useExisting: forwardRef(() => InputComponent),
|
|
20
|
-
multi: true
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
})
|
|
24
|
-
export class InputComponent implements ControlValueAccessor {
|
|
25
|
-
@Input() label: string = '';
|
|
26
|
-
@Input() placeholder: string = '';
|
|
27
|
-
@Input() value: string = '';
|
|
28
|
-
@Input() formControlName: string = '';
|
|
29
|
-
|
|
30
|
-
@Input() type: 'text' | 'email' | 'number' | 'password' | 'tel' | 'url' | 'date' = 'text';
|
|
31
|
-
@Input() disabled: boolean = false;
|
|
32
|
-
@Input() helperText: boolean = false;
|
|
33
|
-
@Input() helperTextLabel: string = '';
|
|
34
|
-
@Input() leftIcon: string = '';
|
|
35
|
-
@Input() rightIcon: string = '';
|
|
36
|
-
@Input() dropDown: boolean = false;
|
|
37
|
-
@Input() options: string[] = [];
|
|
38
|
-
@Input() size: 'xs' | 'small' | 'base' | 'large' | 'header' = 'base';
|
|
39
|
-
@Input() inputTypes: 'simple' | 'primary' | 'success' | 'warn' | 'disabled' | 'plain' = 'simple';
|
|
40
|
-
@Input() noBorder: boolean = false;
|
|
41
|
-
|
|
42
|
-
@Output() valueChange = new EventEmitter<string>();
|
|
43
|
-
|
|
44
|
-
private onChange = (value: string) => { };
|
|
45
|
-
onTouched = () => { };
|
|
46
|
-
|
|
47
|
-
get isDisabled(): boolean {
|
|
48
|
-
return this.disabled || this.inputTypes === 'disabled';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
writeValue(value: string | null | undefined): void {
|
|
52
|
-
this.value = value || '';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
registerOnChange(fn: (value: string) => void): void {
|
|
56
|
-
this.onChange = fn;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
registerOnTouched(fn: () => void): void {
|
|
60
|
-
this.onTouched = fn;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
setDisabledState(isDisabled: boolean): void {
|
|
64
|
-
this.disabled = isDisabled;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
onInputChange(value: string): void {
|
|
68
|
-
this.value = value;
|
|
69
|
-
this.onChange(value);
|
|
70
|
-
this.valueChange.emit(value);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
onSelectionChange(value: string): void {
|
|
74
|
-
this.value = value;
|
|
75
|
-
this.onChange(value);
|
|
76
|
-
this.valueChange.emit(value);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
getSizeClass(): string {
|
|
80
|
-
return 'al-input-size-' + this.size;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
getCategoryClass(): string {
|
|
84
|
-
if (this.disabled) {
|
|
85
|
-
return 'al-input-category-disabled';
|
|
86
|
-
}
|
|
87
|
-
if (this.inputTypes === 'plain') {
|
|
88
|
-
return 'al-input-category-plain';
|
|
89
|
-
}
|
|
90
|
-
return 'al-input-category-' + this.inputTypes;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { InputComponent } from './input.component';
|
|
4
|
-
|
|
5
|
-
@NgModule({
|
|
6
|
-
imports: [CommonModule, InputComponent],
|
|
7
|
-
exports: [InputComponent],
|
|
8
|
-
})
|
|
9
|
-
export class InputModule { }
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
-
import { InputComponent } from '../input.component';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<InputComponent> = {
|
|
5
|
-
tags: ['autodocs'],
|
|
6
|
-
title: 'Components/Input/Gallery',
|
|
7
|
-
component: InputComponent,
|
|
8
|
-
argTypes: {
|
|
9
|
-
label: { control: 'text' },
|
|
10
|
-
placeholder: { control: 'text' },
|
|
11
|
-
value: { control: 'text' },
|
|
12
|
-
formControlName: { control: 'text' },
|
|
13
|
-
type: {
|
|
14
|
-
control: 'select',
|
|
15
|
-
options: ['text', 'email', 'number', 'password', 'tel', 'url', 'date'],
|
|
16
|
-
},
|
|
17
|
-
disabled: { control: 'boolean' },
|
|
18
|
-
helperText: { control: 'boolean' },
|
|
19
|
-
helperTextLabel: { control: 'text' },
|
|
20
|
-
leftIcon: { control: 'text' },
|
|
21
|
-
rightIcon: { control: 'text' },
|
|
22
|
-
dropDown: { control: 'boolean' },
|
|
23
|
-
options: { control: 'object' },
|
|
24
|
-
size: {
|
|
25
|
-
control: 'radio',
|
|
26
|
-
options: ['header', 'xs', 'small', 'base', 'large'],
|
|
27
|
-
},
|
|
28
|
-
inputTypes: {
|
|
29
|
-
control: 'radio',
|
|
30
|
-
options: ['primary', 'success', 'warn', 'disabled', 'plain'],
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
args: {
|
|
34
|
-
label: 'Placeholder text',
|
|
35
|
-
placeholder: 'Type here...',
|
|
36
|
-
value: '',
|
|
37
|
-
formControlName: '',
|
|
38
|
-
type: 'text',
|
|
39
|
-
disabled: false,
|
|
40
|
-
helperText: false,
|
|
41
|
-
helperTextLabel: '',
|
|
42
|
-
leftIcon: 'person',
|
|
43
|
-
rightIcon: 'expand_more',
|
|
44
|
-
dropDown: false,
|
|
45
|
-
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
46
|
-
size: 'base',
|
|
47
|
-
inputTypes: 'primary',
|
|
48
|
-
},
|
|
49
|
-
parameters: { controls: { expanded: true } },
|
|
50
|
-
};
|
|
51
|
-
export default meta;
|
|
52
|
-
|
|
53
|
-
type Story = StoryObj<InputComponent>;
|
|
54
|
-
|
|
55
|
-
export const Gallery: Story = {
|
|
56
|
-
name: 'Gallery',
|
|
57
|
-
render: (args: any) => ({
|
|
58
|
-
props: args,
|
|
59
|
-
template: `
|
|
60
|
-
<al-input
|
|
61
|
-
[label]="label"
|
|
62
|
-
[placeholder]="placeholder"
|
|
63
|
-
[value]="value"
|
|
64
|
-
[formControlName]="formControlName"
|
|
65
|
-
[type]="type"
|
|
66
|
-
[disabled]="disabled"
|
|
67
|
-
[helperText]="helperText"
|
|
68
|
-
[helperTextLabel]="helperTextLabel"
|
|
69
|
-
[leftIcon]="leftIcon"
|
|
70
|
-
[rightIcon]="rightIcon"
|
|
71
|
-
[dropDown]="dropDown"
|
|
72
|
-
[options]="options"
|
|
73
|
-
[size]="size"
|
|
74
|
-
[inputTypes]="inputTypes"
|
|
75
|
-
(valueChange)="value = $event"
|
|
76
|
-
></al-input>
|
|
77
|
-
`,
|
|
78
|
-
}),
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const FullMatrix: Story = {
|
|
82
|
-
render: () => ({
|
|
83
|
-
props: {
|
|
84
|
-
categories: [
|
|
85
|
-
{ name: 'Primary Input', value: 'primary' },
|
|
86
|
-
{ name: 'Disabled State', value: 'disabled' },
|
|
87
|
-
{ name: 'Success State', value: 'success' },
|
|
88
|
-
{ name: 'Warn State', value: 'warn' },
|
|
89
|
-
{ name: 'Plain Input', value: 'plain' }
|
|
90
|
-
],
|
|
91
|
-
sizes: ['header', 'xs', 'small', 'base', 'large'],
|
|
92
|
-
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
93
|
-
},
|
|
94
|
-
template: `
|
|
95
|
-
<div style="display: flex; flex-direction: column; gap: 48px;">
|
|
96
|
-
<div *ngFor="let size of sizes">
|
|
97
|
-
<h3 style="margin-bottom: 24px; font-size: 20px; font-weight: 600;">{{ size | titlecase }} Input Fields</h3>
|
|
98
|
-
<div style="display: flex; flex-direction: row; gap: 24px; align-items: flex-start;">
|
|
99
|
-
<div *ngFor="let inputType of categories">
|
|
100
|
-
<h4 style="margin-bottom: 16px; font-size: 16px; font-weight: 500;">{{ inputType.name }}</h4>
|
|
101
|
-
<!-- Default state -->
|
|
102
|
-
<al-input
|
|
103
|
-
[label]="'Placeholder text'"
|
|
104
|
-
[placeholder]="'Placeholder'"
|
|
105
|
-
[value]="''"
|
|
106
|
-
[type]="'text'"
|
|
107
|
-
[disabled]="false"
|
|
108
|
-
[helperText]="false"
|
|
109
|
-
[helperTextLabel]="'Helper text'"
|
|
110
|
-
[leftIcon]="'person'"
|
|
111
|
-
[rightIcon]="''"
|
|
112
|
-
[size]="size"
|
|
113
|
-
[inputTypes]="inputType.value"
|
|
114
|
-
[dropDown]="size === 'large'"
|
|
115
|
-
[options]="options"
|
|
116
|
-
></al-input>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
`,
|
|
122
|
-
}),
|
|
123
|
-
name: 'Full Variation Matrix',
|
|
124
|
-
};
|