@corp-products/ui-components 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +3 -0
  2. package/eslint.config.js +34 -0
  3. package/ng-package.json +7 -0
  4. package/package.json +19 -0
  5. package/project.json +29 -0
  6. package/src/index.ts +13 -0
  7. package/src/lib/app-accordion/app-accordion.component.html +15 -0
  8. package/src/lib/app-accordion/app-accordion.component.scss +0 -0
  9. package/src/lib/app-accordion/app-accordion.component.spec.ts +21 -0
  10. package/src/lib/app-accordion/app-accordion.component.ts +21 -0
  11. package/src/lib/app-accordion/index.ts +2 -0
  12. package/src/lib/app-button/app-button.component.html +13 -0
  13. package/src/lib/app-button/app-button.component.scss +0 -0
  14. package/src/lib/app-button/app-button.component.ts +28 -0
  15. package/src/lib/app-button/app-button.ts +15 -0
  16. package/src/lib/app-button/index.ts +2 -0
  17. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.html +25 -0
  18. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.scss +39 -0
  19. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.spec.ts +21 -0
  20. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.ts +43 -0
  21. package/src/lib/app-dropdown-menu/app-dropdown-menu.ts +17 -0
  22. package/src/lib/app-dropdown-menu/index.ts +2 -0
  23. package/src/lib/app-dropdown-menu/menu-popup.pipe.ts +18 -0
  24. package/src/lib/app-tabs/app-tab.interface.ts +26 -0
  25. package/src/lib/app-tabs/app-tabs.component.html +35 -0
  26. package/src/lib/app-tabs/app-tabs.component.scss +103 -0
  27. package/src/lib/app-tabs/app-tabs.component.spec.ts +21 -0
  28. package/src/lib/app-tabs/app-tabs.component.ts +48 -0
  29. package/src/lib/app-tabs/index.ts +2 -0
  30. package/src/lib/confirmation-dialog/confirmation-dialog.component.html +54 -0
  31. package/src/lib/confirmation-dialog/confirmation-dialog.component.scss +0 -0
  32. package/src/lib/confirmation-dialog/confirmation-dialog.component.spec.ts +22 -0
  33. package/src/lib/confirmation-dialog/confirmation-dialog.component.ts +51 -0
  34. package/src/lib/dynamic-form/dynamic-form.component.html +39 -0
  35. package/src/lib/dynamic-form/dynamic-form.component.scss +0 -0
  36. package/src/lib/dynamic-form/dynamic-form.component.spec.ts +21 -0
  37. package/src/lib/dynamic-form/dynamic-form.component.ts +29 -0
  38. package/src/lib/dynamic-form/dynamic-form.interface.ts +56 -0
  39. package/src/lib/form-components/@utils/form-utils.ts +12 -0
  40. package/src/lib/form-components/@utils/validations/error-keys.enum.ts +24 -0
  41. package/src/lib/form-components/@utils/validations/form-validation.service.ts +53 -0
  42. package/src/lib/form-components/@utils/validations/index.ts +3 -0
  43. package/src/lib/form-components/@utils/validations/validation-message.pipe.ts +24 -0
  44. package/src/lib/form-components/components/auto-complete/auto-complete.component.html +48 -0
  45. package/src/lib/form-components/components/auto-complete/auto-complete.component.scss +0 -0
  46. package/src/lib/form-components/components/auto-complete/auto-complete.component.spec.ts +21 -0
  47. package/src/lib/form-components/components/auto-complete/auto-complete.component.ts +48 -0
  48. package/src/lib/form-components/components/base-input.component.ts +41 -0
  49. package/src/lib/form-components/components/date-picker/date-picker.component.html +53 -0
  50. package/src/lib/form-components/components/date-picker/date-picker.component.scss +4 -0
  51. package/src/lib/form-components/components/date-picker/date-picker.component.spec.ts +23 -0
  52. package/src/lib/form-components/components/date-picker/date-picker.component.ts +45 -0
  53. package/src/lib/form-components/components/input/input.component.html +59 -0
  54. package/src/lib/form-components/components/input/input.component.scss +3 -0
  55. package/src/lib/form-components/components/input/input.component.spec.ts +21 -0
  56. package/src/lib/form-components/components/input/input.component.ts +32 -0
  57. package/src/lib/form-components/components/select/select.component.html +90 -0
  58. package/src/lib/form-components/components/select/select.component.scss +0 -0
  59. package/src/lib/form-components/components/select/select.component.spec.ts +21 -0
  60. package/src/lib/form-components/components/select/select.component.ts +51 -0
  61. package/src/lib/form-components/components/select-button/select-button.component.html +21 -0
  62. package/src/lib/form-components/components/select-button/select-button.component.scss +0 -0
  63. package/src/lib/form-components/components/select-button/select-button.component.spec.ts +21 -0
  64. package/src/lib/form-components/components/select-button/select-button.component.ts +22 -0
  65. package/src/lib/form-components/components/switcher/switch.component.html +5 -0
  66. package/src/lib/form-components/components/switcher/switch.component.scss +0 -0
  67. package/src/lib/form-components/components/switcher/switch.component.spec.ts +21 -0
  68. package/src/lib/form-components/components/switcher/switch.component.ts +25 -0
  69. package/src/lib/form-components/index.ts +9 -0
  70. package/src/lib/form-components/interfaces/index.ts +1 -0
  71. package/src/lib/form-components/interfaces/label-value.ts +4 -0
  72. package/src/lib/ico-moon-icon/ico-moon-icon.component.ts +23 -0
  73. package/src/lib/read-more/read-more.component.html +17 -0
  74. package/src/lib/read-more/read-more.component.scss +0 -0
  75. package/src/lib/read-more/read-more.component.spec.ts +21 -0
  76. package/src/lib/read-more/read-more.component.ts +21 -0
  77. package/src/lib/side-bar/side-bar.component.html +25 -0
  78. package/src/lib/side-bar/side-bar.component.scss +5 -0
  79. package/src/lib/side-bar/side-bar.component.spec.ts +21 -0
  80. package/src/lib/side-bar/side-bar.component.ts +32 -0
  81. package/src/lib/side-bar-dynamic/data-injector.pipe.ts +15 -0
  82. package/src/lib/side-bar-dynamic/dynamic-sidebar.service.ts +116 -0
  83. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.html +51 -0
  84. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.scss +5 -0
  85. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.spec.ts +21 -0
  86. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.ts +37 -0
  87. package/src/lib/side-bar-dynamic/side-bar-utils.ts +30 -0
  88. package/src/lib/side-bar-dynamic/sidebar-config.ts +48 -0
  89. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.html +20 -0
  90. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.scss +0 -0
  91. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.spec.ts +21 -0
  92. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.ts +21 -0
  93. package/src/lib/user-info/user-info.component.html +10 -0
  94. package/src/lib/user-info/user-info.component.ts +11 -0
  95. package/tsconfig.json +25 -0
  96. package/tsconfig.lib.json +12 -0
  97. package/tsconfig.lib.prod.json +9 -0
