@sarasanalytics-com/design-system 0.0.3

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.
Files changed (136) hide show
  1. package/.editorconfig +16 -0
  2. package/.eslintrc.json +22 -0
  3. package/.storybook/main.ts +21 -0
  4. package/.storybook/manager.ts +17 -0
  5. package/.storybook/preview-head.html +5 -0
  6. package/.storybook/preview.ts +65 -0
  7. package/.storybook/tsconfig.doc.json +10 -0
  8. package/.storybook/tsconfig.json +11 -0
  9. package/.storybook/typings.d.ts +4 -0
  10. package/.vscode/extensions.json +7 -0
  11. package/.vscode/launch.json +20 -0
  12. package/.vscode/settings.json +13 -0
  13. package/.vscode/tasks.json +42 -0
  14. package/README.md +27 -0
  15. package/angular.json +189 -0
  16. package/build-storybook.log +39 -0
  17. package/documentation.json +0 -0
  18. package/package.json +74 -0
  19. package/projects/component-library/README.md +24 -0
  20. package/projects/component-library/ng-package.json +8 -0
  21. package/projects/component-library/package.json +12 -0
  22. package/projects/component-library/src/interfaces/avatar-interface.ts +6 -0
  23. package/projects/component-library/src/interfaces/button-interface.ts +12 -0
  24. package/projects/component-library/src/interfaces/chip-interface.ts +11 -0
  25. package/projects/component-library/src/interfaces/grid-interface.ts +24 -0
  26. package/projects/component-library/src/interfaces/select-interface.ts +19 -0
  27. package/projects/component-library/src/interfaces/tab-interface.ts +6 -0
  28. package/projects/component-library/src/lib/avatar/avatar.component.css +48 -0
  29. package/projects/component-library/src/lib/avatar/avatar.component.html +5 -0
  30. package/projects/component-library/src/lib/avatar/avatar.component.spec.ts +23 -0
  31. package/projects/component-library/src/lib/avatar/avatar.component.ts +50 -0
  32. package/projects/component-library/src/lib/button/button.component.css +145 -0
  33. package/projects/component-library/src/lib/button/button.component.html +11 -0
  34. package/projects/component-library/src/lib/button/button.component.spec.ts +23 -0
  35. package/projects/component-library/src/lib/button/button.component.ts +68 -0
  36. package/projects/component-library/src/lib/calendar-header/calendar-header.component.css +67 -0
  37. package/projects/component-library/src/lib/calendar-header/calendar-header.component.html +20 -0
  38. package/projects/component-library/src/lib/calendar-header/calendar-header.component.spec.ts +23 -0
  39. package/projects/component-library/src/lib/calendar-header/calendar-header.component.ts +196 -0
  40. package/projects/component-library/src/lib/chips/chips.component.css +129 -0
  41. package/projects/component-library/src/lib/chips/chips.component.html +17 -0
  42. package/projects/component-library/src/lib/chips/chips.component.spec.ts +23 -0
  43. package/projects/component-library/src/lib/chips/chips.component.ts +55 -0
  44. package/projects/component-library/src/lib/component-library.component.spec.ts +23 -0
  45. package/projects/component-library/src/lib/component-library.component.ts +16 -0
  46. package/projects/component-library/src/lib/component-library.service.spec.ts +16 -0
  47. package/projects/component-library/src/lib/component-library.service.ts +9 -0
  48. package/projects/component-library/src/lib/datepicker/datepicker.component.css +33 -0
  49. package/projects/component-library/src/lib/datepicker/datepicker.component.html +11 -0
  50. package/projects/component-library/src/lib/datepicker/datepicker.component.spec.ts +23 -0
  51. package/projects/component-library/src/lib/datepicker/datepicker.component.ts +37 -0
  52. package/projects/component-library/src/lib/form-select/form-select.component.css +156 -0
  53. package/projects/component-library/src/lib/form-select/form-select.component.html +38 -0
  54. package/projects/component-library/src/lib/form-select/form-select.component.spec.ts +23 -0
  55. package/projects/component-library/src/lib/form-select/form-select.component.ts +54 -0
  56. package/projects/component-library/src/lib/grid-cell/grid-cell.component.css +78 -0
  57. package/projects/component-library/src/lib/grid-cell/grid-cell.component.html +31 -0
  58. package/projects/component-library/src/lib/grid-cell/grid-cell.component.spec.ts +23 -0
  59. package/projects/component-library/src/lib/grid-cell/grid-cell.component.ts +89 -0
  60. package/projects/component-library/src/lib/header/header.component.css +62 -0
  61. package/projects/component-library/src/lib/header/header.component.html +23 -0
  62. package/projects/component-library/src/lib/header/header.component.spec.ts +23 -0
  63. package/projects/component-library/src/lib/header/header.component.ts +28 -0
  64. package/projects/component-library/src/lib/stepper/stepper.component.css +96 -0
  65. package/projects/component-library/src/lib/stepper/stepper.component.html +14 -0
  66. package/projects/component-library/src/lib/stepper/stepper.component.spec.ts +23 -0
  67. package/projects/component-library/src/lib/stepper/stepper.component.ts +61 -0
  68. package/projects/component-library/src/lib/tabs/tabs.component.css +100 -0
  69. package/projects/component-library/src/lib/tabs/tabs.component.html +16 -0
  70. package/projects/component-library/src/lib/tabs/tabs.component.spec.ts +23 -0
  71. package/projects/component-library/src/lib/tabs/tabs.component.ts +37 -0
  72. package/projects/component-library/src/lib/toast/toast.component.css +108 -0
  73. package/projects/component-library/src/lib/toast/toast.component.html +25 -0
  74. package/projects/component-library/src/lib/toast/toast.component.spec.ts +23 -0
  75. package/projects/component-library/src/lib/toast/toast.component.ts +37 -0
  76. package/projects/component-library/src/lib/tool-tip/tool-tip.component.css +139 -0
  77. package/projects/component-library/src/lib/tool-tip/tool-tip.component.html +31 -0
  78. package/projects/component-library/src/lib/tool-tip/tool-tip.component.spec.ts +23 -0
  79. package/projects/component-library/src/lib/tool-tip/tool-tip.component.ts +37 -0
  80. package/projects/component-library/src/public-api.ts +25 -0
  81. package/projects/component-library/tsconfig.lib.json +14 -0
  82. package/projects/component-library/tsconfig.lib.prod.json +10 -0
  83. package/projects/component-library/tsconfig.spec.json +14 -0
  84. package/src/Saras-logo.svg +15 -0
  85. package/src/app/app.component.css +13 -0
  86. package/src/app/app.component.html +77 -0
  87. package/src/app/app.component.spec.ts +29 -0
  88. package/src/app/app.component.ts +505 -0
  89. package/src/app/app.config.ts +27 -0
  90. package/src/app/app.routes.ts +3 -0
  91. package/src/app/data.ts +52 -0
  92. package/src/app/kitchen-sink/kitchen-sink.component.css +29 -0
  93. package/src/app/kitchen-sink/kitchen-sink.component.html +7 -0
  94. package/src/app/kitchen-sink/kitchen-sink.component.spec.ts +23 -0
  95. package/src/app/kitchen-sink/kitchen-sink.component.ts +92 -0
  96. package/src/assets/.gitkeep +0 -0
  97. package/src/assets/Chevron.svg +5 -0
  98. package/src/assets/Frame.svg +5 -0
  99. package/src/assets/Grid.svg +5 -0
  100. package/src/assets/Location.svg +5 -0
  101. package/src/assets/Mail.svg +5 -0
  102. package/src/assets/Person.svg +5 -0
  103. package/src/assets/Scan.svg +5 -0
  104. package/src/assets/Sources.svg +5 -0
  105. package/src/assets/arrow.svg +5 -0
  106. package/src/assets/avatar.svg +12 -0
  107. package/src/assets/checkmark.svg +5 -0
  108. package/src/assets/crossmark.svg +5 -0
  109. package/src/assets/dot.svg +5 -0
  110. package/src/assets/negativemark.svg +5 -0
  111. package/src/assets/pointer-polygon.svg +3 -0
  112. package/src/assets/tick-icon.svg +5 -0
  113. package/src/assets/tick.svg +8 -0
  114. package/src/assets/warningmark.svg +5 -0
  115. package/src/custom-theme.scss +37 -0
  116. package/src/favicon.ico +0 -0
  117. package/src/index.html +23 -0
  118. package/src/main.ts +6 -0
  119. package/src/stories/GettingStarted.mdx +233 -0
  120. package/src/stories/KitchenSink.stories.ts +86 -0
  121. package/src/stories/avatar.stories.ts +45 -0
  122. package/src/stories/chips.stories.ts +61 -0
  123. package/src/stories/custom-button.stories.ts +74 -0
  124. package/src/stories/datepicker.stories.ts +78 -0
  125. package/src/stories/gridCell.stories.ts +234 -0
  126. package/src/stories/header.stories.ts +61 -0
  127. package/src/stories/selectInput.stories.ts +158 -0
  128. package/src/stories/stepper.stories.ts +92 -0
  129. package/src/stories/tabs.stories.ts +97 -0
  130. package/src/stories/toast.stories.ts +54 -0
  131. package/src/stories/tool-tip.stories.ts +45 -0
  132. package/src/styles.css +204 -0
  133. package/src/svg.d.ts +1 -0
  134. package/tsconfig.app.json +14 -0
  135. package/tsconfig.json +42 -0
  136. package/tsconfig.spec.json +14 -0
