@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,196 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ ChangeDetectorRef,
4
+ Component,
5
+ Inject,
6
+ OnDestroy,
7
+ } from '@angular/core';
8
+ import {
9
+ DateAdapter,
10
+ MatDateFormats,
11
+ MAT_DATE_FORMATS,
12
+ } from '@angular/material/core';
13
+ import { MAT_DATE_RANGE_SELECTION_STRATEGY } from '@angular/material/datepicker';
14
+ import { MatCalendar } from '@angular/material/datepicker';
15
+ import { Subject } from 'rxjs';
16
+ import { takeUntil } from 'rxjs/operators';
17
+ import { MatIconModule } from '@angular/material/icon';
18
+ import { MatIconButton } from '@angular/material/button';
19
+ import { MatButton } from '@angular/material/button';
20
+ import { NgFor } from '@angular/common';
21
+ import { MatDateRangePicker } from '@angular/material/datepicker';
22
+ import { MatDateRangeSelectionStrategy } from '@angular/material/datepicker'
23
+
24
+
25
+ let nextId = 0; // used to give unique ids to inputs used in html
26
+
27
+ @Component({
28
+ templateUrl: './calendar-header.component.html',
29
+ styleUrls: ['./calendar-header.component.css'],
30
+ standalone: true,
31
+ imports: [
32
+ MatIconButton,
33
+ NgFor,
34
+ MatIconModule,
35
+ MatButton
36
+ ],
37
+ // changeDetection: ChangeDetectionStrategy.OnPush,
38
+ })
39
+ export class CalendarHeaderComponent<D> implements OnDestroy {
40
+ uuid: number = nextId++;
41
+
42
+ private readonly destroy$ = new Subject<void>();
43
+
44
+ constructor(
45
+ private calendar: MatCalendar<D>, // calendar instance of picker
46
+ private dateAdapter: DateAdapter<D>, // native or moment date adapter
47
+ private picker: MatDateRangePicker<D>,
48
+ @Inject(MAT_DATE_FORMATS) private dateFormats: MatDateFormats, // for formatting
49
+ cdr: ChangeDetectorRef
50
+ ) {
51
+ // make sure your header stays in sync with the calendar:
52
+ calendar.stateChanges
53
+ .pipe(takeUntil(this.destroy$)) // unsubscribe when destroyed
54
+ .subscribe(() => cdr.markForCheck());
55
+
56
+ }
57
+
58
+ selectedPreset = "Custom"
59
+ presets = [
60
+ "This Quarter",
61
+ "Last Quarter",
62
+ "Last 6 Months",
63
+ "This Year",
64
+ "Last Year",
65
+ "Custom"
66
+ ]
67
+ // active date label rendered between the arrow buttons
68
+
69
+ ngOnInit() {
70
+ let currentRange: any = this.calendar.selected;
71
+
72
+ currentRange?.start.setHours(0, 0, 0, 0);
73
+ currentRange?.end.setHours(0, 0, 0, 0);
74
+
75
+ // To pre-select a preset when the calendar opens.
76
+ // Match the already selected date range with the date-ranges of all presets.
77
+ // If already selected date range matches with a preset, pre-select it.
78
+
79
+ for (let i = 0; i < this.presets.length; i++) {
80
+ let tempRange = this.findDate(this.presets[i]);
81
+ if (tempRange.newStart.getTime() == currentRange.start.getTime() && tempRange.newEnd.getTime() == currentRange.end.getTime()) {
82
+ this.selectedPreset = this.presets[i];
83
+ break;
84
+ }
85
+ }
86
+ }
87
+
88
+ get periodLabel(): string {
89
+ // use date adapter to format the label, e.g. "SEP 2020"
90
+ return this.dateAdapter
91
+ .format(this.calendar.activeDate, this.dateFormats.display.monthYearLabel)
92
+ .toLocaleUpperCase();
93
+ }
94
+
95
+ previousClicked(mode: 'month' | 'year'): void {
96
+ this.changeDate(mode, -1);
97
+ }
98
+
99
+ nextClicked(mode: 'month' | 'year'): void {
100
+ this.changeDate(mode, 1);
101
+ }
102
+
103
+ changeView() {
104
+ this.calendar.currentView =
105
+ this.calendar.currentView == "month"
106
+ ? "year"
107
+ : this.calendar.currentView == "year"
108
+ ? "multi-year"
109
+ : "month";
110
+ }
111
+
112
+ today = new Date();
113
+
114
+ presetChanged(evt: any) {
115
+ let newRange: any = this.findDate(evt.target.value);
116
+ this.calendar.activeDate = newRange.newStart;
117
+ this.picker.select(newRange.newStart);
118
+ this.picker.select(newRange.newEnd);
119
+ }
120
+
121
+ findDate(selected: string) {
122
+ let date = this.today.getDate();
123
+ let month = this.today.getMonth();
124
+ let year = this.today.getFullYear();
125
+ let newRange: any;
126
+ this.selectedPreset = selected;
127
+ switch (selected) {
128
+ case "This Quarter": {
129
+ let thisQuarterMonth = Math.floor(month / 3) * 3;
130
+ let start = this.dateAdapter.createDate(year, thisQuarterMonth, 1);
131
+ let end = this.dateAdapter.createDate(year, thisQuarterMonth + 3, 1);
132
+ newRange = {
133
+ newStart: start,
134
+ newEnd: end,
135
+ }
136
+ break;
137
+ }
138
+ case "Last Quarter": {
139
+ let lastQuarterMonth = (Math.floor(month / 3) * 3) - 3;
140
+ let start = this.dateAdapter.createDate(year, lastQuarterMonth, 1);
141
+ let end = this.dateAdapter.createDate(year, lastQuarterMonth + 3, 1);
142
+ newRange = {
143
+ newStart: start,
144
+ newEnd: end,
145
+ }
146
+ break;
147
+ }
148
+ case "Last 6 Months": {
149
+ let end = this.dateAdapter.createDate(year, month, date);
150
+ let start = this.dateAdapter.addCalendarMonths(end, -6);
151
+ newRange = {
152
+ newStart: start,
153
+ newEnd: end,
154
+ }
155
+ break;
156
+ }
157
+ case "This Year": {
158
+ let start = this.dateAdapter.createDate(year, 0, 1);
159
+ let end = this.dateAdapter.createDate(year, 11, 31);
160
+ newRange = {
161
+ newStart: start,
162
+ newEnd: end,
163
+ }
164
+ break;
165
+ }
166
+ case "Last Year": {
167
+ let start = this.dateAdapter.createDate(year - 1, 0, 1);
168
+ let end = this.dateAdapter.createDate(year - 1, 11, 31);
169
+ newRange = {
170
+ newStart: start,
171
+ newEnd: end,
172
+ }
173
+ break;
174
+ }
175
+ default: {
176
+ newRange = {
177
+ newStart: new Date(),
178
+ newEnd: new Date(),
179
+ }
180
+ }
181
+ }
182
+ return newRange;
183
+ }
184
+
185
+ private changeDate(mode: 'month' | 'year', amount: -1 | 1): void {
186
+ // increment or decrement month or year
187
+ this.calendar.activeDate =
188
+ mode === 'month'
189
+ ? this.dateAdapter.addCalendarMonths(this.calendar.activeDate, amount)
190
+ : this.dateAdapter.addCalendarYears(this.calendar.activeDate, amount);
191
+ }
192
+
193
+ ngOnDestroy(): void {
194
+ this.destroy$.next(); // will trigger unsubscription in takeUntil
195
+ }
196
+ }
@@ -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
+ }
@@ -0,0 +1,17 @@
1
+ <div class="chip {{type}} {{state}} {{filling}}">
2
+ <button type="button" (click)="buttonClicked($event)" id="icon-button_{{uuid}}" class="btn_hide"></button>
3
+ <!-- (click)="buttonClicked()" on button instead of label breaks whole thing -->
4
+ <label for="icon-button_{{uuid}}" class="svg-icon" [style]="svgStyle"
5
+ [style.display]="((iconPosition == 'left' || iconPosition == 'both') && type != 'large') ? 'block' : 'none'">
6
+ </label>
7
+
8
+ {{text}}
9
+
10
+ <div class="second-svg-icon" [style]="secondSvgStyle" [style.display]="(type == 'large') ? 'block' : 'none'"></div>
11
+
12
+ {{type == 'large' ? largeStateText : ""}}
13
+
14
+ <label for="icon-button_{{uuid}}" class="svg-icon" [style]="svgStyle"
15
+ [style.display]="((iconPosition == 'right' || iconPosition == 'both') && type != 'large') ? 'block' : 'none'">
16
+ </label>
17
+ </div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { ChipsComponent } from './chips.component';
4
+
5
+ describe('ChipsComponent', () => {
6
+ let component: ChipsComponent;
7
+ let fixture: ComponentFixture<ChipsComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [ChipsComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(ChipsComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,55 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, input } from '@angular/core';
3
+ import { Input } from '@angular/core';
4
+ import { Output } from '@angular/core';
5
+ import { EventEmitter } from '@angular/core';
6
+ import { v4 as uuidv4 } from 'uuid';
7
+
8
+ let nextId = 0; // used to give unique ids to inputs used in html
9
+
10
+ @Component({
11
+ selector: 'sa-chip',
12
+ standalone: true,
13
+ imports: [CommonModule],
14
+ templateUrl: './chips.component.html',
15
+ styleUrl: './chips.component.css'
16
+ })
17
+ export class ChipsComponent {
18
+ @Input() id: string | number;
19
+ @Input() iconPath: string;
20
+ @Input() text: string | number;
21
+ @Input() type: string;
22
+ @Input() state: string;
23
+ @Input() filling: string;
24
+ @Input() iconPosition: string;
25
+ @Input() largeStateIcon: string;
26
+ @Input() largeStateText: string;
27
+
28
+ @Output() onClickEvent = new EventEmitter();
29
+
30
+ svgStyle = {}
31
+ secondSvgStyle = {}
32
+ eventEmitObject = {}
33
+ uuid: number = nextId++;
34
+
35
+ ngOnChanges(): void {
36
+ this.svgStyle = {
37
+ '-webkit-mask-image': `url(${this.iconPath})`,
38
+ 'mask-image': `url(${this.iconPath})`,
39
+ }
40
+ this.secondSvgStyle = {
41
+ '-webkit-mask-image': `url(${this.largeStateIcon})`,
42
+ 'mask-image': `url(${this.largeStateIcon})`,
43
+ }
44
+ this.eventEmitObject = {
45
+ id: this.id
46
+ }
47
+ }
48
+
49
+ buttonClicked(evt: Event) {
50
+ this.onClickEvent.emit({
51
+ ...this.eventEmitObject,
52
+ evt
53
+ });
54
+ }
55
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { TestLibraryComponent } from './component-library.component';
4
+
5
+ describe('TestLibraryComponent', () => {
6
+ let component: TestLibraryComponent;
7
+ let fixture: ComponentFixture<TestLibraryComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [TestLibraryComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(TestLibraryComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,16 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'lib-component-library',
5
+ standalone: true,
6
+ imports: [],
7
+ template: `
8
+ <p>
9
+ component-library works!
10
+ </p>
11
+ `,
12
+ styles: ``
13
+ })
14
+ export class TestLibraryComponent {
15
+
16
+ }
@@ -0,0 +1,16 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+
3
+ import { TestLibraryService } from './component-library.service';
4
+
5
+ describe('TestLibraryService', () => {
6
+ let service: TestLibraryService;
7
+
8
+ beforeEach(() => {
9
+ TestBed.configureTestingModule({});
10
+ service = TestBed.inject(TestLibraryService);
11
+ });
12
+
13
+ it('should be created', () => {
14
+ expect(service).toBeTruthy();
15
+ });
16
+ });
@@ -0,0 +1,9 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable({
4
+ providedIn: 'root'
5
+ })
6
+ export class TestLibraryService {
7
+
8
+ constructor() { }
9
+ }
@@ -0,0 +1,33 @@
1
+ ::ng-deep .cdk-overlay-container {
2
+ --mat-datepicker-calendar-container-elevation-shadow: none;
3
+ --mat-datepicker-calendar-container-shape: 0px;
4
+ --mat-datepicker-calendar-date-selected-state-background-color: var(--primary-500);
5
+ --mat-datepicker-calendar-date-hover-state-background-color: var(--grey-50);
6
+ --mat-datepicker-calendar-date-in-range-state-background-color: var(--grey-50);
7
+ --mat-datepicker-calendar-date-focus-state-background-color: var(--grey-50);
8
+ }
9
+
10
+ ::ng-deep .cdk-overlay-container .mat-datepicker-popup {
11
+ border-top: 1px solid var(--grey-50);
12
+ border-right: 1px solid var(--grey-50);
13
+ border-bottom: 1px solid var(--grey-50);
14
+ border-radius: var(--small-8px, 8px);
15
+ height: 356px;
16
+ padding: 12px;
17
+ margin-top: 0px;
18
+ margin-left: 180px;
19
+ background-color: white;
20
+ }
21
+
22
+ ::ng-deep .cdk-overlay-container .mat-datepicker-content .mat-calendar {
23
+ box-shadow: none;
24
+ height: 300px;
25
+ }
26
+
27
+ ::ng-deep .mat-calendar-content .mat-calendar-table-header-divider {
28
+ display: none;
29
+ }
30
+
31
+ .date-picker {
32
+ margin: 30px
33
+ }
@@ -0,0 +1,11 @@
1
+ <mat-form-field class="date-picker">
2
+ <mat-label>Choose a date</mat-label>
3
+ <mat-date-range-input [rangePicker]="picker" [formGroup]="range">
4
+ <input formControlName="start" matStartDate placeholder="Start date">
5
+ <input formControlName="end" matEndDate placeholder="End date">
6
+ </mat-date-range-input>
7
+ <mat-hint>MM/DD/YYYY</mat-hint>
8
+ <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
9
+ <mat-date-range-picker [calendarHeaderComponent]="CalendarHeaderComponent" #picker>
10
+ </mat-date-range-picker>
11
+ </mat-form-field>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { DatepickerComponent } from './datepicker.component';
4
+
5
+ describe('DatepickerComponent', () => {
6
+ let component: DatepickerComponent;
7
+ let fixture: ComponentFixture<DatepickerComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [DatepickerComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(DatepickerComponent);
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 { MatDatepickerModule } from '@angular/material/datepicker';
3
+ import { MatInputModule } from '@angular/material/input';
4
+ import { MatFormFieldModule } from '@angular/material/form-field';
5
+ import { provideNativeDateAdapter } from '@angular/material/core';
6
+ import { NgFor } from '@angular/common';
7
+ import { NgIf } from '@angular/common';
8
+ import { ReactiveFormsModule } from '@angular/forms';
9
+ import { FieldType, FieldTypeConfig } from '@ngx-formly/core';
10
+ import { CalendarHeaderComponent } from '../calendar-header/calendar-header.component';
11
+ import { FormControl, FormGroup } from '@angular/forms';
12
+ import { CommonModule } from '@angular/common';
13
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
14
+
15
+ @Component({
16
+ selector: 'sa-datepicker',
17
+ standalone: true,
18
+ providers: [provideNativeDateAdapter()],
19
+ imports: [
20
+ MatFormFieldModule,
21
+ MatInputModule,
22
+ MatDatepickerModule,
23
+ NgFor,
24
+ NgIf,
25
+ ReactiveFormsModule,
26
+ CalendarHeaderComponent,
27
+ CommonModule,
28
+ ],
29
+ templateUrl: './datepicker.component.html',
30
+ styleUrl: './datepicker.component.css'
31
+ })
32
+ export class DatepickerComponent extends FieldType<FieldTypeConfig> {
33
+ @Input() range: any;
34
+
35
+ readonly CalendarHeaderComponent = CalendarHeaderComponent;
36
+
37
+ }