@sarasanalytics-com/design-system 0.0.7 → 0.0.9

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 (142) hide show
  1. package/ng-package.json +8 -0
  2. package/package.json +2 -15
  3. package/src/interfaces/avatar-interface.ts +6 -0
  4. package/src/interfaces/button-interface.ts +12 -0
  5. package/src/interfaces/chip-interface.ts +11 -0
  6. package/src/interfaces/grid-interface.ts +24 -0
  7. package/src/interfaces/select-interface.ts +20 -0
  8. package/src/interfaces/tab-interface.ts +6 -0
  9. package/src/lib/avatar/avatar.component.css +48 -0
  10. package/src/lib/avatar/avatar.component.html +5 -0
  11. package/src/lib/avatar/avatar.component.spec.ts +23 -0
  12. package/src/lib/avatar/avatar.component.ts +50 -0
  13. package/src/lib/button/button.component.css +145 -0
  14. package/src/lib/button/button.component.html +11 -0
  15. package/src/lib/button/button.component.spec.ts +23 -0
  16. package/src/lib/button/button.component.ts +68 -0
  17. package/src/lib/calendar-header/calendar-header.component.css +67 -0
  18. package/src/lib/calendar-header/calendar-header.component.html +20 -0
  19. package/src/lib/calendar-header/calendar-header.component.spec.ts +23 -0
  20. package/src/lib/calendar-header/calendar-header.component.ts +191 -0
  21. package/src/lib/card/card-body/card-body.component.css +0 -0
  22. package/src/lib/card/card-body/card-body.component.html +1 -0
  23. package/src/lib/card/card-body/card-body.component.spec.ts +23 -0
  24. package/src/lib/card/card-body/card-body.component.ts +12 -0
  25. package/src/lib/card/card-footer-actions/card-footer-actions.component.css +4 -0
  26. package/src/lib/card/card-footer-actions/card-footer-actions.component.html +3 -0
  27. package/src/lib/card/card-footer-actions/card-footer-actions.component.spec.ts +23 -0
  28. package/src/lib/card/card-footer-actions/card-footer-actions.component.ts +12 -0
  29. package/src/lib/card/card-icon/card-icon.component.css +0 -0
  30. package/src/lib/card/card-icon/card-icon.component.html +1 -0
  31. package/src/lib/card/card-icon/card-icon.component.spec.ts +23 -0
  32. package/src/lib/card/card-icon/card-icon.component.ts +12 -0
  33. package/src/lib/card/card-title-actions/card-title-actions.component.css +3 -0
  34. package/src/lib/card/card-title-actions/card-title-actions.component.html +1 -0
  35. package/src/lib/card/card-title-actions/card-title-actions.component.spec.ts +23 -0
  36. package/src/lib/card/card-title-actions/card-title-actions.component.ts +12 -0
  37. package/src/lib/card/card.component.css +84 -0
  38. package/src/lib/card/card.component.html +34 -0
  39. package/src/lib/card/card.component.spec.ts +23 -0
  40. package/src/lib/card/card.component.ts +33 -0
  41. package/src/lib/chips/chips.component.css +129 -0
  42. package/src/lib/chips/chips.component.html +17 -0
  43. package/src/lib/chips/chips.component.spec.ts +23 -0
  44. package/src/lib/chips/chips.component.ts +54 -0
  45. package/src/lib/component-library.component.spec.ts +23 -0
  46. package/src/lib/component-library.component.ts +16 -0
  47. package/src/lib/component-library.service.spec.ts +16 -0
  48. package/src/lib/component-library.service.ts +9 -0
  49. package/src/lib/datepicker/datepicker.component.css +33 -0
  50. package/src/lib/datepicker/datepicker.component.html +11 -0
  51. package/src/lib/datepicker/datepicker.component.spec.ts +23 -0
  52. package/src/lib/datepicker/datepicker.component.ts +36 -0
  53. package/src/lib/form-input/form-input.component.css +109 -0
  54. package/src/lib/form-input/form-input.component.html +27 -0
  55. package/src/lib/form-input/form-input.component.spec.ts +23 -0
  56. package/src/lib/form-input/form-input.component.ts +196 -0
  57. package/src/lib/form-select/form-select.component.css +157 -0
  58. package/src/lib/form-select/form-select.component.html +38 -0
  59. package/src/lib/form-select/form-select.component.spec.ts +23 -0
  60. package/src/lib/form-select/form-select.component.ts +54 -0
  61. package/src/lib/grid-cell/grid-cell.component.css +78 -0
  62. package/src/lib/grid-cell/grid-cell.component.html +31 -0
  63. package/src/lib/grid-cell/grid-cell.component.spec.ts +23 -0
  64. package/src/lib/grid-cell/grid-cell.component.ts +89 -0
  65. package/src/lib/header/header.component.css +62 -0
  66. package/src/lib/header/header.component.html +23 -0
  67. package/src/lib/header/header.component.spec.ts +23 -0
  68. package/src/lib/header/header.component.ts +28 -0
  69. package/src/lib/icon/icon.component.css +21 -0
  70. package/src/lib/icon/icon.component.html +5 -0
  71. package/src/lib/icon/icon.component.ts +49 -0
  72. package/src/lib/icon/icon.service.ts +27 -0
  73. package/src/lib/left-nav/left-nav.component.css +106 -0
  74. package/src/lib/left-nav/left-nav.component.html +48 -0
  75. package/src/lib/left-nav/left-nav.component.spec.ts +23 -0
  76. package/src/lib/left-nav/left-nav.component.ts +146 -0
  77. package/src/lib/stepper/stepper.component.css +96 -0
  78. package/src/lib/stepper/stepper.component.html +14 -0
  79. package/src/lib/stepper/stepper.component.spec.ts +23 -0
  80. package/src/lib/stepper/stepper.component.ts +61 -0
  81. package/src/lib/tabs/tabs.component.css +100 -0
  82. package/src/lib/tabs/tabs.component.html +16 -0
  83. package/src/lib/tabs/tabs.component.spec.ts +23 -0
  84. package/src/lib/tabs/tabs.component.ts +37 -0
  85. package/src/lib/toast/toast.component.css +107 -0
  86. package/src/lib/toast/toast.component.html +29 -0
  87. package/src/lib/toast/toast.component.spec.ts +23 -0
  88. package/src/lib/toast/toast.component.ts +87 -0
  89. package/src/lib/tool-tip/tool-tip.component.css +139 -0
  90. package/src/lib/tool-tip/tool-tip.component.html +31 -0
  91. package/src/lib/tool-tip/tool-tip.component.spec.ts +23 -0
  92. package/src/lib/tool-tip/tool-tip.component.ts +37 -0
  93. package/{public-api.d.ts → src/public-api.ts} +14 -0
  94. package/src/utils/validators.ts +68 -0
  95. package/tsconfig.lib.json +14 -0
  96. package/tsconfig.lib.prod.json +10 -0
  97. package/tsconfig.spec.json +14 -0
  98. package/esm2022/interfaces/avatar-interface.mjs +0 -2
  99. package/esm2022/interfaces/button-interface.mjs +0 -2
  100. package/esm2022/interfaces/chip-interface.mjs +0 -2
  101. package/esm2022/interfaces/grid-interface.mjs +0 -2
  102. package/esm2022/interfaces/select-interface.mjs +0 -2
  103. package/esm2022/interfaces/tab-interface.mjs +0 -2
  104. package/esm2022/lib/avatar/avatar.component.mjs +0 -56
  105. package/esm2022/lib/button/button.component.mjs +0 -84
  106. package/esm2022/lib/calendar-header/calendar-header.component.mjs +0 -168
  107. package/esm2022/lib/chips/chips.component.mjs +0 -62
  108. package/esm2022/lib/component-library.component.mjs +0 -19
  109. package/esm2022/lib/component-library.service.mjs +0 -14
  110. package/esm2022/lib/datepicker/datepicker.component.mjs +0 -40
  111. package/esm2022/lib/form-select/form-select.component.mjs +0 -59
  112. package/esm2022/lib/grid-cell/grid-cell.component.mjs +0 -84
  113. package/esm2022/lib/header/header.component.mjs +0 -37
  114. package/esm2022/lib/stepper/stepper.component.mjs +0 -64
  115. package/esm2022/lib/tabs/tabs.component.mjs +0 -38
  116. package/esm2022/lib/toast/toast.component.mjs +0 -54
  117. package/esm2022/lib/tool-tip/tool-tip.component.mjs +0 -41
  118. package/esm2022/public-api.mjs +0 -23
  119. package/esm2022/sarasanalytics-com-design-system.mjs +0 -5
  120. package/fesm2022/sarasanalytics-com-design-system.mjs +0 -760
  121. package/fesm2022/sarasanalytics-com-design-system.mjs.map +0 -1
  122. package/index.d.ts +0 -5
  123. package/interfaces/avatar-interface.d.ts +0 -6
  124. package/interfaces/button-interface.d.ts +0 -12
  125. package/interfaces/chip-interface.d.ts +0 -11
  126. package/interfaces/grid-interface.d.ts +0 -24
  127. package/interfaces/select-interface.d.ts +0 -19
  128. package/interfaces/tab-interface.d.ts +0 -6
  129. package/lib/avatar/avatar.component.d.ts +0 -18
  130. package/lib/button/button.component.d.ts +0 -26
  131. package/lib/calendar-header/calendar-header.component.d.ts +0 -31
  132. package/lib/chips/chips.component.d.ts +0 -22
  133. package/lib/component-library.component.d.ts +0 -5
  134. package/lib/component-library.service.d.ts +0 -6
  135. package/lib/datepicker/datepicker.component.d.ts +0 -9
  136. package/lib/form-select/form-select.component.d.ts +0 -17
  137. package/lib/grid-cell/grid-cell.component.d.ts +0 -20
  138. package/lib/header/header.component.d.ts +0 -14
  139. package/lib/stepper/stepper.component.d.ts +0 -17
  140. package/lib/tabs/tabs.component.d.ts +0 -15
  141. package/lib/toast/toast.component.d.ts +0 -18
  142. package/lib/tool-tip/tool-tip.component.d.ts +0 -15
