@brickclay-org/ui 0.0.36 → 0.0.38
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/ASSETS_SETUP.md +59 -0
- package/ng-package.json +29 -0
- package/package.json +15 -26
- package/src/lib/assets/icons.ts +8 -0
- package/src/lib/badge/badge.html +24 -0
- package/src/lib/badge/badge.ts +42 -0
- package/src/lib/brickclay-lib.spec.ts +23 -0
- package/src/lib/brickclay-lib.ts +15 -0
- package/src/lib/button-group/button-group.html +12 -0
- package/src/lib/button-group/button-group.ts +73 -0
- package/src/lib/calender/calendar.module.ts +35 -0
- package/src/lib/calender/components/custom-calendar/custom-calendar.component.css +698 -0
- package/src/lib/calender/components/custom-calendar/custom-calendar.component.html +230 -0
- package/src/lib/calender/components/custom-calendar/custom-calendar.component.spec.ts +23 -0
- package/src/lib/calender/components/custom-calendar/custom-calendar.component.ts +1554 -0
- package/src/lib/calender/components/scheduled-date-picker/scheduled-date-picker.component.css +373 -0
- package/src/lib/calender/components/scheduled-date-picker/scheduled-date-picker.component.html +210 -0
- package/src/lib/calender/components/scheduled-date-picker/scheduled-date-picker.component.ts +361 -0
- package/src/lib/calender/components/time-picker/time-picker.component.css +174 -0
- package/src/lib/calender/components/time-picker/time-picker.component.html +60 -0
- package/src/lib/calender/components/time-picker/time-picker.component.ts +283 -0
- package/src/lib/calender/services/calendar-manager.service.ts +45 -0
- package/src/lib/checkbox/checkbox.html +42 -0
- package/src/lib/checkbox/checkbox.ts +67 -0
- package/src/lib/chips/chips.html +74 -0
- package/src/lib/chips/chips.ts +222 -0
- package/src/lib/grid/components/grid/grid.html +97 -0
- package/src/lib/grid/components/grid/grid.ts +139 -0
- package/src/lib/grid/models/grid.model.ts +20 -0
- package/src/lib/input/input.css +5 -5
- package/src/lib/input/input.html +125 -0
- package/src/lib/input/input.ts +394 -0
- package/src/lib/pill/pill.html +24 -0
- package/src/lib/pill/pill.ts +39 -0
- package/src/lib/radio/radio.html +58 -0
- package/src/lib/radio/radio.ts +72 -0
- package/src/lib/select/select.html +111 -0
- package/src/lib/select/select.ts +401 -0
- package/src/lib/spinner/spinner.html +5 -0
- package/src/lib/spinner/spinner.ts +22 -0
- package/src/lib/tabs/tabs.css +56 -0
- package/src/lib/tabs/tabs.html +28 -0
- package/src/lib/tabs/tabs.ts +48 -0
- package/src/lib/textarea/textarea.html +80 -0
- package/src/lib/textarea/textarea.ts +172 -0
- package/src/lib/toggle/toggle.html +24 -0
- package/src/lib/toggle/toggle.ts +62 -0
- package/src/lib/ui-button/ui-button.html +25 -0
- package/src/lib/ui-button/ui-button.ts +55 -0
- package/src/lib/ui-icon-button/ui-icon-button.html +7 -0
- package/src/lib/ui-icon-button/ui-icon-button.ts +38 -0
- package/src/public-api.ts +43 -0
- package/src/styles.css +1 -0
- package/tsconfig.lib.json +19 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/fesm2022/brickclay-org-ui.mjs +0 -3979
- package/fesm2022/brickclay-org-ui.mjs.map +0 -1
- package/index.d.ts +0 -833
package/ASSETS_SETUP.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Brickclay Library - Assets Setup
|
|
2
|
+
|
|
3
|
+
When installing `brickclay-lib` from npm, you need to configure your Angular project to copy the library's assets to your application.
|
|
4
|
+
|
|
5
|
+
## Method 1: Configure angular.json (Recommended)
|
|
6
|
+
|
|
7
|
+
Add the following to your `angular.json` under the `build` target's `assets` array:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"projects": {
|
|
12
|
+
"your-app": {
|
|
13
|
+
"architect": {
|
|
14
|
+
"build": {
|
|
15
|
+
"options": {
|
|
16
|
+
"assets": [
|
|
17
|
+
"src/favicon.ico",
|
|
18
|
+
"src/assets",
|
|
19
|
+
{
|
|
20
|
+
"glob": "**/*",
|
|
21
|
+
"input": "node_modules/brickclay-lib/assets",
|
|
22
|
+
"output": "/assets/brickclay-lib/"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This will copy all assets from `node_modules/brickclay-lib/assets` to your app's `/assets/brickclay-lib/` folder during build.
|
|
34
|
+
|
|
35
|
+
## Method 2: Manual Copy (Alternative)
|
|
36
|
+
|
|
37
|
+
If you prefer to customize the icons, you can manually copy them:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Copy icons to your assets folder
|
|
41
|
+
cp -r node_modules/brickclay-lib/assets/icons src/assets/brickclay-lib/
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Verification
|
|
45
|
+
|
|
46
|
+
After setup, the icons should be accessible at:
|
|
47
|
+
|
|
48
|
+
- `assets/brickclay-lib/icons/calender.svg`
|
|
49
|
+
- `assets/brickclay-lib/icons/chevron-left.svg`
|
|
50
|
+
- `assets/brickclay-lib/icons/chevron-right.svg`
|
|
51
|
+
- `assets/brickclay-lib/icons/timer.svg`
|
|
52
|
+
|
|
53
|
+
## Troubleshooting
|
|
54
|
+
|
|
55
|
+
If icons don't load:
|
|
56
|
+
|
|
57
|
+
1. Check that the assets are copied to `dist/your-app/assets/brickclay-lib/icons/` after build
|
|
58
|
+
2. Verify the `angular.json` configuration is correct
|
|
59
|
+
3. Clear your build cache and rebuild: `ng build --no-cache`
|
package/ng-package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "../../dist/brickclay-lib",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "src/public-api.ts",
|
|
6
|
+
"styleIncludePaths": ["src/lib/styles"]
|
|
7
|
+
},
|
|
8
|
+
"assets": [
|
|
9
|
+
"src/assets/**/*",
|
|
10
|
+
"src/styles.css",
|
|
11
|
+
"src/lib/toggle/toggle.css",
|
|
12
|
+
"src/lib/checkbox/checkbox.css",
|
|
13
|
+
"src/lib/radio/radio.css",
|
|
14
|
+
"src/lib/pill/pill.css",
|
|
15
|
+
"src/lib/badge/badge.css",
|
|
16
|
+
"src/lib/spinner/spinner.css",
|
|
17
|
+
"src/lib/ui-button/ui-button.css",
|
|
18
|
+
"src/lib/ui-icon-button/ui-icon-button.css",
|
|
19
|
+
"src/lib/button-group/button-group.css",
|
|
20
|
+
"src/lib/textarea/textarea.css",
|
|
21
|
+
"src/lib/grid/components/grid/grid.css",
|
|
22
|
+
"src/lib/select/select.css",
|
|
23
|
+
"src/lib/input/input.css",
|
|
24
|
+
"src/lib/chips/chips.css",
|
|
25
|
+
"src/lib/tabs/tabs.css"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
package/package.json
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@brickclay-org/ui",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": ">=17.0.0 <=21.0.0",
|
|
6
|
-
"@angular/core": ">=17.0.0 <=21.0.0",
|
|
7
|
-
"@angular/cdk": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
8
|
-
"moment": "^2.29.0",
|
|
9
|
-
"ngx-mask": "^20.0.3"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"tslib": "^2.3.0"
|
|
13
|
-
},
|
|
14
|
-
"sideEffects": false
|
|
15
|
-
|
|
16
|
-
"typings": "index.d.ts",
|
|
17
|
-
"exports": {
|
|
18
|
-
"./package.json": {
|
|
19
|
-
"default": "./package.json"
|
|
20
|
-
},
|
|
21
|
-
".": {
|
|
22
|
-
"types": "./index.d.ts",
|
|
23
|
-
"default": "./fesm2022/brickclay-org-ui.mjs"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@brickclay-org/ui",
|
|
3
|
+
"version": "0.0.38",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": ">=17.0.0 <=21.0.0",
|
|
6
|
+
"@angular/core": ">=17.0.0 <=21.0.0",
|
|
7
|
+
"@angular/cdk": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
8
|
+
"moment": "^2.29.0",
|
|
9
|
+
"ngx-mask": "^20.0.3"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"tslib": "^2.3.0"
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": false
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Icon paths that will be resolved relative to the library's assets folder
|
|
2
|
+
// When published to npm, users will need to configure their angular.json to include these assets
|
|
3
|
+
export const BrickclayIcons = {
|
|
4
|
+
arrowleft: 'assets/icons/chevron-left.svg',
|
|
5
|
+
arrowRight: 'assets/icons/chevron-right.svg',
|
|
6
|
+
calenderIcon: 'assets/icons/calender.svg',
|
|
7
|
+
timerIcon: 'assets/icons/timer.svg',
|
|
8
|
+
} as const;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<span [className]="containerClasses">
|
|
2
|
+
|
|
3
|
+
@if (dot === 'left') {
|
|
4
|
+
<span class="dot"></span>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
<span>{{ label }}</span>
|
|
8
|
+
|
|
9
|
+
@if (dot === 'right') {
|
|
10
|
+
<span class="dot"></span>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@if (removable) {
|
|
14
|
+
<button
|
|
15
|
+
(click)="onRemove($event)"
|
|
16
|
+
class="badge-close"> <svg
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
19
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
20
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
21
|
+
</svg>
|
|
22
|
+
</button>
|
|
23
|
+
}
|
|
24
|
+
</span>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
|
|
4
|
+
export type BadgeVariant = 'Light' | 'Solid' | 'Outline' | 'Transparent';
|
|
5
|
+
export type BadgeColor = 'Gray' | 'Primary' | 'Error' | 'Warning' | 'Success' | 'Purple' | 'Cyan';
|
|
6
|
+
export type BadgeSize = 'xsm' |'sm' | 'md' | 'lg';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'bk-badge',
|
|
10
|
+
standalone: true,
|
|
11
|
+
imports: [CommonModule],
|
|
12
|
+
templateUrl: './badge.html',
|
|
13
|
+
styleUrls: ['./badge.css'],
|
|
14
|
+
})
|
|
15
|
+
export class BkBadge {
|
|
16
|
+
@Input() label: string = '';
|
|
17
|
+
@Input() variant: BadgeVariant = 'Light';
|
|
18
|
+
@Input() color: BadgeColor = 'Gray';
|
|
19
|
+
@Input() size: BadgeSize = 'md';
|
|
20
|
+
@Input() dot: 'left' | 'right' | 'none' = 'none';
|
|
21
|
+
@Input() removable: boolean = false;
|
|
22
|
+
@Input() customClass: string = '';
|
|
23
|
+
|
|
24
|
+
@Output() clicked = new EventEmitter<string>();
|
|
25
|
+
|
|
26
|
+
get containerClasses(): string {
|
|
27
|
+
// 1. Size Class
|
|
28
|
+
const sizeClass = `badge-${this.size}`;
|
|
29
|
+
|
|
30
|
+
// 2. Color/Variant Class (Dynamic Generation)
|
|
31
|
+
const styleClass = `${this.color}-${this.variant}`;
|
|
32
|
+
|
|
33
|
+
// 3. customClasses
|
|
34
|
+
const customClass = `${this.customClass}`;
|
|
35
|
+
return `badge ${sizeClass} ${styleClass} ${customClass}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onRemove(e: Event) {
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
this.clicked.emit(this.label);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { BrickclayLib } from './brickclay-lib';
|
|
4
|
+
|
|
5
|
+
describe('BrickclayLib', () => {
|
|
6
|
+
let component: BrickclayLib;
|
|
7
|
+
let fixture: ComponentFixture<BrickclayLib>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [BrickclayLib]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(BrickclayLib);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div [class]="containerClass">
|
|
2
|
+
@for (item of items; track item.value) {
|
|
3
|
+
<div
|
|
4
|
+
class="group-item"
|
|
5
|
+
[class.active]="isActive(item.value)"
|
|
6
|
+
[class.inactive]="!isActive(item.value)"
|
|
7
|
+
(click)="onItemClick(item.value)"
|
|
8
|
+
>
|
|
9
|
+
{{ item.label }}
|
|
10
|
+
</div>
|
|
11
|
+
}
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
|
|
4
|
+
export interface GroupItem {
|
|
5
|
+
label: string;
|
|
6
|
+
value: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type GroupMode = 'single' | 'multiple';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'bk-button-group',
|
|
13
|
+
standalone: true,
|
|
14
|
+
imports: [CommonModule],
|
|
15
|
+
templateUrl: './button-group.html',
|
|
16
|
+
styleUrl: './button-group.css',
|
|
17
|
+
})
|
|
18
|
+
export class BkButtonGroup {
|
|
19
|
+
// --- Inputs ---
|
|
20
|
+
@Input() items: GroupItem[] = [];
|
|
21
|
+
@Input() mode: GroupMode = 'single';
|
|
22
|
+
@Input() disabled: boolean = false;
|
|
23
|
+
|
|
24
|
+
// Holds the current selection.
|
|
25
|
+
// For 'single', it's a single value. For 'multiple', it's an array.
|
|
26
|
+
@Input() value: any | any[] = null;
|
|
27
|
+
|
|
28
|
+
// --- Outputs ---
|
|
29
|
+
@Output() valueChange = new EventEmitter<any>();
|
|
30
|
+
|
|
31
|
+
// --- Logic ---
|
|
32
|
+
|
|
33
|
+
onItemClick(itemValue: any) {
|
|
34
|
+
if (this.disabled) return;
|
|
35
|
+
|
|
36
|
+
if (this.mode === 'single') {
|
|
37
|
+
// 1. Single Mode: Just set the value
|
|
38
|
+
if (this.value !== itemValue) {
|
|
39
|
+
this.value = itemValue;
|
|
40
|
+
this.valueChange.emit(this.value);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
// 2. Multiple Mode: Toggle value in array
|
|
44
|
+
let currentValues = Array.isArray(this.value) ? [...this.value] : [];
|
|
45
|
+
|
|
46
|
+
if (currentValues.includes(itemValue)) {
|
|
47
|
+
// Remove if exists
|
|
48
|
+
currentValues = currentValues.filter(v => v !== itemValue);
|
|
49
|
+
} else {
|
|
50
|
+
// Add if not exists
|
|
51
|
+
currentValues.push(itemValue);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.value = currentValues;
|
|
55
|
+
this.valueChange.emit(this.value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Helper to check active state for UI
|
|
60
|
+
isActive(itemValue: any): boolean {
|
|
61
|
+
if (this.mode === 'single') {
|
|
62
|
+
return this.value === itemValue;
|
|
63
|
+
} else {
|
|
64
|
+
return Array.isArray(this.value) && this.value.includes(itemValue);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// --- Styles ---
|
|
69
|
+
|
|
70
|
+
get containerClass(): string {
|
|
71
|
+
return `group-container ${this.disabled ? 'disabled' : ''}`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { BkCustomCalendar } from './components/custom-calendar/custom-calendar.component';
|
|
4
|
+
import { BkScheduledDatePicker } from './components/scheduled-date-picker/scheduled-date-picker.component';
|
|
5
|
+
import { BkTimePicker } from './components/time-picker/time-picker.component';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Optional NgModule wrapper for projects that prefer module-based usage.
|
|
11
|
+
*
|
|
12
|
+
* Note:
|
|
13
|
+
* - The components themselves are standalone, so you can also import them
|
|
14
|
+
* directly into any standalone component without using this module.
|
|
15
|
+
* - This module is mainly for:
|
|
16
|
+
* - Existing apps that still use feature modules
|
|
17
|
+
* - Easier "plug-and-play" integration: import CalendarModule once and use
|
|
18
|
+
* the three exported components anywhere in your templates.
|
|
19
|
+
*/
|
|
20
|
+
@NgModule({
|
|
21
|
+
imports: [
|
|
22
|
+
CommonModule,
|
|
23
|
+
BkCustomCalendar,
|
|
24
|
+
BkScheduledDatePicker,
|
|
25
|
+
BkTimePicker
|
|
26
|
+
],
|
|
27
|
+
exports: [
|
|
28
|
+
BkCustomCalendar,
|
|
29
|
+
BkScheduledDatePicker,
|
|
30
|
+
BkTimePicker
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
export class CalendarModule {}
|
|
34
|
+
|
|
35
|
+
|