@brickclay-org/ui 0.0.9 → 0.0.13

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 (31) hide show
  1. package/README.md +1 -1
  2. package/package.json +16 -15
  3. package/ng-package.json +0 -8
  4. package/src/lib/assets/icons.ts +0 -8
  5. package/src/lib/brickclay-lib.spec.ts +0 -23
  6. package/src/lib/brickclay-lib.ts +0 -15
  7. package/src/lib/calender/calendar.module.ts +0 -35
  8. package/src/lib/calender/components/custom-calendar/custom-calendar.component.css +0 -698
  9. package/src/lib/calender/components/custom-calendar/custom-calendar.component.html +0 -230
  10. package/src/lib/calender/components/custom-calendar/custom-calendar.component.spec.ts +0 -23
  11. package/src/lib/calender/components/custom-calendar/custom-calendar.component.ts +0 -1534
  12. package/src/lib/calender/components/scheduled-date-picker/scheduled-date-picker.component.css +0 -373
  13. package/src/lib/calender/components/scheduled-date-picker/scheduled-date-picker.component.html +0 -210
  14. package/src/lib/calender/components/scheduled-date-picker/scheduled-date-picker.component.ts +0 -360
  15. package/src/lib/calender/components/time-picker/time-picker.component.css +0 -174
  16. package/src/lib/calender/components/time-picker/time-picker.component.html +0 -60
  17. package/src/lib/calender/components/time-picker/time-picker.component.ts +0 -283
  18. package/src/lib/calender/services/calendar-manager.service.ts +0 -45
  19. package/src/lib/checkbox/checkbox.css +0 -26
  20. package/src/lib/checkbox/checkbox.html +0 -42
  21. package/src/lib/checkbox/checkbox.ts +0 -67
  22. package/src/lib/radio/radio.css +0 -39
  23. package/src/lib/radio/radio.html +0 -58
  24. package/src/lib/radio/radio.ts +0 -77
  25. package/src/lib/toggle/components/toggle.component.css +0 -74
  26. package/src/lib/toggle/components/toggle.component.html +0 -24
  27. package/src/lib/toggle/components/toggle.component.ts +0 -62
  28. package/src/public-api.ts +0 -20
  29. package/tsconfig.lib.json +0 -19
  30. package/tsconfig.lib.prod.json +0 -11
  31. package/tsconfig.spec.json +0 -15