@@ -0,0 +1,191 @@
1
+ import {
2
+ ChangeDetectorRef,
3
+ Component,
4
+ Inject,
5
+ OnDestroy,
6
+ } from '@angular/core';
7
+ import {
8
+ DateAdapter,
9
+ MatDateFormats,
10
+ MAT_DATE_FORMATS,
11
+ } from '@angular/material/core';
12
+ import { MatCalendar } from '@angular/material/datepicker';
13
+ import { Subject } from 'rxjs';
14
+ import { takeUntil } from 'rxjs/operators';
15
+ import { MatIconModule } from '@angular/material/icon';
16
+ import { MatButton } from '@angular/material/button';
17
+ import { NgFor } from '@angular/common';
18
+ import { MatDateRangePicker } from '@angular/material/datepicker';
19
+
20
+
21
+ let nextId = 0; // used to give unique ids to inputs used in html
22
+
23
+ @Component({
24
+ templateUrl: './calendar-header.component.html',
25
+ styleUrls: ['./calendar-header.component.css'],
26
+ standalone: true,
27
+ imports: [
28
+ NgFor,
29
+ MatIconModule,
30
+ MatButton
31
+ ],
32
+ // changeDetection: ChangeDetectionStrategy.OnPush,
33
+ })
34
+ export class CalendarHeaderComponent<D> implements OnDestroy {
35
+ uuid: number = nextId++;
36
+
37
+ private readonly destroy$ = new Subject<void>();
38
+
39
+ constructor(
40
+ private calendar: MatCalendar<D>, // calendar instance of picker
41
+ private dateAdapter: DateAdapter<D>, // native or moment date adapter
42
+ private picker: MatDateRangePicker<D>,
43
+ @Inject(MAT_DATE_FORMATS) private dateFormats: MatDateFormats, // for formatting
44
+ cdr: ChangeDetectorRef
45
+ ) {
46
+ // make sure your header stays in sync with the calendar:
47
+ calendar.stateChanges
48
+ .pipe(takeUntil(this.destroy$)) // unsubscribe when destroyed
49
+ .subscribe(() => cdr.markForCheck());
50
+
51
+ }
52
+
53
+ selectedPreset = "Custom"
54
+ presets = [
55
+ "This Quarter",
56
+ "Last Quarter",
57
+ "Last 6 Months",
58
+ "This Year",
59
+ "Last Year",
60
+ "Custom"
61
+ ]
62
+ // active date label rendered between the arrow buttons
63
+
64
+ ngOnInit() {
65
+ const currentRange: any = this.calendar.selected;
66
+
67
+ currentRange?.start.setHours(0, 0, 0, 0);
68
+ currentRange?.end.setHours(0, 0, 0, 0);
69
+
70
+ // To pre-select a preset when the calendar opens.
71
+ // Match the already selected date range with the date-ranges of all presets.
72
+ // If already selected date range matches with a preset, pre-select it.
73
+
74
+ for (let i = 0; i < this.presets.length; i++) {
75
+ const tempRange = this.findDate(this.presets[i]);
76
+ if (tempRange.newStart.getTime() == currentRange.start.getTime() && tempRange.newEnd.getTime() == currentRange.end.getTime()) {
77
+ this.selectedPreset = this.presets[i];
78
+ break;
79
+ }
80
+ }
81
+ }
82
+
83
+ get periodLabel(): string {
84
+ // use date adapter to format the label, e.g. "SEP 2020"
85
+ return this.dateAdapter
86
+ .format(this.calendar.activeDate, this.dateFormats.display.monthYearLabel)
87
+ .toLocaleUpperCase();
88
+ }
89
+
90
+ previousClicked(mode: 'month' | 'year'): void {
91
+ this.changeDate(mode, -1);
92
+ }
93
+
94
+ nextClicked(mode: 'month' | 'year'): void {
95
+ this.changeDate(mode, 1);
96
+ }
97
+
98
+ changeView() {
99
+ this.calendar.currentView =
100
+ this.calendar.currentView == "month"
101
+ ? "year"
102
+ : this.calendar.currentView == "year"
103
+ ? "multi-year"
104
+ : "month";
105
+ }
106
+
107
+ today = new Date();
108
+
109
+ presetChanged(evt: any) {
110
+ const newRange: any = this.findDate(evt.target.value);
111
+ this.calendar.activeDate = newRange.newStart;
112
+ this.picker.select(newRange.newStart);
113
+ this.picker.select(newRange.newEnd);
114
+ }
115
+
116
+ findDate(selected: string) {
117
+ const date = this.today.getDate();
118
+ const month = this.today.getMonth();
119
+ const year = this.today.getFullYear();
120
+ let newRange: any;
121
+ this.selectedPreset = selected;
122
+ switch (selected) {
123
+ case "This Quarter": {
124
+ const thisQuarterMonth = Math.floor(month / 3) * 3;
125
+ const start = this.dateAdapter.createDate(year, thisQuarterMonth, 1);
126
+ const end = this.dateAdapter.createDate(year, thisQuarterMonth + 3, 1);
127
+ newRange = {
128
+ newStart: start,
129
+ newEnd: end,
130
+ }
131
+ break;
132
+ }
133
+ case "Last Quarter": {
134
+ const lastQuarterMonth = (Math.floor(month / 3) * 3) - 3;
135
+ const start = this.dateAdapter.createDate(year, lastQuarterMonth, 1);
136
+ const end = this.dateAdapter.createDate(year, lastQuarterMonth + 3, 1);
137
+ newRange = {
138
+ newStart: start,
139
+ newEnd: end,
140
+ }
141
+ break;
142
+ }
143
+ case "Last 6 Months": {
144
+ const end = this.dateAdapter.createDate(year, month, date);
145
+ const start = this.dateAdapter.addCalendarMonths(end, -6);
146
+ newRange = {
147
+ newStart: start,
148
+ newEnd: end,
149
+ }
150
+ break;
151
+ }
152
+ case "This Year": {
153
+ const start = this.dateAdapter.createDate(year, 0, 1);
154
+ const end = this.dateAdapter.createDate(year, 11, 31);
155
+ newRange = {
156
+ newStart: start,
157
+ newEnd: end,
158
+ }
159
+ break;
160
+ }
161
+ case "Last Year": {
162
+ const start = this.dateAdapter.createDate(year - 1, 0, 1);
163
+ const end = this.dateAdapter.createDate(year - 1, 11, 31);
164
+ newRange = {
165
+ newStart: start,
166
+ newEnd: end,
167
+ }
168
+ break;
169
+ }
170
+ default: {
171
+ newRange = {
172
+ newStart: new Date(),
173
+ newEnd: new Date(),
174
+ }
175
+ }
176
+ }
177
+ return newRange;
178
+ }
179
+
180
+ private changeDate(mode: 'month' | 'year', amount: -1 | 1): void {
181
+ // increment or decrement month or year
182
+ this.calendar.activeDate =
183
+ mode === 'month'
184
+ ? this.dateAdapter.addCalendarMonths(this.calendar.activeDate, amount)
185
+ : this.dateAdapter.addCalendarYears(this.calendar.activeDate, amount);
186
+ }
187
+
188
+ ngOnDestroy(): void {
189
+ this.destroy$.next(); // will trigger unsubscription in takeUntil
190
+ }
191
+ }
File without changes
@@ -0,0 +1 @@
1
+ <p>card-body works!</p>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { CardBodyComponent } from './card-body.component';
4
+
5
+ describe('CardBodyComponent', () => {
6
+ let component: CardBodyComponent;
7
+ let fixture: ComponentFixture<CardBodyComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [CardBodyComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(CardBodyComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,12 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'lib-card-body',
5
+ standalone: true,
6
+ imports: [],
7
+ templateUrl: './card-body.component.html',
8
+ styleUrl: './card-body.component.css'
9
+ })
10
+ export class CardBodyComponent {
11
+
12
+ }
@@ -0,0 +1,4 @@
1
+ .sa-card-footer-actions {
2
+ display: flex;
3
+ justify-content: end;
4
+ }
@@ -0,0 +1,3 @@
1
+ <div class="sa-card-footer-actions">
2
+ <ng-content></ng-content>
3
+ </div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { CardFooterActionsComponent } from './card-footer-actions.component';
4
+
5
+ describe('CardFooterActionsComponent', () => {
6
+ let component: CardFooterActionsComponent;
7
+ let fixture: ComponentFixture<CardFooterActionsComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [CardFooterActionsComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(CardFooterActionsComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,12 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'sa-card-footer-actions',
5
+ standalone: true,
6
+ imports: [],
7
+ templateUrl: './card-footer-actions.component.html',
8
+ styleUrl: './card-footer-actions.component.css'
9
+ })
10
+ export class CardFooterActionsComponent {
11
+
12
+ }
File without changes
@@ -0,0 +1 @@
1
+ <ng-content></ng-content>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { CardIconComponent } from './card-icon.component';
4
+
5
+ describe('CardIconComponent', () => {
6
+ let component: CardIconComponent;
7
+ let fixture: ComponentFixture<CardIconComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [CardIconComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(CardIconComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,12 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'sa-card-icon',
5
+ standalone: true,
6
+ imports: [],
7
+ templateUrl: './card-icon.component.html',
8
+ styleUrl: './card-icon.component.css'
9
+ })
10
+ export class CardIconComponent {
11
+
12
+ }
@@ -0,0 +1,3 @@
1
+ .sa-card-title-actions {
2
+ margin-bottom: 8px;
3
+ }
@@ -0,0 +1 @@
1
+ <div class="sa-card-title-actions"><ng-content></ng-content></div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { CardTitleActionsComponent } from './card-title-actions.component';
4
+
5
+ describe('CardTitleActionsComponent', () => {
6
+ let component: CardTitleActionsComponent;
7
+ let fixture: ComponentFixture<CardTitleActionsComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [CardTitleActionsComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(CardTitleActionsComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,12 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'sa-card-title-actions',
5
+ standalone: true,
6
+ imports: [],
7
+ templateUrl: './card-title-actions.component.html',
8
+ styleUrl: './card-title-actions.component.css'
9
+ })
10
+ export class CardTitleActionsComponent {
11
+
12
+ }
@@ -0,0 +1,84 @@
1
+ * {
2
+ font-family: var(--font);
3
+ }
4
+
5
+ .sa-card-wrapper {
6
+ display: flex;
7
+ border: 1px solid var(--grey-50);
8
+ border-radius: 6px;
9
+ /* width: inherit; */
10
+ padding: 12px;
11
+ background: var(--structural-white);
12
+ }
13
+
14
+ .sa-card-wrapper.column {
15
+ flex-direction: column;
16
+ }
17
+
18
+ .sa-card-img,
19
+ .sa-card-icon {
20
+ margin-right: 12px;
21
+ }
22
+
23
+ .sa-card-img.column,
24
+ .sa-card-icon.column {}
25
+
26
+ .column .sa-card-img,
27
+ .column .sa-card-icon {
28
+ margin: 0 0 12px 0;
29
+ display: flex;
30
+ justify-content: space-between;
31
+ }
32
+
33
+ .sa-card-img img {
34
+ height: auto;
35
+ width: 200px;
36
+ }
37
+
38
+ .sa-card-icon span {
39
+ background-repeat: no-repeat;
40
+ background-size: cover;
41
+ background-position: center;
42
+ display: block;
43
+ height: 24px;
44
+ width: 24px;
45
+ }
46
+
47
+ .sa-card-container {
48
+ /* margin-left: 12px; */
49
+ display: flex;
50
+ flex-direction: column;
51
+ justify-content: space-between;
52
+ width: -webkit-fill-available;
53
+ }
54
+
55
+ .sa-card-title-container {
56
+ display: flex;
57
+ justify-content: space-between;
58
+ }
59
+
60
+ .column .sa-card-title-container {
61
+ flex-direction: column;
62
+ margin-bottom: 8px;
63
+ }
64
+
65
+ .sa-card-title {
66
+ /* font-family: var(--font-family); */
67
+ font-size: 16px;
68
+ font-weight: 600;
69
+ line-height: 24px;
70
+ margin-bottom: 4px;
71
+ /* letter-spacing: 0.15000000596046448px;
72
+ text-align: left; */
73
+ }
74
+
75
+ .sa-card-body {
76
+ /* font-family: var(--font-family); */
77
+ font-size: 14px;
78
+ font-weight: 400;
79
+ line-height: 20px;
80
+ letter-spacing: 0.25px;
81
+ text-align: left;
82
+ color: var(--grey-300);
83
+ flex: 1;
84
+ }
@@ -0,0 +1,34 @@
1
+ <div class="sa-card" [ngStyle]="cardStyles">
2
+ <div class="sa-card-wrapper" [ngClass]="column ? 'column' : ''">
3
+ <div class="" [ngClass]="avatar ? 'sa-card-img' : 'sa-card-icon'">
4
+ @if(avatar){
5
+ <img [src]="avatar" />
6
+ }@else if(icon){
7
+ <sa-icon [icon]="icon" [size]="iconSize"></sa-icon>
8
+ }@else{
9
+ <ng-content select="sa-card-icon"></ng-content>
10
+ }
11
+ @if(column){
12
+ <ng-content select="sa-card-title-actions"></ng-content>
13
+ }
14
+ </div>
15
+ <div class="sa-card-container">
16
+ @if(title){
17
+ <div class="sa-card-title-container">
18
+ <div class="sa-card-title">{{title}}</div>
19
+ @if(chip){
20
+ <sa-chip [text]="chip.text" [type]="chip.type" [state]="chip.state"></sa-chip>
21
+ }
22
+ <ng-content select="sa-card-title-actions"></ng-content>
23
+
24
+ </div>
25
+ }
26
+ @if(body){
27
+ <div class="sa-card-body">
28
+ {{body}}
29
+ </div>
30
+ }
31
+ <ng-content select="sa-card-footer-actions"></ng-content>
32
+ </div>
33
+ </div>
34
+ </div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { CardComponent } from './card.component';
4
+
5
+ describe('CardComponent', () => {
6
+ let component: CardComponent;
7
+ let fixture: ComponentFixture<CardComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [CardComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(CardComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,33 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, Input, SimpleChanges } from '@angular/core';
3
+ import { ChipsComponent } from '../chips/chips.component';
4
+ import { ChipInterface } from '../../interfaces/chip-interface';
5
+ import { IconComponent } from '../icon/icon.component';
6
+
7
+ @Component({
8
+ selector: 'sa-card',
9
+ standalone: true,
10
+ imports: [CommonModule, ChipsComponent, IconComponent],
11
+ templateUrl: './card.component.html',
12
+ styleUrl: './card.component.css'
13
+ })
14
+ export class CardComponent {
15
+ @Input('title') title: string = '';
16
+ @Input('chip') chip: ChipInterface | null = null;
17
+ @Input('body') body: string = '';
18
+ @Input('avatar') avatar: string = '';
19
+
20
+ @Input('icon') icon: string = '';
21
+ @Input('iconSize') iconSize: string;
22
+
23
+ @Input('width') width: string | number;
24
+ @Input('column') column: boolean = false;
25
+
26
+ cardStyles: any = {};
27
+
28
+ ngOnChanges(changes: SimpleChanges) {
29
+ if (changes['width']?.currentValue) {
30
+ this.cardStyles['width'] = typeof changes['width']?.currentValue === 'string' ? changes['width']?.currentValue : changes['width']?.currentValue + '%';
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,129 @@
1
+ .regular {
2
+ --chip-height: var(--medium-24px);
3
+ --chip-padding: var(--small-4px) var(--small-8px);
4
+ --chip-gap: var(--small-4px);
5
+ --border-radius: var(--small-16px);
6
+ --font-weight: 500;
7
+ --line-height: 16px;
8
+ --font-size: 12px
9
+ }
10
+
11
+ .small {
12
+ --chip-height: var(--small-18px);
13
+ --chip-padding: var(--small-4px) var(--small-8px);
14
+ --chip-gap: var(--small-4px);
15
+ --border-radius: var(--small-4px);
16
+ --font-weight: 500;
17
+ --line-height: 16px;
18
+ --font-size: 11px
19
+ }
20
+
21
+ .large {
22
+ --chip-height: 40px;
23
+ --chip-padding: var(--small-12px) var(--medium-24px) var(--small-12px) var(--small-16px);
24
+ --chip-gap: var(--small-8px);
25
+ --border-radius: var(--small-16px) 0px;
26
+ --font-weight: 600;
27
+ --line-height: 20px;
28
+ --font-size: 14px;
29
+ background-color: var(--light-color) !important;
30
+ color: var(--dark-color) !important;
31
+ border: 1px solid transparent !important;
32
+ }
33
+
34
+ .primary {
35
+ --light-color: var(--primary-50);
36
+ --dark-color: var(--primary-500);
37
+ }
38
+
39
+ .secondary {
40
+ --light-color: var(--secondary-50);
41
+ --dark-color: var(--secondary-500);
42
+ }
43
+
44
+ .neutral {
45
+ --light-color: var(--grey-50);
46
+ --dark-color: var(--text-mediumemphasis);
47
+ }
48
+
49
+ .success {
50
+ --light-color: var(--semantic-success-50);
51
+ --dark-color: var(--semantic-success-500);
52
+ }
53
+
54
+ .error {
55
+ --light-color: var(--semantic-error-50);
56
+ --dark-color: var(--semantic-error-500);
57
+ }
58
+
59
+ .warning {
60
+ --light-color: var(--semantic-yellow-50);
61
+ --dark-color: var(--semantic-yellow-500);
62
+ }
63
+
64
+ .filled {
65
+ --background-color: var(--light-color);
66
+ --color: var(--dark-color);
67
+ --border: 1px solid transparent;
68
+ }
69
+
70
+ .outline {
71
+ --background-color: none;
72
+ --color: var(--dark-color);
73
+ --border: 1px solid var(--dark-color);
74
+ }
75
+
76
+ .chip {
77
+ display: flex;
78
+ width: max-content;
79
+ height: var(--chip-height);
80
+ padding: var(--chip-padding);
81
+
82
+ justify-content: center;
83
+ align-items: center;
84
+
85
+ gap: var(--chip-gap);
86
+ flex-shrink: 0;
87
+ letter-spacing: 0.5px;
88
+ box-sizing: border-box;
89
+
90
+ font-family: var(--font);
91
+ font-size: var(--font-size);
92
+ font-weight: var(--font-weight);
93
+ line-height: var(--line-height);
94
+
95
+ background-color: var(--background-color);
96
+ color: var(--color);
97
+ border-radius: var(--border-radius);
98
+ border: var(--border);
99
+
100
+ -webkit-user-select: none;
101
+ -khtml-user-select: none;
102
+ -moz-user-select: none;
103
+ -o-user-select: none;
104
+ user-select: none;
105
+ }
106
+
107
+ .svg-icon {
108
+ width: 16px;
109
+ height: 16px;
110
+ mask-size: contain;
111
+ background-color: var(--dark-color);
112
+ mask-repeat: no-repeat;
113
+ }
114
+
115
+ .svg-icon:hover {
116
+ cursor: pointer;
117
+ }
118
+
119
+ .second-svg-icon {
120
+ width: 18px;
121
+ height: 18px;
122
+ mask-size: contain;
123
+ background-color: var(--dark-color);
124
+ mask-repeat: no-repeat;
125
+ }
126
+
127
+ .btn_hide {
128
+ display: none;
129
+ }