@aaamb/ngx-design-system 1.3.5 → 1.3.6
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/.editorconfig +17 -0
- package/.nvmrc +1 -0
- package/.postcssrc.json +5 -0
- package/.storybook/main.ts +20 -0
- package/.storybook/preview.ts +23 -0
- package/.storybook/storybook.css +1 -0
- package/.storybook/tsconfig.json +19 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/CHANGELOG.md +10 -0
- package/LOCAL_DEVELOPMENT.md +129 -0
- package/angular.json +74 -0
- package/bitbucket-pipelines.yml +41 -0
- package/iac/bin/app.ts +42 -0
- package/iac/cdk.json +82 -0
- package/iac/lib/config/environments.ts +19 -0
- package/iac/lib/config/types.ts +13 -0
- package/iac/lib/stacks/certificate-stack.ts +34 -0
- package/iac/lib/stacks/frontend-stack.ts +120 -0
- package/iac/lib/stacks/index.ts +2 -0
- package/iac/package-lock.json +726 -0
- package/iac/package.json +25 -0
- package/iac/tsconfig.json +24 -0
- package/ng-package.json +8 -0
- package/package.json +58 -14
- package/src/components/button/button-green.stories.ts +101 -0
- package/src/components/button/button-text.stories.ts +105 -0
- package/src/components/button/button-white.stories.ts +105 -0
- package/src/components/button/button.component.stories.ts +91 -0
- package/src/components/button/button.component.ts +93 -0
- package/src/components/checkbox/checkbox.component.html +30 -0
- package/src/components/checkbox/checkbox.component.stories.ts +183 -0
- package/src/components/checkbox/checkbox.component.ts +211 -0
- package/src/components/datepicker-selector/datepicker-selector.component.html +103 -0
- package/src/components/datepicker-selector/datepicker-selector.component.stories.ts +69 -0
- package/src/components/datepicker-selector/datepicker-selector.component.ts +287 -0
- package/src/components/error-message/error-message.component.html +3 -0
- package/src/components/error-message/error-message.component.ts +13 -0
- package/src/components/filter-button/filter-button.component.html +286 -0
- package/src/components/filter-button/filter-button.component.stories.ts +123 -0
- package/src/components/filter-button/filter-button.component.ts +582 -0
- package/src/components/icon/icon.component.ts +20 -0
- package/src/components/icon/icon.html +1333 -0
- package/src/components/icon/icon.stories.ts +49 -0
- package/src/components/icon/icons-list.stories.ts +42 -0
- package/src/components/input/input.component.stories.ts +101 -0
- package/src/components/input/input.component.ts +317 -0
- package/src/components/input/input.html +160 -0
- package/src/components/input-datepicker/input-datepicker.component.ts +356 -0
- package/src/components/input-datepicker/input-datepicker.html +69 -0
- package/src/components/input-datepicker/input-datepicker.stories.ts +99 -0
- package/src/components/input-rangepicker/input-rangepicker.component.ts +365 -0
- package/src/components/input-rangepicker/input-rangepicker.html +54 -0
- package/src/components/input-rangepicker/input-rangepicker.stories.ts +88 -0
- package/src/components/input-weekpicker/input-weekpicker.component.ts +417 -0
- package/src/components/input-weekpicker/input-weekpicker.html +54 -0
- package/src/components/input-weekpicker/input-weekpicker.stories.ts +103 -0
- package/src/components/label/label.component.html +20 -0
- package/src/components/label/label.component.ts +22 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.html +32 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.stories.ts +57 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.ts +48 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.html +118 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.stories.ts +93 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.ts +187 -0
- package/src/components/modals/help-modal/help-modal.component.html +32 -0
- package/src/components/modals/help-modal/help-modal.component.stories.ts +76 -0
- package/src/components/modals/help-modal/help-modal.component.ts +54 -0
- package/src/components/modals/information-modal/information-modal.component.html +24 -0
- package/src/components/modals/information-modal/information-modal.component.stories.ts +62 -0
- package/src/components/modals/information-modal/information-modal.component.ts +35 -0
- package/src/components/modals/main-modal/main-modal.component.html +85 -0
- package/src/components/modals/main-modal/main-modal.component.stories.ts +127 -0
- package/src/components/modals/main-modal/main-modal.component.ts +85 -0
- package/src/components/modals/notification-modal/notification-modal.component.html +22 -0
- package/src/components/modals/notification-modal/notification-modal.component.stories.ts +59 -0
- package/src/components/modals/notification-modal/notification-modal.component.ts +37 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.html +51 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.stories.ts +306 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.ts +308 -0
- package/src/components/selectors/single-selector/single-selector.component.html +46 -0
- package/src/components/selectors/single-selector/single-selector.component.stories.ts +294 -0
- package/src/components/selectors/single-selector/single-selector.component.ts +239 -0
- package/src/components/side-nav/side-nav.component.stories.ts +157 -0
- package/src/components/side-nav/side-nav.component.ts +306 -0
- package/src/components/snackbar/snackbar.component.ts +150 -0
- package/src/components/snackbar/snackbar.html +21 -0
- package/src/components/snackbar/snackbar.stories.ts +51 -0
- package/src/components/state/state.component.ts +30 -0
- package/src/components/state/state.html +13 -0
- package/src/components/state/state.stories.ts +74 -0
- package/src/components/table/table.component.html +441 -0
- package/src/components/table/table.component.scss +28 -0
- package/src/components/table/table.component.stories.ts +655 -0
- package/src/components/table/table.component.ts +475 -0
- package/src/components/tabs/tabs.component.stories.ts +114 -0
- package/src/components/tabs/tabs.component.ts +69 -0
- package/src/core/types.ts +486 -0
- package/src/public-api.ts +23 -0
- package/tsconfig.json +37 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +13 -0
- package/fesm2022/aaamb-ngx-design-system.mjs +0 -4024
- package/fesm2022/aaamb-ngx-design-system.mjs.map +0 -1
- package/styles/compiled.css +0 -2
- package/types/aaamb-ngx-design-system.d.ts +0 -1132
package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Component, computed, input, output } from '@angular/core';
|
|
2
|
+
import { AdsMainModalAction, AdsIconName } from '../../../core/types';
|
|
3
|
+
import { IconComponent } from '../../icon/icon.component';
|
|
4
|
+
import { MainModalComponent } from '../main-modal/main-modal.component';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'ads-delicate-confirmation-modal',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [MainModalComponent, IconComponent],
|
|
10
|
+
templateUrl: './delicate-confirmation-modal.component.html',
|
|
11
|
+
})
|
|
12
|
+
export class DelicateConfirmationModalComponent {
|
|
13
|
+
open = input<boolean>(false);
|
|
14
|
+
buttonsFullWidth = input<boolean>(false);
|
|
15
|
+
|
|
16
|
+
title = input<string>('Delete Task');
|
|
17
|
+
description = input<string>(
|
|
18
|
+
"Are you sure you want to delete this task?\nThis action can't be undone.",
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
iconName = input<AdsIconName>('warning');
|
|
22
|
+
cancelText = input<string>('Cancel');
|
|
23
|
+
confirmText = input<string>('Delete');
|
|
24
|
+
|
|
25
|
+
closeOnBackdrop = input<boolean>(true);
|
|
26
|
+
closeOnEsc = input<boolean>(true);
|
|
27
|
+
|
|
28
|
+
closed = output<void>();
|
|
29
|
+
cancel = output<void>();
|
|
30
|
+
confirm = output<void>();
|
|
31
|
+
|
|
32
|
+
actions = computed<AdsMainModalAction[]>(() => [
|
|
33
|
+
{
|
|
34
|
+
id: 'delicate-cancel',
|
|
35
|
+
text: this.cancelText(),
|
|
36
|
+
variant: 'primary',
|
|
37
|
+
color: 'white',
|
|
38
|
+
callback: () => this.cancel.emit(),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'delicate-confirm',
|
|
42
|
+
text: this.confirmText(),
|
|
43
|
+
variant: 'primary',
|
|
44
|
+
color: 'green',
|
|
45
|
+
callback: () => this.confirm.emit(),
|
|
46
|
+
},
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
@if (open()) {
|
|
2
|
+
<div
|
|
3
|
+
class="fixed inset-0 z-50"
|
|
4
|
+
(click)="onBackdropClick($event)"
|
|
5
|
+
animate.enter="fade-in"
|
|
6
|
+
animate.leave="fade-out"
|
|
7
|
+
>
|
|
8
|
+
<section
|
|
9
|
+
class="absolute overflow-hidden rounded-[0.8rem] bg-white-base shadow-[0px_1px_17px_-7px_rgba(128,128,128,1)]"
|
|
10
|
+
[style.top]="modalPositionStyles()['top']"
|
|
11
|
+
[style.right]="modalPositionStyles()['right']"
|
|
12
|
+
[style.bottom]="modalPositionStyles()['bottom']"
|
|
13
|
+
[style.left]="modalPositionStyles()['left']"
|
|
14
|
+
[style.width]="modalPositionStyles()['width']"
|
|
15
|
+
(click)="$event.stopPropagation()"
|
|
16
|
+
>
|
|
17
|
+
@if (!responseOpen()) {
|
|
18
|
+
<div
|
|
19
|
+
class="flex h-28 flex-col items-center justify-center bg-green-base px-6 text-center"
|
|
20
|
+
>
|
|
21
|
+
<h2 class="m-0 text-[1.4rem] font-semibold text-white-base">
|
|
22
|
+
{{ title() }}
|
|
23
|
+
</h2>
|
|
24
|
+
<p class="m-0 text-[0.9rem] text-white-base">{{ subtitle() }}</p>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<form
|
|
28
|
+
class="flex flex-col gap-2 p-8"
|
|
29
|
+
[formGroup]="form"
|
|
30
|
+
(ngSubmit)="submitFeedback()"
|
|
31
|
+
>
|
|
32
|
+
<ads-input
|
|
33
|
+
label="Subject*"
|
|
34
|
+
formControlName="subject"
|
|
35
|
+
placeholder="Enter subject"
|
|
36
|
+
inputType="text"
|
|
37
|
+
[hasError]="!!subjectError()"
|
|
38
|
+
[errorMessage]="subjectError()"
|
|
39
|
+
></ads-input>
|
|
40
|
+
|
|
41
|
+
<ads-single-selector
|
|
42
|
+
label="Category"
|
|
43
|
+
formControlName="category"
|
|
44
|
+
placeholder="Select a category"
|
|
45
|
+
[options]="categoryOptions()"
|
|
46
|
+
></ads-single-selector>
|
|
47
|
+
|
|
48
|
+
<ads-input
|
|
49
|
+
label="Description*"
|
|
50
|
+
formControlName="description"
|
|
51
|
+
placeholder="Enter description"
|
|
52
|
+
inputType="text_area"
|
|
53
|
+
[hasError]="!!descriptionError()"
|
|
54
|
+
[errorMessage]="descriptionError()"
|
|
55
|
+
></ads-input>
|
|
56
|
+
|
|
57
|
+
<div class="flex items-center justify-between">
|
|
58
|
+
<span class="text-xs text-neutral-disabled-text"
|
|
59
|
+
>200 characters max.</span
|
|
60
|
+
>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<button
|
|
64
|
+
ads-button
|
|
65
|
+
type="submit"
|
|
66
|
+
variant="primary"
|
|
67
|
+
color="green"
|
|
68
|
+
[disabled]="form.invalid"
|
|
69
|
+
class="mt-2"
|
|
70
|
+
>
|
|
71
|
+
Submit
|
|
72
|
+
</button>
|
|
73
|
+
</form>
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@if (responseOpen()) {
|
|
77
|
+
<button
|
|
78
|
+
type="button"
|
|
79
|
+
class="absolute right-2 top-2 inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border-0 bg-transparent text-green-base hover:text-green-2"
|
|
80
|
+
(click)="closeModal()"
|
|
81
|
+
aria-label="Close"
|
|
82
|
+
>
|
|
83
|
+
<ads-icon iconName="error" [size]="16"></ads-icon>
|
|
84
|
+
</button>
|
|
85
|
+
|
|
86
|
+
<div class="flex flex-col items-center gap-2 px-12 py-8 text-center">
|
|
87
|
+
<div
|
|
88
|
+
class="inline-flex h-12 w-12 items-center justify-center rounded-full border-2 text-xl font-semibold"
|
|
89
|
+
[ngClass]="responseIconStyles().containerClass"
|
|
90
|
+
>
|
|
91
|
+
<ads-icon
|
|
92
|
+
[iconName]="responseIconStyles().iconName"
|
|
93
|
+
[size]="24"
|
|
94
|
+
></ads-icon>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<h3 class="m-0 text-[1.3rem] font-bold text-green-base">
|
|
98
|
+
{{ responseTitle() }}
|
|
99
|
+
</h3>
|
|
100
|
+
<p class="m-0 text-[0.8rem] text-[#3d3d3d]">
|
|
101
|
+
{{ responseDescription() }}
|
|
102
|
+
</p>
|
|
103
|
+
|
|
104
|
+
<button
|
|
105
|
+
ads-button
|
|
106
|
+
type="button"
|
|
107
|
+
variant="secondary"
|
|
108
|
+
color="text"
|
|
109
|
+
class="mt-2"
|
|
110
|
+
(click)="onResponseButtonClick()"
|
|
111
|
+
>
|
|
112
|
+
{{ responseButtonText() }}
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
}
|
|
116
|
+
</section>
|
|
117
|
+
</div>
|
|
118
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { FeedbackModalComponent } from './feedback-modal.component';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<FeedbackModalComponent> = {
|
|
5
|
+
title: 'Components/Modals/Feedback Modal',
|
|
6
|
+
component: FeedbackModalComponent,
|
|
7
|
+
args: {
|
|
8
|
+
open: true,
|
|
9
|
+
width: '30rem',
|
|
10
|
+
right: '1rem',
|
|
11
|
+
bottom: '7rem',
|
|
12
|
+
title: 'Feedback Submission',
|
|
13
|
+
subtitle: 'Use this form to share suggestions or report issues.',
|
|
14
|
+
responseOpen: false,
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
open: { control: 'boolean' },
|
|
18
|
+
width: { control: 'text' },
|
|
19
|
+
top: { control: 'text' },
|
|
20
|
+
right: { control: 'text' },
|
|
21
|
+
bottom: { control: 'text' },
|
|
22
|
+
left: { control: 'text' },
|
|
23
|
+
title: { control: 'text' },
|
|
24
|
+
subtitle: { control: 'text' },
|
|
25
|
+
responseOpen: { control: 'boolean' },
|
|
26
|
+
responseType: { control: 'select', options: ['success', 'error'] },
|
|
27
|
+
responseTitle: { control: 'text' },
|
|
28
|
+
responseDescription: { control: 'text' },
|
|
29
|
+
responseButtonText: { control: 'text' },
|
|
30
|
+
},
|
|
31
|
+
render: (args) => ({
|
|
32
|
+
props: (() => {
|
|
33
|
+
let modalOpen = args.open;
|
|
34
|
+
let showResponse = args.responseOpen;
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
...args,
|
|
38
|
+
get open() {
|
|
39
|
+
return modalOpen;
|
|
40
|
+
},
|
|
41
|
+
get responseOpen() {
|
|
42
|
+
return showResponse;
|
|
43
|
+
},
|
|
44
|
+
closeModal: () => {
|
|
45
|
+
modalOpen = false;
|
|
46
|
+
},
|
|
47
|
+
handleSubmit: () => {
|
|
48
|
+
showResponse = true;
|
|
49
|
+
},
|
|
50
|
+
handleResponseAction: () => {
|
|
51
|
+
showResponse = false;
|
|
52
|
+
modalOpen = true;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
})(),
|
|
56
|
+
template: `
|
|
57
|
+
<div class="relative h-136 w-full bg-[#f2f2f2]">
|
|
58
|
+
<ads-feedback-modal
|
|
59
|
+
[open]="open"
|
|
60
|
+
[width]="width"
|
|
61
|
+
[top]="top || null"
|
|
62
|
+
[right]="right || null"
|
|
63
|
+
[bottom]="bottom || null"
|
|
64
|
+
[left]="left || null"
|
|
65
|
+
[title]="title"
|
|
66
|
+
[subtitle]="subtitle"
|
|
67
|
+
[responseOpen]="responseOpen"
|
|
68
|
+
[responseType]="responseType"
|
|
69
|
+
[responseTitle]="responseTitle"
|
|
70
|
+
[responseDescription]="responseDescription"
|
|
71
|
+
[responseButtonText]="responseButtonText"
|
|
72
|
+
(closed)="closeModal()"
|
|
73
|
+
(submitted)="handleSubmit()"
|
|
74
|
+
(responseAction)="handleResponseAction()"
|
|
75
|
+
></ads-feedback-modal>
|
|
76
|
+
</div>
|
|
77
|
+
`,
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default meta;
|
|
82
|
+
type Story = StoryObj<FeedbackModalComponent>;
|
|
83
|
+
|
|
84
|
+
export const Playground: Story = {};
|
|
85
|
+
|
|
86
|
+
export const NextToLeftButton: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
open: true,
|
|
89
|
+
right: null,
|
|
90
|
+
left: '1rem',
|
|
91
|
+
bottom: '7rem',
|
|
92
|
+
},
|
|
93
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
Component,
|
|
4
|
+
computed,
|
|
5
|
+
effect,
|
|
6
|
+
input,
|
|
7
|
+
output,
|
|
8
|
+
signal,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
11
|
+
import {
|
|
12
|
+
AdsIconName,
|
|
13
|
+
AdsMainModalAction,
|
|
14
|
+
AdsSingleSelectorOption,
|
|
15
|
+
FeedbackPayload,
|
|
16
|
+
FeedbackResponseType,
|
|
17
|
+
ICONS,
|
|
18
|
+
} from '../../../core/types';
|
|
19
|
+
import { ButtonComponent } from '../../button/button.component';
|
|
20
|
+
import { IconComponent } from '../../icon/icon.component';
|
|
21
|
+
import { InputComponent } from '../../input/input.component';
|
|
22
|
+
import { SingleSelectorComponent } from '../../selectors/single-selector/single-selector.component';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'ads-feedback-modal',
|
|
26
|
+
standalone: true,
|
|
27
|
+
imports: [
|
|
28
|
+
CommonModule,
|
|
29
|
+
ReactiveFormsModule,
|
|
30
|
+
ButtonComponent,
|
|
31
|
+
IconComponent,
|
|
32
|
+
InputComponent,
|
|
33
|
+
SingleSelectorComponent,
|
|
34
|
+
],
|
|
35
|
+
templateUrl: './feedback-modal.component.html',
|
|
36
|
+
})
|
|
37
|
+
export class FeedbackModalComponent {
|
|
38
|
+
private readonly fb = new FormBuilder();
|
|
39
|
+
|
|
40
|
+
open = input<boolean>(false);
|
|
41
|
+
|
|
42
|
+
width = input<string>('30rem');
|
|
43
|
+
top = input<string | null>(null);
|
|
44
|
+
right = input<string | null>('1rem');
|
|
45
|
+
bottom = input<string | null>('7rem');
|
|
46
|
+
left = input<string | null>(null);
|
|
47
|
+
|
|
48
|
+
title = input<string>('Feedback Submission');
|
|
49
|
+
subtitle = input<string>(
|
|
50
|
+
'Use this form to share suggestions or report issues.',
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
categoryOptions = input<AdsSingleSelectorOption[]>([
|
|
54
|
+
{ value: 'feedback', label: 'Feedback' },
|
|
55
|
+
{ value: 'feature-request', label: 'Feature Request' },
|
|
56
|
+
{ value: 'bug', label: 'Bug' },
|
|
57
|
+
{ value: 'other', label: 'Other' },
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
responseOpen = input<boolean>(false);
|
|
61
|
+
responseType = input<FeedbackResponseType>('success');
|
|
62
|
+
responseTitle = input<string>('Feedback Sent Successfully');
|
|
63
|
+
responseDescription = input<string>(
|
|
64
|
+
'Thank you for your feedback. Our team will review it shortly.',
|
|
65
|
+
);
|
|
66
|
+
responseButtonText = input<string>('Submit another');
|
|
67
|
+
|
|
68
|
+
closed = output<void>();
|
|
69
|
+
submitted = output<FeedbackPayload>();
|
|
70
|
+
responseAction = output<void>();
|
|
71
|
+
|
|
72
|
+
form = this.fb.group({
|
|
73
|
+
subject: ['', [Validators.required, Validators.minLength(3)]],
|
|
74
|
+
category: [''],
|
|
75
|
+
description: [
|
|
76
|
+
'',
|
|
77
|
+
[
|
|
78
|
+
Validators.required,
|
|
79
|
+
Validators.minLength(10),
|
|
80
|
+
Validators.maxLength(200),
|
|
81
|
+
],
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
actions = computed<AdsMainModalAction[]>(() => []);
|
|
86
|
+
|
|
87
|
+
modalPositionStyles = computed(() => {
|
|
88
|
+
const styles: Record<string, string | null> = {
|
|
89
|
+
top: this.top(),
|
|
90
|
+
right: this.right(),
|
|
91
|
+
bottom: this.bottom(),
|
|
92
|
+
left: this.left(),
|
|
93
|
+
width: this.width(),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return styles;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
responseIconStyles = computed(() => {
|
|
100
|
+
if (this.responseType() === 'error') {
|
|
101
|
+
return {
|
|
102
|
+
containerClass: 'border-red-2 text-red-2',
|
|
103
|
+
iconName: ICONS.error as AdsIconName,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
containerClass: 'border-green-base text-green-base',
|
|
109
|
+
iconName: ICONS.check as AdsIconName,
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
constructor() {
|
|
114
|
+
effect(() => {
|
|
115
|
+
if (this.open()) {
|
|
116
|
+
this.form.markAsPristine();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
closeModal(): void {
|
|
122
|
+
this.closed.emit();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
onBackdropClick(event: MouseEvent): void {
|
|
126
|
+
if (event.target === event.currentTarget) {
|
|
127
|
+
this.closeModal();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
submitFeedback(): void {
|
|
132
|
+
if (this.form.invalid) {
|
|
133
|
+
this.form.markAllAsTouched();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this.submitted.emit({
|
|
138
|
+
subject: this.form.controls.subject.value ?? '',
|
|
139
|
+
category: this.form.controls.category.value ?? '',
|
|
140
|
+
description: this.form.controls.description.value ?? '',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onResponseButtonClick(): void {
|
|
145
|
+
this.responseAction.emit();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
subjectError(): string {
|
|
149
|
+
const control = this.form.controls.subject;
|
|
150
|
+
|
|
151
|
+
if (!control.touched && !control.dirty) {
|
|
152
|
+
return '';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (control.hasError('required')) {
|
|
156
|
+
return 'This field is required.';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (control.hasError('minlength')) {
|
|
160
|
+
return 'Minimum 3 characters.';
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return '';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
descriptionError(): string {
|
|
167
|
+
const control = this.form.controls.description;
|
|
168
|
+
|
|
169
|
+
if (!control.touched && !control.dirty) {
|
|
170
|
+
return '';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (control.hasError('required')) {
|
|
174
|
+
return 'This field is required.';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (control.hasError('minlength')) {
|
|
178
|
+
return 'Minimum 10 characters.';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (control.hasError('maxlength')) {
|
|
182
|
+
return 'Maximum 200 characters.';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return '';
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<ads-main-modal
|
|
2
|
+
[open]="open()"
|
|
3
|
+
width="35rem"
|
|
4
|
+
[actions]="actions()"
|
|
5
|
+
[closeOnBackdrop]="closeOnBackdrop()"
|
|
6
|
+
[closeOnEsc]="closeOnEsc()"
|
|
7
|
+
(closed)="closed.emit()"
|
|
8
|
+
[buttonsFullWidth]="buttonsFullWidth()"
|
|
9
|
+
[actionsAlign]="actionsAlign()"
|
|
10
|
+
>
|
|
11
|
+
<div ads-main-modal-header-extra class="flex items-center h-10 w-full">
|
|
12
|
+
<h2 class="m-0 text-[1.12rem] font-semibold leading-tight text-aqua-0">
|
|
13
|
+
{{ title() }}
|
|
14
|
+
</h2>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<p
|
|
18
|
+
class="m-0 whitespace-pre-line text-[1.03rem] leading-[1.45] text-green-base pt-6 pb-5"
|
|
19
|
+
>
|
|
20
|
+
{{ description() }}
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<div class="pb-8">
|
|
24
|
+
<ads-checkbox
|
|
25
|
+
[checked]="checkedState()"
|
|
26
|
+
[label]="checkboxLabel()"
|
|
27
|
+
labelPosition="right"
|
|
28
|
+
labelColor="green"
|
|
29
|
+
(checkedChange)="onCheckboxChange($event)"
|
|
30
|
+
></ads-checkbox>
|
|
31
|
+
</div>
|
|
32
|
+
</ads-main-modal>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { HelpModalComponent } from './help-modal.component';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<HelpModalComponent> = {
|
|
5
|
+
title: 'Components/Modals/Help Modal',
|
|
6
|
+
component: HelpModalComponent,
|
|
7
|
+
args: {
|
|
8
|
+
title: 'Filter: Video Tutorial Available',
|
|
9
|
+
description:
|
|
10
|
+
'Learn how this feature works with a visual walkthrough from our team. ',
|
|
11
|
+
checkboxLabel: 'Don’t show this again',
|
|
12
|
+
continueText: 'Access video',
|
|
13
|
+
actionsAlign: 'start',
|
|
14
|
+
open: true,
|
|
15
|
+
checkboxChecked: false,
|
|
16
|
+
buttonsFullWidth: false,
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
actionsAlign: { control: 'select', options: ['start', 'center', 'end'] },
|
|
20
|
+
title: { control: 'text' },
|
|
21
|
+
description: { control: 'text' },
|
|
22
|
+
checkboxLabel: { control: 'text' },
|
|
23
|
+
open: { control: 'boolean' },
|
|
24
|
+
checkboxChecked: { control: 'boolean' },
|
|
25
|
+
buttonsFullWidth: { control: 'boolean' },
|
|
26
|
+
},
|
|
27
|
+
render: (args) => ({
|
|
28
|
+
props: (() => {
|
|
29
|
+
let modalOpen = args.open;
|
|
30
|
+
let checked = args.checkboxChecked;
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
...args,
|
|
34
|
+
get open() {
|
|
35
|
+
return modalOpen;
|
|
36
|
+
},
|
|
37
|
+
set open(value: boolean) {
|
|
38
|
+
modalOpen = value;
|
|
39
|
+
},
|
|
40
|
+
get checkboxChecked() {
|
|
41
|
+
return checked;
|
|
42
|
+
},
|
|
43
|
+
set checkboxChecked(value: boolean) {
|
|
44
|
+
checked = value;
|
|
45
|
+
},
|
|
46
|
+
closeModal: () => {
|
|
47
|
+
modalOpen = false;
|
|
48
|
+
},
|
|
49
|
+
handleContinue: (value: boolean) => {
|
|
50
|
+
checked = value;
|
|
51
|
+
modalOpen = false;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
})(),
|
|
55
|
+
template: `
|
|
56
|
+
<ads-help-modal
|
|
57
|
+
[open]="open"
|
|
58
|
+
[title]="title"
|
|
59
|
+
[description]="description"
|
|
60
|
+
[checkboxLabel]="checkboxLabel"
|
|
61
|
+
[checkboxChecked]="checkboxChecked"
|
|
62
|
+
[buttonsFullWidth]="buttonsFullWidth"
|
|
63
|
+
[actionsAlign]="actionsAlign"
|
|
64
|
+
(closed)="closeModal()"
|
|
65
|
+
(continue)="handleContinue($event)"
|
|
66
|
+
(checkedChange)="checkboxChecked = $event"
|
|
67
|
+
[continueText]="continueText"
|
|
68
|
+
></ads-help-modal>
|
|
69
|
+
`,
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default meta;
|
|
74
|
+
type Story = StoryObj<HelpModalComponent>;
|
|
75
|
+
|
|
76
|
+
export const Playground: Story = {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Component, computed, effect, input, output, signal } from '@angular/core';
|
|
2
|
+
import { AdsMainModalAction } from '../../../core/types';
|
|
3
|
+
import { CheckboxComponent } from '../../checkbox/checkbox.component';
|
|
4
|
+
import { MainModalComponent } from '../main-modal/main-modal.component';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'ads-help-modal',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [MainModalComponent, CheckboxComponent],
|
|
10
|
+
templateUrl: './help-modal.component.html',
|
|
11
|
+
})
|
|
12
|
+
export class HelpModalComponent {
|
|
13
|
+
open = input<boolean>(false);
|
|
14
|
+
buttonsFullWidth = input<boolean>(false);
|
|
15
|
+
actionsAlign = input<'start' | 'center' | 'end'>('start');
|
|
16
|
+
continueText = input<string>('Continue');
|
|
17
|
+
|
|
18
|
+
title = input<string>('Help and Tips');
|
|
19
|
+
description = input<string>(
|
|
20
|
+
'Use this information to understand how to proceed with the next step.',
|
|
21
|
+
);
|
|
22
|
+
checkboxLabel = input<string>('I understand and want to continue');
|
|
23
|
+
checkboxChecked = input<boolean>(false);
|
|
24
|
+
|
|
25
|
+
closeOnBackdrop = input<boolean>(true);
|
|
26
|
+
closeOnEsc = input<boolean>(true);
|
|
27
|
+
|
|
28
|
+
closed = output<void>();
|
|
29
|
+
checkedChange = output<boolean>();
|
|
30
|
+
continue = output<boolean>();
|
|
31
|
+
|
|
32
|
+
checkedState = signal<boolean>(false);
|
|
33
|
+
|
|
34
|
+
actions = computed<AdsMainModalAction[]>(() => [
|
|
35
|
+
{
|
|
36
|
+
id: 'help-continue',
|
|
37
|
+
text: this.continueText(),
|
|
38
|
+
variant: 'secondary',
|
|
39
|
+
color: 'green',
|
|
40
|
+
callback: () => this.continue.emit(this.checkedState()),
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
constructor() {
|
|
45
|
+
effect(() => {
|
|
46
|
+
this.checkedState.set(this.checkboxChecked());
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onCheckboxChange(value: boolean): void {
|
|
51
|
+
this.checkedState.set(value);
|
|
52
|
+
this.checkedChange.emit(value);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<ads-main-modal
|
|
2
|
+
[open]="open()"
|
|
3
|
+
width="35rem"
|
|
4
|
+
[showCloseButton]="false"
|
|
5
|
+
[actionsAlign]="'center'"
|
|
6
|
+
[actions]="actions()"
|
|
7
|
+
[closeOnBackdrop]="closeOnBackdrop()"
|
|
8
|
+
[closeOnEsc]="closeOnEsc()"
|
|
9
|
+
(closed)="closed.emit()"
|
|
10
|
+
[buttonsFullWidth]="buttonsFullWidth()"
|
|
11
|
+
[actionsAlign]="actionsAlign()"
|
|
12
|
+
>
|
|
13
|
+
<div ads-main-modal-header-extra class="flex items-center h-full w-full">
|
|
14
|
+
<h2 class="m-0 text-[1.6rem] font-semibold leading-tight text-green-base">
|
|
15
|
+
{{ title() }}
|
|
16
|
+
</h2>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<p
|
|
20
|
+
class="m-0 whitespace-pre-line text-[15px] leading-6 text-green-base pt-4 pb-8"
|
|
21
|
+
>
|
|
22
|
+
{{ description() }}
|
|
23
|
+
</p>
|
|
24
|
+
</ads-main-modal>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { InformationModalComponent } from './information-modal.component';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<InformationModalComponent> = {
|
|
5
|
+
title: 'Components/Modals/Information Modal',
|
|
6
|
+
component: InformationModalComponent,
|
|
7
|
+
args: {
|
|
8
|
+
open: true,
|
|
9
|
+
title: 'Information Verified',
|
|
10
|
+
description:
|
|
11
|
+
'Your First Name, Last Name, and NPI code have been successfully confirmed.',
|
|
12
|
+
continueText: 'Continue',
|
|
13
|
+
buttonsFullWidth: false,
|
|
14
|
+
actionsAlign: 'end',
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
open: { control: 'boolean' },
|
|
18
|
+
title: { control: 'text' },
|
|
19
|
+
description: { control: 'text' },
|
|
20
|
+
continueText: { control: 'text' },
|
|
21
|
+
buttonsFullWidth: { control: 'boolean' },
|
|
22
|
+
actionsAlign: { control: 'select', options: ['start', 'center', 'end'] },
|
|
23
|
+
},
|
|
24
|
+
render: (args) => ({
|
|
25
|
+
props: (() => {
|
|
26
|
+
let modalOpen = args.open;
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
...args,
|
|
30
|
+
get open() {
|
|
31
|
+
return modalOpen;
|
|
32
|
+
},
|
|
33
|
+
set open(value: boolean) {
|
|
34
|
+
modalOpen = value;
|
|
35
|
+
},
|
|
36
|
+
closeModal: () => {
|
|
37
|
+
modalOpen = false;
|
|
38
|
+
},
|
|
39
|
+
openModal: () => {
|
|
40
|
+
modalOpen = true;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
})(),
|
|
44
|
+
template: `
|
|
45
|
+
<ads-information-modal
|
|
46
|
+
[open]="open"
|
|
47
|
+
[title]="title"
|
|
48
|
+
[description]="description"
|
|
49
|
+
[continueText]="continueText"
|
|
50
|
+
[buttonsFullWidth]="buttonsFullWidth"
|
|
51
|
+
(closed)="closeModal()"
|
|
52
|
+
(continue)="closeModal()"
|
|
53
|
+
[actionsAlign]="actionsAlign"
|
|
54
|
+
></ads-information-modal>
|
|
55
|
+
`,
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
60
|
+
type Story = StoryObj<InformationModalComponent>;
|
|
61
|
+
|
|
62
|
+
export const Playground: Story = {};
|