@@ -0,0 +1,96 @@
1
+ .stepper {
2
+ display: flex;
3
+ width: max-content;
4
+ justify-content: center;
5
+ align-items: center;
6
+ font-family: var(--font);
7
+ }
8
+
9
+ .active {
10
+ --main-bg: var(--primary-500);
11
+ --main-line: var(--primary-500);
12
+ }
13
+
14
+ .disabled {
15
+ --main-bg: var(--grey-100);
16
+ --main-line: var(--grey-50);
17
+ }
18
+
19
+ .done {
20
+ --bg-line: var(--main-line);
21
+ --bg: var(--main-bg);
22
+ --border: none;
23
+ }
24
+
25
+ .default {
26
+ --bg-line: var(--grey-50);
27
+ --bg: var(--grey-100);
28
+ --border: 4px solid white;
29
+ }
30
+
31
+ .latest {
32
+ --bg: white;
33
+ --border: 4px solid var(--main-bg);
34
+ }
35
+
36
+ .steps {
37
+ display: flex;
38
+ justify-content: center;
39
+ align-items: center;
40
+ position: relative;
41
+ }
42
+
43
+ .line {
44
+ width: 140px;
45
+ height: 2px;
46
+ background-color: var(--bg-line);
47
+ transition: 0.25s;
48
+ }
49
+
50
+ .label-wrapper {
51
+ width: 16px;
52
+ height: 16px;
53
+ height: fit-content;
54
+ border-radius: 16px;
55
+ background-color: var(--bg);
56
+ display: flex;
57
+ justify-content: center;
58
+ }
59
+
60
+ .step-label-icon {
61
+ display: flex;
62
+ justify-content: center;
63
+ width: 16px;
64
+ height: 16px;
65
+ border-radius: 16px;
66
+
67
+ mask-size: contain;
68
+ mask-position: center;
69
+
70
+ background-position: center;
71
+ background-color: white;
72
+ border: var(--border);
73
+ box-sizing: border-box;
74
+
75
+ font-size: 14px;
76
+ font-style: normal;
77
+ font-weight: 400;
78
+ line-height: 20px;
79
+ letter-spacing: 0.25px;
80
+ cursor: pointer;
81
+ }
82
+
83
+ .undone {
84
+ background-color: var(--grey-100);
85
+ }
86
+
87
+ .step-label-text {
88
+ color: var(--text-mediumemphasis, #697079);
89
+ position: absolute;
90
+ top: 20px;
91
+ cursor: pointer;
92
+ }
93
+
94
+ .step-hide {
95
+ display: none;
96
+ }
@@ -0,0 +1,14 @@
1
+ <div class="stepper {{isDisabled ? 'disabled' : 'active'}}">
2
+ <div class="steps" *ngFor="let label of stepLabels; let i = index">
3
+ <input id="stepper-{{uuid}}-{{i}}" (change)="update(i)" name="stepper-radio-{{uuid}}"
4
+ [checked]="i == latestStep ? true: false" class="step-hide" type="radio">
5
+ <div
6
+ class="label-wrapper {{i < latestStep ? 'done' : ''}} {{i > latestStep ? 'default' : ''}} {{i == latestStep ? 'latest' : ''}}">
7
+ <label [style]="i < latestStep ? tickIcon : ''" for="stepper-{{uuid}}-{{i}}"
8
+ class="step-label-icon {{i > latestStep ? 'undone' : ''}}">
9
+ </label>
10
+ <label for="stepper-{{uuid}}-{{i}}" class="step-label-text">{{label.name}}</label>
11
+ </div>
12
+ <div *ngIf=" i !=stepLabels.length-1" class="line {{i < latestStep ? 'done' : 'default'}}"></div>
13
+ </div>
14
+ </div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { StepperComponent } from './stepper.component';
4
+
5
+ describe('StepperComponent', () => {
6
+ let component: StepperComponent;
7
+ let fixture: ComponentFixture<StepperComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [StepperComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(StepperComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,61 @@
1
+ import { Component, EventEmitter, Input } from '@angular/core';
2
+ import { FieldType, FieldTypeConfig } from '@ngx-formly/core';
3
+ import { NgFor, NgIf } from '@angular/common';
4
+ import { Output } from '@angular/core';
5
+
6
+ let nextId = 0; // used to give unique ids to inputs used in html
7
+
8
+ @Component({
9
+ selector: 'sa-stepper',
10
+ standalone: true,
11
+ imports: [NgFor, NgIf],
12
+ templateUrl: './stepper.component.html',
13
+ styleUrl: './stepper.component.css'
14
+ })
15
+ export class StepperComponent extends FieldType<FieldTypeConfig> {
16
+ @Input() latestStep: number = -1;
17
+ @Input() editable: boolean = true;
18
+ @Input() stepLabels: any;
19
+ @Input() doneIcon: string;
20
+
21
+ @Output() stepped = new EventEmitter;
22
+
23
+ uuid: number = nextId++;
24
+
25
+ isDisabled: boolean = false;
26
+
27
+ tickIcon = {};
28
+
29
+ // {
30
+ // '-webkit-mask-image': `url(${this.ImagePath})`,
31
+ // 'mask-image': `url(${this.ImagePath})`,
32
+ // }
33
+
34
+ ngOnInit() {
35
+ if (this.field.props) {
36
+ this.stepLabels = this.field.props.options;
37
+ this.editable = this.field.props['params'].editable;
38
+ this.latestStep = this.model[`${this.key}`] ? this.model[`${this.key}`].id : -1;
39
+ this.doneIcon = this.field.props['params'].doneIcon;
40
+
41
+ this.isDisabled = this.field.props.disabled!;
42
+ }
43
+ console.log(this.doneIcon);
44
+ this.tickIcon = {
45
+ '-webkit-mask-image': `url(${this.doneIcon})`,
46
+ 'mask-image': `url(${this.doneIcon})`
47
+ };
48
+ }
49
+
50
+ update(chosen: number) {
51
+ if (!this.editable || this.field.props?.disabled) return;
52
+ this.latestStep = chosen;
53
+ if (!this.formControl) {
54
+ this.stepped.emit(this.latestStep);
55
+ return;
56
+ }
57
+ this.formControl.setValue({
58
+ id: this.latestStep
59
+ });
60
+ }
61
+ }
@@ -0,0 +1,100 @@
1
+ .box {
2
+ --bg: var(--grey-50);
3
+ --tab-bg: white;
4
+ --border: none;
5
+ --tab-border: none;
6
+ --tab-border-radius: 2px;
7
+ --icon-color: var(--text-mediumemphasis);
8
+ }
9
+
10
+ .inline {
11
+ --bg: white;
12
+ --tab-bg: white;
13
+ --border: 1px solid var(--grey-50, #E9EAEB);
14
+ --tab-border: var(--primary-500, #1B77E4);
15
+ --tab-border-radius: none;
16
+ --icon-color: var(--text-mediumemphasis);
17
+ }
18
+
19
+ .tab-wrapper {
20
+ width: max-content;
21
+ padding: var(--small-8px, 8px);
22
+ background-color: var(--bg);
23
+ border-radius: var(--Small-4px, 4px);
24
+ }
25
+
26
+ .tabs {
27
+ display: flex;
28
+ height: 42px;
29
+ gap: var(--small-8px, 8px);
30
+ font-family: var(--font);
31
+ border-bottom: var(--border);
32
+ }
33
+
34
+ .tab-item {
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
38
+ gap: var(--small-8px, 8px);
39
+ }
40
+
41
+ .tab-label {
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ gap: var(--small-4px, 4px);
46
+ padding: var(--small-8px, 8px) var(--small-12px, 12px);
47
+ border-bottom: none;
48
+ transition: 0.1s;
49
+
50
+ font-size: 14px;
51
+ font-style: normal;
52
+ font-weight: 500;
53
+ line-height: 20px;
54
+ letter-spacing: 0.1px;
55
+ color: var(--text-mediumemphasis);
56
+ cursor: pointer;
57
+ }
58
+
59
+ .tab-checks {
60
+ display: none;
61
+ }
62
+
63
+ .tab-checks:checked+label {
64
+ background-color: var(--tab-bg);
65
+ border-bottom: 2px solid var(--tab-border);
66
+ border-radius: var(--tab-border-radius);
67
+ color: var(--primary-500);
68
+ --icon-color: var(--primary-500)
69
+ }
70
+
71
+ .tab-checks:checked+label .badge {
72
+ width: auto;
73
+ height: auto;
74
+ padding: var(--Small-4px, 4px) var(--Small-12px, 12px);
75
+ border-radius: 16px;
76
+ font-size: 12px;
77
+ font-style: normal;
78
+ font-weight: 500;
79
+ line-height: 16px;
80
+ letter-spacing: 0.5px;
81
+ }
82
+
83
+ .badge {
84
+ width: var(--small-8px);
85
+ height: var(--small-8px);
86
+ border-radius: var(--small-8px);
87
+ background-color: var(--secondary-500, #FE8235);
88
+ color: white;
89
+ margin-left: var(--small-4px);
90
+ overflow: hidden;
91
+ transition: 0.25s;
92
+ font-size: 0;
93
+ }
94
+
95
+ .svg-icon {
96
+ height: 16px;
97
+ width: 16px;
98
+ mask-size: contain;
99
+ background-color: var(--icon-color);
100
+ }
@@ -0,0 +1,16 @@
1
+ <div class="tab-wrapper {{type}}">
2
+ <div class="tabs">
3
+ <div *ngFor="let item of tabs, let i = index" class="tab-item">
4
+ <input [checked]="(defaultTab == i) ? true : false" [value]="i" (change)="tabChange($event)"
5
+ id="tab-check-{{i}}-{{uuid}}" class="tab-checks" type="radio" name="tab-checkbox-{{uuid}}">
6
+ <label for="tab-check-{{i}}-{{uuid}}" class="tab-label">
7
+ <div *ngIf="item.iconPosition == 'left' || item.iconPosition == 'both'" class="svg-icon" [style]="svgStyle[i]">
8
+ </div>
9
+ {{item.tabName}}
10
+ <div *ngIf="item.iconPosition == 'right' || item.iconPosition == 'both'" class="svg-icon" [style]="svgStyle[i]">
11
+ </div>
12
+ <div class="badge" *ngIf="item.badgeContent">{{item.badgeContent}}</div>
13
+ </label>
14
+ </div>
15
+ </div>
16
+ </div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { TabsComponent } from './tabs.component';
4
+
5
+ describe('TabsComponent', () => {
6
+ let component: TabsComponent;
7
+ let fixture: ComponentFixture<TabsComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [TabsComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(TabsComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,37 @@
1
+ import { Component, EventEmitter, Input, Output } from '@angular/core';
2
+ import { TabInterface } from '../../interfaces/tab-interface';
3
+ import { NgFor } from '@angular/common';
4
+ import { NgIf } from '@angular/common';
5
+
6
+
7
+ let nextId = 0; // used to give unique ids to inputs used in html
8
+ @Component({
9
+ selector: 'sa-tabs',
10
+ standalone: true,
11
+ imports: [NgFor, NgIf],
12
+ templateUrl: './tabs.component.html',
13
+ styleUrl: './tabs.component.css'
14
+ })
15
+ export class TabsComponent {
16
+ @Input() tabs: TabInterface[];
17
+ @Input() type: string;
18
+ @Input() defaultTab: number;
19
+
20
+ @Output() tabChanged = new EventEmitter();
21
+
22
+
23
+ uuid: number = nextId++;
24
+ svgStyle: any = [];
25
+
26
+ ngOnChanges(): void {
27
+ this.svgStyle = this.tabs.map((item) => {
28
+ return {
29
+ '-webkit-mask-image': `url(${item.tabIcon})`,
30
+ 'mask-image': `url(${item.tabIcon})`,
31
+ }
32
+ })
33
+ }
34
+ tabChange(evt: any) {
35
+ this.tabChanged.emit(evt.target.value)
36
+ }
37
+ }
@@ -0,0 +1,108 @@
1
+ .toast {
2
+ display: flex;
3
+ width: max-content;
4
+ flex-direction: column;
5
+ justify-content: center;
6
+ align-items: center;
7
+ padding: var(--small-16px, 16px);
8
+ gap: var(--small-16px, 16px);
9
+ border-radius: var(--small-8px, 8px);
10
+ border: 1px solid var(--grey-50, #E9EAEB);
11
+ background: var(--structural-white, #FFF);
12
+ box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.05);
13
+ font-family: var(--font);
14
+ }
15
+
16
+ .cross {
17
+ cursor: pointer;
18
+ }
19
+
20
+ .heading {
21
+ width: 359px;
22
+ font-size: 16px;
23
+ font-style: normal;
24
+ font-weight: 600;
25
+ line-height: 24px;
26
+ letter-spacing: 0.15px;
27
+ color: var(--text-highemphasis, #1B1D20);
28
+ }
29
+
30
+ .toast-icon {
31
+ display: flex;
32
+ justify-content: center;
33
+ border-radius: 50%;
34
+ }
35
+
36
+ .positive {
37
+ box-shadow: 0 0 0 var(--small-4px, 4px) var(--semantic-success-50);
38
+ background-color: var(--semantic-success-50);
39
+ }
40
+
41
+ .negative {
42
+ box-shadow: 0 0 0 var(--small-4px, 4px) var(--semantic-error-50);
43
+ background-color: var(--semantic-error-50);
44
+ }
45
+
46
+ .tentative {
47
+ box-shadow: 0 0 0 var(--small-4px, 4px) var(--semantic-yellow-50);
48
+ background-color: var(--semantic-yellow-50);
49
+ }
50
+
51
+ .toast-icon img {
52
+ width: 24px;
53
+ height: 24px;
54
+ }
55
+
56
+ .subheading {
57
+ font-size: 16px;
58
+ font-style: normal;
59
+ font-weight: 400;
60
+ line-height: 24px;
61
+ letter-spacing: 0.5px;
62
+ color: var(--text-mediumemphasis, #697079);
63
+ }
64
+
65
+ .heading,
66
+ .subheading {
67
+ margin: 0;
68
+ }
69
+
70
+ .content {
71
+ display: flex;
72
+ justify-content: center;
73
+ align-items: flex-start;
74
+ gap: var(--small-12px, 12px);
75
+ }
76
+
77
+ .head-subhead {
78
+ justify-content: space-between;
79
+ display: flex;
80
+ flex-direction: column;
81
+ gap: var(--small-4px, 4px);
82
+ }
83
+
84
+ .controls {
85
+ width: 100%;
86
+ display: flex;
87
+ justify-content: flex-end;
88
+ align-items: center;
89
+ gap: var(--small-12px, 12px);
90
+ }
91
+
92
+ .progress-bar {
93
+ display: flex;
94
+ width: 100%;
95
+ }
96
+
97
+ .progress-done {
98
+ height: 3px;
99
+ background-color: var(--primary-500);
100
+ border-radius: 2px;
101
+ }
102
+
103
+ .progress-left {
104
+ height: 3px;
105
+ background-color: #C5C5C5;
106
+ border-top-right-radius: 2px;
107
+ border-bottom-right-radius: 2px;
108
+ }
@@ -0,0 +1,25 @@
1
+ <div class="toast">
2
+ <div class="content">
3
+ <div class="toast-icon {{status}}">
4
+ <img [src]="statusIcon" alt="">
5
+ </div>
6
+ <div class="head-subhead">
7
+ <p class="heading">{{heading}}</p>
8
+ <p class="subheading">{{subHeading}}</p>
9
+ </div>
10
+ <!-- <img class="cross" (click)="clicked(2)" [src]="crossmark" alt=""> -->
11
+ <mat-icon class="cross" (click)="clicked(2)">close</mat-icon>
12
+ </div>
13
+ <div class="controls">
14
+ <sa-button *ngIf="firstButtonName" (onClickEvent)="clicked(0)" [text]="firstButtonName" type="transparent"
15
+ size="medium" state="default">
16
+ </sa-button>
17
+ <sa-button *ngIf="secondButtonName" (onClickEvent)="clicked(1)" [text]="secondButtonName" type="outline"
18
+ size="medium" state="default">
19
+ </sa-button>
20
+ </div>
21
+ <div *ngIf="finishPercentage >= 0" class="progress-bar">
22
+ <div class="progress-done" [style.width]="finishPercentage+'%'"></div>
23
+ <div class="progress-left" [style.width]="100-finishPercentage+'%'"></div>
24
+ </div>
25
+ </div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { ToastComponent } from './toast.component';
4
+
5
+ describe('ToastComponent', () => {
6
+ let component: ToastComponent;
7
+ let fixture: ComponentFixture<ToastComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [ToastComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(ToastComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,37 @@
1
+ import { Component, EventEmitter, OnChanges } from '@angular/core';
2
+ import { ButtonComponent } from '../button/button.component';
3
+ import { Input } from '@angular/core';
4
+ import { Output } from '@angular/core';
5
+ import { MatIcon } from '@angular/material/icon';
6
+ import { NgIf } from '@angular/common';
7
+
8
+ @Component({
9
+ selector: 'sa-toast',
10
+ standalone: true,
11
+ imports: [ButtonComponent, MatIcon, NgIf],
12
+ templateUrl: './toast.component.html',
13
+ styleUrl: './toast.component.css'
14
+ })
15
+ export class ToastComponent implements OnChanges {
16
+ @Input() finishPercentage: number = -1;
17
+ @Input() heading: string;
18
+ @Input() subHeading: string;
19
+ @Input() statusIcon: string;
20
+ @Input() status: string;
21
+ @Input() firstButtonName: string;
22
+ @Input() secondButtonName: string;
23
+
24
+ @Output() firstButton = new EventEmitter();
25
+ @Output() secondButton = new EventEmitter();
26
+ @Output() closed = new EventEmitter();
27
+
28
+ ngOnChanges() {
29
+ if (this.finishPercentage > 100) this.finishPercentage = 100;
30
+ }
31
+
32
+ clicked(num: number) {
33
+ if (num == 0) this.firstButton.emit();
34
+ else if (num == 1) this.secondButton.emit();
35
+ else if (num == 2) this.closed.emit();
36
+ }
37
+ }