@@ -0,0 +1,45 @@
1
+ import { NgClass } from "@angular/common";
2
+ import { Component, EventEmitter, Input, Output, ViewEncapsulation } from "@angular/core";
3
+ import { FormsModule, ReactiveFormsModule } from "@angular/forms";
4
+ import { ValidationErrorsPipe } from "../../@utils/validations/validation-message.pipe";
5
+ import { DatePicker } from "primeng/datepicker";
6
+ import { BaseInputComponent } from "../base-input.component";
7
+ import { CalendarModule } from "primeng/calendar";
8
+ import {TranslatePipe} from "@ngx-translate/core";
9
+ @Component({
10
+ selector: "stc-date-picker",
11
+ standalone: true,
12
+ imports: [FormsModule, DatePicker, ReactiveFormsModule, NgClass, CalendarModule, ValidationErrorsPipe, TranslatePipe],
13
+ templateUrl: "./date-picker.component.html",
14
+ styleUrl: "./date-picker.component.scss",
15
+ encapsulation: ViewEncapsulation.None
16
+ })
17
+ export class DatePickerComponent extends BaseInputComponent {
18
+ @Input() showIcon: boolean = false;
19
+ @Input() showClear: boolean = false;
20
+ @Input() basicInput!: boolean;
21
+ @Input() isTimeOnly: boolean = false;
22
+ @Input() minDate: Date | undefined | null;
23
+ @Input() maxDate: Date | undefined | null;
24
+ @Input() hourFormat: "12" | "24" = "12";
25
+ nowTime = new Date();
26
+ @Input() selectionMode: "single" | "range" = "single";
27
+ @Output() onAfterClearDate = new EventEmitter<void>();
28
+
29
+ constructor() {
30
+ super();
31
+ }
32
+
33
+ selectCurrentTime(e: any) {
34
+ this.control.setValue(this.nowTime);
35
+ }
36
+
37
+ clearButtonClick(e: any) {
38
+ this.control.setValue(null);
39
+ }
40
+
41
+ afterClearDate() {
42
+ this.control.reset();
43
+ this.onAfterClearDate.emit();
44
+ }
45
+ }
@@ -0,0 +1,59 @@
1
+ <div class="field flex flex-col gap-2 my-3 relative">
2
+ @if (label) {
3
+ <label [for]="inputId">
4
+ {{ label }}
5
+ @if (required) {
6
+ <span [class.text-red-700]="isInvalid">*</span>
7
+ }
8
+ </label>
9
+ }
10
+ @if (!required && !hideOptionalLabel) {
11
+ <span class="absolute top-[6px] left-0 text-[10px] text-gray-400">{{'forms.config.optional' | translate}}</span>
12
+ }
13
+
14
+ <!-- input text align will be handled according to lang when implemented -->
15
+
16
+ @if (type !== 'textarea') {
17
+ <input
18
+ [id]="inputId"
19
+ [type]="contentType"
20
+ [formControl]="control"
21
+ [placeholder]="placeholder"
22
+ [readonly]="readonly"
23
+ [disabled]="disabled"
24
+ [name]="name"
25
+ pInputText
26
+ [ngStyle]="{'direction': inputDirection || 'inherit', 'text-align': 'right'}"
27
+ [ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid, 'basic-style': basicInput, 'no-style':noStyle}"
28
+ />
29
+ @if (prefix) {
30
+ <span class="absolute top-[40px] font-bold text-[16px] left-[25px]">
31
+ {{ prefix }}
32
+ </span>
33
+ }
34
+ } @else {
35
+ <textarea
36
+ [name]="name"
37
+ [id]="inputId"
38
+ [formControl]="control"
39
+ [placeholder]="placeholder"
40
+ [readonly]="readonly"
41
+ [disabled]="disabled"
42
+ pTextarea
43
+ [rows]="rows"
44
+ [cols]="cols"
45
+ [autoResize]="autoResize"
46
+ [ngClass]="{'ng-invalid ng-dirty': control.invalid && (control.dirty || control.touched), 'basic-style': basicInput, 'no-style':noStyle}"
47
+ ></textarea>
48
+ }
49
+ @if (hint) {
50
+ <small class="p-mt-1">{{ hint }}</small>
51
+ }
52
+ @if (isInvalid && (control.dirty || control.touched)) {
53
+ <small class="p-error text-red-700">
54
+ @for (error of control.errors | validationErrors; track error) {
55
+ {{ error }}<br>
56
+ }
57
+ </small>
58
+ }
59
+ </div>
@@ -0,0 +1,3 @@
1
+ textarea {
2
+ @apply h-auto min-h-[50px] overflow-auto;
3
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { InputComponent } from './input.component';
3
+
4
+ describe('InputComponent', () => {
5
+ let component: InputComponent;
6
+ let fixture: ComponentFixture<InputComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [InputComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(InputComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,32 @@
1
+ import { NgClass, NgStyle } from "@angular/common";
2
+ import { Component, Input } from "@angular/core";
3
+ import { ReactiveFormsModule } from "@angular/forms";
4
+ import { ValidationErrorsPipe } from "../../@utils/validations/validation-message.pipe";
5
+ import { InputText } from "primeng/inputtext";
6
+ import { Textarea } from "primeng/textarea";
7
+ import { BaseInputComponent } from "../base-input.component";
8
+ import {TranslatePipe} from "@ngx-translate/core";
9
+
10
+ @Component({
11
+ selector: "stc-input",
12
+ standalone: true,
13
+ imports: [ReactiveFormsModule, InputText, Textarea, ValidationErrorsPipe, NgClass, NgStyle, TranslatePipe],
14
+ templateUrl: "./input.component.html",
15
+ styleUrl: "./input.component.scss"
16
+ })
17
+ export class InputComponent extends BaseInputComponent {
18
+ @Input() type: "text" | "textarea" = "text";
19
+ @Input() contentType: "text" | "email" | "number" = "text";
20
+ @Input() prefix: string;
21
+ @Input() rows = 2;
22
+ @Input() cols = 20;
23
+ @Input() autoResize = true;
24
+ @Input() basicInput!: boolean;
25
+ @Input() noStyle!: boolean;
26
+ @Input() hideOptionalLabel: boolean;
27
+ @Input() inputDirection: "ltr" | "rtl" | "inherit" = "inherit";
28
+
29
+ constructor() {
30
+ super();
31
+ }
32
+ }
@@ -0,0 +1,90 @@
1
+ <div class="field flex flex-col gap-2 my-3 relative">
2
+ @if (label) {
3
+ <label [for]="inputId">
4
+ {{ label }}
5
+ @if (required) {
6
+ <span [class.text-red-700]="isInvalid">*</span>
7
+ }
8
+ </label>
9
+ } @if (!required) {
10
+ <span class="absolute top-[6px] left-0 text-[10px] text-gray-400">{{'forms.config.optional' | translate}}</span>
11
+ }
12
+
13
+
14
+ @if(multiple) {
15
+
16
+
17
+ <p-multiselect
18
+ [disabled]="disabled"
19
+ [filterBy]="filterBy"
20
+ [filter]="filter"
21
+ [formControl]="control"
22
+ [id]="inputId"
23
+ [name]="name"
24
+ [ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid }"
25
+ [optionLabel]="optionLabel"
26
+ [options]="options"
27
+ [placeholder]="placeholder"
28
+ [readonly]="readonly"
29
+ [showClear]="showClear"
30
+ class="w-full"
31
+ [selectedItemsLabel]="selectedItemsLabel"
32
+ (onChange)="onChange($event)"
33
+ [ngClass]="{ 'basic-style': basicInput }"
34
+ >
35
+
36
+
37
+ @if(optionTemplate){
38
+ <ng-template let-item #item>
39
+ <ng-container [ngTemplateOutletContext]="{ $implicit: item }" [ngTemplateOutlet]="optionTemplate" />
40
+ </ng-template>
41
+ }
42
+
43
+
44
+ <ng-template #dropdownicon>
45
+ <i class="pi pi-map"></i>
46
+ </ng-template>
47
+
48
+
49
+ </p-multiselect>
50
+
51
+ } @else {
52
+ <p-select
53
+ [checkmark]="checkmark"
54
+ [disabled]="disabled"
55
+ [editable]="editable"
56
+ [filterBy]="filterBy"
57
+ [filter]="filter"
58
+ [formControl]="control"
59
+ [id]="inputId"
60
+ [name]="name"
61
+ [ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid }"
62
+ [optionLabel]="optionLabel"
63
+ [options]="options"
64
+ [placeholder]="placeholder"
65
+ [readonly]="readonly"
66
+ [showClear]="showClear"
67
+ class="w-full"
68
+ (onChange)="onChange($event)"
69
+ [ngClass]="{ 'basic-style': basicInput }"
70
+ >
71
+
72
+
73
+ @if (selectedItemTemplate) {
74
+ <ng-template let-item pTemplate="item">
75
+ <ng-container [ngTemplateOutletContext]="{ $implicit: item }" [ngTemplateOutlet]="selectedItemTemplate" />
76
+ </ng-template>
77
+ }
78
+ </p-select>
79
+ }
80
+
81
+ @if (hint) {
82
+ <small class="p-mt-1">{{ hint }}</small>
83
+ } @if (isInvalid && (control.dirty || control.touched)) {
84
+ <small class="p-error text-red-700">
85
+ @for (error of control.errors | validationErrors; track error) {
86
+ {{ error }}<br />
87
+ }
88
+ </small>
89
+ }
90
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { SelectComponent } from './select.component';
3
+
4
+ describe('SelectComponent', () => {
5
+ let component: SelectComponent;
6
+ let fixture: ComponentFixture<SelectComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SelectComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(SelectComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,51 @@
1
+ import { NgClass, NgTemplateOutlet } from '@angular/common';
2
+ import { Component, EventEmitter, Input, Output, TemplateRef } from '@angular/core';
3
+ import { PrimeTemplate } from 'primeng/api';
4
+ import { ValidationErrorsPipe } from "../../@utils/validations";
5
+ import { FormsModule, ReactiveFormsModule } from "@angular/forms";
6
+ import { Select, SelectChangeEvent } from "primeng/select";
7
+ import { BaseInputComponent } from "../base-input.component";
8
+ import { MultiSelectModule } from 'primeng/multiselect';
9
+ import {TranslatePipe} from "@ngx-translate/core";
10
+
11
+ @Component({
12
+ selector: "stc-select",
13
+ standalone: true,
14
+ imports: [
15
+ FormsModule,
16
+ Select,
17
+ ReactiveFormsModule,
18
+ NgClass,
19
+ NgTemplateOutlet,
20
+ PrimeTemplate,
21
+ ValidationErrorsPipe,
22
+ MultiSelectModule,
23
+ TranslatePipe
24
+ ],
25
+ templateUrl: "./select.component.html",
26
+ styleUrl: "./select.component.scss"
27
+ })
28
+ export class SelectComponent extends BaseInputComponent {
29
+ @Input() selectedItemTemplate: TemplateRef<unknown> | null = null;
30
+ @Input() optionTemplate: TemplateRef<unknown> | null = null;
31
+ @Input() options: unknown[];
32
+ @Input() optionLabel!: string;
33
+ @Input() checkmark = true;
34
+ @Input() showClear = false;
35
+ @Input() editable = false;
36
+ @Input() filter = false;
37
+ @Input() multiple = false;
38
+ @Input() filterBy!: string;
39
+ @Input() selectedItemsLabel!: string;
40
+ @Input() basicInput!: boolean;
41
+ // eslint-disable-next-line @angular-eslint/no-output-native
42
+ @Output() change = new EventEmitter();
43
+
44
+ constructor() {
45
+ super();
46
+ }
47
+
48
+ onChange(e: SelectChangeEvent) {
49
+ this.change.emit(e);
50
+ }
51
+ }
@@ -0,0 +1,21 @@
1
+ <div class="grid grid-cols-12 gap-x-4 gap-y-0 items-end">
2
+ <div class="col-span-12">
3
+ <div class="text-[14px] font-bold mb-1">{{ title }}</div>
4
+ <div class="grid w-100 bg-gray-100 rounded drop-shadow-basic">
5
+ <p-selectButton [disabled]="disabled"
6
+ [options]="options"
7
+ [formControl]="control"
8
+ optionLabel="label"
9
+ optionValue="value"
10
+ class="rounded"
11
+ [styleClass]="'full-width'"
12
+ (onChange)="changeValue($event)">
13
+ <ng-template let-item class="flex w-100">
14
+ <div class="col-span-4">
15
+ <span>{{ item.value }}</span>
16
+ </div>
17
+ </ng-template>
18
+ </p-selectButton>
19
+ </div>
20
+ </div>
21
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from "@angular/core/testing";
2
+ import { SelectButtonComponent } from "./select-button.component";
3
+
4
+ describe("AppSelectButtonComponent", () => {
5
+ let component: SelectButtonComponent;
6
+ let fixture: ComponentFixture<SelectButtonComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SelectButtonComponent]
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(SelectButtonComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it("should create", () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,22 @@
1
+ import { Component, EventEmitter, Input, Output } from "@angular/core";
2
+ import { SelectButtonChangeEvent, SelectButtonModule } from 'primeng/selectbutton';
3
+ import { BaseInputComponent } from "../base-input.component";
4
+ import { FormsModule, ReactiveFormsModule } from "@angular/forms";
5
+ import {LabelValue} from "../../interfaces";
6
+
7
+ @Component({
8
+ selector: "stc-select-button",
9
+ standalone: true,
10
+ imports: [ReactiveFormsModule, SelectButtonModule, FormsModule],
11
+ templateUrl: "./select-button.component.html",
12
+ styleUrl: "./select-button.component.scss"
13
+ })
14
+ export class SelectButtonComponent extends BaseInputComponent {
15
+ @Output() onChange: EventEmitter<any> = new EventEmitter<string>();
16
+ @Input() options: LabelValue<any>[];
17
+ @Input() title: string;
18
+
19
+ changeValue(e: SelectButtonChangeEvent) {
20
+ this.onChange.emit(e.value);
21
+ }
22
+ }
@@ -0,0 +1,5 @@
1
+ <div class="flex items-center mr-2">
2
+ <p-toggleswitch [(ngModel)]="checked" [inputId]="key" (onChange)="sendUpdatedValue($event)" class="flex">
3
+ </p-toggleswitch>
4
+ <label [for]="key" class="text-[12px] mx-2">{{label}}</label>
5
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from "@angular/core/testing";
2
+ import { SwitchComponent } from "./switch.component";
3
+
4
+ describe("SwitchComponent", () => {
5
+ let component: SwitchComponent;
6
+ let fixture: ComponentFixture<SwitchComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SwitchComponent]
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(SwitchComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it("should create", () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,25 @@
1
+ import { Component, EventEmitter, Input, Output } from "@angular/core";
2
+ import { CommonModule } from "@angular/common";
3
+ import { ToggleSwitchModule } from 'primeng/toggleswitch';
4
+ import { FormsModule } from "@angular/forms";
5
+
6
+ @Component({
7
+ selector: "stc-switch",
8
+ standalone: true,
9
+ imports: [CommonModule, ToggleSwitchModule, FormsModule],
10
+ templateUrl: "./switch.component.html",
11
+ styleUrl: "./switch.component.scss"
12
+ })
13
+ export class SwitchComponent {
14
+ @Input() label: string;
15
+ @Input() key: string;
16
+ @Input() checked: boolean = false;
17
+ @Output() onChange: EventEmitter<string> = new EventEmitter<string>();
18
+ // checked: boolean = false;
19
+
20
+ sendUpdatedValue(value: any) {
21
+ if (value) {
22
+ this.onChange.emit(value.checked);
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,9 @@
1
+ export * from "./components/input/input.component";
2
+ export * from "./components/select/select.component";
3
+ export * from "./components/date-picker/date-picker.component";
4
+ export * from "./components/auto-complete/auto-complete.component";
5
+ export * from "./components/select-button/select-button.component";
6
+ export * from "./components/switcher/switch.component";
7
+ export * from "./@utils/form-utils";
8
+ export * from "./@utils/validations";
9
+ export * from "./interfaces";
@@ -0,0 +1 @@
1
+ export * from "./label-value";
@@ -0,0 +1,4 @@
1
+ export interface LabelValue<T> {
2
+ label: string;
3
+ value: T | any;
4
+ }
@@ -0,0 +1,23 @@
1
+ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'app-ico-moon-card',
5
+ standalone: true,
6
+ template:`
7
+ <i [class]="iconName + ' ' + iconClass">
8
+ @for (path of getPathCount; track $index) {
9
+ <i [class]="iconName + ' path'+path"></i>
10
+ }
11
+ </i>
12
+ `,
13
+ changeDetection: ChangeDetectionStrategy.OnPush
14
+ })
15
+ export class IcoMoonIconComponent {
16
+ @Input({ required: true }) iconName!: string;
17
+ @Input() iconClass!: string;
18
+ @Input() iconPathCount = 0;
19
+
20
+ get getPathCount() {
21
+ return Array.from({ length: this.iconPathCount }, (_, i) => i + 1);
22
+ }
23
+ }
@@ -0,0 +1,17 @@
1
+ <p [class]="styleClass">
2
+ {{ isExpanded ? text : (text | slice : 0 : maxCharacters) }}
3
+ @if (text.length > maxCharacters && !isExpanded) {
4
+ <span>...</span>
5
+ }
6
+ @if (isExpanded) {
7
+ <span>
8
+ {{ text | slice : maxCharacters + 1 : text.length }}
9
+ </span>
10
+ }
11
+ <br>
12
+ @if (text.length > maxCharacters) {
13
+ <span class="text-primary_light cursor-pointer" (click)="toggleReadMore()">
14
+ {{ isExpanded ? ('less' | translate) : ('more' | translate) }}
15
+ </span>
16
+ }
17
+ </p>
File without changes
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from "@angular/core/testing";
2
+ import { ReadMoreComponent } from "./read-more.component";
3
+
4
+ describe("ReadMoreComponent", () => {
5
+ let component: ReadMoreComponent;
6
+ let fixture: ComponentFixture<ReadMoreComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [ReadMoreComponent]
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(ReadMoreComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it("should create", () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,21 @@
1
+ import { Component, Input } from "@angular/core";
2
+ import {SlicePipe} from "@angular/common";
3
+ import { TranslateModule } from "@ngx-translate/core";
4
+
5
+ @Component({
6
+ selector: "app-read-more",
7
+ standalone: true,
8
+ imports: [TranslateModule, SlicePipe],
9
+ templateUrl: "./read-more.component.html",
10
+ styleUrl: "./read-more.component.scss"
11
+ })
12
+ export class ReadMoreComponent {
13
+ @Input({ required: true }) text = "";
14
+ @Input() styleClass = "";
15
+ @Input() maxCharacters = 100;
16
+ isExpanded = false;
17
+
18
+ toggleReadMore() {
19
+ this.isExpanded = !this.isExpanded;
20
+ }
21
+ }
@@ -0,0 +1,25 @@
1
+ <!-- TODO refactor position sidebar based on html dir-->
2
+ <p-drawer
3
+ (onHide)="hideSidebar()"
4
+ (onShow)="onShow.emit($event)"
5
+ [(visible)]="show"
6
+ [closable]="closable"
7
+ [closeOnEscape]="closeOnEscape"
8
+ [dismissible]="dismissible"
9
+ [ngClass]="{ show: show }"
10
+ [position]="'left'"
11
+ appendTo="body"
12
+ styleClass="p-drawer-{{ sidebarSize }} custom-content bg-white {{ styleClass }}">
13
+ <ng-template pTemplate="header">{{ title }}</ng-template>
14
+ @if (contentTemplate) {
15
+ <ng-template pTemplate="content">
16
+ <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
17
+ </ng-template>
18
+ <ng-template pTemplate="footer">
19
+ <ng-container *ngTemplateOutlet="footerTemplate"></ng-container>
20
+ </ng-template>
21
+ }
22
+ <ng-template pTemplate="content">
23
+ <ng-content id="side-content"></ng-content>
24
+ </ng-template>
25
+ </p-drawer>
@@ -0,0 +1,5 @@
1
+ .sidebar {
2
+ &.show {
3
+ @apply min-w-[550px];
4
+ }
5
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { SideBarComponent } from './side-bar.component';
3
+
4
+ describe('SideBarComponent', () => {
5
+ let component: SideBarComponent;
6
+ let fixture: ComponentFixture<SideBarComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SideBarComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(SideBarComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,32 @@
1
+ import { NgClass, NgTemplateOutlet } from "@angular/common";
2
+ import { Component, EventEmitter, Input, Output, TemplateRef, ViewEncapsulation } from "@angular/core";
3
+ import { PrimeTemplate } from "primeng/api";
4
+ import { Drawer } from "primeng/drawer";
5
+
6
+ @Component({
7
+ selector: "app-side-bar",
8
+ standalone: true,
9
+ imports: [PrimeTemplate, Drawer, NgClass, NgTemplateOutlet],
10
+ templateUrl: "./side-bar.component.html",
11
+ styleUrl: "./side-bar.component.scss",
12
+ encapsulation: ViewEncapsulation.None
13
+ })
14
+ export class SideBarComponent {
15
+ @Input() show = false;
16
+ @Input() title: string;
17
+ @Input() closable = false;
18
+ @Input() dismissible = false;
19
+ @Input() closeOnEscape = false;
20
+ @Input() sidebarSize: "sm" | "md" | "lg" | "xl" = "sm";
21
+ @Input() styleClass = "";
22
+ @Output() hide = new EventEmitter<boolean>();
23
+ // eslint-disable-next-line @angular-eslint/no-output-on-prefix
24
+ @Output() onShow = new EventEmitter<boolean>();
25
+ @Input() contentTemplate!: TemplateRef<unknown>;
26
+ @Input() footerTemplate!: TemplateRef<unknown>;
27
+
28
+ hideSidebar() {
29
+ this.show = false;
30
+ this.hide.emit(false);
31
+ }
32
+ }