@brickclay-org/ui 0.0.13 β†’ 0.0.16

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 CHANGED
@@ -1,1385 +1,1911 @@
1
- # @brickclay-org/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
- ### Toggle Component
22
-
23
- A customizable toggle/switch component with support for Angular forms integration via `ngModel` and reactive forms. Features three size variants (small, medium, large), disabled state, and full accessibility support.
24
-
25
- ### Checkbox Component
26
-
27
- A fully accessible checkbox component with Angular forms integration. Features customizable styling via CSS classes, disabled state, keyboard navigation, and seamless integration with both template-driven and reactive forms.
28
-
29
- ### Radio Component
30
-
31
- A fully accessible radio button component with Angular forms integration. Features two visual variants (dot and tick), customizable styling, disabled state, keyboard navigation, and seamless integration with both template-driven and reactive forms.
32
-
33
- *More components coming soon...*
34
-
35
- ## Installation
36
-
37
- ```bash
38
- npm i @brickclay-org/ui@0.0.10
39
- ```
40
-
41
- ### Peer Dependencies
42
-
43
- This library requires Angular 20.3.0 or higher:
44
-
45
- ```bash
46
- npm install @angular/common@^20.3.0 @angular/core@^20.3.0 moment
47
- ```
48
-
49
- ## Quick Start
50
-
51
- ### Standalone Component Usage (Recommended)
52
-
53
- ```typescript
54
- import { Component } from '@angular/core';
55
- import { CustomCalendarComponent, CalendarSelection } from '@brickclay/ui';
56
-
57
- @Component({
58
- standalone: true,
59
- selector: 'app-my-component',
60
- imports: [CustomCalendarComponent],
61
- template: `
62
- <brickclay-custom-calendar
63
- (selected)="onDateSelected($event)">
64
- </brickclay-custom-calendar>
65
- `
66
- })
67
- export class MyComponent {
68
- onDateSelected(selection: CalendarSelection) {
69
- console.log('Selected:', selection);
70
- }
71
- }
72
- ```
73
-
74
- ### Module-based Usage
75
-
76
- ```typescript
77
- import { NgModule } from '@angular/core';
78
- import { CalendarModule } from '@brickclay/ui';
79
-
80
- @NgModule({
81
- imports: [CalendarModule],
82
- // ...
83
- })
84
- export class AppModule {}
85
- ```
86
-
87
- ## πŸ“… Calendar
88
-
89
- 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`.
90
-
91
- ### Components Overview
92
-
93
- 1. **CustomCalendarComponent** (`brickclay-custom-calendar`) - Main calendar component with support for single date, date range, and multiple date selection
94
- 2. **ScheduledDatePickerComponent** (`brickclay-scheduled-date-picker`) - Advanced scheduling component with time configuration for events
95
- 3. **TimePickerComponent** (`brickclay-time-picker`) - Standalone time selection component with scrollable pickers
96
-
97
- ### CustomCalendarComponent
98
-
99
- A versatile calendar component that supports single date, date range, and multiple date selection modes.
100
-
101
- #### Basic Example
102
-
103
- ```typescript
104
- import { CustomCalendarComponent, CalendarSelection } from '@brickclay/ui';
105
-
106
- @Component({
107
- template: `
108
- <brickclay-custom-calendar
109
- [singleDatePicker]="false"
110
- [dualCalendar]="true"
111
- [enableTimepicker]="true"
112
- [showRanges]="true"
113
- [placeholder]="'Select date range'"
114
- (selected)="onDateSelected($event)">
115
- </brickclay-custom-calendar>
116
- `
117
- })
118
- export class MyComponent {
119
- onDateSelected(selection: CalendarSelection) {
120
- console.log('Start:', selection.startDate);
121
- console.log('End:', selection.endDate);
122
- }
123
- }
124
- ```
125
-
126
- #### Component Selector
127
-
128
- `<brickclay-custom-calendar>`
129
-
130
- #### Inputs
131
-
132
- | Input | Type | Default | Description |
133
- |-------|------|---------|-------------|
134
- | `enableTimepicker` | `boolean` | `false` | Enable time selection |
135
- | `autoApply` | `boolean` | `false` | Automatically apply selection when date is chosen |
136
- | `closeOnAutoApply` | `boolean` | `false` | Close calendar after auto-apply |
137
- | `showCancel` | `boolean` | `true` | Show cancel button in footer |
138
- | `singleDatePicker` | `boolean` | `false` | Enable single date selection mode |
139
- | `dualCalendar` | `boolean` | `false` | Show two calendars side-by-side |
140
- | `showRanges` | `boolean` | `true` | Show predefined date range buttons |
141
- | `multiDateSelection` | `boolean` | `false` | Enable multiple date selection |
142
- | `inline` | `boolean` | `false` | Always show calendar (no dropdown) |
143
- | `minDate` | `Date` | `undefined` | Minimum selectable date |
144
- | `maxDate` | `Date` | `undefined` | Maximum selectable date |
145
- | `placeholder` | `string` | `'Select date range'` | Input placeholder text |
146
- | `opens` | `'left' \| 'right' \| 'center'` | `'left'` | Dropdown alignment |
147
- | `drop` | `'up' \| 'down'` | `'down'` | Dropdown direction |
148
- | `displayFormat` | `string` | `'MM/DD/YYYY'` | Date display format (moment format) |
149
- | `customRanges` | `Record<string, CalendarRange>` | `undefined` | Custom predefined ranges |
150
- | `selectedValue` | `CalendarSelection \| null` | `null` | Pre-selected date(s) |
151
- | `isDisplayCrossIcon` | `boolean` | `true` | Show/hide clear button |
152
-
153
- #### Outputs
154
-
155
- | Output | Type | Description |
156
- |--------|------|-------------|
157
- | `selected` | `EventEmitter<CalendarSelection>` | Emitted when date selection changes |
158
- | `opened` | `EventEmitter<void>` | Emitted when calendar opens |
159
- | `closed` | `EventEmitter<void>` | Emitted when calendar closes |
160
-
161
- #### Usage Examples
162
-
163
- **Single Date Selection:**
164
-
165
- ```typescript
166
- <brickclay-custom-calendar
167
- [singleDatePicker]="true"
168
- [placeholder]="'Select a date'"
169
- (selected)="onDateSelected($event)">
170
- </brickclay-custom-calendar>
171
- ```
172
-
173
- **Date Range with Time Picker:**
174
-
175
- ```typescript
176
- <brickclay-custom-calendar
177
- [dualCalendar]="true"
178
- [enableTimepicker]="true"
179
- [enableSeconds]="true"
180
- (selected)="onRangeSelected($event)">
181
- </brickclay-custom-calendar>
182
- ```
183
-
184
- **Multiple Date Selection:**
185
-
186
- ```typescript
187
- <brickclay-custom-calendar
188
- [multiDateSelection]="true"
189
- [inline]="true"
190
- (selected)="onMultipleDatesSelected($event)">
191
- </brickclay-custom-calendar>
192
- ```
193
-
194
- **Inline Calendar:**
195
-
196
- ```typescript
197
- <brickclay-custom-calendar
198
- [inline]="true"
199
- [dualCalendar]="false"
200
- [showRanges]="false"
201
- (selected)="onDateSelected($event)">
202
- </brickclay-custom-calendar>
203
- ```
204
-
205
- **Custom Date Ranges:**
206
-
207
- ```typescript
208
- import { CalendarRange } from '@brickclay/ui';
209
-
210
- const customRanges: Record<string, CalendarRange> = {
211
- 'Last Week': {
212
- start: new Date(2024, 0, 1),
213
- end: new Date(2024, 0, 7)
214
- },
215
- 'This Quarter': {
216
- start: new Date(2024, 0, 1),
217
- end: new Date(2024, 2, 31)
218
- }
219
- };
220
-
221
- <brickclay-custom-calendar
222
- [customRanges]="customRanges"
223
- [showRanges]="true"
224
- (selected)="onDateSelected($event)">
225
- </brickclay-custom-calendar>
226
- ```
227
-
228
- **Date Constraints:**
229
-
230
- ```typescript
231
- <brickclay-custom-calendar
232
- [minDate]="new Date(2024, 0, 1)"
233
- [maxDate]="new Date(2024, 11, 31)"
234
- (selected)="onDateSelected($event)">
235
- </brickclay-custom-calendar>
236
- ```
237
-
238
- **Pre-selected Values:**
239
-
240
- ```typescript
241
- export class MyComponent {
242
- selectedValue: CalendarSelection = {
243
- startDate: new Date(2024, 5, 15),
244
- endDate: new Date(2024, 5, 20)
245
- };
246
-
247
- onDateChange() {
248
- this.selectedValue = {
249
- startDate: new Date(),
250
- endDate: new Date()
251
- };
252
- }
253
- }
254
-
255
- <brickclay-custom-calendar
256
- [selectedValue]="selectedValue"
257
- (selected)="onDateSelected($event)">
258
- </brickclay-custom-calendar>
259
- ```
260
-
261
- ### ScheduledDatePickerComponent
262
-
263
- A comprehensive date and time scheduling component with three modes: single date, multiple dates, and date range, each with time configuration.
264
-
265
- #### Basic Example
266
-
267
- ```typescript
268
- import { ScheduledDatePickerComponent, ScheduledDateSelection } from '@brickclay/ui';
269
-
270
- @Component({
271
- template: `
272
- <brickclay-scheduled-date-picker
273
- [timeFormat]="12"
274
- (scheduled)="onScheduled($event)">
275
- </brickclay-scheduled-date-picker>
276
- `
277
- })
278
- export class MyComponent {
279
- onScheduled(selection: ScheduledDateSelection) {
280
- console.log('Mode:', selection.mode);
281
- if (selection.mode === 'single' && selection.singleDate) {
282
- console.log('Start:', selection.singleDate.startDate);
283
- console.log('End:', selection.singleDate.endDate);
284
- console.log('All Day:', selection.singleDate.allDay);
285
- }
286
- }
287
- }
288
- ```
289
-
290
- #### Component Selector
291
-
292
- `<brickclay-scheduled-date-picker>`
293
-
294
- #### Inputs
295
-
296
- | Input | Type | Default | Description |
297
- |-------|------|---------|-------------|
298
- | `timeFormat` | `12 \| 24` | `12` | Time format (12-hour or 24-hour) |
299
- | `enableSeconds` | `boolean` | `false` | Enable seconds in time picker |
300
-
301
- #### Outputs
302
-
303
- | Output | Type | Description |
304
- |--------|------|-------------|
305
- | `scheduled` | `EventEmitter<ScheduledDateSelection>` | Emitted when selection changes |
306
- | `cleared` | `EventEmitter<void>` | Emitted when clear button is clicked |
307
-
308
- #### Features
309
-
310
- - **Single Date Mode**: Select one date with optional start and end times
311
- - **Multiple Dates Mode**: Select multiple dates, each with individual time configuration
312
- - **Date Range Mode**: Select a date range with start and end times
313
- - **All Day Toggle**: Mark dates as all-day events
314
- - **Time Configuration**: Individual time pickers for each date/range
315
-
316
- ### TimePickerComponent
317
-
318
- A standalone time picker component with scrollable hour, minute, and AM/PM selectors.
319
-
320
- #### Basic Example
321
-
322
- ```typescript
323
- import { TimePickerComponent } from '@brickclay/ui';
324
-
325
- @Component({
326
- template: `
327
- <brickclay-time-picker
328
- [value]="selectedTime"
329
- [label]="'Start Time'"
330
- [timeFormat]="12"
331
- (timeChange)="onTimeChange($event)">
332
- </brickclay-time-picker>
333
- `
334
- })
335
- export class MyComponent {
336
- selectedTime = '1:00 AM';
337
-
338
- onTimeChange(time: string) {
339
- this.selectedTime = time;
340
- console.log('New time:', time);
341
- }
342
- }
343
- ```
344
-
345
- #### Component Selector
346
-
347
- `<brickclay-time-picker>`
348
-
349
- #### Inputs
350
-
351
- | Input | Type | Default | Description |
352
- |-------|------|---------|-------------|
353
- | `value` | `string` | `'1:00 AM'` | Current time value (format: "H:MM AM/PM" or "HH:MM") |
354
- | `label` | `string` | `'Time'` | Label text |
355
- | `placeholder` | `string` | `'Select time'` | Placeholder text |
356
- | `position` | `'left' \| 'right'` | `'left'` | Dropdown position |
357
- | `pickerId` | `string` | `''` | Unique identifier for the picker |
358
- | `closePicker` | `number` | `0` | Counter to trigger picker close |
359
- | `timeFormat` | `12 \| 24` | `12` | Time format (12-hour or 24-hour) |
360
- | `showSeconds` | `boolean` | `false` | Show seconds selector |
361
-
362
- #### Outputs
363
-
364
- | Output | Type | Description |
365
- |--------|------|-------------|
366
- | `timeChange` | `EventEmitter<string>` | Emitted when time changes |
367
- | `pickerOpened` | `EventEmitter<string>` | Emitted when picker opens |
368
- | `pickerClosed` | `EventEmitter<string>` | Emitted when picker closes |
369
-
370
- #### Features
371
-
372
- - Scrollable time selectors
373
- - Keyboard navigation support
374
- - 12-hour and 24-hour formats
375
- - Optional seconds support
376
- - Multiple picker coordination (only one open at a time)
377
- - Click outside to close
378
-
379
- #### Time Format Examples
380
-
381
- **12-hour format:**
382
- ```typescript
383
- value="1:00 AM"
384
- value="12:30 PM"
385
- value="11:45 PM"
386
- ```
387
-
388
- **24-hour format:**
389
- ```typescript
390
- value="01:00"
391
- value="13:30"
392
- value="23:45"
393
- ```
394
-
395
- ## πŸ”˜ Toggle
396
-
397
- A versatile toggle/switch component that integrates seamlessly with Angular forms. Supports both template-driven forms (`ngModel`) and reactive forms, with full accessibility features and keyboard navigation.
398
-
399
- ### ToggleComponent
400
-
401
- A standalone toggle component that implements `ControlValueAccessor` for seamless Angular forms integration.
402
-
403
- #### Basic Example
404
-
405
- ```typescript
406
- import { ToggleComponent } from '@brickclay/ui';
407
- import { FormsModule } from '@angular/forms';
408
-
409
- @Component({
410
- template: `
411
- <brickclay-toggle
412
- [(ngModel)]="isEnabled"
413
- [label]="'Enable notifications'"
414
- (change)="onToggleChange($event)">
415
- </brickclay-toggle>
416
- `,
417
- imports: [ToggleComponent, FormsModule]
418
- })
419
- export class MyComponent {
420
- isEnabled = false;
421
-
422
- onToggleChange(value: boolean) {
423
- console.log('Toggle state:', value);
424
- }
425
- }
426
- ```
427
-
428
- #### Component Selector
429
-
430
- `<brickclay-toggle>`
431
-
432
- #### Inputs
433
-
434
- | Input | Type | Default | Description |
435
- |-------|------|---------|-------------|
436
- | `label` | `string` | `''` | Optional label text displayed next to the toggle |
437
- | `disabled` | `boolean` | `false` | Disables the toggle interaction |
438
- | `toggleClass` | `string` | `'toggle-md'` | CSS class for size styling. Options: `'toggle-sm'`, `'toggle-md'`, `'toggle-lg'` |
439
-
440
- #### Outputs
441
-
442
- | Output | Type | Description |
443
- |--------|------|-------------|
444
- | `change` | `EventEmitter<boolean>` | Emitted when toggle state changes (returns new boolean value) |
445
-
446
- #### Features
447
-
448
- - βœ… **Angular Forms Integration** - Full support for `ngModel` and reactive forms
449
- - βœ… **Three Size Variants** - Small (`toggle-sm`), Medium (`toggle-md`), Large (`toggle-lg`)
450
- - βœ… **Accessibility** - ARIA attributes, keyboard navigation, and screen reader support
451
- - βœ… **Disabled State** - Visual and functional disabled state
452
- - βœ… **Customizable Styling** - Custom CSS classes for size and appearance
453
- - βœ… **Event Handling** - `change` event for state change notifications
454
-
455
- #### Usage Examples
456
-
457
- **Basic Toggle with ngModel:**
458
-
459
- ```typescript
460
- import { ToggleComponent } from '@brickclay/ui';
461
- import { FormsModule } from '@angular/forms';
462
-
463
- @Component({
464
- template: `
465
- <brickclay-toggle
466
- [(ngModel)]="isActive"
467
- [label]="'Active Status'">
468
- </brickclay-toggle>
469
- `,
470
- imports: [ToggleComponent, FormsModule]
471
- })
472
- export class MyComponent {
473
- isActive = true;
474
- }
475
- ```
476
-
477
- **Different Sizes:**
478
-
479
- ```typescript
480
- <brickclay-toggle
481
- [(ngModel)]="value1"
482
- [toggleClass]="'toggle-sm'"
483
- [label]="'Small Toggle'">
484
- </brickclay-toggle>
485
-
486
- <brickclay-toggle
487
- [(ngModel)]="value2"
488
- [toggleClass]="'toggle-md'"
489
- [label]="'Medium Toggle'">
490
- </brickclay-toggle>
491
-
492
- <brickclay-toggle
493
- [(ngModel)]="value3"
494
- [toggleClass]="'toggle-lg'"
495
- [label]="'Large Toggle'">
496
- </brickclay-toggle>
497
- ```
498
-
499
- **Disabled State:**
500
-
501
- ```typescript
502
- <brickclay-toggle
503
- [ngModel]="true"
504
- [disabled]="true"
505
- [label]="'Disabled Toggle'">
506
- </brickclay-toggle>
507
- ```
508
-
509
- **With Event Handler:**
510
-
511
- ```typescript
512
- @Component({
513
- template: `
514
- <brickclay-toggle
515
- [(ngModel)]="notificationsEnabled"
516
- [label]="'Email Notifications'"
517
- (change)="onNotificationToggle($event)">
518
- </brickclay-toggle>
519
- `
520
- })
521
- export class MyComponent {
522
- notificationsEnabled = false;
523
-
524
- onNotificationToggle(enabled: boolean) {
525
- if (enabled) {
526
- this.enableNotifications();
527
- } else {
528
- this.disableNotifications();
529
- }
530
- }
531
- }
532
- ```
533
-
534
- **Reactive Forms Integration:**
535
-
536
- ```typescript
537
- import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
538
- import { ToggleComponent } from '@brickclay/ui';
539
-
540
- @Component({
541
- template: `
542
- <form [formGroup]="settingsForm">
543
- <brickclay-toggle
544
- formControlName="darkMode"
545
- [label]="'Dark Mode'">
546
- </brickclay-toggle>
547
-
548
- <brickclay-toggle
549
- formControlName="notifications"
550
- [label]="'Push Notifications'">
551
- </brickclay-toggle>
552
- </form>
553
- `,
554
- imports: [ToggleComponent, ReactiveFormsModule]
555
- })
556
- export class SettingsComponent {
557
- settingsForm: FormGroup;
558
-
559
- constructor(private fb: FormBuilder) {
560
- this.settingsForm = this.fb.group({
561
- darkMode: [false],
562
- notifications: [true]
563
- });
564
- }
565
- }
566
- ```
567
-
568
- **Without Label:**
569
-
570
- ```typescript
571
- <brickclay-toggle
572
- [(ngModel)]="isEnabled"
573
- [toggleClass]="'toggle-md'">
574
- </brickclay-toggle>
575
- ```
576
-
577
- #### Styling
578
-
579
- The toggle component uses CSS classes for size variants:
580
-
581
- - **Small**: `toggle-sm` - Width: 28px (w-7)
582
- - **Medium**: `toggle-md` - Width: 36px (w-9) - Default
583
- - **Large**: `toggle-lg` - Width: 44px (w-11)
584
-
585
- The component includes built-in styles for:
586
- - On state (green background: `#22973F`)
587
- - Off state (gray background: `#BBBDC5`)
588
- - Disabled state (light gray: `#D6D7DC`)
589
- - Hover states
590
- - Focus ring for accessibility
591
- - Smooth transitions
592
-
593
- #### Accessibility
594
-
595
- The toggle component includes:
596
- - `role="switch"` for screen readers
597
- - `aria-checked` attribute that reflects the current state
598
- - Keyboard navigation support
599
- - Focus visible ring for keyboard users
600
- - Disabled state properly communicated to assistive technologies
601
-
602
- ## β˜‘οΈ Checkbox
603
-
604
- A fully accessible checkbox component that integrates seamlessly with Angular forms. Supports both template-driven forms (`ngModel`) and reactive forms, with customizable styling and comprehensive accessibility features.
605
-
606
- ### CheckboxComponent
607
-
608
- A standalone checkbox component that implements `ControlValueAccessor` for seamless Angular forms integration.
609
-
610
- #### Basic Example
611
-
612
- ```typescript
613
- import { CheckboxComponent } from '@brickclay/ui';
614
- import { FormsModule } from '@angular/forms';
615
-
616
- @Component({
617
- template: `
618
- <brickclay-checkbox
619
- [(ngModel)]="isAccepted"
620
- [label]="'I agree to the terms and conditions'"
621
- (change)="onCheckboxChange($event)">
622
- </brickclay-checkbox>
623
- `,
624
- imports: [CheckboxComponent, FormsModule]
625
- })
626
- export class MyComponent {
627
- isAccepted = false;
628
-
629
- onCheckboxChange(value: boolean) {
630
- console.log('Checkbox state:', value);
631
- }
632
- }
633
- ```
634
-
635
- #### Component Selector
636
-
637
- `<brickclay-checkbox>`
638
-
639
- #### Inputs
640
-
641
- | Input | Type | Default | Description |
642
- |-------|------|---------|-------------|
643
- | `label` | `string` | `''` | Optional label text displayed next to the checkbox |
644
- | `disabled` | `boolean` | `false` | Disables the checkbox interaction |
645
- | `checkboxClass` | `string` | `''` | CSS class for size styling. Options: `'xsm'`, `'sm'`, `'md'`, `'lg'` |
646
- | `labelClass` | `string` | `''` | Custom CSS classes for the label text |
647
-
648
- #### Outputs
649
-
650
- | Output | Type | Description |
651
- |--------|------|-------------|
652
- | `change` | `EventEmitter<boolean>` | Emitted when checkbox state changes (returns new boolean value) |
653
-
654
- #### Features
655
-
656
- - βœ… **Angular Forms Integration** - Full support for `ngModel` and reactive forms
657
- - βœ… **Four Size Variants** - Extra Small (`xsm`), Small (`sm`), Medium (`md`), Large (`lg`)
658
- - βœ… **Accessibility** - ARIA attributes, keyboard navigation (Enter/Space), and screen reader support
659
- - βœ… **Disabled State** - Visual and functional disabled state
660
- - βœ… **Keyboard Support** - Full keyboard navigation with Enter and Space keys
661
- - βœ… **Focus Management** - Focus visible ring for keyboard users
662
- - βœ… **Event Handling** - `change` event for state change notifications
663
-
664
- #### Usage Examples
665
-
666
- **Basic Checkbox with ngModel:**
667
-
668
- ```typescript
669
- import { CheckboxComponent } from '@brickclay/ui';
670
- import { FormsModule } from '@angular/forms';
671
-
672
- @Component({
673
- template: `
674
- <brickclay-checkbox
675
- [(ngModel)]="isChecked"
676
- [label]="'Accept terms'">
677
- </brickclay-checkbox>
678
- `,
679
- imports: [CheckboxComponent, FormsModule]
680
- })
681
- export class MyComponent {
682
- isChecked = false;
683
- }
684
- ```
685
-
686
- **Different Sizes:**
687
-
688
- ```typescript
689
- <!-- Extra Small checkbox -->
690
- <brickclay-checkbox
691
- [(ngModel)]="value1"
692
- [checkboxClass]="'xsm'"
693
- [label]="'Extra Small Checkbox'">
694
- </brickclay-checkbox>
695
-
696
- <!-- Small checkbox -->
697
- <brickclay-checkbox
698
- [(ngModel)]="value2"
699
- [checkboxClass]="'sm'"
700
- [label]="'Small Checkbox'">
701
- </brickclay-checkbox>
702
-
703
- <!-- Medium checkbox -->
704
- <brickclay-checkbox
705
- [(ngModel)]="value3"
706
- [checkboxClass]="'md'"
707
- [label]="'Medium Checkbox'">
708
- </brickclay-checkbox>
709
-
710
- <!-- Large checkbox with custom label styling -->
711
- <brickclay-checkbox
712
- [(ngModel)]="value4"
713
- [checkboxClass]="'lg'"
714
- [labelClass]="'text-lg font-bold'"
715
- [label]="'Large Checkbox'">
716
- </brickclay-checkbox>
717
- ```
718
-
719
- **Disabled State:**
720
-
721
- ```typescript
722
- <brickclay-checkbox
723
- [ngModel]="true"
724
- [disabled]="true"
725
- [label]="'Disabled Checkbox'">
726
- </brickclay-checkbox>
727
- ```
728
-
729
- **With Event Handler:**
730
-
731
- ```typescript
732
- @Component({
733
- template: `
734
- <brickclay-checkbox
735
- [(ngModel)]="newsletterSubscribed"
736
- [label]="'Subscribe to newsletter'"
737
- (change)="onNewsletterToggle($event)">
738
- </brickclay-checkbox>
739
- `
740
- })
741
- export class MyComponent {
742
- newsletterSubscribed = false;
743
-
744
- onNewsletterToggle(subscribed: boolean) {
745
- if (subscribed) {
746
- this.subscribeToNewsletter();
747
- } else {
748
- this.unsubscribeFromNewsletter();
749
- }
750
- }
751
- }
752
- ```
753
-
754
- **Reactive Forms Integration:**
755
-
756
- ```typescript
757
- import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
758
- import { CheckboxComponent } from '@brickclay/ui';
759
-
760
- @Component({
761
- template: `
762
- <form [formGroup]="registrationForm">
763
- <brickclay-checkbox
764
- formControlName="acceptTerms"
765
- [label]="'I accept the terms and conditions'">
766
- </brickclay-checkbox>
767
-
768
- <brickclay-checkbox
769
- formControlName="receiveUpdates"
770
- [label]="'Receive product updates'">
771
- </brickclay-checkbox>
772
- </form>
773
- `,
774
- imports: [CheckboxComponent, ReactiveFormsModule]
775
- })
776
- export class RegistrationComponent {
777
- registrationForm: FormGroup;
778
-
779
- constructor(private fb: FormBuilder) {
780
- this.registrationForm = this.fb.group({
781
- acceptTerms: [false, Validators.requiredTrue],
782
- receiveUpdates: [false]
783
- });
784
- }
785
- }
786
- ```
787
-
788
- **Without Label:**
789
-
790
- ```typescript
791
- <brickclay-checkbox
792
- [(ngModel)]="isSelected"
793
- [checkboxClass]="'md'">
794
- </brickclay-checkbox>
795
- ```
796
-
797
- **Multiple Checkboxes:**
798
-
799
- ```typescript
800
- @Component({
801
- template: `
802
- <div>
803
- <brickclay-checkbox
804
- *ngFor="let option of options"
805
- [(ngModel)]="option.selected"
806
- [label]="option.label"
807
- (change)="onOptionChange(option)">
808
- </brickclay-checkbox>
809
- </div>
810
- `
811
- })
812
- export class MyComponent {
813
- options = [
814
- { label: 'Option 1', selected: false },
815
- { label: 'Option 2', selected: false },
816
- { label: 'Option 3', selected: false }
817
- ];
818
-
819
- onOptionChange(option: any) {
820
- console.log(`${option.label} is now ${option.selected ? 'selected' : 'deselected'}`);
821
- }
822
- }
823
- ```
824
-
825
- #### Styling
826
-
827
- The checkbox component supports predefined size classes:
828
-
829
- - **Extra Small**: `xsm` - 14px Γ— 14px
830
- - **Small**: `sm` - 16px Γ— 16px
831
- - **Medium**: `md` - 18px Γ— 18px
832
- - **Large**: `lg` - 20px Γ— 20px
833
-
834
- Use `labelClass` to style the label text (font size, weight, color, etc.)
835
-
836
- The component includes built-in styles for:
837
- - Checked state (black background with white checkmark/tick icon)
838
- - Unchecked state (white background with gray border)
839
- - Hover states (darker border on hover)
840
- - Disabled states (gray background and border)
841
- - Focus ring for accessibility (blue ring with offset)
842
- - Smooth transitions for state changes
843
-
844
- #### Accessibility
845
-
846
- The checkbox component includes:
847
- - Keyboard navigation support (Enter and Space keys)
848
- - Focus visible ring for keyboard users
849
- - Proper ARIA attributes
850
- - Disabled state properly communicated to assistive technologies
851
- - Tab navigation support
852
-
853
- ## πŸ”˜ Radio Button
854
-
855
- A fully accessible radio button component that integrates seamlessly with Angular forms. Supports both template-driven forms (`ngModel`) and reactive forms, with two visual variants (dot and tick) and comprehensive accessibility features.
856
-
857
- ### RadioComponent
858
-
859
- A standalone radio button component that implements `ControlValueAccessor` for seamless Angular forms integration. Radio buttons are used when only one option can be selected from a group.
860
-
861
- #### Basic Example
862
-
863
- ```typescript
864
- import { RadioComponent } from '@brickclay/ui';
865
- import { FormsModule } from '@angular/forms';
866
-
867
- @Component({
868
- template: `
869
- <brickclay-radio-button
870
- [(ngModel)]="selectedOption"
871
- [value]="'option1'"
872
- [label]="'Option 1'"
873
- (change)="onRadioChange($event)">
874
- </brickclay-radio-button>
875
-
876
- <brickclay-radio-button
877
- [(ngModel)]="selectedOption"
878
- [value]="'option2'"
879
- [label]="'Option 2'">
880
- </brickclay-radio-button>
881
- `,
882
- imports: [RadioComponent, FormsModule]
883
- })
884
- export class MyComponent {
885
- selectedOption = 'option1';
886
-
887
- onRadioChange(value: any) {
888
- console.log('Selected option:', value);
889
- }
890
- }
891
- ```
892
-
893
- #### Component Selector
894
-
895
- `<brickclay-radio-button>`
896
-
897
- #### Inputs
898
-
899
- | Input | Type | Default | Description |
900
- |-------|------|---------|-------------|
901
- | `label` | `string` | `''` | Optional label text displayed next to the radio button |
902
- | `value` | `any` | `undefined` | The value associated with this radio button (required for radio groups) |
903
- | `disabled` | `boolean` | `false` | Disables the radio button interaction |
904
- | `variant` | `'dot' \| 'tick'` | `'dot'` | Visual variant. `'dot'` shows a filled circle, `'tick'` shows a checkmark |
905
- | `radioClass` | `string` | `''` | CSS class for size styling. Options: `'xsm'`, `'sm'`, `'md'`, `'lg'` |
906
- | `labelClass` | `string` | `''` | Custom CSS classes for the label text |
907
-
908
- #### Outputs
909
-
910
- | Output | Type | Description |
911
- |--------|------|-------------|
912
- | `change` | `EventEmitter<any>` | Emitted when radio button is selected (returns the value) |
913
-
914
- #### Features
915
-
916
- - βœ… **Angular Forms Integration** - Full support for `ngModel` and reactive forms
917
- - βœ… **Two Visual Variants** - Dot (filled circle) and Tick (checkmark) styles
918
- - βœ… **Four Size Variants** - Extra Small (`xsm`), Small (`sm`), Medium (`md`), Large (`lg`)
919
- - βœ… **Radio Groups** - Automatically groups radio buttons with the same `ngModel` binding
920
- - βœ… **Accessibility** - ARIA attributes, keyboard navigation (Enter/Space), and screen reader support
921
- - βœ… **Disabled State** - Visual and functional disabled state
922
- - βœ… **Keyboard Support** - Full keyboard navigation with Enter and Space keys
923
- - βœ… **Focus Management** - Focus visible ring for keyboard users
924
- - βœ… **Event Handling** - `change` event for selection notifications
925
-
926
- #### Usage Examples
927
-
928
- **Basic Radio Group with ngModel:**
929
-
930
- ```typescript
931
- import { RadioComponent } from '@brickclay/ui';
932
- import { FormsModule } from '@angular/forms';
933
-
934
- @Component({
935
- template: `
936
- <brickclay-radio-button
937
- [(ngModel)]="selectedPayment"
938
- [value]="'credit'"
939
- [label]="'Credit Card'">
940
- </brickclay-radio-button>
941
-
942
- <brickclay-radio-button
943
- [(ngModel)]="selectedPayment"
944
- [value]="'debit'"
945
- [label]="'Debit Card'">
946
- </brickclay-radio-button>
947
-
948
- <brickclay-radio-button
949
- [(ngModel)]="selectedPayment"
950
- [value]="'paypal'"
951
- [label]="'PayPal'">
952
- </brickclay-radio-button>
953
- `,
954
- imports: [RadioComponent, FormsModule]
955
- })
956
- export class MyComponent {
957
- selectedPayment = 'credit';
958
- }
959
- ```
960
-
961
- **Dot Variant (Default):**
962
-
963
- ```typescript
964
- <brickclay-radio-button
965
- [(ngModel)]="selectedOption"
966
- [value]="'option1'"
967
- [variant]="'dot'"
968
- [label]="'Option with Dot'">
969
- </brickclay-radio-button>
970
- ```
971
-
972
- **Tick Variant:**
973
-
974
- ```typescript
975
- <brickclay-radio-button
976
- [(ngModel)]="selectedOption"
977
- [value]="'option2'"
978
- [variant]="'tick'"
979
- [label]="'Option with Tick'">
980
- </brickclay-radio-button>
981
- ```
982
-
983
- **Different Sizes:**
984
-
985
- ```typescript
986
- <!-- Extra Small radio -->
987
- <brickclay-radio-button
988
- [(ngModel)]="selectedOption"
989
- [value]="'xsm'"
990
- [radioClass]="'xsm'"
991
- [label]="'Extra Small Radio'">
992
- </brickclay-radio-button>
993
-
994
- <!-- Small radio -->
995
- <brickclay-radio-button
996
- [(ngModel)]="selectedOption"
997
- [value]="'sm'"
998
- [radioClass]="'sm'"
999
- [label]="'Small Radio'">
1000
- </brickclay-radio-button>
1001
-
1002
- <!-- Medium radio -->
1003
- <brickclay-radio-button
1004
- [(ngModel)]="selectedOption"
1005
- [value]="'md'"
1006
- [radioClass]="'md'"
1007
- [label]="'Medium Radio'">
1008
- </brickclay-radio-button>
1009
-
1010
- <!-- Large radio with custom label styling -->
1011
- <brickclay-radio-button
1012
- [(ngModel)]="selectedOption"
1013
- [value]="'lg'"
1014
- [radioClass]="'lg'"
1015
- [labelClass]="'text-lg font-bold'"
1016
- [label]="'Large Radio'">
1017
- </brickclay-radio-button>
1018
- ```
1019
-
1020
- **Disabled State:**
1021
-
1022
- ```typescript
1023
- <brickclay-radio-button
1024
- [(ngModel)]="selectedOption"
1025
- [value]="'disabled-option'"
1026
- [disabled]="true"
1027
- [label]="'Disabled Option'">
1028
- </brickclay-radio-button>
1029
- ```
1030
-
1031
- **With Event Handler:**
1032
-
1033
- ```typescript
1034
- @Component({
1035
- template: `
1036
- <brickclay-radio-button
1037
- *ngFor="let option of options"
1038
- [(ngModel)]="selectedOption"
1039
- [value]="option.value"
1040
- [label]="option.label"
1041
- (change)="onOptionChange($event)">
1042
- </brickclay-radio-button>
1043
- `
1044
- })
1045
- export class MyComponent {
1046
- options = [
1047
- { value: 'option1', label: 'Option 1' },
1048
- { value: 'option2', label: 'Option 2' },
1049
- { value: 'option3', label: 'Option 3' }
1050
- ];
1051
- selectedOption = 'option1';
1052
-
1053
- onOptionChange(value: any) {
1054
- console.log('Selected:', value);
1055
- }
1056
- }
1057
- ```
1058
-
1059
- **Reactive Forms Integration:**
1060
-
1061
- ```typescript
1062
- import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
1063
- import { RadioComponent } from '@brickclay/ui';
1064
-
1065
- @Component({
1066
- template: `
1067
- <form [formGroup]="surveyForm">
1068
- <brickclay-radio-button
1069
- formControlName="rating"
1070
- [value]="'excellent'"
1071
- [label]="'Excellent'">
1072
- </brickclay-radio-button>
1073
-
1074
- <brickclay-radio-button
1075
- formControlName="rating"
1076
- [value]="'good'"
1077
- [label]="'Good'">
1078
- </brickclay-radio-button>
1079
-
1080
- <brickclay-radio-button
1081
- formControlName="rating"
1082
- [value]="'fair'"
1083
- [label]="'Fair'">
1084
- </brickclay-radio-button>
1085
- </form>
1086
- `,
1087
- imports: [RadioComponent, ReactiveFormsModule]
1088
- })
1089
- export class SurveyComponent {
1090
- surveyForm: FormGroup;
1091
-
1092
- constructor(private fb: FormBuilder) {
1093
- this.surveyForm = this.fb.group({
1094
- rating: ['good', Validators.required]
1095
- });
1096
- }
1097
- }
1098
- ```
1099
-
1100
- **Without Label:**
1101
-
1102
- ```typescript
1103
- <brickclay-radio-button
1104
- [(ngModel)]="selectedOption"
1105
- [value]="'option1'"
1106
- [radioClass]="'md'">
1107
- </brickclay-radio-button>
1108
- ```
1109
-
1110
- **Dynamic Radio Group:**
1111
-
1112
- ```typescript
1113
- @Component({
1114
- template: `
1115
- <div>
1116
- <brickclay-radio-button
1117
- *ngFor="let item of items"
1118
- [(ngModel)]="selectedItem"
1119
- [value]="item.id"
1120
- [label]="item.name"
1121
- [variant]="item.variant || 'dot'">
1122
- </brickclay-radio-button>
1123
- </div>
1124
- `
1125
- })
1126
- export class MyComponent {
1127
- items = [
1128
- { id: 1, name: 'Item 1', variant: 'dot' },
1129
- { id: 2, name: 'Item 2', variant: 'tick' },
1130
- { id: 3, name: 'Item 3', variant: 'dot' }
1131
- ];
1132
- selectedItem = 1;
1133
- }
1134
- ```
1135
-
1136
- #### Styling
1137
-
1138
- The radio button component supports predefined size classes:
1139
-
1140
- - **Extra Small**: `xsm` - 14px Γ— 14px
1141
- - **Small**: `sm` - 16px Γ— 16px
1142
- - **Medium**: `md` - 18px Γ— 18px
1143
- - **Large**: `lg` - 19px Γ— 19px
1144
-
1145
- Use `labelClass` to style the label text (font size, weight, color, etc.)
1146
-
1147
- The component includes built-in styles for:
1148
- - **Dot Variant**: Filled circle indicator when selected (size varies by radioClass)
1149
- - **Tick Variant**: Checkmark indicator when selected (size varies by radioClass)
1150
- - Unselected state (white background with gray border)
1151
- - Hover states (darker border on hover)
1152
- - Disabled states (gray background and border)
1153
- - Focus ring for accessibility (blue ring with offset)
1154
- - Smooth transitions for state changes
1155
-
1156
- #### Accessibility
1157
-
1158
- The radio button component includes:
1159
- - Keyboard navigation support (Enter and Space keys)
1160
- - Focus visible ring for keyboard users
1161
- - Proper ARIA attributes
1162
- - Disabled state properly communicated to assistive technologies
1163
- - Tab navigation support
1164
- - Radio group semantics for screen readers
1165
-
1166
- #### Radio Groups
1167
-
1168
- Radio buttons are automatically grouped when they share the same `ngModel` binding. Only one radio button in a group can be selected at a time. When a radio button is selected, the previously selected one in the same group is automatically deselected.
1169
-
1170
- ## πŸ“ TypeScript Interfaces
1171
-
1172
- ### CalendarRange
1173
-
1174
- ```typescript
1175
- interface CalendarRange {
1176
- start: Date;
1177
- end: Date;
1178
- }
1179
- ```
1180
-
1181
- ### CalendarSelection
1182
-
1183
- ```typescript
1184
- interface CalendarSelection {
1185
- startDate: Date | null;
1186
- endDate: Date | null;
1187
- selectedDates?: Date[]; // For multi-date selection
1188
- }
1189
- ```
1190
-
1191
- ### TimeConfiguration
1192
-
1193
- ```typescript
1194
- interface TimeConfiguration {
1195
- date: Date;
1196
- allDay: boolean;
1197
- startTime: string; // Format: "HH:mm" or "HH:mm:ss"
1198
- endTime: string;
1199
- }
1200
- ```
1201
-
1202
- ### ScheduledDateSelection
1203
-
1204
- ```typescript
1205
- interface ScheduledDateSelection {
1206
- mode: 'single' | 'multiple' | 'range';
1207
- singleDate?: {
1208
- startDate: Date;
1209
- endDate: Date;
1210
- allDay: boolean;
1211
- startTime: string;
1212
- endTime: string;
1213
- };
1214
- multipleDates?: TimeConfiguration[];
1215
- dateRange?: {
1216
- startDate: Date;
1217
- endDate: Date;
1218
- allDay: boolean;
1219
- startTime: string;
1220
- endTime: string;
1221
- };
1222
- }
1223
- ```
1224
-
1225
- ## 🎯 Common Use Cases
1226
-
1227
- ### Form Integration
1228
-
1229
- ```typescript
1230
- import { FormBuilder, FormGroup, Validators } from '@angular/forms';
1231
- import { CustomCalendarComponent } from '@brickclay/ui';
1232
-
1233
- export class BookingFormComponent {
1234
- bookingForm: FormGroup;
1235
-
1236
- constructor(private fb: FormBuilder) {
1237
- this.bookingForm = this.fb.group({
1238
- checkIn: [null, Validators.required],
1239
- checkOut: [null, Validators.required]
1240
- });
1241
- }
1242
-
1243
- onDateSelected(selection: CalendarSelection) {
1244
- this.bookingForm.patchValue({
1245
- checkIn: selection.startDate,
1246
- checkOut: selection.endDate
1247
- });
1248
- }
1249
- }
1250
- ```
1251
-
1252
- ### Reactive Forms
1253
-
1254
- ```typescript
1255
- <brickclay-custom-calendar
1256
- [selectedValue]="form.get('dateRange')?.value"
1257
- (selected)="form.patchValue({ dateRange: $event })">
1258
- </brickclay-custom-calendar>
1259
- ```
1260
-
1261
- ### Date Filtering
1262
-
1263
- ```typescript
1264
- export class DataTableComponent {
1265
- filterDates: CalendarSelection = { startDate: null, endDate: null };
1266
-
1267
- onDateFilter(selection: CalendarSelection) {
1268
- this.filterDates = selection;
1269
- this.loadFilteredData();
1270
- }
1271
-
1272
- loadFilteredData() {
1273
- const filtered = this.data.filter(item => {
1274
- if (!this.filterDates.startDate || !this.filterDates.endDate) {
1275
- return true;
1276
- }
1277
- return item.date >= this.filterDates.startDate! &&
1278
- item.date <= this.filterDates.endDate!;
1279
- });
1280
- }
1281
- }
1282
- ```
1283
-
1284
- ## πŸ“¦ Assets Configuration
1285
-
1286
- The calendar components require SVG icons. Configure your `angular.json` to copy assets:
1287
-
1288
- ```json
1289
- {
1290
- "glob": "**/*",
1291
- "input": "node_modules/@brickclay/ui/assets",
1292
- "output": "assets"
1293
- }
1294
- ```
1295
-
1296
- Or manually copy assets from:
1297
- ```
1298
- node_modules/@brickclay/ui/assets/calender/* β†’ your-app/public/assets/calender/
1299
- ```
1300
-
1301
- ## πŸ”§ Service
1302
-
1303
- ### CalendarManagerService
1304
-
1305
- 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`.
1306
-
1307
- ## 🌐 Browser Support
1308
-
1309
- - Chrome (latest)
1310
- - Firefox (latest)
1311
- - Safari (latest)
1312
- - Edge (latest)
1313
-
1314
- ## πŸ“¦ Dependencies
1315
-
1316
- - Angular 20.3.0+
1317
- - moment (for date formatting)
1318
-
1319
- ## 🀝 Contributing
1320
-
1321
- We welcome contributions! Please see our contributing guidelines for more information.
1322
-
1323
- ## πŸ“„ License
1324
-
1325
- MIT
1326
-
1327
- ## πŸ“ž Support
1328
-
1329
- For issues, feature requests, or contributions, please visit our [GitHub repository](https://github.com/brickclay/ui).
1330
-
1331
- ## πŸ—ΊοΈ Roadmap
1332
-
1333
- - [ ] Button components
1334
- - [ ] Input components
1335
- - [ ] Card components
1336
- - [ ] Modal/Dialog components
1337
- - [ ] Table components
1338
- - [ ] Form components
1339
- - [ ] Navigation components
1340
- - [ ] Loading/Spinner components
1341
- - [ ] Toast/Notification components
1342
- - [ ] More calendar features
1343
-
1344
- ## πŸ“ Changelog
1345
-
1346
- ### Version 0.0.1
1347
-
1348
- **Initial Release:**
1349
- - βœ… Calendar component suite
1350
- - Single date selection
1351
- - Date range selection
1352
- - Multiple date selection
1353
- - Time picker integration
1354
- - Inline and dropdown modes
1355
- - Dual calendar view
1356
- - Custom date ranges
1357
- - Date constraints (min/max)
1358
- - βœ… Scheduled date picker component
1359
- - βœ… Standalone time picker component
1360
- - βœ… Toggle/Switch component
1361
- - Angular forms integration (ngModel & reactive forms)
1362
- - Three size variants (small, medium, large)
1363
- - Disabled state support
1364
- - Full accessibility features
1365
- - Customizable styling
1366
- - βœ… Checkbox component
1367
- - Angular forms integration (ngModel & reactive forms)
1368
- - Customizable styling via CSS classes
1369
- - Disabled state support
1370
- - Full keyboard navigation support
1371
- - Complete accessibility features
1372
- - βœ… Radio button component
1373
- - Angular forms integration (ngModel & reactive forms)
1374
- - Two visual variants (dot and tick)
1375
- - Radio group support
1376
- - Customizable styling via CSS classes
1377
- - Disabled state support
1378
- - Full keyboard navigation support
1379
- - Complete accessibility features
1380
- - βœ… TypeScript definitions
1381
- - βœ… Comprehensive documentation
1382
-
1383
- ---
1384
-
1385
- **Built with ❀️ by the Brickclay team**
1
+ # @brickclay-org/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
+ ### Toggle Component
22
+
23
+ A customizable toggle/switch component with support for Angular forms integration via `ngModel` and reactive forms. Features three size variants (small, medium, large), disabled state, and full accessibility support.
24
+
25
+ ### Checkbox Component
26
+
27
+ A fully accessible checkbox component with Angular forms integration. Features customizable styling via CSS classes, disabled state, keyboard navigation, and seamless integration with both template-driven and reactive forms.
28
+
29
+ ### Radio Component
30
+
31
+ A fully accessible radio button component with Angular forms integration. Features two visual variants (dot and tick), customizable styling, disabled state, keyboard navigation, and seamless integration with both template-driven and reactive forms.
32
+
33
+ ### Pill Component
34
+
35
+ A versatile pill component for displaying labels, tags, or status indicators. Features multiple variants (Light, Solid, Outline, Transparent), color options, size variants, optional dot indicators, and removable functionality with click events.
36
+
37
+ ### Badge Component
38
+
39
+ A flexible badge component for displaying labels, tags, or status indicators. Features multiple variants (Light, Solid, Outline, Transparent), color options, size variants, optional dot indicators, and removable functionality with click events.
40
+
41
+ ### Button Component
42
+
43
+ A versatile button component with support for text labels, icons, loading states, and multiple variants. Features seven size options, two variants (primary/secondary), optional left/right icons, loading spinner, and full customization support.
44
+
45
+ ### Icon Button Component
46
+
47
+ A compact icon-only button component perfect for toolbars and action buttons. Features seven size options, two variants (primary/secondary), and customizable styling.
48
+
49
+ ### Button Group Component
50
+
51
+ A button group component for creating toggleable button sets. Supports single and multiple selection modes, with automatic state management and value change events.
52
+
53
+ ### Spinner Component
54
+
55
+ A loading spinner component for indicating asynchronous operations. Features five size variants, customizable colors, and show/hide control.
56
+
57
+ _More components coming soon..._
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ npm i @brickclay-org/ui@0.0.16
63
+ ```
64
+
65
+ ### Peer Dependencies
66
+
67
+ This library requires Angular 20.3.0 or higher:
68
+
69
+ ```bash
70
+ npm install @angular/common@^20.3.0 @angular/core@^20.3.0 moment
71
+ ```
72
+
73
+ ### Asset Configuration (Required)
74
+
75
+ After installing the library, you need to configure your `angular.json` to include the library's assets (icons, etc.). Add the following to your project's `assets` array in the `build` options:
76
+
77
+ ```json
78
+ {
79
+ "projects": {
80
+ "your-app-name": {
81
+ "architect": {
82
+ "build": {
83
+ "options": {
84
+ "assets": [
85
+ "src/favicon.ico",
86
+ "src/assets",
87
+ {
88
+ "glob": "**/*",
89
+ "input": "node_modules/@brickclay-org/ui/assets",
90
+ "output": "/assets/brickclay-lib/"
91
+ }
92
+ ]
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ This configuration copies the library's assets (SVG icons, etc.) to your application's output folder during build. Without this, the component icons will not display correctly.
102
+
103
+ ## Quick Start
104
+
105
+ ### Standalone Component Usage (Recommended)
106
+
107
+ ```typescript
108
+ import { Component } from '@angular/core';
109
+ import { CustomCalendarComponent, CalendarSelection } from '@brickclay/ui';
110
+
111
+ @Component({
112
+ standalone: true,
113
+ selector: 'app-my-component',
114
+ imports: [CustomCalendarComponent],
115
+ template: `
116
+ <brickclay-custom-calendar (selected)="onDateSelected($event)"> </brickclay-custom-calendar>
117
+ `,
118
+ })
119
+ export class MyComponent {
120
+ onDateSelected(selection: CalendarSelection) {
121
+ console.log('Selected:', selection);
122
+ }
123
+ }
124
+ ```
125
+
126
+ ### Module-based Usage
127
+
128
+ ```typescript
129
+ import { NgModule } from '@angular/core';
130
+ import { CalendarModule } from '@brickclay/ui';
131
+
132
+ @NgModule({
133
+ imports: [CalendarModule],
134
+ // ...
135
+ })
136
+ export class AppModule {}
137
+ ```
138
+
139
+ ## πŸ“… Calendar
140
+
141
+ 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`.
142
+
143
+ ### Components Overview
144
+
145
+ 1. **CustomCalendarComponent** (`brickclay-custom-calendar`) - Main calendar component with support for single date, date range, and multiple date selection
146
+ 2. **ScheduledDatePickerComponent** (`brickclay-scheduled-date-picker`) - Advanced scheduling component with time configuration for events
147
+ 3. **TimePickerComponent** (`brickclay-time-picker`) - Standalone time selection component with scrollable pickers
148
+
149
+ ### CustomCalendarComponent
150
+
151
+ A versatile calendar component that supports single date, date range, and multiple date selection modes.
152
+
153
+ #### Basic Example
154
+
155
+ ```typescript
156
+ import { CustomCalendarComponent, CalendarSelection } from '@brickclay/ui';
157
+
158
+ @Component({
159
+ template: `
160
+ <brickclay-custom-calendar
161
+ [singleDatePicker]="false"
162
+ [dualCalendar]="true"
163
+ [enableTimepicker]="true"
164
+ [showRanges]="true"
165
+ [placeholder]="'Select date range'"
166
+ (selected)="onDateSelected($event)"
167
+ >
168
+ </brickclay-custom-calendar>
169
+ `,
170
+ })
171
+ export class MyComponent {
172
+ onDateSelected(selection: CalendarSelection) {
173
+ console.log('Start:', selection.startDate);
174
+ console.log('End:', selection.endDate);
175
+ }
176
+ }
177
+ ```
178
+
179
+ #### Component Selector
180
+
181
+ `<brickclay-custom-calendar>`
182
+
183
+ #### Inputs
184
+
185
+ | Input | Type | Default | Description |
186
+ | -------------------- | ------------------------------- | --------------------- | ------------------------------------------------- |
187
+ | `enableTimepicker` | `boolean` | `false` | Enable time selection |
188
+ | `autoApply` | `boolean` | `false` | Automatically apply selection when date is chosen |
189
+ | `closeOnAutoApply` | `boolean` | `false` | Close calendar after auto-apply |
190
+ | `showCancel` | `boolean` | `true` | Show cancel button in footer |
191
+ | `singleDatePicker` | `boolean` | `false` | Enable single date selection mode |
192
+ | `dualCalendar` | `boolean` | `false` | Show two calendars side-by-side |
193
+ | `showRanges` | `boolean` | `true` | Show predefined date range buttons |
194
+ | `multiDateSelection` | `boolean` | `false` | Enable multiple date selection |
195
+ | `inline` | `boolean` | `false` | Always show calendar (no dropdown) |
196
+ | `minDate` | `Date` | `undefined` | Minimum selectable date |
197
+ | `maxDate` | `Date` | `undefined` | Maximum selectable date |
198
+ | `placeholder` | `string` | `'Select date range'` | Input placeholder text |
199
+ | `opens` | `'left' \| 'right' \| 'center'` | `'left'` | Dropdown alignment |
200
+ | `drop` | `'up' \| 'down'` | `'down'` | Dropdown direction |
201
+ | `displayFormat` | `string` | `'MM/DD/YYYY'` | Date display format (moment format) |
202
+ | `customRanges` | `Record<string, CalendarRange>` | `undefined` | Custom predefined ranges |
203
+ | `selectedValue` | `CalendarSelection \| null` | `null` | Pre-selected date(s) |
204
+ | `isDisplayCrossIcon` | `boolean` | `true` | Show/hide clear button |
205
+
206
+ #### Outputs
207
+
208
+ | Output | Type | Description |
209
+ | ---------- | --------------------------------- | ----------------------------------- |
210
+ | `selected` | `EventEmitter<CalendarSelection>` | Emitted when date selection changes |
211
+ | `opened` | `EventEmitter<void>` | Emitted when calendar opens |
212
+ | `closed` | `EventEmitter<void>` | Emitted when calendar closes |
213
+
214
+ #### Usage Examples
215
+
216
+ **Single Date Selection:**
217
+
218
+ ```typescript
219
+ <brickclay-custom-calendar
220
+ [singleDatePicker]="true"
221
+ [placeholder]="'Select a date'"
222
+ (selected)="onDateSelected($event)">
223
+ </brickclay-custom-calendar>
224
+ ```
225
+
226
+ **Date Range with Time Picker:**
227
+
228
+ ```typescript
229
+ <brickclay-custom-calendar
230
+ [dualCalendar]="true"
231
+ [enableTimepicker]="true"
232
+ [enableSeconds]="true"
233
+ (selected)="onRangeSelected($event)">
234
+ </brickclay-custom-calendar>
235
+ ```
236
+
237
+ **Multiple Date Selection:**
238
+
239
+ ```typescript
240
+ <brickclay-custom-calendar
241
+ [multiDateSelection]="true"
242
+ [inline]="true"
243
+ (selected)="onMultipleDatesSelected($event)">
244
+ </brickclay-custom-calendar>
245
+ ```
246
+
247
+ **Inline Calendar:**
248
+
249
+ ```typescript
250
+ <brickclay-custom-calendar
251
+ [inline]="true"
252
+ [dualCalendar]="false"
253
+ [showRanges]="false"
254
+ (selected)="onDateSelected($event)">
255
+ </brickclay-custom-calendar>
256
+ ```
257
+
258
+ **Custom Date Ranges:**
259
+
260
+ ```typescript
261
+ import { CalendarRange } from '@brickclay/ui';
262
+
263
+ const customRanges: Record<string, CalendarRange> = {
264
+ 'Last Week': {
265
+ start: new Date(2024, 0, 1),
266
+ end: new Date(2024, 0, 7)
267
+ },
268
+ 'This Quarter': {
269
+ start: new Date(2024, 0, 1),
270
+ end: new Date(2024, 2, 31)
271
+ }
272
+ };
273
+
274
+ <brickclay-custom-calendar
275
+ [customRanges]="customRanges"
276
+ [showRanges]="true"
277
+ (selected)="onDateSelected($event)">
278
+ </brickclay-custom-calendar>
279
+ ```
280
+
281
+ **Date Constraints:**
282
+
283
+ ```typescript
284
+ <brickclay-custom-calendar
285
+ [minDate]="new Date(2024, 0, 1)"
286
+ [maxDate]="new Date(2024, 11, 31)"
287
+ (selected)="onDateSelected($event)">
288
+ </brickclay-custom-calendar>
289
+ ```
290
+
291
+ **Pre-selected Values:**
292
+
293
+ ```typescript
294
+ export class MyComponent {
295
+ selectedValue: CalendarSelection = {
296
+ startDate: new Date(2024, 5, 15),
297
+ endDate: new Date(2024, 5, 20)
298
+ };
299
+
300
+ onDateChange() {
301
+ this.selectedValue = {
302
+ startDate: new Date(),
303
+ endDate: new Date()
304
+ };
305
+ }
306
+ }
307
+
308
+ <brickclay-custom-calendar
309
+ [selectedValue]="selectedValue"
310
+ (selected)="onDateSelected($event)">
311
+ </brickclay-custom-calendar>
312
+ ```
313
+
314
+ ### ScheduledDatePickerComponent
315
+
316
+ A comprehensive date and time scheduling component with three modes: single date, multiple dates, and date range, each with time configuration.
317
+
318
+ #### Basic Example
319
+
320
+ ```typescript
321
+ import { ScheduledDatePickerComponent, ScheduledDateSelection } from '@brickclay/ui';
322
+
323
+ @Component({
324
+ template: `
325
+ <brickclay-scheduled-date-picker [timeFormat]="12" (scheduled)="onScheduled($event)">
326
+ </brickclay-scheduled-date-picker>
327
+ `,
328
+ })
329
+ export class MyComponent {
330
+ onScheduled(selection: ScheduledDateSelection) {
331
+ console.log('Mode:', selection.mode);
332
+ if (selection.mode === 'single' && selection.singleDate) {
333
+ console.log('Start:', selection.singleDate.startDate);
334
+ console.log('End:', selection.singleDate.endDate);
335
+ console.log('All Day:', selection.singleDate.allDay);
336
+ }
337
+ }
338
+ }
339
+ ```
340
+
341
+ #### Component Selector
342
+
343
+ `<brickclay-scheduled-date-picker>`
344
+
345
+ #### Inputs
346
+
347
+ | Input | Type | Default | Description |
348
+ | --------------- | ---------- | ------- | -------------------------------- |
349
+ | `timeFormat` | `12 \| 24` | `12` | Time format (12-hour or 24-hour) |
350
+ | `enableSeconds` | `boolean` | `false` | Enable seconds in time picker |
351
+
352
+ #### Outputs
353
+
354
+ | Output | Type | Description |
355
+ | ----------- | -------------------------------------- | ------------------------------------ |
356
+ | `scheduled` | `EventEmitter<ScheduledDateSelection>` | Emitted when selection changes |
357
+ | `cleared` | `EventEmitter<void>` | Emitted when clear button is clicked |
358
+
359
+ #### Features
360
+
361
+ - **Single Date Mode**: Select one date with optional start and end times
362
+ - **Multiple Dates Mode**: Select multiple dates, each with individual time configuration
363
+ - **Date Range Mode**: Select a date range with start and end times
364
+ - **All Day Toggle**: Mark dates as all-day events
365
+ - **Time Configuration**: Individual time pickers for each date/range
366
+
367
+ ### TimePickerComponent
368
+
369
+ A standalone time picker component with scrollable hour, minute, and AM/PM selectors.
370
+
371
+ #### Basic Example
372
+
373
+ ```typescript
374
+ import { TimePickerComponent } from '@brickclay/ui';
375
+
376
+ @Component({
377
+ template: `
378
+ <brickclay-time-picker
379
+ [value]="selectedTime"
380
+ [label]="'Start Time'"
381
+ [timeFormat]="12"
382
+ (timeChange)="onTimeChange($event)"
383
+ >
384
+ </brickclay-time-picker>
385
+ `,
386
+ })
387
+ export class MyComponent {
388
+ selectedTime = '1:00 AM';
389
+
390
+ onTimeChange(time: string) {
391
+ this.selectedTime = time;
392
+ console.log('New time:', time);
393
+ }
394
+ }
395
+ ```
396
+
397
+ #### Component Selector
398
+
399
+ `<brickclay-time-picker>`
400
+
401
+ #### Inputs
402
+
403
+ | Input | Type | Default | Description |
404
+ | ------------- | ------------------- | --------------- | ---------------------------------------------------- |
405
+ | `value` | `string` | `'1:00 AM'` | Current time value (format: "H:MM AM/PM" or "HH:MM") |
406
+ | `label` | `string` | `'Time'` | Label text |
407
+ | `placeholder` | `string` | `'Select time'` | Placeholder text |
408
+ | `position` | `'left' \| 'right'` | `'left'` | Dropdown position |
409
+ | `pickerId` | `string` | `''` | Unique identifier for the picker |
410
+ | `closePicker` | `number` | `0` | Counter to trigger picker close |
411
+ | `timeFormat` | `12 \| 24` | `12` | Time format (12-hour or 24-hour) |
412
+ | `showSeconds` | `boolean` | `false` | Show seconds selector |
413
+
414
+ #### Outputs
415
+
416
+ | Output | Type | Description |
417
+ | -------------- | ---------------------- | -------------------------- |
418
+ | `timeChange` | `EventEmitter<string>` | Emitted when time changes |
419
+ | `pickerOpened` | `EventEmitter<string>` | Emitted when picker opens |
420
+ | `pickerClosed` | `EventEmitter<string>` | Emitted when picker closes |
421
+
422
+ #### Features
423
+
424
+ - Scrollable time selectors
425
+ - Keyboard navigation support
426
+ - 12-hour and 24-hour formats
427
+ - Optional seconds support
428
+ - Multiple picker coordination (only one open at a time)
429
+ - Click outside to close
430
+
431
+ #### Time Format Examples
432
+
433
+ **12-hour format:**
434
+
435
+ ```typescript
436
+ value = '1:00 AM';
437
+ value = '12:30 PM';
438
+ value = '11:45 PM';
439
+ ```
440
+
441
+ **24-hour format:**
442
+
443
+ ```typescript
444
+ value = '01:00';
445
+ value = '13:30';
446
+ value = '23:45';
447
+ ```
448
+
449
+ ## πŸ”˜ Toggle
450
+
451
+ A versatile toggle/switch component that integrates seamlessly with Angular forms. Supports both template-driven forms (`ngModel`) and reactive forms, with full accessibility features and keyboard navigation.
452
+
453
+ ### ToggleComponent
454
+
455
+ A standalone toggle component that implements `ControlValueAccessor` for seamless Angular forms integration.
456
+
457
+ #### Basic Example
458
+
459
+ ```typescript
460
+ import { ToggleComponent } from '@brickclay/ui';
461
+ import { FormsModule } from '@angular/forms';
462
+
463
+ @Component({
464
+ template: `
465
+ <brickclay-toggle
466
+ [(ngModel)]="isEnabled"
467
+ [label]="'Enable notifications'"
468
+ (change)="onToggleChange($event)"
469
+ >
470
+ </brickclay-toggle>
471
+ `,
472
+ imports: [ToggleComponent, FormsModule],
473
+ })
474
+ export class MyComponent {
475
+ isEnabled = false;
476
+
477
+ onToggleChange(value: boolean) {
478
+ console.log('Toggle state:', value);
479
+ }
480
+ }
481
+ ```
482
+
483
+ #### Component Selector
484
+
485
+ `<brickclay-toggle>`
486
+
487
+ #### Inputs
488
+
489
+ | Input | Type | Default | Description |
490
+ | ------------- | --------- | ------------- | -------------------------------------------------------------------------------- |
491
+ | `label` | `string` | `''` | Optional label text displayed next to the toggle |
492
+ | `disabled` | `boolean` | `false` | Disables the toggle interaction |
493
+ | `toggleClass` | `string` | `'toggle-md'` | CSS class for size styling. Options: `'toggle-sm'`, `'toggle-md'`, `'toggle-lg'` |
494
+
495
+ #### Outputs
496
+
497
+ | Output | Type | Description |
498
+ | -------- | ----------------------- | ------------------------------------------------------------- |
499
+ | `change` | `EventEmitter<boolean>` | Emitted when toggle state changes (returns new boolean value) |
500
+
501
+ #### Features
502
+
503
+ - βœ… **Angular Forms Integration** - Full support for `ngModel` and reactive forms
504
+ - βœ… **Three Size Variants** - Small (`toggle-sm`), Medium (`toggle-md`), Large (`toggle-lg`)
505
+ - βœ… **Accessibility** - ARIA attributes, keyboard navigation, and screen reader support
506
+ - βœ… **Disabled State** - Visual and functional disabled state
507
+ - βœ… **Customizable Styling** - Custom CSS classes for size and appearance
508
+ - βœ… **Event Handling** - `change` event for state change notifications
509
+
510
+ #### Usage Examples
511
+
512
+ **Basic Toggle with ngModel:**
513
+
514
+ ```typescript
515
+ import { ToggleComponent } from '@brickclay/ui';
516
+ import { FormsModule } from '@angular/forms';
517
+
518
+ @Component({
519
+ template: `
520
+ <brickclay-toggle [(ngModel)]="isActive" [label]="'Active Status'"> </brickclay-toggle>
521
+ `,
522
+ imports: [ToggleComponent, FormsModule],
523
+ })
524
+ export class MyComponent {
525
+ isActive = true;
526
+ }
527
+ ```
528
+
529
+ **Different Sizes:**
530
+
531
+ ```typescript
532
+ <brickclay-toggle
533
+ [(ngModel)]="value1"
534
+ [toggleClass]="'toggle-sm'"
535
+ [label]="'Small Toggle'">
536
+ </brickclay-toggle>
537
+
538
+ <brickclay-toggle
539
+ [(ngModel)]="value2"
540
+ [toggleClass]="'toggle-md'"
541
+ [label]="'Medium Toggle'">
542
+ </brickclay-toggle>
543
+
544
+ <brickclay-toggle
545
+ [(ngModel)]="value3"
546
+ [toggleClass]="'toggle-lg'"
547
+ [label]="'Large Toggle'">
548
+ </brickclay-toggle>
549
+ ```
550
+
551
+ **Disabled State:**
552
+
553
+ ```typescript
554
+ <brickclay-toggle
555
+ [ngModel]="true"
556
+ [disabled]="true"
557
+ [label]="'Disabled Toggle'">
558
+ </brickclay-toggle>
559
+ ```
560
+
561
+ **With Event Handler:**
562
+
563
+ ```typescript
564
+ @Component({
565
+ template: `
566
+ <brickclay-toggle
567
+ [(ngModel)]="notificationsEnabled"
568
+ [label]="'Email Notifications'"
569
+ (change)="onNotificationToggle($event)"
570
+ >
571
+ </brickclay-toggle>
572
+ `,
573
+ })
574
+ export class MyComponent {
575
+ notificationsEnabled = false;
576
+
577
+ onNotificationToggle(enabled: boolean) {
578
+ if (enabled) {
579
+ this.enableNotifications();
580
+ } else {
581
+ this.disableNotifications();
582
+ }
583
+ }
584
+ }
585
+ ```
586
+
587
+ **Reactive Forms Integration:**
588
+
589
+ ```typescript
590
+ import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
591
+ import { ToggleComponent } from '@brickclay/ui';
592
+
593
+ @Component({
594
+ template: `
595
+ <form [formGroup]="settingsForm">
596
+ <brickclay-toggle formControlName="darkMode" [label]="'Dark Mode'"> </brickclay-toggle>
597
+
598
+ <brickclay-toggle formControlName="notifications" [label]="'Push Notifications'">
599
+ </brickclay-toggle>
600
+ </form>
601
+ `,
602
+ imports: [ToggleComponent, ReactiveFormsModule],
603
+ })
604
+ export class SettingsComponent {
605
+ settingsForm: FormGroup;
606
+
607
+ constructor(private fb: FormBuilder) {
608
+ this.settingsForm = this.fb.group({
609
+ darkMode: [false],
610
+ notifications: [true],
611
+ });
612
+ }
613
+ }
614
+ ```
615
+
616
+ **Without Label:**
617
+
618
+ ```typescript
619
+ <brickclay-toggle
620
+ [(ngModel)]="isEnabled"
621
+ [toggleClass]="'toggle-md'">
622
+ </brickclay-toggle>
623
+ ```
624
+
625
+ #### Styling
626
+
627
+ The toggle component uses CSS classes for size variants:
628
+
629
+ - **Small**: `toggle-sm` - Width: 28px (w-7)
630
+ - **Medium**: `toggle-md` - Width: 36px (w-9) - Default
631
+ - **Large**: `toggle-lg` - Width: 44px (w-11)
632
+
633
+ The component includes built-in styles for:
634
+
635
+ - On state (green background: `#22973F`)
636
+ - Off state (gray background: `#BBBDC5`)
637
+ - Disabled state (light gray: `#D6D7DC`)
638
+ - Hover states
639
+ - Focus ring for accessibility
640
+ - Smooth transitions
641
+
642
+ #### Accessibility
643
+
644
+ The toggle component includes:
645
+
646
+ - `role="switch"` for screen readers
647
+ - `aria-checked` attribute that reflects the current state
648
+ - Keyboard navigation support
649
+ - Focus visible ring for keyboard users
650
+ - Disabled state properly communicated to assistive technologies
651
+
652
+ ## β˜‘οΈ Checkbox
653
+
654
+ A fully accessible checkbox component that integrates seamlessly with Angular forms. Supports both template-driven forms (`ngModel`) and reactive forms, with customizable styling and comprehensive accessibility features.
655
+
656
+ ### CheckboxComponent
657
+
658
+ A standalone checkbox component that implements `ControlValueAccessor` for seamless Angular forms integration.
659
+
660
+ #### Basic Example
661
+
662
+ ```typescript
663
+ import { CheckboxComponent } from '@brickclay/ui';
664
+ import { FormsModule } from '@angular/forms';
665
+
666
+ @Component({
667
+ template: `
668
+ <brickclay-checkbox
669
+ [(ngModel)]="isAccepted"
670
+ [label]="'I agree to the terms and conditions'"
671
+ (change)="onCheckboxChange($event)"
672
+ >
673
+ </brickclay-checkbox>
674
+ `,
675
+ imports: [CheckboxComponent, FormsModule],
676
+ })
677
+ export class MyComponent {
678
+ isAccepted = false;
679
+
680
+ onCheckboxChange(value: boolean) {
681
+ console.log('Checkbox state:', value);
682
+ }
683
+ }
684
+ ```
685
+
686
+ #### Component Selector
687
+
688
+ `<brickclay-checkbox>`
689
+
690
+ #### Inputs
691
+
692
+ | Input | Type | Default | Description |
693
+ | --------------- | --------- | ------- | -------------------------------------------------------------------- |
694
+ | `label` | `string` | `''` | Optional label text displayed next to the checkbox |
695
+ | `disabled` | `boolean` | `false` | Disables the checkbox interaction |
696
+ | `checkboxClass` | `string` | `''` | CSS class for size styling. Options: `'xsm'`, `'sm'`, `'md'`, `'lg'` |
697
+ | `labelClass` | `string` | `''` | Custom CSS classes for the label text |
698
+
699
+ #### Outputs
700
+
701
+ | Output | Type | Description |
702
+ | -------- | ----------------------- | --------------------------------------------------------------- |
703
+ | `change` | `EventEmitter<boolean>` | Emitted when checkbox state changes (returns new boolean value) |
704
+
705
+ #### Features
706
+
707
+ - βœ… **Angular Forms Integration** - Full support for `ngModel` and reactive forms
708
+ - βœ… **Four Size Variants** - Extra Small (`xsm`), Small (`sm`), Medium (`md`), Large (`lg`)
709
+ - βœ… **Accessibility** - ARIA attributes, keyboard navigation (Enter/Space), and screen reader support
710
+ - βœ… **Disabled State** - Visual and functional disabled state
711
+ - βœ… **Keyboard Support** - Full keyboard navigation with Enter and Space keys
712
+ - βœ… **Focus Management** - Focus visible ring for keyboard users
713
+ - βœ… **Event Handling** - `change` event for state change notifications
714
+
715
+ #### Usage Examples
716
+
717
+ **Basic Checkbox with ngModel:**
718
+
719
+ ```typescript
720
+ import { CheckboxComponent } from '@brickclay/ui';
721
+ import { FormsModule } from '@angular/forms';
722
+
723
+ @Component({
724
+ template: `
725
+ <brickclay-checkbox [(ngModel)]="isChecked" [label]="'Accept terms'"> </brickclay-checkbox>
726
+ `,
727
+ imports: [CheckboxComponent, FormsModule],
728
+ })
729
+ export class MyComponent {
730
+ isChecked = false;
731
+ }
732
+ ```
733
+
734
+ **Different Sizes:**
735
+
736
+ ```typescript
737
+ <!-- Extra Small checkbox -->
738
+ <brickclay-checkbox
739
+ [(ngModel)]="value1"
740
+ [checkboxClass]="'xsm'"
741
+ [label]="'Extra Small Checkbox'">
742
+ </brickclay-checkbox>
743
+
744
+ <!-- Small checkbox -->
745
+ <brickclay-checkbox
746
+ [(ngModel)]="value2"
747
+ [checkboxClass]="'sm'"
748
+ [label]="'Small Checkbox'">
749
+ </brickclay-checkbox>
750
+
751
+ <!-- Medium checkbox -->
752
+ <brickclay-checkbox
753
+ [(ngModel)]="value3"
754
+ [checkboxClass]="'md'"
755
+ [label]="'Medium Checkbox'">
756
+ </brickclay-checkbox>
757
+
758
+ <!-- Large checkbox with custom label styling -->
759
+ <brickclay-checkbox
760
+ [(ngModel)]="value4"
761
+ [checkboxClass]="'lg'"
762
+ [labelClass]="'text-lg font-bold'"
763
+ [label]="'Large Checkbox'">
764
+ </brickclay-checkbox>
765
+ ```
766
+
767
+ **Disabled State:**
768
+
769
+ ```typescript
770
+ <brickclay-checkbox
771
+ [ngModel]="true"
772
+ [disabled]="true"
773
+ [label]="'Disabled Checkbox'">
774
+ </brickclay-checkbox>
775
+ ```
776
+
777
+ **With Event Handler:**
778
+
779
+ ```typescript
780
+ @Component({
781
+ template: `
782
+ <brickclay-checkbox
783
+ [(ngModel)]="newsletterSubscribed"
784
+ [label]="'Subscribe to newsletter'"
785
+ (change)="onNewsletterToggle($event)"
786
+ >
787
+ </brickclay-checkbox>
788
+ `,
789
+ })
790
+ export class MyComponent {
791
+ newsletterSubscribed = false;
792
+
793
+ onNewsletterToggle(subscribed: boolean) {
794
+ if (subscribed) {
795
+ this.subscribeToNewsletter();
796
+ } else {
797
+ this.unsubscribeFromNewsletter();
798
+ }
799
+ }
800
+ }
801
+ ```
802
+
803
+ **Reactive Forms Integration:**
804
+
805
+ ```typescript
806
+ import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
807
+ import { CheckboxComponent } from '@brickclay/ui';
808
+
809
+ @Component({
810
+ template: `
811
+ <form [formGroup]="registrationForm">
812
+ <brickclay-checkbox
813
+ formControlName="acceptTerms"
814
+ [label]="'I accept the terms and conditions'"
815
+ >
816
+ </brickclay-checkbox>
817
+
818
+ <brickclay-checkbox formControlName="receiveUpdates" [label]="'Receive product updates'">
819
+ </brickclay-checkbox>
820
+ </form>
821
+ `,
822
+ imports: [CheckboxComponent, ReactiveFormsModule],
823
+ })
824
+ export class RegistrationComponent {
825
+ registrationForm: FormGroup;
826
+
827
+ constructor(private fb: FormBuilder) {
828
+ this.registrationForm = this.fb.group({
829
+ acceptTerms: [false, Validators.requiredTrue],
830
+ receiveUpdates: [false],
831
+ });
832
+ }
833
+ }
834
+ ```
835
+
836
+ **Without Label:**
837
+
838
+ ```typescript
839
+ <brickclay-checkbox
840
+ [(ngModel)]="isSelected"
841
+ [checkboxClass]="'md'">
842
+ </brickclay-checkbox>
843
+ ```
844
+
845
+ **Multiple Checkboxes:**
846
+
847
+ ```typescript
848
+ @Component({
849
+ template: `
850
+ <div>
851
+ <brickclay-checkbox
852
+ *ngFor="let option of options"
853
+ [(ngModel)]="option.selected"
854
+ [label]="option.label"
855
+ (change)="onOptionChange(option)"
856
+ >
857
+ </brickclay-checkbox>
858
+ </div>
859
+ `,
860
+ })
861
+ export class MyComponent {
862
+ options = [
863
+ { label: 'Option 1', selected: false },
864
+ { label: 'Option 2', selected: false },
865
+ { label: 'Option 3', selected: false },
866
+ ];
867
+
868
+ onOptionChange(option: any) {
869
+ console.log(`${option.label} is now ${option.selected ? 'selected' : 'deselected'}`);
870
+ }
871
+ }
872
+ ```
873
+
874
+ #### Styling
875
+
876
+ The checkbox component supports predefined size classes:
877
+
878
+ - **Extra Small**: `xsm` - 14px Γ— 14px
879
+ - **Small**: `sm` - 16px Γ— 16px
880
+ - **Medium**: `md` - 18px Γ— 18px
881
+ - **Large**: `lg` - 20px Γ— 20px
882
+
883
+ Use `labelClass` to style the label text (font size, weight, color, etc.)
884
+
885
+ The component includes built-in styles for:
886
+
887
+ - Checked state (black background with white checkmark/tick icon)
888
+ - Unchecked state (white background with gray border)
889
+ - Hover states (darker border on hover)
890
+ - Disabled states (gray background and border)
891
+ - Focus ring for accessibility (blue ring with offset)
892
+ - Smooth transitions for state changes
893
+
894
+ #### Accessibility
895
+
896
+ The checkbox component includes:
897
+
898
+ - Keyboard navigation support (Enter and Space keys)
899
+ - Focus visible ring for keyboard users
900
+ - Proper ARIA attributes
901
+ - Disabled state properly communicated to assistive technologies
902
+ - Tab navigation support
903
+
904
+ ## πŸ”˜ Radio Button
905
+
906
+ A fully accessible radio button component that integrates seamlessly with Angular forms. Supports both template-driven forms (`ngModel`) and reactive forms, with two visual variants (dot and tick) and comprehensive accessibility features.
907
+
908
+ ### RadioComponent
909
+
910
+ A standalone radio button component that implements `ControlValueAccessor` for seamless Angular forms integration. Radio buttons are used when only one option can be selected from a group.
911
+
912
+ #### Basic Example
913
+
914
+ ```typescript
915
+ import { RadioComponent } from '@brickclay/ui';
916
+ import { FormsModule } from '@angular/forms';
917
+
918
+ @Component({
919
+ template: `
920
+ <brickclay-radio-button
921
+ [(ngModel)]="selectedOption"
922
+ [value]="'option1'"
923
+ [label]="'Option 1'"
924
+ (change)="onRadioChange($event)"
925
+ >
926
+ </brickclay-radio-button>
927
+
928
+ <brickclay-radio-button [(ngModel)]="selectedOption" [value]="'option2'" [label]="'Option 2'">
929
+ </brickclay-radio-button>
930
+ `,
931
+ imports: [RadioComponent, FormsModule],
932
+ })
933
+ export class MyComponent {
934
+ selectedOption = 'option1';
935
+
936
+ onRadioChange(value: any) {
937
+ console.log('Selected option:', value);
938
+ }
939
+ }
940
+ ```
941
+
942
+ #### Component Selector
943
+
944
+ `<brickclay-radio-button>`
945
+
946
+ #### Inputs
947
+
948
+ | Input | Type | Default | Description |
949
+ | ------------ | ----------------- | ----------- | ------------------------------------------------------------------------- |
950
+ | `label` | `string` | `''` | Optional label text displayed next to the radio button |
951
+ | `value` | `any` | `undefined` | The value associated with this radio button (required for radio groups) |
952
+ | `disabled` | `boolean` | `false` | Disables the radio button interaction |
953
+ | `variant` | `'dot' \| 'tick'` | `'dot'` | Visual variant. `'dot'` shows a filled circle, `'tick'` shows a checkmark |
954
+ | `radioClass` | `string` | `''` | CSS class for size styling. Options: `'xsm'`, `'sm'`, `'md'`, `'lg'` |
955
+ | `labelClass` | `string` | `''` | Custom CSS classes for the label text |
956
+
957
+ #### Outputs
958
+
959
+ | Output | Type | Description |
960
+ | -------- | ------------------- | --------------------------------------------------------- |
961
+ | `change` | `EventEmitter<any>` | Emitted when radio button is selected (returns the value) |
962
+
963
+ #### Features
964
+
965
+ - βœ… **Angular Forms Integration** - Full support for `ngModel` and reactive forms
966
+ - βœ… **Two Visual Variants** - Dot (filled circle) and Tick (checkmark) styles
967
+ - βœ… **Four Size Variants** - Extra Small (`xsm`), Small (`sm`), Medium (`md`), Large (`lg`)
968
+ - βœ… **Radio Groups** - Automatically groups radio buttons with the same `ngModel` binding
969
+ - βœ… **Accessibility** - ARIA attributes, keyboard navigation (Enter/Space), and screen reader support
970
+ - βœ… **Disabled State** - Visual and functional disabled state
971
+ - βœ… **Keyboard Support** - Full keyboard navigation with Enter and Space keys
972
+ - βœ… **Focus Management** - Focus visible ring for keyboard users
973
+ - βœ… **Event Handling** - `change` event for selection notifications
974
+
975
+ #### Usage Examples
976
+
977
+ **Basic Radio Group with ngModel:**
978
+
979
+ ```typescript
980
+ import { RadioComponent } from '@brickclay/ui';
981
+ import { FormsModule } from '@angular/forms';
982
+
983
+ @Component({
984
+ template: `
985
+ <brickclay-radio-button
986
+ [(ngModel)]="selectedPayment"
987
+ [value]="'credit'"
988
+ [label]="'Credit Card'"
989
+ >
990
+ </brickclay-radio-button>
991
+
992
+ <brickclay-radio-button [(ngModel)]="selectedPayment" [value]="'debit'" [label]="'Debit Card'">
993
+ </brickclay-radio-button>
994
+
995
+ <brickclay-radio-button [(ngModel)]="selectedPayment" [value]="'paypal'" [label]="'PayPal'">
996
+ </brickclay-radio-button>
997
+ `,
998
+ imports: [RadioComponent, FormsModule],
999
+ })
1000
+ export class MyComponent {
1001
+ selectedPayment = 'credit';
1002
+ }
1003
+ ```
1004
+
1005
+ **Dot Variant (Default):**
1006
+
1007
+ ```typescript
1008
+ <brickclay-radio-button
1009
+ [(ngModel)]="selectedOption"
1010
+ [value]="'option1'"
1011
+ [variant]="'dot'"
1012
+ [label]="'Option with Dot'">
1013
+ </brickclay-radio-button>
1014
+ ```
1015
+
1016
+ **Tick Variant:**
1017
+
1018
+ ```typescript
1019
+ <brickclay-radio-button
1020
+ [(ngModel)]="selectedOption"
1021
+ [value]="'option2'"
1022
+ [variant]="'tick'"
1023
+ [label]="'Option with Tick'">
1024
+ </brickclay-radio-button>
1025
+ ```
1026
+
1027
+ **Different Sizes:**
1028
+
1029
+ ```typescript
1030
+ <!-- Extra Small radio -->
1031
+ <brickclay-radio-button
1032
+ [(ngModel)]="selectedOption"
1033
+ [value]="'xsm'"
1034
+ [radioClass]="'xsm'"
1035
+ [label]="'Extra Small Radio'">
1036
+ </brickclay-radio-button>
1037
+
1038
+ <!-- Small radio -->
1039
+ <brickclay-radio-button
1040
+ [(ngModel)]="selectedOption"
1041
+ [value]="'sm'"
1042
+ [radioClass]="'sm'"
1043
+ [label]="'Small Radio'">
1044
+ </brickclay-radio-button>
1045
+
1046
+ <!-- Medium radio -->
1047
+ <brickclay-radio-button
1048
+ [(ngModel)]="selectedOption"
1049
+ [value]="'md'"
1050
+ [radioClass]="'md'"
1051
+ [label]="'Medium Radio'">
1052
+ </brickclay-radio-button>
1053
+
1054
+ <!-- Large radio with custom label styling -->
1055
+ <brickclay-radio-button
1056
+ [(ngModel)]="selectedOption"
1057
+ [value]="'lg'"
1058
+ [radioClass]="'lg'"
1059
+ [labelClass]="'text-lg font-bold'"
1060
+ [label]="'Large Radio'">
1061
+ </brickclay-radio-button>
1062
+ ```
1063
+
1064
+ **Disabled State:**
1065
+
1066
+ ```typescript
1067
+ <brickclay-radio-button
1068
+ [(ngModel)]="selectedOption"
1069
+ [value]="'disabled-option'"
1070
+ [disabled]="true"
1071
+ [label]="'Disabled Option'">
1072
+ </brickclay-radio-button>
1073
+ ```
1074
+
1075
+ **With Event Handler:**
1076
+
1077
+ ```typescript
1078
+ @Component({
1079
+ template: `
1080
+ <brickclay-radio-button
1081
+ *ngFor="let option of options"
1082
+ [(ngModel)]="selectedOption"
1083
+ [value]="option.value"
1084
+ [label]="option.label"
1085
+ (change)="onOptionChange($event)"
1086
+ >
1087
+ </brickclay-radio-button>
1088
+ `,
1089
+ })
1090
+ export class MyComponent {
1091
+ options = [
1092
+ { value: 'option1', label: 'Option 1' },
1093
+ { value: 'option2', label: 'Option 2' },
1094
+ { value: 'option3', label: 'Option 3' },
1095
+ ];
1096
+ selectedOption = 'option1';
1097
+
1098
+ onOptionChange(value: any) {
1099
+ console.log('Selected:', value);
1100
+ }
1101
+ }
1102
+ ```
1103
+
1104
+ **Reactive Forms Integration:**
1105
+
1106
+ ```typescript
1107
+ import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
1108
+ import { RadioComponent } from '@brickclay/ui';
1109
+
1110
+ @Component({
1111
+ template: `
1112
+ <form [formGroup]="surveyForm">
1113
+ <brickclay-radio-button formControlName="rating" [value]="'excellent'" [label]="'Excellent'">
1114
+ </brickclay-radio-button>
1115
+
1116
+ <brickclay-radio-button formControlName="rating" [value]="'good'" [label]="'Good'">
1117
+ </brickclay-radio-button>
1118
+
1119
+ <brickclay-radio-button formControlName="rating" [value]="'fair'" [label]="'Fair'">
1120
+ </brickclay-radio-button>
1121
+ </form>
1122
+ `,
1123
+ imports: [RadioComponent, ReactiveFormsModule],
1124
+ })
1125
+ export class SurveyComponent {
1126
+ surveyForm: FormGroup;
1127
+
1128
+ constructor(private fb: FormBuilder) {
1129
+ this.surveyForm = this.fb.group({
1130
+ rating: ['good', Validators.required],
1131
+ });
1132
+ }
1133
+ }
1134
+ ```
1135
+
1136
+ **Without Label:**
1137
+
1138
+ ```typescript
1139
+ <brickclay-radio-button
1140
+ [(ngModel)]="selectedOption"
1141
+ [value]="'option1'"
1142
+ [radioClass]="'md'">
1143
+ </brickclay-radio-button>
1144
+ ```
1145
+
1146
+ **Dynamic Radio Group:**
1147
+
1148
+ ```typescript
1149
+ @Component({
1150
+ template: `
1151
+ <div>
1152
+ <brickclay-radio-button
1153
+ *ngFor="let item of items"
1154
+ [(ngModel)]="selectedItem"
1155
+ [value]="item.id"
1156
+ [label]="item.name"
1157
+ [variant]="item.variant || 'dot'"
1158
+ >
1159
+ </brickclay-radio-button>
1160
+ </div>
1161
+ `,
1162
+ })
1163
+ export class MyComponent {
1164
+ items = [
1165
+ { id: 1, name: 'Item 1', variant: 'dot' },
1166
+ { id: 2, name: 'Item 2', variant: 'tick' },
1167
+ { id: 3, name: 'Item 3', variant: 'dot' },
1168
+ ];
1169
+ selectedItem = 1;
1170
+ }
1171
+ ```
1172
+
1173
+ #### Styling
1174
+
1175
+ The radio button component supports predefined size classes:
1176
+
1177
+ - **Extra Small**: `xsm` - 14px Γ— 14px
1178
+ - **Small**: `sm` - 16px Γ— 16px
1179
+ - **Medium**: `md` - 18px Γ— 18px
1180
+ - **Large**: `lg` - 19px Γ— 19px
1181
+
1182
+ Use `labelClass` to style the label text (font size, weight, color, etc.)
1183
+
1184
+ The component includes built-in styles for:
1185
+
1186
+ - **Dot Variant**: Filled circle indicator when selected (size varies by radioClass)
1187
+ - **Tick Variant**: Checkmark indicator when selected (size varies by radioClass)
1188
+ - Unselected state (white background with gray border)
1189
+ - Hover states (darker border on hover)
1190
+ - Disabled states (gray background and border)
1191
+ - Focus ring for accessibility (blue ring with offset)
1192
+ - Smooth transitions for state changes
1193
+
1194
+ #### Accessibility
1195
+
1196
+ The radio button component includes:
1197
+
1198
+ - Keyboard navigation support (Enter and Space keys)
1199
+ - Focus visible ring for keyboard users
1200
+ - Proper ARIA attributes
1201
+ - Disabled state properly communicated to assistive technologies
1202
+ - Tab navigation support
1203
+ - Radio group semantics for screen readers
1204
+
1205
+ #### Radio Groups
1206
+
1207
+ Radio buttons are automatically grouped when they share the same `ngModel` binding. Only one radio button in a group can be selected at a time. When a radio button is selected, the previously selected one in the same group is automatically deselected.
1208
+
1209
+ ## πŸ’Š Pill
1210
+
1211
+ A versatile pill component for displaying labels, tags, or status indicators. Perfect for categorizing content, showing status, or creating removable tag lists. Supports multiple visual variants, color schemes, sizes, and optional dot indicators.
1212
+
1213
+ ### PillComponent
1214
+
1215
+ A standalone pill component that displays text labels with customizable styling and optional removal functionality.
1216
+
1217
+ #### Basic Example
1218
+
1219
+ ```typescript
1220
+ import { PillComponent } from '@brickclay/ui';
1221
+
1222
+ @Component({
1223
+ template: `
1224
+ <brickclay-pill
1225
+ [label]="'New Feature'"
1226
+ [variant]="'Solid'"
1227
+ [color]="'Primary'"
1228
+ [size]="'md'"
1229
+ (clicked)="onPillRemoved($event)"
1230
+ >
1231
+ </brickclay-pill>
1232
+ `,
1233
+ imports: [PillComponent],
1234
+ })
1235
+ export class MyComponent {
1236
+ onPillRemoved(label: string) {
1237
+ console.log('Pill removed:', label);
1238
+ }
1239
+ }
1240
+ ```
1241
+
1242
+ #### Component Selector
1243
+
1244
+ `<brickclay-pill>`
1245
+
1246
+ #### Inputs
1247
+
1248
+ | Input | Type | Default | Description |
1249
+ | ------------ | --------------------------------------- | --------- | -------------------------------------------------------------------- |
1250
+ | `label` | `string` | `''` | The text content displayed in the pill |
1251
+ | `variant` | `'Light' \| 'Solid' \| 'Outline' \| 'Transparent'` | `'Light'` | Visual style variant |
1252
+ | `color` | `'Gray' \| 'Primary' \| 'Error' \| 'Warning' \| 'Success' \| 'Purple' \| 'Cyan'` | `'Gray'` | Color scheme for the pill |
1253
+ | `size` | `'xsm' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Size variant of the pill |
1254
+ | `dot` | `'left' \| 'right' \| 'none'` | `'none'` | Position of optional dot indicator (left, right, or none) |
1255
+ | `removable` | `boolean` | `false` | Whether to show a remove button |
1256
+ | `customClass`| `string` | `''` | Additional CSS classes for custom styling |
1257
+
1258
+ #### Outputs
1259
+
1260
+ | Output | Type | Description |
1261
+ | -------- | ------------------------ | ----------------------------------------------------- |
1262
+ | `clicked`| `EventEmitter<string>` | Emitted when the remove button is clicked (returns label) |
1263
+
1264
+ #### Features
1265
+
1266
+ - βœ… **Multiple Variants** - Light, Solid, Outline, and Transparent styles
1267
+ - βœ… **Color Options** - Gray, Primary, Error, Warning, Success, Purple, and Cyan
1268
+ - βœ… **Size Variants** - Extra Small (`xsm`), Small (`sm`), Medium (`md`), Large (`lg`)
1269
+ - βœ… **Dot Indicators** - Optional dot indicator on left or right side
1270
+ - βœ… **Removable** - Optional remove button with click event
1271
+ - βœ… **Custom Styling** - Additional CSS classes for custom appearance
1272
+ - βœ… **Event Handling** - `clicked` event for remove button interactions
1273
+
1274
+ #### Usage Examples
1275
+
1276
+ **Basic Pill:**
1277
+
1278
+ ```typescript
1279
+ import { PillComponent } from '@brickclay/ui';
1280
+
1281
+ @Component({
1282
+ template: `
1283
+ <brickclay-pill [label]="'Status'" [color]="'Success'"> </brickclay-pill>
1284
+ `,
1285
+ imports: [PillComponent],
1286
+ })
1287
+ export class MyComponent {}
1288
+ ```
1289
+
1290
+ **Different Variants:**
1291
+
1292
+ ```typescript
1293
+ <!-- Light variant -->
1294
+ <brickclay-pill
1295
+ [label]="'Light Pill'"
1296
+ [variant]="'Light'"
1297
+ [color]="'Primary'">
1298
+ </brickclay-pill>
1299
+
1300
+ <!-- Solid variant -->
1301
+ <brickclay-pill
1302
+ [label]="'Solid Pill'"
1303
+ [variant]="'Solid'"
1304
+ [color]="'Primary'">
1305
+ </brickclay-pill>
1306
+
1307
+ <!-- Outline variant -->
1308
+ <brickclay-pill
1309
+ [label]="'Outline Pill'"
1310
+ [variant]="'Outline'"
1311
+ [color]="'Primary'">
1312
+ </brickclay-pill>
1313
+
1314
+ <!-- Transparent variant -->
1315
+ <brickclay-pill
1316
+ [label]="'Transparent Pill'"
1317
+ [variant]="'Transparent'"
1318
+ [color]="'Primary'">
1319
+ </brickclay-pill>
1320
+ ```
1321
+
1322
+ **Different Colors:**
1323
+
1324
+ ```typescript
1325
+ <brickclay-pill [label]="'Gray'" [color]="'Gray'"> </brickclay-pill>
1326
+ <brickclay-pill [label]="'Primary'" [color]="'Primary'"> </brickclay-pill>
1327
+ <brickclay-pill [label]="'Error'" [color]="'Error'"> </brickclay-pill>
1328
+ <brickclay-pill [label]="'Warning'" [color]="'Warning'"> </brickclay-pill>
1329
+ <brickclay-pill [label]="'Success'" [color]="'Success'"> </brickclay-pill>
1330
+ <brickclay-pill [label]="'Purple'" [color]="'Purple'"> </brickclay-pill>
1331
+ <brickclay-pill [label]="'Cyan'" [color]="'Cyan'"> </brickclay-pill>
1332
+ ```
1333
+
1334
+ **Different Sizes:**
1335
+
1336
+ ```typescript
1337
+ <!-- Extra Small -->
1338
+ <brickclay-pill [label]="'XSM'" [size]="'xsm'"> </brickclay-pill>
1339
+
1340
+ <!-- Small -->
1341
+ <brickclay-pill [label]="'SM'" [size]="'sm'"> </brickclay-pill>
1342
+
1343
+ <!-- Medium -->
1344
+ <brickclay-pill [label]="'MD'" [size]="'md'"> </brickclay-pill>
1345
+
1346
+ <!-- Large -->
1347
+ <brickclay-pill [label]="'LG'" [size]="'lg'"> </brickclay-pill>
1348
+ ```
1349
+
1350
+ **With Dot Indicators:**
1351
+
1352
+ ```typescript
1353
+ <!-- Dot on left -->
1354
+ <brickclay-pill
1355
+ [label]="'Active'"
1356
+ [dot]="'left'"
1357
+ [color]="'Success'">
1358
+ </brickclay-pill>
1359
+
1360
+ <!-- Dot on right -->
1361
+ <brickclay-pill
1362
+ [label]="'Pending'"
1363
+ [dot]="'right'"
1364
+ [color]="'Warning'">
1365
+ </brickclay-pill>
1366
+ ```
1367
+
1368
+ **Removable Pill:**
1369
+
1370
+ ```typescript
1371
+ @Component({
1372
+ template: `
1373
+ <brickclay-pill
1374
+ [label]="'Removable Tag'"
1375
+ [removable]="true"
1376
+ (clicked)="onRemoveTag($event)">
1377
+ </brickclay-pill>
1378
+ `,
1379
+ })
1380
+ export class MyComponent {
1381
+ onRemoveTag(label: string) {
1382
+ console.log('Removed:', label);
1383
+ // Remove from list, update state, etc.
1384
+ }
1385
+ }
1386
+ ```
1387
+
1388
+ **Dynamic Pill List:**
1389
+
1390
+ ```typescript
1391
+ @Component({
1392
+ template: `
1393
+ <div>
1394
+ <brickclay-pill
1395
+ *ngFor="let tag of tags"
1396
+ [label]="tag"
1397
+ [removable]="true"
1398
+ [color]="getTagColor(tag)"
1399
+ (clicked)="removeTag(tag)">
1400
+ </brickclay-pill>
1401
+ </div>
1402
+ `,
1403
+ })
1404
+ export class MyComponent {
1405
+ tags = ['Angular', 'TypeScript', 'RxJS', 'NgRx'];
1406
+
1407
+ removeTag(tag: string) {
1408
+ this.tags = this.tags.filter((t) => t !== tag);
1409
+ }
1410
+
1411
+ getTagColor(tag: string): 'Primary' | 'Success' | 'Warning' {
1412
+ // Custom logic to determine color
1413
+ return 'Primary';
1414
+ }
1415
+ }
1416
+ ```
1417
+
1418
+ **With Custom Classes:**
1419
+
1420
+ ```typescript
1421
+ <brickclay-pill
1422
+ [label]="'Custom Styled'"
1423
+ [customClass]="'my-custom-class font-bold'">
1424
+ </brickclay-pill>
1425
+ ```
1426
+
1427
+ #### Styling
1428
+
1429
+ The pill component supports predefined size classes:
1430
+
1431
+ - **Extra Small**: `xsm`
1432
+ - **Small**: `sm`
1433
+ - **Medium**: `md` - Default
1434
+ - **Large**: `lg`
1435
+
1436
+ The component includes built-in styles for:
1437
+
1438
+ - All variant styles (Light, Solid, Outline, Transparent)
1439
+ - All color schemes (Gray, Primary, Error, Warning, Success, Purple, Cyan)
1440
+ - Dot indicators (left and right positions)
1441
+ - Remove button styling
1442
+ - Hover states
1443
+ - Smooth transitions
1444
+
1445
+ ## 🏷️ Badge
1446
+
1447
+ A flexible badge component for displaying labels, tags, or status indicators. Perfect for categorizing content, showing status, or creating removable tag lists. Supports multiple visual variants, color schemes, sizes, and optional dot indicators.
1448
+
1449
+ ### BadgeComponent
1450
+
1451
+ A standalone badge component that displays text labels with customizable styling and optional removal functionality.
1452
+
1453
+ #### Basic Example
1454
+
1455
+ ```typescript
1456
+ import { BadgeComponent } from '@brickclay/ui';
1457
+
1458
+ @Component({
1459
+ template: `
1460
+ <brickclay-badge
1461
+ [label]="'New'"
1462
+ [variant]="'Solid'"
1463
+ [color]="'Primary'"
1464
+ [size]="'md'"
1465
+ (clicked)="onBadgeRemoved($event)"
1466
+ >
1467
+ </brickclay-badge>
1468
+ `,
1469
+ imports: [BadgeComponent],
1470
+ })
1471
+ export class MyComponent {
1472
+ onBadgeRemoved(label: string) {
1473
+ console.log('Badge removed:', label);
1474
+ }
1475
+ }
1476
+ ```
1477
+
1478
+ #### Component Selector
1479
+
1480
+ `<brickclay-badge>`
1481
+
1482
+ #### Inputs
1483
+
1484
+ | Input | Type | Default | Description |
1485
+ | ------------ | --------------------------------------- | --------- | -------------------------------------------------------------------- |
1486
+ | `label` | `string` | `''` | The text content displayed in the badge |
1487
+ | `variant` | `'Light' \| 'Solid' \| 'Outline' \| 'Transparent'` | `'Light'` | Visual style variant |
1488
+ | `color` | `'Gray' \| 'Primary' \| 'Error' \| 'Warning' \| 'Success' \| 'Purple' \| 'Cyan'` | `'Gray'` | Color scheme for the badge |
1489
+ | `size` | `'xsm' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Size variant of the badge |
1490
+ | `dot` | `'left' \| 'right' \| 'none'` | `'none'` | Position of optional dot indicator (left, right, or none) |
1491
+ | `removable` | `boolean` | `false` | Whether to show a remove button |
1492
+ | `customClass`| `string` | `''` | Additional CSS classes for custom styling |
1493
+
1494
+ #### Outputs
1495
+
1496
+ | Output | Type | Description |
1497
+ | -------- | ------------------------ | ----------------------------------------------------- |
1498
+ | `clicked`| `EventEmitter<string>` | Emitted when the remove button is clicked (returns label) |
1499
+
1500
+ #### Features
1501
+
1502
+ - βœ… **Multiple Variants** - Light, Solid, Outline, and Transparent styles
1503
+ - βœ… **Color Options** - Gray, Primary, Error, Warning, Success, Purple, and Cyan
1504
+ - βœ… **Size Variants** - Extra Small (`xsm`), Small (`sm`), Medium (`md`), Large (`lg`)
1505
+ - βœ… **Dot Indicators** - Optional dot indicator on left or right side
1506
+ - βœ… **Removable** - Optional remove button with click event
1507
+ - βœ… **Custom Styling** - Additional CSS classes for custom appearance
1508
+ - βœ… **Event Handling** - `clicked` event for remove button interactions
1509
+
1510
+ #### Usage Examples
1511
+
1512
+ **Basic Badge:**
1513
+
1514
+ ```typescript
1515
+ import { BadgeComponent } from '@brickclay/ui';
1516
+
1517
+ @Component({
1518
+ template: `
1519
+ <brickclay-badge [label]="'New'" [color]="'Success'"> </brickclay-badge>
1520
+ `,
1521
+ imports: [BadgeComponent],
1522
+ })
1523
+ export class MyComponent {}
1524
+ ```
1525
+
1526
+ **Different Variants:**
1527
+
1528
+ ```typescript
1529
+ <!-- Light variant -->
1530
+ <brickclay-badge
1531
+ [label]="'Light Badge'"
1532
+ [variant]="'Light'"
1533
+ [color]="'Primary'">
1534
+ </brickclay-badge>
1535
+
1536
+ <!-- Solid variant -->
1537
+ <brickclay-badge
1538
+ [label]="'Solid Badge'"
1539
+ [variant]="'Solid'"
1540
+ [color]="'Primary'">
1541
+ </brickclay-badge>
1542
+
1543
+ <!-- Outline variant -->
1544
+ <brickclay-badge
1545
+ [label]="'Outline Badge'"
1546
+ [variant]="'Outline'"
1547
+ [color]="'Primary'">
1548
+ </brickclay-badge>
1549
+
1550
+ <!-- Transparent variant -->
1551
+ <brickclay-badge
1552
+ [label]="'Transparent Badge'"
1553
+ [variant]="'Transparent'"
1554
+ [color]="'Primary'">
1555
+ </brickclay-badge>
1556
+ ```
1557
+
1558
+ **Different Colors:**
1559
+
1560
+ ```typescript
1561
+ <brickclay-badge [label]="'Gray'" [color]="'Gray'"> </brickclay-badge>
1562
+ <brickclay-badge [label]="'Primary'" [color]="'Primary'"> </brickclay-badge>
1563
+ <brickclay-badge [label]="'Error'" [color]="'Error'"> </brickclay-badge>
1564
+ <brickclay-badge [label]="'Warning'" [color]="'Warning'"> </brickclay-badge>
1565
+ <brickclay-badge [label]="'Success'" [color]="'Success'"> </brickclay-badge>
1566
+ <brickclay-badge [label]="'Purple'" [color]="'Purple'"> </brickclay-badge>
1567
+ <brickclay-badge [label]="'Cyan'" [color]="'Cyan'"> </brickclay-badge>
1568
+ ```
1569
+
1570
+ **Different Sizes:**
1571
+
1572
+ ```typescript
1573
+ <!-- Extra Small -->
1574
+ <brickclay-badge [label]="'XSM'" [size]="'xsm'"> </brickclay-badge>
1575
+
1576
+ <!-- Small -->
1577
+ <brickclay-badge [label]="'SM'" [size]="'sm'"> </brickclay-badge>
1578
+
1579
+ <!-- Medium -->
1580
+ <brickclay-badge [label]="'MD'" [size]="'md'"> </brickclay-badge>
1581
+
1582
+ <!-- Large -->
1583
+ <brickclay-badge [label]="'LG'" [size]="'lg'"> </brickclay-badge>
1584
+ ```
1585
+
1586
+ **With Dot Indicators:**
1587
+
1588
+ ```typescript
1589
+ <!-- Dot on left -->
1590
+ <brickclay-badge
1591
+ [label]="'Active'"
1592
+ [dot]="'left'"
1593
+ [color]="'Success'">
1594
+ </brickclay-badge>
1595
+
1596
+ <!-- Dot on right -->
1597
+ <brickclay-badge
1598
+ [label]="'Pending'"
1599
+ [dot]="'right'"
1600
+ [color]="'Warning'">
1601
+ </brickclay-badge>
1602
+ ```
1603
+
1604
+ **Removable Badge:**
1605
+
1606
+ ```typescript
1607
+ @Component({
1608
+ template: `
1609
+ <brickclay-badge
1610
+ [label]="'Removable Tag'"
1611
+ [removable]="true"
1612
+ (clicked)="onRemoveTag($event)">
1613
+ </brickclay-badge>
1614
+ `,
1615
+ })
1616
+ export class MyComponent {
1617
+ onRemoveTag(label: string) {
1618
+ console.log('Removed:', label);
1619
+ // Remove from list, update state, etc.
1620
+ }
1621
+ }
1622
+ ```
1623
+
1624
+ **Dynamic Badge List:**
1625
+
1626
+ ```typescript
1627
+ @Component({
1628
+ template: `
1629
+ <div>
1630
+ <brickclay-badge
1631
+ *ngFor="let tag of tags"
1632
+ [label]="tag"
1633
+ [removable]="true"
1634
+ [color]="getTagColor(tag)"
1635
+ (clicked)="removeTag(tag)">
1636
+ </brickclay-badge>
1637
+ </div>
1638
+ `,
1639
+ })
1640
+ export class MyComponent {
1641
+ tags = ['Angular', 'TypeScript', 'RxJS', 'NgRx'];
1642
+
1643
+ removeTag(tag: string) {
1644
+ this.tags = this.tags.filter((t) => t !== tag);
1645
+ }
1646
+
1647
+ getTagColor(tag: string): 'Primary' | 'Success' | 'Warning' {
1648
+ // Custom logic to determine color
1649
+ return 'Primary';
1650
+ }
1651
+ }
1652
+ ```
1653
+
1654
+ **With Custom Classes:**
1655
+
1656
+ ```typescript
1657
+ <brickclay-badge
1658
+ [label]="'Custom Styled'"
1659
+ [customClass]="'my-custom-class font-bold'">
1660
+ </brickclay-badge>
1661
+ ```
1662
+
1663
+ #### Styling
1664
+
1665
+ The badge component supports predefined size classes:
1666
+
1667
+ - **Extra Small**: `xsm`
1668
+ - **Small**: `sm`
1669
+ - **Medium**: `md` - Default
1670
+ - **Large**: `lg`
1671
+
1672
+ The component includes built-in styles for:
1673
+
1674
+ - All variant styles (Light, Solid, Outline, Transparent)
1675
+ - All color schemes (Gray, Primary, Error, Warning, Success, Purple, Cyan)
1676
+ - Dot indicators (left and right positions)
1677
+ - Remove button styling
1678
+ - Hover states
1679
+ - Smooth transitions
1680
+
1681
+ ## πŸ“ TypeScript Interfaces
1682
+
1683
+ ### CalendarRange
1684
+
1685
+ ```typescript
1686
+ interface CalendarRange {
1687
+ start: Date;
1688
+ end: Date;
1689
+ }
1690
+ ```
1691
+
1692
+ ### CalendarSelection
1693
+
1694
+ ```typescript
1695
+ interface CalendarSelection {
1696
+ startDate: Date | null;
1697
+ endDate: Date | null;
1698
+ selectedDates?: Date[]; // For multi-date selection
1699
+ }
1700
+ ```
1701
+
1702
+ ### TimeConfiguration
1703
+
1704
+ ```typescript
1705
+ interface TimeConfiguration {
1706
+ date: Date;
1707
+ allDay: boolean;
1708
+ startTime: string; // Format: "HH:mm" or "HH:mm:ss"
1709
+ endTime: string;
1710
+ }
1711
+ ```
1712
+
1713
+ ### ScheduledDateSelection
1714
+
1715
+ ```typescript
1716
+ interface ScheduledDateSelection {
1717
+ mode: 'single' | 'multiple' | 'range';
1718
+ singleDate?: {
1719
+ startDate: Date;
1720
+ endDate: Date;
1721
+ allDay: boolean;
1722
+ startTime: string;
1723
+ endTime: string;
1724
+ };
1725
+ multipleDates?: TimeConfiguration[];
1726
+ dateRange?: {
1727
+ startDate: Date;
1728
+ endDate: Date;
1729
+ allDay: boolean;
1730
+ startTime: string;
1731
+ endTime: string;
1732
+ };
1733
+ }
1734
+ ```
1735
+
1736
+ ## 🎯 Common Use Cases
1737
+
1738
+ ### Form Integration
1739
+
1740
+ ```typescript
1741
+ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
1742
+ import { CustomCalendarComponent } from '@brickclay/ui';
1743
+
1744
+ export class BookingFormComponent {
1745
+ bookingForm: FormGroup;
1746
+
1747
+ constructor(private fb: FormBuilder) {
1748
+ this.bookingForm = this.fb.group({
1749
+ checkIn: [null, Validators.required],
1750
+ checkOut: [null, Validators.required],
1751
+ });
1752
+ }
1753
+
1754
+ onDateSelected(selection: CalendarSelection) {
1755
+ this.bookingForm.patchValue({
1756
+ checkIn: selection.startDate,
1757
+ checkOut: selection.endDate,
1758
+ });
1759
+ }
1760
+ }
1761
+ ```
1762
+
1763
+ ### Reactive Forms
1764
+
1765
+ ```typescript
1766
+ <brickclay-custom-calendar
1767
+ [selectedValue]="form.get('dateRange')?.value"
1768
+ (selected)="form.patchValue({ dateRange: $event })">
1769
+ </brickclay-custom-calendar>
1770
+ ```
1771
+
1772
+ ### Date Filtering
1773
+
1774
+ ```typescript
1775
+ export class DataTableComponent {
1776
+ filterDates: CalendarSelection = { startDate: null, endDate: null };
1777
+
1778
+ onDateFilter(selection: CalendarSelection) {
1779
+ this.filterDates = selection;
1780
+ this.loadFilteredData();
1781
+ }
1782
+
1783
+ loadFilteredData() {
1784
+ const filtered = this.data.filter((item) => {
1785
+ if (!this.filterDates.startDate || !this.filterDates.endDate) {
1786
+ return true;
1787
+ }
1788
+ return item.date >= this.filterDates.startDate! && item.date <= this.filterDates.endDate!;
1789
+ });
1790
+ }
1791
+ }
1792
+ ```
1793
+
1794
+ ## πŸ“¦ Assets Configuration
1795
+
1796
+ The calendar components require SVG icons. Configure your `angular.json` to copy assets:
1797
+
1798
+ ```json
1799
+ {
1800
+ "glob": "**/*",
1801
+ "input": "node_modules/@brickclay/ui/assets",
1802
+ "output": "assets"
1803
+ }
1804
+ ```
1805
+
1806
+ Or manually copy assets from:
1807
+
1808
+ ```
1809
+ node_modules/@brickclay/ui/assets/calender/* β†’ your-app/public/assets/calender/
1810
+ ```
1811
+
1812
+ ## πŸ”§ Service
1813
+
1814
+ ### CalendarManagerService
1815
+
1816
+ 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`.
1817
+
1818
+ ## 🌐 Browser Support
1819
+
1820
+ - Chrome (latest)
1821
+ - Firefox (latest)
1822
+ - Safari (latest)
1823
+ - Edge (latest)
1824
+
1825
+ ## πŸ“¦ Dependencies
1826
+
1827
+ - Angular 20.3.0+
1828
+ - moment (for date formatting)
1829
+
1830
+ ## 🀝 Contributing
1831
+
1832
+ We welcome contributions! Please see our contributing guidelines for more information.
1833
+
1834
+ ## πŸ“„ License
1835
+
1836
+ MIT
1837
+
1838
+ ## πŸ“ž Support
1839
+
1840
+ For issues, feature requests, or contributions, please visit our [GitHub repository](https://github.com/brickclay/ui).
1841
+
1842
+ ## πŸ—ΊοΈ Roadmap
1843
+
1844
+ - [ ] Button components
1845
+ - [ ] Input components
1846
+ - [ ] Card components
1847
+ - [ ] Modal/Dialog components
1848
+ - [ ] Table components
1849
+ - [ ] Form components
1850
+ - [ ] Navigation components
1851
+ - [ ] Loading/Spinner components
1852
+ - [ ] Toast/Notification components
1853
+ - [ ] More calendar features
1854
+
1855
+ ## πŸ“ Changelog
1856
+
1857
+ ### Version 0.0.1
1858
+
1859
+ **Initial Release:**
1860
+
1861
+ - βœ… Calendar component suite
1862
+ - Single date selection
1863
+ - Date range selection
1864
+ - Multiple date selection
1865
+ - Time picker integration
1866
+ - Inline and dropdown modes
1867
+ - Dual calendar view
1868
+ - Custom date ranges
1869
+ - Date constraints (min/max)
1870
+ - βœ… Scheduled date picker component
1871
+ - βœ… Standalone time picker component
1872
+ - βœ… Toggle/Switch component
1873
+ - Angular forms integration (ngModel & reactive forms)
1874
+ - Three size variants (small, medium, large)
1875
+ - Disabled state support
1876
+ - Full accessibility features
1877
+ - Customizable styling
1878
+ - βœ… Checkbox component
1879
+ - Angular forms integration (ngModel & reactive forms)
1880
+ - Customizable styling via CSS classes
1881
+ - Disabled state support
1882
+ - Full keyboard navigation support
1883
+ - Complete accessibility features
1884
+ - βœ… Radio button component
1885
+ - Angular forms integration (ngModel & reactive forms)
1886
+ - Two visual variants (dot and tick)
1887
+ - Radio group support
1888
+ - Customizable styling via CSS classes
1889
+ - Disabled state support
1890
+ - Full keyboard navigation support
1891
+ - Complete accessibility features
1892
+ - βœ… Pill component
1893
+ - Multiple visual variants (Light, Solid, Outline, Transparent)
1894
+ - Seven color options (Gray, Primary, Error, Warning, Success, Purple, Cyan)
1895
+ - Four size variants (xsm, sm, md, lg)
1896
+ - Optional dot indicators (left, right, none)
1897
+ - Removable functionality with click events
1898
+ - Custom CSS class support
1899
+ - βœ… Badge component
1900
+ - Multiple visual variants (Light, Solid, Outline, Transparent)
1901
+ - Seven color options (Gray, Primary, Error, Warning, Success, Purple, Cyan)
1902
+ - Four size variants (xsm, sm, md, lg)
1903
+ - Optional dot indicators (left, right, none)
1904
+ - Removable functionality with click events
1905
+ - Custom CSS class support
1906
+ - βœ… TypeScript definitions
1907
+ - βœ… Comprehensive documentation
1908
+
1909
+ ---
1910
+
1911
+ **Built with ❀️ by the Brickclay team**