@@ -1,360 +0,0 @@
1
- import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { FormsModule } from '@angular/forms';
4
- import { CustomCalendarComponent, CalendarSelection } from '../custom-calendar/custom-calendar.component';
5
- import { TimePickerComponent } from '../time-picker/time-picker.component';
6
-
7
- export interface TimeConfiguration {
8
- date: Date;
9
- allDay: boolean;
10
- startTime: string; // Format: "HH:mm" or "HH:mm:ss"
11
- endTime: string; // Format: "HH:mm" or "HH:mm:ss"
12
- }
13
-
14
- export interface ScheduledDateSelection {
15
- mode: 'single' | 'multiple' | 'range';
16
- singleDate?: {
17
- startDate: Date;
18
- endDate: Date;
19
- allDay: boolean;
20
- startTime: string;
21
- endTime: string;
22
- };
23
- multipleDates?: TimeConfiguration[];
24
- dateRange?: {
25
- startDate: Date;
26
- endDate: Date;
27
- allDay: boolean;
28
- startTime: string;
29
- endTime: string;
30
- };
31
- }
32
-
33
- @Component({
34
- selector: 'brickclay-scheduled-date-picker',
35
- standalone: true,
36
- imports: [CommonModule, FormsModule, CustomCalendarComponent, TimePickerComponent],
37
- templateUrl: './scheduled-date-picker.component.html',
38
- styleUrls: ['./scheduled-date-picker.component.css']
39
- })
40
- export class ScheduledDatePickerComponent implements OnInit {
41
- @Input() timeFormat: 12 | 24 = 12;
42
- @Input() enableSeconds = false;
43
-
44
- @Output() scheduled = new EventEmitter<ScheduledDateSelection>();
45
- @Output() cleared = new EventEmitter<void>();
46
-
47
- activeTab: 'single' | 'multiple' | 'range' = 'single';
48
- openTimePickerId: string | null = null; // Track which time picker is currently open
49
- closePickerCounter: { [key: string]: number } = {}; // Track close signals for each picker
50
-
51
- // Single Date
52
- singleDate: Date | null = null;
53
- singleAllDay = false;
54
- singleStartTime = '1:00 AM';
55
- singleEndTime = '2:00 AM';
56
-
57
- // Multiple Dates
58
- multipleDates: TimeConfiguration[] = [];
59
-
60
- // Date Range
61
- rangeStartDate: Date | null = null;
62
- rangeEndDate: Date | null = null;
63
- rangeAllDay = false;
64
- rangeStartTime = '1:00 AM';
65
- rangeEndTime = '2:00 AM';
66
-
67
- ngOnInit() {
68
- // Initialize with default time if needed
69
- }
70
-
71
- onTabChange(tab: 'single' | 'multiple' | 'range') {
72
- this.activeTab = tab;
73
- this.openTimePickerId = null; // Close any open pickers when switching tabs
74
- }
75
-
76
- onTimePickerOpened(pickerId: string) {
77
- // Close all other pickers when one opens
78
- if (this.openTimePickerId && this.openTimePickerId !== pickerId) {
79
- // Increment close counter for the previously open picker
80
- if (!this.closePickerCounter[this.openTimePickerId]) {
81
- this.closePickerCounter[this.openTimePickerId] = 0;
82
- }
83
- this.closePickerCounter[this.openTimePickerId]++;
84
- }
85
- this.openTimePickerId = pickerId;
86
- }
87
-
88
- onTimePickerClosed(pickerId: string) {
89
- // Reset open picker ID if this was the open one
90
- if (this.openTimePickerId === pickerId) {
91
- this.openTimePickerId = null;
92
- }
93
- }
94
-
95
- shouldClosePicker(pickerId: string): number {
96
- // Return the counter value for this picker (triggers change detection)
97
- return this.closePickerCounter[pickerId] || 0;
98
- }
99
-
100
- // Single Date Handlers
101
- onSingleDateSelected(event: CalendarSelection) {
102
- if (event.startDate) {
103
- this.singleDate = new Date(event.startDate);
104
- // Initialize time if not all day
105
- if (!this.singleAllDay) {
106
- this.updateSingleDateTimes();
107
- }
108
- this.emitScheduled();
109
- } else {
110
- this.singleDate = null;
111
- }
112
- }
113
-
114
- onSingleAllDayChange() {
115
- this.singleAllDay = !this.singleAllDay;
116
- if (this.singleDate) {
117
- this.updateSingleDateTimes();
118
- this.emitScheduled();
119
- }
120
- }
121
-
122
- onSingleStartTimeChange(time: string) {
123
- this.singleStartTime = time;
124
- if (this.singleDate) {
125
- this.updateSingleDateTimes();
126
- this.emitScheduled();
127
- }
128
- }
129
-
130
- onSingleEndTimeChange(time: string) {
131
- this.singleEndTime = time;
132
- if (this.singleDate) {
133
- this.updateSingleDateTimes();
134
- this.emitScheduled();
135
- }
136
- }
137
-
138
- updateSingleDateTimes() {
139
- if (!this.singleDate) return;
140
- if (this.singleAllDay) {
141
- this.singleDate.setHours(0, 0, 0, 0);
142
- } else {
143
- const startTime = this.parseTimeString(this.singleStartTime);
144
- const endTime = this.parseTimeString(this.singleEndTime);
145
- this.singleDate.setHours(startTime.hours, startTime.minutes, 0, 0);
146
- }
147
- }
148
-
149
- // Multiple Dates Handlers
150
- onMultipleDatesSelected(event: CalendarSelection) {
151
- if (event.selectedDates && event.selectedDates.length > 0) {
152
- const newDates: TimeConfiguration[] = [];
153
-
154
- event.selectedDates.forEach(date => {
155
- const dateStr = this.getDateString(date);
156
- const existing = this.multipleDates.find(d => this.getDateString(d.date) === dateStr);
157
-
158
- if (existing) {
159
- newDates.push(existing);
160
- } else {
161
- // Create new time configuration for this date
162
- newDates.push({
163
- date: new Date(date),
164
- allDay: false,
165
- startTime: '1:00 AM',
166
- endTime: '2:00 AM'
167
- });
168
- }
169
- });
170
-
171
- this.multipleDates = newDates;
172
- this.emitScheduled();
173
- } else {
174
- this.multipleDates = [];
175
- this.emitScheduled();
176
- }
177
- }
178
-
179
- onMultipleDateAllDayChange(index: number) {
180
- if (this.multipleDates[index]) {
181
- this.multipleDates[index].allDay = !this.multipleDates[index].allDay;
182
- if (this.multipleDates[index].allDay) {
183
- this.multipleDates[index].date.setHours(0, 0, 0, 0);
184
- } else {
185
- const time = this.parseTimeString(this.multipleDates[index].startTime);
186
- this.multipleDates[index].date.setHours(time.hours, time.minutes, 0, 0);
187
- }
188
- this.emitScheduled();
189
- }
190
- }
191
-
192
- onMultipleDateStartTimeChange(index: number, time: string) {
193
- if (this.multipleDates[index]) {
194
- this.multipleDates[index].startTime = time;
195
- if (!this.multipleDates[index].allDay) {
196
- const parsed = this.parseTimeString(time);
197
- this.multipleDates[index].date.setHours(parsed.hours, parsed.minutes, 0, 0);
198
- }
199
- this.emitScheduled();
200
- }
201
- }
202
-
203
- onMultipleDateEndTimeChange(index: number, time: string) {
204
- if (this.multipleDates[index]) {
205
- this.multipleDates[index].endTime = time;
206
- this.emitScheduled();
207
- }
208
- }
209
-
210
- // Date Range Handlers
211
- onRangeSelected(event: CalendarSelection) {
212
- if (event.startDate && event.endDate) {
213
- this.rangeStartDate = new Date(event.startDate);
214
- this.rangeEndDate = new Date(event.endDate);
215
- if (!this.rangeAllDay) {
216
- this.updateRangeTimes();
217
- }
218
- this.emitScheduled();
219
- } else {
220
- this.rangeStartDate = null;
221
- this.rangeEndDate = null;
222
- }
223
- }
224
-
225
- onRangeAllDayChange() {
226
- this.rangeAllDay = !this.rangeAllDay;
227
- if (this.rangeStartDate && this.rangeEndDate) {
228
- this.updateRangeTimes();
229
- this.emitScheduled();
230
- }
231
- }
232
-
233
- onRangeStartTimeChange(time: string) {
234
- this.rangeStartTime = time;
235
- if (this.rangeStartDate && !this.rangeAllDay) {
236
- this.updateRangeTimes();
237
- this.emitScheduled();
238
- }
239
- }
240
-
241
- onRangeEndTimeChange(time: string) {
242
- this.rangeEndTime = time;
243
- if (this.rangeEndDate && !this.rangeAllDay) {
244
- this.updateRangeTimes();
245
- this.emitScheduled();
246
- }
247
- }
248
-
249
- updateRangeTimes() {
250
- if (!this.rangeStartDate || !this.rangeEndDate) return;
251
-
252
- if (this.rangeAllDay) {
253
- this.rangeStartDate.setHours(0, 0, 0, 0);
254
- this.rangeEndDate.setHours(23, 59, 59, 999);
255
- } else {
256
- const startTime = this.parseTimeString(this.rangeStartTime);
257
- const endTime = this.parseTimeString(this.rangeEndTime);
258
- this.rangeStartDate.setHours(startTime.hours, startTime.minutes, 0, 0);
259
- this.rangeEndDate.setHours(endTime.hours, endTime.minutes, 0, 0);
260
- }
261
- }
262
-
263
- // Utility Methods
264
- parseTimeString(timeStr: string): { hours: number; minutes: number } {
265
- // Parse time string like "7:01 AM" or "19:01"
266
- const parts = timeStr.split(' ');
267
- let timePart = parts[0];
268
- const ampm = parts[1];
269
-
270
- const [hoursStr, minutesStr] = timePart.split(':');
271
- let hours = parseInt(hoursStr, 10);
272
- const minutes = parseInt(minutesStr || '0', 10);
273
-
274
- if (ampm) {
275
- if (ampm.toUpperCase() === 'PM' && hours !== 12) {
276
- hours += 12;
277
- } else if (ampm.toUpperCase() === 'AM' && hours === 12) {
278
- hours = 0;
279
- }
280
- }
281
-
282
- return { hours, minutes };
283
- }
284
-
285
- getDateString(date: Date): string {
286
- return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
287
- }
288
-
289
- formatDate(date: Date): string {
290
- const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
291
- return `${months[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
292
- }
293
-
294
- emitScheduled() {
295
- const selection: ScheduledDateSelection = {
296
- mode: this.activeTab
297
- };
298
-
299
- if (this.activeTab === 'single' && this.singleDate) {
300
- // For single date, create startDate and endDate with same date but different times
301
- const startDate = new Date(this.singleDate);
302
- const endDate = new Date(this.singleDate);
303
-
304
- if (!this.singleAllDay) {
305
- const startTime = this.parseTimeString(this.singleStartTime);
306
- const endTime = this.parseTimeString(this.singleEndTime);
307
- startDate.setHours(startTime.hours, startTime.minutes, 0, 0);
308
- endDate.setHours(endTime.hours, endTime.minutes, 0, 0);
309
- } else {
310
- startDate.setHours(0, 0, 0, 0);
311
- endDate.setHours(23, 59, 59, 999);
312
- }
313
-
314
- selection.singleDate = {
315
- startDate: startDate,
316
- endDate: endDate,
317
- allDay: this.singleAllDay,
318
- startTime: this.singleStartTime,
319
- endTime: this.singleEndTime
320
- };
321
- } else if (this.activeTab === 'multiple') {
322
- selection.multipleDates = this.multipleDates.map(d => ({
323
- date: new Date(d.date),
324
- allDay: d.allDay,
325
- startTime: d.startTime,
326
- endTime: d.endTime
327
- }));
328
- } else if (this.activeTab === 'range' && this.rangeStartDate && this.rangeEndDate) {
329
- selection.dateRange = {
330
- startDate: new Date(this.rangeStartDate),
331
- endDate: new Date(this.rangeEndDate),
332
- allDay: this.rangeAllDay,
333
- startTime: this.rangeStartTime,
334
- endTime: this.rangeEndTime
335
- };
336
- }
337
-
338
- this.scheduled.emit(selection);
339
- }
340
-
341
- clear() {
342
- this.singleDate = null;
343
- this.multipleDates = [];
344
- this.rangeStartDate = null;
345
- this.rangeEndDate = null;
346
- this.singleAllDay = false;
347
- this.rangeAllDay = false;
348
- this.singleStartTime = '1:00 AM';
349
- this.singleEndTime = '2:00 AM';
350
- this.rangeStartTime = '1:00 AM';
351
- this.rangeEndTime = '2:00 AM';
352
- this.cleared.emit();
353
- }
354
-
355
- apply() {
356
- this.emitScheduled();
357
- }
358
-
359
- }
360
-
@@ -1,174 +0,0 @@
1
- .time-picker-wrapper {
2
- width: 100%;
3
- font-family: 'Inter', sans-serif;
4
- }
5
-
6
- .time-input-group {
7
- display: flex;
8
- flex-direction: column;
9
- gap: 4px;
10
- }
11
-
12
- .time-input-group label {
13
- font-size: 11px;
14
- font-weight: 500;
15
- color: #15191E;
16
- text-transform: uppercase;
17
- letter-spacing: -0.28px;
18
- }
19
-
20
- .time-input-wrapper {
21
- position: relative;
22
- display: flex;
23
- align-items: center;
24
- }
25
-
26
- .time-input {
27
- padding: 8px 40px 8px 12px;
28
- border: 1px solid #d1d5db;
29
- border-radius: 4px;
30
- font-size: 12px;
31
- font-family: 'Inter', sans-serif;
32
- color: #6F737B;
33
- background: #ffffff;
34
- transition: all 0.2s;
35
- width: 100%;
36
- box-sizing: border-box;
37
- cursor: pointer;
38
- }
39
-
40
- .time-input:focus {
41
- outline: none;
42
- border-color: #111827;
43
- box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
44
- }
45
-
46
- .time-input:hover {
47
- border-color: #9ca3af;
48
- }
49
-
50
- .time-icon {
51
- position: absolute;
52
- right: 12px;
53
- font-size: 16px;
54
- pointer-events: none;
55
- color: #9ca3af;
56
- cursor: pointer;
57
- }
58
-
59
- /* Custom Time Picker Dropdown */
60
- /* .custom-time-picker-dropdown {
61
- position: absolute;
62
- top: calc(100% + 4px);
63
- left: 0;
64
- z-index: 1000;
65
- width: 172px;
66
- min-width: 172px;
67
- } */
68
-
69
- .custom-time-picker-wrapper {
70
- width: 100%;
71
- display: flex;
72
- justify-content: center;
73
- }
74
-
75
- .custom-time-picker {
76
- display: flex;
77
- /* align-items: center; */
78
- gap: 8px;
79
- background: #ffffff;
80
- border: 1px solid #e5e7eb;
81
- border-radius: 8px;
82
- padding: 10px;
83
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
84
- width:182px;
85
- position: absolute;
86
- top: calc(100% + 4px);
87
- /* right: 0; */
88
- z-index: 1000;
89
- }
90
- .custom-time-picker.left-position {
91
- left: 0;
92
- }
93
- .custom-time-picker.right-position {
94
- right: 0;
95
- }
96
- .time-column {
97
- display: flex;
98
- flex-direction: column;
99
- position: relative;
100
- }
101
-
102
- .time-scroll {
103
- display: flex;
104
- flex-direction: column;
105
- max-height: 95px;
106
- overflow-y: auto;
107
- overflow-x: hidden;
108
- scrollbar-width: thin;
109
- scrollbar-color: #cbd5e1 transparent;
110
- /* padding: 4px 0; */
111
- scrollbar-width: none; /* For Firefox */
112
- -ms-overflow-style: none; /* For Internet Explorer and Edge */
113
- }
114
-
115
-
116
- .time-scroll::-webkit-scrollbar {
117
- display: none; /* For Chrome, Safari, and Opera */
118
- /* width: 4px; */
119
- }
120
-
121
- .time-scroll::-webkit-scrollbar-track {
122
- background: transparent;
123
- }
124
-
125
- .time-scroll::-webkit-scrollbar-thumb {
126
- background: #cbd5e1;
127
- border-radius: 2px;
128
- }
129
-
130
- .time-scroll::-webkit-scrollbar-thumb:hover {
131
- background: #94a3b8;
132
- }
133
-
134
- .time-item {
135
- min-width: 40px;
136
- width: 40px;
137
- height: 32px;
138
- min-height: 32px;
139
- display: flex;
140
- align-items: center;
141
- justify-content: center;
142
- font-size: 14px;
143
- font-weight: 400;
144
- color: #374151;
145
- cursor: pointer;
146
- border-radius: 4px;
147
- transition: all 0.15s ease;
148
- user-select: none;
149
- font-family: 'Inter', sans-serif;
150
- }
151
-
152
- .time-item:hover {
153
- background: #f3f4f6;
154
- }
155
-
156
- .time-item.selected {
157
- background: #111827;
158
- color: #ffffff;
159
- font-weight: 500;
160
- box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
161
- }
162
-
163
- .ampm-column .time-item {
164
- min-width: 40px;
165
- width: 40px;
166
- }
167
-
168
- .time-separator {
169
- font-size: 16px;
170
- font-weight: 600;
171
- color: #6b7280;
172
- margin: 5px 0 0px;
173
- }
174
-
@@ -1,60 +0,0 @@
1
- <div class="time-picker-wrapper">
2
- <div class="time-input-group">
3
- <label *ngIf="label">{{ label }}</label>
4
- <div class="time-input-wrapper">
5
- <input
6
- type="text"
7
- class="time-input"
8
- [value]="value"
9
- [placeholder]="placeholder"
10
- readonly
11
- (click)="togglePicker()">
12
- <span class="time-icon">
13
- <img alt="timer" class="timer-icon" [src]='brickclayIcons.timerIcon'/>
14
- </span>
15
- <div class="custom-time-picker-dropdown" *ngIf="showPicker">
16
- <div class="custom-time-picker" [ngClass]="position === 'left' ? 'left-position' : 'right-position'">
17
- <!-- Hours Column -->
18
- <div class="time-column">
19
- <div class="time-scroll" #timeScroll>
20
- <div
21
- *ngFor="let h of getHours()"
22
- class="time-item"
23
- [class.selected]="currentHour === h"
24
- (click)="onHourChange(h)">
25
- {{ h.toString().padStart(2, '0') }}
26
- </div>
27
- </div>
28
- </div>
29
- <span class="time-separator">:</span>
30
- <!-- Minutes Column -->
31
- <div class="time-column">
32
- <div class="time-scroll" #timeScroll>
33
- <div
34
- *ngFor="let m of getMinutes()"
35
- class="time-item"
36
- [class.selected]="currentMinute === m"
37
- (click)="onMinuteChange(m)">
38
- {{ m.toString().padStart(2, '0') }}
39
- </div>
40
- </div>
41
- </div>
42
- <span class="time-separator">:</span>
43
- <!-- AM/PM Column -->
44
- <div class="time-column ampm-column">
45
- <div class="time-scroll" #timeScroll>
46
- <div
47
- *ngFor="let ap of getAMPMOptions()"
48
- class="time-item"
49
- [class.selected]="currentAMPM === ap"
50
- (click)="onAMPMChange(ap)">
51
- {{ ap }}
52
- </div>
53
- </div>
54
- </div>
55
- </div>
56
- </div>
57
- </div>
58
- </div>
59
- </div>
60
-