@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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Component, computed, input, output } from '@angular/core';
|
|
2
|
+
import { AdsMainModalAction } from '../../../core/types';
|
|
3
|
+
import { MainModalComponent } from '../main-modal/main-modal.component';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'ads-information-modal',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [MainModalComponent],
|
|
9
|
+
templateUrl: './information-modal.component.html',
|
|
10
|
+
})
|
|
11
|
+
export class InformationModalComponent {
|
|
12
|
+
open = input<boolean>(false);
|
|
13
|
+
buttonsFullWidth = input<boolean>(false);
|
|
14
|
+
actionsAlign = input<'start' | 'center' | 'end'>('end');
|
|
15
|
+
|
|
16
|
+
title = input<string>('Information');
|
|
17
|
+
description = input<string>('This is an informational modal message.');
|
|
18
|
+
continueText = input<string>('Continue');
|
|
19
|
+
|
|
20
|
+
closeOnBackdrop = input<boolean>(true);
|
|
21
|
+
closeOnEsc = input<boolean>(true);
|
|
22
|
+
|
|
23
|
+
closed = output<void>();
|
|
24
|
+
continue = output<void>();
|
|
25
|
+
|
|
26
|
+
actions = computed<AdsMainModalAction[]>(() => [
|
|
27
|
+
{
|
|
28
|
+
id: 'information-continue',
|
|
29
|
+
text: this.continueText(),
|
|
30
|
+
variant: 'primary',
|
|
31
|
+
color: 'green',
|
|
32
|
+
callback: () => this.continue.emit(),
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@if (open()) {
|
|
2
|
+
<div
|
|
3
|
+
animate.enter="fade-in"
|
|
4
|
+
animate.leave="fade-out"
|
|
5
|
+
class="fixed inset-0 z-50 flex items-center justify-center bg-black/15"
|
|
6
|
+
(click)="onBackdropClick()"
|
|
7
|
+
>
|
|
8
|
+
<section
|
|
9
|
+
class="flex w-full flex-col overflow-hidden rounded-[10px] bg-white text-green-base p-9"
|
|
10
|
+
[style.width]="width()"
|
|
11
|
+
[style.min-height]="'10vh'"
|
|
12
|
+
[style.max-height]="'80vh'"
|
|
13
|
+
role="dialog"
|
|
14
|
+
aria-modal="true"
|
|
15
|
+
[attr.aria-label]="title() || 'Main modal'"
|
|
16
|
+
(click)="$event.stopPropagation()"
|
|
17
|
+
>
|
|
18
|
+
<header class="flex items-start justify-between gap-4 min-h-10 h-fit">
|
|
19
|
+
<div class="min-w-0 h-full">
|
|
20
|
+
@if (title()) {
|
|
21
|
+
<h2
|
|
22
|
+
class="text-[1.62rem] font-semibold leading-tight text-green-base mb-1"
|
|
23
|
+
>
|
|
24
|
+
{{ title() }}
|
|
25
|
+
</h2>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@if (subtitle()) {
|
|
29
|
+
<p class="text-[14px] text-green-base m-0 mb-0">
|
|
30
|
+
{{ subtitle() }}
|
|
31
|
+
</p>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
<ng-content select="[ads-main-modal-header-extra]" />
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
@if (showCloseButton()) {
|
|
38
|
+
<button
|
|
39
|
+
type="button"
|
|
40
|
+
class="border-0 inline-flex h-10 w-10 items-center justify-center rounded-full text-green-base transition-colors bg-transparent cursor-pointer hover:text-green-2"
|
|
41
|
+
aria-label="Cerrar modal"
|
|
42
|
+
(click)="onCloseButtonClick()"
|
|
43
|
+
>
|
|
44
|
+
<ads-icon iconName="error" [size]="16" />
|
|
45
|
+
</button>
|
|
46
|
+
}
|
|
47
|
+
</header>
|
|
48
|
+
|
|
49
|
+
<div class="flex-1 overflow-y-auto">
|
|
50
|
+
<ng-content />
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<footer
|
|
54
|
+
[class]="
|
|
55
|
+
'w-full flex flex-wrap items-center gap-6.5 ' + actionsJustifyClass()
|
|
56
|
+
"
|
|
57
|
+
>
|
|
58
|
+
<ng-content select="[ads-main-modal-footer]" />
|
|
59
|
+
|
|
60
|
+
@if (actions().length > 0) {
|
|
61
|
+
<div
|
|
62
|
+
[class]="
|
|
63
|
+
'w-full flex items-center gap-6.5 ' + actionsJustifyClass()
|
|
64
|
+
"
|
|
65
|
+
>
|
|
66
|
+
@for (action of actions(); track actionTrackBy($index, action)) {
|
|
67
|
+
<button
|
|
68
|
+
ads-button
|
|
69
|
+
type="button"
|
|
70
|
+
[variant]="action.variant || 'primary'"
|
|
71
|
+
[color]="action.color || 'green'"
|
|
72
|
+
[buttonType]="action.buttonType || 'button'"
|
|
73
|
+
[disabled]="action.disabled || false"
|
|
74
|
+
(click)="onActionClick(action)"
|
|
75
|
+
[fullWidth]="buttonsFullWidth()"
|
|
76
|
+
>
|
|
77
|
+
{{ action.text }}
|
|
78
|
+
</button>
|
|
79
|
+
}
|
|
80
|
+
</div>
|
|
81
|
+
}
|
|
82
|
+
</footer>
|
|
83
|
+
</section>
|
|
84
|
+
</div>
|
|
85
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { ButtonComponent } from '../../button/button.component';
|
|
4
|
+
import { InputDatepickerComponent } from '../../input-datepicker/input-datepicker.component';
|
|
5
|
+
import { InputComponent } from '../../input/input.component';
|
|
6
|
+
import { SingleSelectorComponent } from '../../selectors/single-selector/single-selector.component';
|
|
7
|
+
import { MainModalComponent } from './main-modal.component';
|
|
8
|
+
import {
|
|
9
|
+
AdsMainModalAction,
|
|
10
|
+
AdsSingleSelectorOption,
|
|
11
|
+
} from '../../../core/types';
|
|
12
|
+
|
|
13
|
+
const countryOptions: AdsSingleSelectorOption[] = [
|
|
14
|
+
{ label: 'Mexico', value: 'mx' },
|
|
15
|
+
{ label: 'Colombia', value: 'co' },
|
|
16
|
+
{ label: 'Argentina', value: 'ar' },
|
|
17
|
+
{ label: 'Chile', value: 'cl' },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const meta: Meta<MainModalComponent> = {
|
|
21
|
+
title: 'Components/Modals/Main Modal',
|
|
22
|
+
component: MainModalComponent,
|
|
23
|
+
args: {
|
|
24
|
+
open: true,
|
|
25
|
+
title: 'Title text',
|
|
26
|
+
subtitle: 'Description',
|
|
27
|
+
width: '60%',
|
|
28
|
+
actionsAlign: 'end',
|
|
29
|
+
buttonsFullWidth: false,
|
|
30
|
+
},
|
|
31
|
+
argTypes: {
|
|
32
|
+
open: { control: 'boolean' },
|
|
33
|
+
title: { control: 'text' },
|
|
34
|
+
subtitle: { control: 'text' },
|
|
35
|
+
width: { control: 'text' },
|
|
36
|
+
actionsAlign: { control: 'select', options: ['start', 'center', 'end'] },
|
|
37
|
+
buttonsFullWidth: { control: 'boolean' },
|
|
38
|
+
},
|
|
39
|
+
render: (args) => {
|
|
40
|
+
const form = new FormGroup({
|
|
41
|
+
practiceName: new FormControl('Eastegate Acupuncture'),
|
|
42
|
+
npiNumber: new FormControl('1234566'),
|
|
43
|
+
country: new FormControl<string | number | null>(null),
|
|
44
|
+
appointmentDate: new FormControl(''),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
moduleMetadata: {
|
|
49
|
+
imports: [
|
|
50
|
+
ReactiveFormsModule,
|
|
51
|
+
ButtonComponent,
|
|
52
|
+
InputComponent,
|
|
53
|
+
SingleSelectorComponent,
|
|
54
|
+
InputDatepickerComponent,
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
...args,
|
|
59
|
+
form,
|
|
60
|
+
countryOptions,
|
|
61
|
+
closeModal: () => {
|
|
62
|
+
args.open = false;
|
|
63
|
+
},
|
|
64
|
+
openModal: () => {
|
|
65
|
+
args.open = true;
|
|
66
|
+
},
|
|
67
|
+
modalActions: [
|
|
68
|
+
{
|
|
69
|
+
id: 'save',
|
|
70
|
+
text: 'Button',
|
|
71
|
+
variant: 'primary',
|
|
72
|
+
color: 'green',
|
|
73
|
+
callback: () => {
|
|
74
|
+
args.open = false;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
] as AdsMainModalAction[],
|
|
78
|
+
},
|
|
79
|
+
template: `
|
|
80
|
+
<ads-main-modal
|
|
81
|
+
[open]="open"
|
|
82
|
+
[title]="title"
|
|
83
|
+
[subtitle]="subtitle"
|
|
84
|
+
[width]="width"
|
|
85
|
+
[actionsAlign]="actionsAlign"
|
|
86
|
+
[actions]="modalActions"
|
|
87
|
+
(closed)="closeModal()"
|
|
88
|
+
[buttonsFullWidth]="buttonsFullWidth"
|
|
89
|
+
>
|
|
90
|
+
<form [formGroup]="form" class="grid gap-6 pt-4 md:grid-cols-2">
|
|
91
|
+
<ads-input
|
|
92
|
+
formControlName="practiceName"
|
|
93
|
+
[label]="'Practice Name*'"
|
|
94
|
+
[placeholder]="'Eastegate Acupuncture'"
|
|
95
|
+
[disabled]="true"
|
|
96
|
+
></ads-input>
|
|
97
|
+
|
|
98
|
+
<ads-input
|
|
99
|
+
formControlName="npiNumber"
|
|
100
|
+
[label]="'NPI Number*'"
|
|
101
|
+
[placeholder]="'1234566'"
|
|
102
|
+
[disabled]="true"
|
|
103
|
+
></ads-input>
|
|
104
|
+
|
|
105
|
+
<ads-single-selector
|
|
106
|
+
formControlName="country"
|
|
107
|
+
[label]="'Country*'"
|
|
108
|
+
[placeholder]="'Select a country'"
|
|
109
|
+
[options]="countryOptions"
|
|
110
|
+
></ads-single-selector>
|
|
111
|
+
|
|
112
|
+
<ads-input-datepicker
|
|
113
|
+
formControlName="appointmentDate"
|
|
114
|
+
[label]="'Appointment Date*'"
|
|
115
|
+
[datePickerPlaceholder]="'MM/DD/YYYY'"
|
|
116
|
+
></ads-input-datepicker>
|
|
117
|
+
</form>
|
|
118
|
+
</ads-main-modal>
|
|
119
|
+
`,
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export default meta;
|
|
125
|
+
type Story = StoryObj<MainModalComponent>;
|
|
126
|
+
|
|
127
|
+
export const Playground: Story = {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Component, HostListener, input, output } from '@angular/core';
|
|
2
|
+
import { ButtonComponent } from '../../button/button.component';
|
|
3
|
+
import {
|
|
4
|
+
AdsButtonColor,
|
|
5
|
+
AdsButtonType,
|
|
6
|
+
AdsButtonVariant,
|
|
7
|
+
AdsMainModalAction,
|
|
8
|
+
AdsMainModalActionsAlign,
|
|
9
|
+
} from '../../../core/types';
|
|
10
|
+
import { IconComponent } from '../../icon/icon.component';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'ads-main-modal',
|
|
14
|
+
standalone: true,
|
|
15
|
+
imports: [ButtonComponent, IconComponent],
|
|
16
|
+
templateUrl: './main-modal.component.html',
|
|
17
|
+
})
|
|
18
|
+
export class MainModalComponent {
|
|
19
|
+
open = input<boolean>(false);
|
|
20
|
+
title = input<string>('');
|
|
21
|
+
subtitle = input<string>('');
|
|
22
|
+
|
|
23
|
+
width = input<string>('10rem');
|
|
24
|
+
buttonsFullWidth = input<boolean>(false);
|
|
25
|
+
|
|
26
|
+
closeOnBackdrop = input<boolean>(true);
|
|
27
|
+
closeOnEsc = input<boolean>(true);
|
|
28
|
+
showCloseButton = input<boolean>(true);
|
|
29
|
+
|
|
30
|
+
actions = input<AdsMainModalAction[]>([]);
|
|
31
|
+
actionsAlign = input<AdsMainModalActionsAlign>('end');
|
|
32
|
+
|
|
33
|
+
closed = output<void>();
|
|
34
|
+
|
|
35
|
+
@HostListener('document:keydown.escape')
|
|
36
|
+
onEscapeKey(): void {
|
|
37
|
+
if (this.open() && this.closeOnEsc()) {
|
|
38
|
+
this.requestClose();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onBackdropClick(): void {
|
|
43
|
+
if (this.closeOnBackdrop()) {
|
|
44
|
+
this.requestClose();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onCloseButtonClick(): void {
|
|
49
|
+
this.requestClose();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onActionClick(action: AdsMainModalAction): void {
|
|
53
|
+
if (action.disabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
action.callback?.();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
actionTrackBy(index: number, action: AdsMainModalAction): string {
|
|
61
|
+
if (action.id && action.id.trim().length > 0) {
|
|
62
|
+
return action.id;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return `${action.text}-${index}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
actionsJustifyClass(): string {
|
|
69
|
+
const align = this.actionsAlign();
|
|
70
|
+
|
|
71
|
+
if (align === 'start') {
|
|
72
|
+
return 'justify-start';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (align === 'center') {
|
|
76
|
+
return 'justify-center';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return 'justify-end';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private requestClose(): void {
|
|
83
|
+
this.closed.emit();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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-8"
|
|
19
|
+
>
|
|
20
|
+
{{ description() }}
|
|
21
|
+
</p>
|
|
22
|
+
</ads-main-modal>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { NotificationModalComponent } from './notification-modal.component';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<NotificationModalComponent> = {
|
|
5
|
+
title: 'Components/Modals/Notification Modal',
|
|
6
|
+
component: NotificationModalComponent,
|
|
7
|
+
args: {
|
|
8
|
+
open: true,
|
|
9
|
+
title: 'System Update: New Version is Live',
|
|
10
|
+
description:
|
|
11
|
+
'We have rolled out global enhancements to standardize your experience. Explore the latest updates to date ranges, pop-up logic, and performance across all modules.',
|
|
12
|
+
continueText: 'See last update',
|
|
13
|
+
buttonsFullWidth: false,
|
|
14
|
+
actionsAlign: 'start',
|
|
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
|
+
};
|
|
40
|
+
})(),
|
|
41
|
+
template: `
|
|
42
|
+
<ads-notification-modal
|
|
43
|
+
[open]="open"
|
|
44
|
+
[title]="title"
|
|
45
|
+
[description]="description"
|
|
46
|
+
[continueText]="continueText"
|
|
47
|
+
[buttonsFullWidth]="buttonsFullWidth"
|
|
48
|
+
[actionsAlign]="actionsAlign"
|
|
49
|
+
(closed)="closeModal()"
|
|
50
|
+
(continue)="closeModal()"
|
|
51
|
+
></ads-notification-modal>
|
|
52
|
+
`,
|
|
53
|
+
}),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default meta;
|
|
57
|
+
type Story = StoryObj<NotificationModalComponent>;
|
|
58
|
+
|
|
59
|
+
export const Playground: Story = {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, computed, input, output } from '@angular/core';
|
|
2
|
+
import { AdsMainModalAction } from '../../../core/types';
|
|
3
|
+
import { MainModalComponent } from '../main-modal/main-modal.component';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'ads-notification-modal',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [MainModalComponent],
|
|
9
|
+
templateUrl: './notification-modal.component.html',
|
|
10
|
+
})
|
|
11
|
+
export class NotificationModalComponent {
|
|
12
|
+
open = input<boolean>(false);
|
|
13
|
+
buttonsFullWidth = input<boolean>(false);
|
|
14
|
+
actionsAlign = input<'start' | 'center' | 'end'>('end');
|
|
15
|
+
|
|
16
|
+
title = input<string>('System Update: New Version is Live');
|
|
17
|
+
description = input<string>(
|
|
18
|
+
'We have rolled out global enhancements to standardize your experience.',
|
|
19
|
+
);
|
|
20
|
+
continueText = input<string>('See last update');
|
|
21
|
+
|
|
22
|
+
closeOnBackdrop = input<boolean>(true);
|
|
23
|
+
closeOnEsc = input<boolean>(true);
|
|
24
|
+
|
|
25
|
+
closed = output<void>();
|
|
26
|
+
continue = output<void>();
|
|
27
|
+
|
|
28
|
+
actions = computed<AdsMainModalAction[]>(() => [
|
|
29
|
+
{
|
|
30
|
+
id: 'notification-continue',
|
|
31
|
+
text: this.continueText(),
|
|
32
|
+
variant: 'secondary',
|
|
33
|
+
color: 'green',
|
|
34
|
+
callback: () => this.continue.emit(),
|
|
35
|
+
},
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<div class="flex w-full flex-col">
|
|
2
|
+
<ads-label
|
|
3
|
+
[text]="label()"
|
|
4
|
+
[iconName]="labelIconName()"
|
|
5
|
+
(iconClicked)="onLabelClicked()"
|
|
6
|
+
></ads-label>
|
|
7
|
+
|
|
8
|
+
<nz-select
|
|
9
|
+
[nzMaxTagCount]="0"
|
|
10
|
+
class="w-full"
|
|
11
|
+
nzMode="multiple"
|
|
12
|
+
[ngModel]="currentValue()"
|
|
13
|
+
[nzPlaceHolder]="placeholder()"
|
|
14
|
+
[nzShowSearch]="true"
|
|
15
|
+
[nzAllowClear]="allowClear()"
|
|
16
|
+
[nzDisabled]="isDisabled()"
|
|
17
|
+
[nzLoading]="isLoading()"
|
|
18
|
+
[nzFilterOption]="filterOption"
|
|
19
|
+
(ngModelChange)="onSelectionChange($event)"
|
|
20
|
+
(nzBlur)="onBlur()"
|
|
21
|
+
[nzMaxTagPlaceholder]="tagPlaceHolder"
|
|
22
|
+
[nzStatus]="errorMessage() ? 'error' : ''"
|
|
23
|
+
>
|
|
24
|
+
@for (option of resolvedOptions(); track $index) {
|
|
25
|
+
@if (isOptionGroup(option)) {
|
|
26
|
+
<nz-optgroup [nzLabel]="option.label">
|
|
27
|
+
@for (item of option.children; track item.value) {
|
|
28
|
+
<nz-option
|
|
29
|
+
[nzValue]="item.value"
|
|
30
|
+
[nzLabel]="item.label"
|
|
31
|
+
[nzDisabled]="item.disabled"
|
|
32
|
+
></nz-option>
|
|
33
|
+
}
|
|
34
|
+
</nz-optgroup>
|
|
35
|
+
} @else {
|
|
36
|
+
<nz-option
|
|
37
|
+
[nzValue]="option.value"
|
|
38
|
+
[nzLabel]="option.label"
|
|
39
|
+
[nzDisabled]="option.disabled"
|
|
40
|
+
></nz-option>
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</nz-select>
|
|
44
|
+
<ng-template #tagPlaceHolder let-selectedList>
|
|
45
|
+
{{ selectedItemsSummary(selectedList.length) }}
|
|
46
|
+
</ng-template>
|
|
47
|
+
<ads-error-message
|
|
48
|
+
[hasError]="!!errorMessage()"
|
|
49
|
+
[errorMessage]="errorMessage()"
|
|
50
|
+
></ads-error-message>
|
|
51
|
+
</div>
|