@brickclay-org/ui 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,578 @@
1
+ # @brickclay/ui
2
+
3
+ A comprehensive Angular UI component library featuring a rich collection of customizable, accessible components. Built with modern Angular standards, this library provides everything you need to build beautiful and functional user interfaces.
4
+
5
+ ## 🌟 Features
6
+
7
+ - πŸ“¦ **Comprehensive Component Library** - Rich set of UI components for common use cases
8
+ - β™Ώ **Accessible by Default** - WCAG compliant components with keyboard navigation and screen reader support
9
+ - πŸš€ **Angular 20+ Ready** - Built with latest Angular features and standalone components
10
+ - πŸ“± **Responsive Design** - Mobile-first components that work on all screen sizes
11
+ - 🎯 **Type-Safe** - Full TypeScript support with comprehensive type definitions
12
+ - ⚑ **Lightweight** - Tree-shakeable and optimized for performance
13
+ - πŸŽ›οΈ **Highly Customizable** - Extensive configuration options for every component
14
+
15
+ ## πŸ“š Available Components
16
+
17
+ ### Calendar Components
18
+
19
+ A powerful calendar suite with advanced date and time selection capabilities. The calendar components support single date selection, date ranges, multiple date selection, and integrated time pickers.
20
+
21
+ *More components coming soon...*
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install @brickclay/ui
27
+ ```
28
+
29
+ ### Peer Dependencies
30
+
31
+ This library requires Angular 20.3.0 or higher:
32
+
33
+ ```bash
34
+ npm install @angular/common@^20.3.0 @angular/core@^20.3.0 moment
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ### Standalone Component Usage (Recommended)
40
+
41
+ ```typescript
42
+ import { Component } from '@angular/core';
43
+ import { CustomCalendarComponent, CalendarSelection } from '@brickclay/ui';
44
+
45
+ @Component({
46
+ standalone: true,
47
+ selector: 'app-my-component',
48
+ imports: [CustomCalendarComponent],
49
+ template: `
50
+ <brickclay-custom-calendar
51
+ (selected)="onDateSelected($event)">
52
+ </brickclay-custom-calendar>
53
+ `
54
+ })
55
+ export class MyComponent {
56
+ onDateSelected(selection: CalendarSelection) {
57
+ console.log('Selected:', selection);
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### Module-based Usage
63
+
64
+ ```typescript
65
+ import { NgModule } from '@angular/core';
66
+ import { CalendarModule } from '@brickclay/ui';
67
+
68
+ @NgModule({
69
+ imports: [CalendarModule],
70
+ // ...
71
+ })
72
+ export class AppModule {}
73
+ ```
74
+
75
+ ## πŸ“… Calendar
76
+
77
+ The calendar components provide a complete solution for date and time selection in your Angular applications. All components are standalone and can be imported individually or as part of the `CalendarModule`.
78
+
79
+ ### Components Overview
80
+
81
+ 1. **CustomCalendarComponent** (`brickclay-custom-calendar`) - Main calendar component with support for single date, date range, and multiple date selection
82
+ 2. **ScheduledDatePickerComponent** (`brickclay-scheduled-date-picker`) - Advanced scheduling component with time configuration for events
83
+ 3. **TimePickerComponent** (`brickclay-time-picker`) - Standalone time selection component with scrollable pickers
84
+
85
+ ### CustomCalendarComponent
86
+
87
+ A versatile calendar component that supports single date, date range, and multiple date selection modes.
88
+
89
+ #### Basic Example
90
+
91
+ ```typescript
92
+ import { CustomCalendarComponent, CalendarSelection } from '@brickclay/ui';
93
+
94
+ @Component({
95
+ template: `
96
+ <brickclay-custom-calendar
97
+ [singleDatePicker]="false"
98
+ [dualCalendar]="true"
99
+ [enableTimepicker]="true"
100
+ [showRanges]="true"
101
+ [placeholder]="'Select date range'"
102
+ (selected)="onDateSelected($event)">
103
+ </brickclay-custom-calendar>
104
+ `
105
+ })
106
+ export class MyComponent {
107
+ onDateSelected(selection: CalendarSelection) {
108
+ console.log('Start:', selection.startDate);
109
+ console.log('End:', selection.endDate);
110
+ }
111
+ }
112
+ ```
113
+
114
+ #### Component Selector
115
+
116
+ `<brickclay-custom-calendar>`
117
+
118
+ #### Inputs
119
+
120
+ | Input | Type | Default | Description |
121
+ |-------|------|---------|-------------|
122
+ | `enableTimepicker` | `boolean` | `false` | Enable time selection |
123
+ | `autoApply` | `boolean` | `false` | Automatically apply selection when date is chosen |
124
+ | `closeOnAutoApply` | `boolean` | `false` | Close calendar after auto-apply |
125
+ | `showCancel` | `boolean` | `true` | Show cancel button in footer |
126
+ | `singleDatePicker` | `boolean` | `false` | Enable single date selection mode |
127
+ | `dualCalendar` | `boolean` | `false` | Show two calendars side-by-side |
128
+ | `showRanges` | `boolean` | `true` | Show predefined date range buttons |
129
+ | `multiDateSelection` | `boolean` | `false` | Enable multiple date selection |
130
+ | `inline` | `boolean` | `false` | Always show calendar (no dropdown) |
131
+ | `minDate` | `Date` | `undefined` | Minimum selectable date |
132
+ | `maxDate` | `Date` | `undefined` | Maximum selectable date |
133
+ | `placeholder` | `string` | `'Select date range'` | Input placeholder text |
134
+ | `opens` | `'left' \| 'right' \| 'center'` | `'left'` | Dropdown alignment |
135
+ | `drop` | `'up' \| 'down'` | `'down'` | Dropdown direction |
136
+ | `displayFormat` | `string` | `'MM/DD/YYYY'` | Date display format (moment format) |
137
+ | `customRanges` | `Record<string, CalendarRange>` | `undefined` | Custom predefined ranges |
138
+ | `selectedValue` | `CalendarSelection \| null` | `null` | Pre-selected date(s) |
139
+ | `isDisplayCrossIcon` | `boolean` | `true` | Show/hide clear button |
140
+
141
+ #### Outputs
142
+
143
+ | Output | Type | Description |
144
+ |--------|------|-------------|
145
+ | `selected` | `EventEmitter<CalendarSelection>` | Emitted when date selection changes |
146
+ | `opened` | `EventEmitter<void>` | Emitted when calendar opens |
147
+ | `closed` | `EventEmitter<void>` | Emitted when calendar closes |
148
+
149
+ #### Usage Examples
150
+
151
+ **Single Date Selection:**
152
+
153
+ ```typescript
154
+ <brickclay-custom-calendar
155
+ [singleDatePicker]="true"
156
+ [placeholder]="'Select a date'"
157
+ (selected)="onDateSelected($event)">
158
+ </brickclay-custom-calendar>
159
+ ```
160
+
161
+ **Date Range with Time Picker:**
162
+
163
+ ```typescript
164
+ <brickclay-custom-calendar
165
+ [dualCalendar]="true"
166
+ [enableTimepicker]="true"
167
+ [enableSeconds]="true"
168
+ (selected)="onRangeSelected($event)">
169
+ </brickclay-custom-calendar>
170
+ ```
171
+
172
+ **Multiple Date Selection:**
173
+
174
+ ```typescript
175
+ <brickclay-custom-calendar
176
+ [multiDateSelection]="true"
177
+ [inline]="true"
178
+ (selected)="onMultipleDatesSelected($event)">
179
+ </brickclay-custom-calendar>
180
+ ```
181
+
182
+ **Inline Calendar:**
183
+
184
+ ```typescript
185
+ <brickclay-custom-calendar
186
+ [inline]="true"
187
+ [dualCalendar]="false"
188
+ [showRanges]="false"
189
+ (selected)="onDateSelected($event)">
190
+ </brickclay-custom-calendar>
191
+ ```
192
+
193
+ **Custom Date Ranges:**
194
+
195
+ ```typescript
196
+ import { CalendarRange } from '@brickclay/ui';
197
+
198
+ const customRanges: Record<string, CalendarRange> = {
199
+ 'Last Week': {
200
+ start: new Date(2024, 0, 1),
201
+ end: new Date(2024, 0, 7)
202
+ },
203
+ 'This Quarter': {
204
+ start: new Date(2024, 0, 1),
205
+ end: new Date(2024, 2, 31)
206
+ }
207
+ };
208
+
209
+ <brickclay-custom-calendar
210
+ [customRanges]="customRanges"
211
+ [showRanges]="true"
212
+ (selected)="onDateSelected($event)">
213
+ </brickclay-custom-calendar>
214
+ ```
215
+
216
+ **Date Constraints:**
217
+
218
+ ```typescript
219
+ <brickclay-custom-calendar
220
+ [minDate]="new Date(2024, 0, 1)"
221
+ [maxDate]="new Date(2024, 11, 31)"
222
+ (selected)="onDateSelected($event)">
223
+ </brickclay-custom-calendar>
224
+ ```
225
+
226
+ **Pre-selected Values:**
227
+
228
+ ```typescript
229
+ export class MyComponent {
230
+ selectedValue: CalendarSelection = {
231
+ startDate: new Date(2024, 5, 15),
232
+ endDate: new Date(2024, 5, 20)
233
+ };
234
+
235
+ onDateChange() {
236
+ this.selectedValue = {
237
+ startDate: new Date(),
238
+ endDate: new Date()
239
+ };
240
+ }
241
+ }
242
+
243
+ <brickclay-custom-calendar
244
+ [selectedValue]="selectedValue"
245
+ (selected)="onDateSelected($event)">
246
+ </brickclay-custom-calendar>
247
+ ```
248
+
249
+ ### ScheduledDatePickerComponent
250
+
251
+ A comprehensive date and time scheduling component with three modes: single date, multiple dates, and date range, each with time configuration.
252
+
253
+ #### Basic Example
254
+
255
+ ```typescript
256
+ import { ScheduledDatePickerComponent, ScheduledDateSelection } from '@brickclay/ui';
257
+
258
+ @Component({
259
+ template: `
260
+ <brickclay-scheduled-date-picker
261
+ [timeFormat]="12"
262
+ (scheduled)="onScheduled($event)">
263
+ </brickclay-scheduled-date-picker>
264
+ `
265
+ })
266
+ export class MyComponent {
267
+ onScheduled(selection: ScheduledDateSelection) {
268
+ console.log('Mode:', selection.mode);
269
+ if (selection.mode === 'single' && selection.singleDate) {
270
+ console.log('Start:', selection.singleDate.startDate);
271
+ console.log('End:', selection.singleDate.endDate);
272
+ console.log('All Day:', selection.singleDate.allDay);
273
+ }
274
+ }
275
+ }
276
+ ```
277
+
278
+ #### Component Selector
279
+
280
+ `<brickclay-scheduled-date-picker>`
281
+
282
+ #### Inputs
283
+
284
+ | Input | Type | Default | Description |
285
+ |-------|------|---------|-------------|
286
+ | `timeFormat` | `12 \| 24` | `12` | Time format (12-hour or 24-hour) |
287
+ | `enableSeconds` | `boolean` | `false` | Enable seconds in time picker |
288
+
289
+ #### Outputs
290
+
291
+ | Output | Type | Description |
292
+ |--------|------|-------------|
293
+ | `scheduled` | `EventEmitter<ScheduledDateSelection>` | Emitted when selection changes |
294
+ | `cleared` | `EventEmitter<void>` | Emitted when clear button is clicked |
295
+
296
+ #### Features
297
+
298
+ - **Single Date Mode**: Select one date with optional start and end times
299
+ - **Multiple Dates Mode**: Select multiple dates, each with individual time configuration
300
+ - **Date Range Mode**: Select a date range with start and end times
301
+ - **All Day Toggle**: Mark dates as all-day events
302
+ - **Time Configuration**: Individual time pickers for each date/range
303
+
304
+ ### TimePickerComponent
305
+
306
+ A standalone time picker component with scrollable hour, minute, and AM/PM selectors.
307
+
308
+ #### Basic Example
309
+
310
+ ```typescript
311
+ import { TimePickerComponent } from '@brickclay/ui';
312
+
313
+ @Component({
314
+ template: `
315
+ <brickclay-time-picker
316
+ [value]="selectedTime"
317
+ [label]="'Start Time'"
318
+ [timeFormat]="12"
319
+ (timeChange)="onTimeChange($event)">
320
+ </brickclay-time-picker>
321
+ `
322
+ })
323
+ export class MyComponent {
324
+ selectedTime = '1:00 AM';
325
+
326
+ onTimeChange(time: string) {
327
+ this.selectedTime = time;
328
+ console.log('New time:', time);
329
+ }
330
+ }
331
+ ```
332
+
333
+ #### Component Selector
334
+
335
+ `<brickclay-time-picker>`
336
+
337
+ #### Inputs
338
+
339
+ | Input | Type | Default | Description |
340
+ |-------|------|---------|-------------|
341
+ | `value` | `string` | `'1:00 AM'` | Current time value (format: "H:MM AM/PM" or "HH:MM") |
342
+ | `label` | `string` | `'Time'` | Label text |
343
+ | `placeholder` | `string` | `'Select time'` | Placeholder text |
344
+ | `position` | `'left' \| 'right'` | `'left'` | Dropdown position |
345
+ | `pickerId` | `string` | `''` | Unique identifier for the picker |
346
+ | `closePicker` | `number` | `0` | Counter to trigger picker close |
347
+ | `timeFormat` | `12 \| 24` | `12` | Time format (12-hour or 24-hour) |
348
+ | `showSeconds` | `boolean` | `false` | Show seconds selector |
349
+
350
+ #### Outputs
351
+
352
+ | Output | Type | Description |
353
+ |--------|------|-------------|
354
+ | `timeChange` | `EventEmitter<string>` | Emitted when time changes |
355
+ | `pickerOpened` | `EventEmitter<string>` | Emitted when picker opens |
356
+ | `pickerClosed` | `EventEmitter<string>` | Emitted when picker closes |
357
+
358
+ #### Features
359
+
360
+ - Scrollable time selectors
361
+ - Keyboard navigation support
362
+ - 12-hour and 24-hour formats
363
+ - Optional seconds support
364
+ - Multiple picker coordination (only one open at a time)
365
+ - Click outside to close
366
+
367
+ #### Time Format Examples
368
+
369
+ **12-hour format:**
370
+ ```typescript
371
+ value="1:00 AM"
372
+ value="12:30 PM"
373
+ value="11:45 PM"
374
+ ```
375
+
376
+ **24-hour format:**
377
+ ```typescript
378
+ value="01:00"
379
+ value="13:30"
380
+ value="23:45"
381
+ ```
382
+
383
+ ## πŸ“ TypeScript Interfaces
384
+
385
+ ### CalendarRange
386
+
387
+ ```typescript
388
+ interface CalendarRange {
389
+ start: Date;
390
+ end: Date;
391
+ }
392
+ ```
393
+
394
+ ### CalendarSelection
395
+
396
+ ```typescript
397
+ interface CalendarSelection {
398
+ startDate: Date | null;
399
+ endDate: Date | null;
400
+ selectedDates?: Date[]; // For multi-date selection
401
+ }
402
+ ```
403
+
404
+ ### TimeConfiguration
405
+
406
+ ```typescript
407
+ interface TimeConfiguration {
408
+ date: Date;
409
+ allDay: boolean;
410
+ startTime: string; // Format: "HH:mm" or "HH:mm:ss"
411
+ endTime: string;
412
+ }
413
+ ```
414
+
415
+ ### ScheduledDateSelection
416
+
417
+ ```typescript
418
+ interface ScheduledDateSelection {
419
+ mode: 'single' | 'multiple' | 'range';
420
+ singleDate?: {
421
+ startDate: Date;
422
+ endDate: Date;
423
+ allDay: boolean;
424
+ startTime: string;
425
+ endTime: string;
426
+ };
427
+ multipleDates?: TimeConfiguration[];
428
+ dateRange?: {
429
+ startDate: Date;
430
+ endDate: Date;
431
+ allDay: boolean;
432
+ startTime: string;
433
+ endTime: string;
434
+ };
435
+ }
436
+ ```
437
+
438
+ ## 🎯 Common Use Cases
439
+
440
+ ### Form Integration
441
+
442
+ ```typescript
443
+ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
444
+ import { CustomCalendarComponent } from '@brickclay/ui';
445
+
446
+ export class BookingFormComponent {
447
+ bookingForm: FormGroup;
448
+
449
+ constructor(private fb: FormBuilder) {
450
+ this.bookingForm = this.fb.group({
451
+ checkIn: [null, Validators.required],
452
+ checkOut: [null, Validators.required]
453
+ });
454
+ }
455
+
456
+ onDateSelected(selection: CalendarSelection) {
457
+ this.bookingForm.patchValue({
458
+ checkIn: selection.startDate,
459
+ checkOut: selection.endDate
460
+ });
461
+ }
462
+ }
463
+ ```
464
+
465
+ ### Reactive Forms
466
+
467
+ ```typescript
468
+ <brickclay-custom-calendar
469
+ [selectedValue]="form.get('dateRange')?.value"
470
+ (selected)="form.patchValue({ dateRange: $event })">
471
+ </brickclay-custom-calendar>
472
+ ```
473
+
474
+ ### Date Filtering
475
+
476
+ ```typescript
477
+ export class DataTableComponent {
478
+ filterDates: CalendarSelection = { startDate: null, endDate: null };
479
+
480
+ onDateFilter(selection: CalendarSelection) {
481
+ this.filterDates = selection;
482
+ this.loadFilteredData();
483
+ }
484
+
485
+ loadFilteredData() {
486
+ const filtered = this.data.filter(item => {
487
+ if (!this.filterDates.startDate || !this.filterDates.endDate) {
488
+ return true;
489
+ }
490
+ return item.date >= this.filterDates.startDate! &&
491
+ item.date <= this.filterDates.endDate!;
492
+ });
493
+ }
494
+ }
495
+ ```
496
+
497
+ ## πŸ“¦ Assets Configuration
498
+
499
+ The calendar components require SVG icons. Configure your `angular.json` to copy assets:
500
+
501
+ ```json
502
+ {
503
+ "glob": "**/*",
504
+ "input": "node_modules/@brickclay/ui/assets",
505
+ "output": "assets"
506
+ }
507
+ ```
508
+
509
+ Or manually copy assets from:
510
+ ```
511
+ node_modules/@brickclay/ui/assets/calender/* β†’ your-app/public/assets/calender/
512
+ ```
513
+
514
+ ## πŸ”§ Service
515
+
516
+ ### CalendarManagerService
517
+
518
+ A service that manages multiple calendar instances, ensuring only one calendar is open at a time when not in inline mode. Used internally by `CustomCalendarComponent`.
519
+
520
+ ## 🌐 Browser Support
521
+
522
+ - Chrome (latest)
523
+ - Firefox (latest)
524
+ - Safari (latest)
525
+ - Edge (latest)
526
+
527
+ ## πŸ“¦ Dependencies
528
+
529
+ - Angular 20.3.0+
530
+ - moment (for date formatting)
531
+
532
+ ## 🀝 Contributing
533
+
534
+ We welcome contributions! Please see our contributing guidelines for more information.
535
+
536
+ ## πŸ“„ License
537
+
538
+ MIT
539
+
540
+ ## πŸ“ž Support
541
+
542
+ For issues, feature requests, or contributions, please visit our [GitHub repository](https://github.com/brickclay/ui).
543
+
544
+ ## πŸ—ΊοΈ Roadmap
545
+
546
+ - [ ] Button components
547
+ - [ ] Input components
548
+ - [ ] Card components
549
+ - [ ] Modal/Dialog components
550
+ - [ ] Table components
551
+ - [ ] Form components
552
+ - [ ] Navigation components
553
+ - [ ] Loading/Spinner components
554
+ - [ ] Toast/Notification components
555
+ - [ ] More calendar features
556
+
557
+ ## πŸ“ Changelog
558
+
559
+ ### Version 0.0.1
560
+
561
+ **Initial Release:**
562
+ - βœ… Calendar component suite
563
+ - Single date selection
564
+ - Date range selection
565
+ - Multiple date selection
566
+ - Time picker integration
567
+ - Inline and dropdown modes
568
+ - Dual calendar view
569
+ - Custom date ranges
570
+ - Date constraints (min/max)
571
+ - βœ… Scheduled date picker component
572
+ - βœ… Standalone time picker component
573
+ - βœ… TypeScript definitions
574
+ - βœ… Comprehensive documentation
575
+
576
+ ---
577
+
578
+ **Built with ❀️ by the Brickclay team**