@carefirst/library 1.3.9 → 1.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/.eslintrc.json +31 -0
  2. package/ng-package.json +8 -0
  3. package/package.json +11 -14
  4. package/src/lib/components/alert/alert.component.html +0 -0
  5. package/src/lib/components/alert/alert.component.scss +63 -0
  6. package/src/lib/components/alert/alert.component.spec.ts +23 -0
  7. package/src/lib/components/alert/alert.component.ts +73 -0
  8. package/src/lib/components/badge/badge.component.html +5 -0
  9. package/src/lib/components/badge/badge.component.scss +96 -0
  10. package/src/lib/components/badge/badge.component.spec.ts +23 -0
  11. package/src/lib/components/badge/badge.component.ts +61 -0
  12. package/src/lib/components/button/button.component.html +20 -0
  13. package/src/lib/components/button/button.component.scss +153 -0
  14. package/src/lib/components/button/button.component.spec.ts +21 -0
  15. package/src/lib/components/button/button.component.ts +94 -0
  16. package/src/lib/components/calendar/calendar.component.html +9 -0
  17. package/src/lib/components/calendar/calendar.component.scss +34 -0
  18. package/src/lib/components/calendar/calendar.component.spec.ts +23 -0
  19. package/src/lib/components/calendar/calendar.component.ts +53 -0
  20. package/src/lib/components/chat-bubble/chat-bubble.component.html +9 -0
  21. package/src/lib/components/chat-bubble/chat-bubble.component.scss +31 -0
  22. package/src/lib/components/chat-bubble/chat-bubble.component.spec.ts +23 -0
  23. package/src/lib/components/chat-bubble/chat-bubble.component.ts +43 -0
  24. package/src/lib/components/form-input/form-input.component.html +37 -0
  25. package/src/lib/components/form-input/form-input.component.scss +23 -0
  26. package/src/lib/components/form-input/form-input.component.spec.ts +23 -0
  27. package/src/lib/components/form-input/form-input.component.ts +95 -0
  28. package/src/lib/components/form-input-select/form-input-select.component.html +27 -0
  29. package/src/lib/components/form-input-select/form-input-select.component.scss +40 -0
  30. package/src/lib/components/form-input-select/form-input-select.component.spec.ts +23 -0
  31. package/src/lib/components/form-input-select/form-input-select.component.ts +61 -0
  32. package/src/lib/components/form-input-text-area/form-input-text-area.component.html +29 -0
  33. package/src/lib/components/form-input-text-area/form-input-text-area.component.scss +19 -0
  34. package/src/lib/components/form-input-text-area/form-input-text-area.component.spec.ts +23 -0
  35. package/src/lib/components/form-input-text-area/form-input-text-area.component.ts +76 -0
  36. package/src/lib/components/form-validation/form-validation.component.html +8 -0
  37. package/src/lib/components/form-validation/form-validation.component.scss +8 -0
  38. package/src/lib/components/form-validation/form-validation.component.spec.ts +23 -0
  39. package/src/lib/components/form-validation/form-validation.component.ts +34 -0
  40. package/src/lib/components/icon/icon.component.html +529 -0
  41. package/src/lib/components/icon/icon.component.scss +61 -0
  42. package/src/lib/components/icon/icon.component.spec.ts +21 -0
  43. package/src/lib/components/icon/icon.component.ts +40 -0
  44. package/src/lib/components/logo/logo.component.html +10 -0
  45. package/src/lib/components/logo/logo.component.scss +5 -0
  46. package/src/lib/components/logo/logo.component.spec.ts +23 -0
  47. package/src/lib/components/logo/logo.component.ts +21 -0
  48. package/src/lib/components/notification/notification.component.html +39 -0
  49. package/src/lib/components/notification/notification.component.scss +20 -0
  50. package/src/lib/components/notification/notification.component.spec.ts +21 -0
  51. package/src/lib/components/notification/notification.component.ts +23 -0
  52. package/src/lib/components/page/page.component.html +5 -0
  53. package/src/lib/components/page/page.component.scss +35 -0
  54. package/src/lib/components/page/page.component.spec.ts +21 -0
  55. package/src/lib/components/page/page.component.ts +42 -0
  56. package/src/lib/components/spacer/spacer.component.html +4 -0
  57. package/src/lib/components/spacer/spacer.component.scss +27 -0
  58. package/src/lib/components/spacer/spacer.component.spec.ts +21 -0
  59. package/src/lib/components/spacer/spacer.component.ts +43 -0
  60. package/src/lib/components/spinner/spinner.component.html +1 -0
  61. package/src/lib/components/spinner/spinner.component.scss +14 -0
  62. package/src/lib/components/spinner/spinner.component.spec.ts +23 -0
  63. package/src/lib/components/spinner/spinner.component.ts +33 -0
  64. package/src/lib/directives/button-loader.directive.spec.ts +8 -0
  65. package/src/lib/directives/button-loader.directive.ts +77 -0
  66. package/src/lib/interfaces/alert.interface.ts +20 -0
  67. package/src/lib/interfaces/icon.interface.ts +62 -0
  68. package/src/lib/interfaces/input.interface.ts +8 -0
  69. package/src/lib/interfaces/notification.interface.ts +15 -0
  70. package/src/lib/interfaces/spacer.interface.ts +6 -0
  71. package/src/lib/library.module.ts +66 -0
  72. package/src/lib/utils/attribute.util.ts +66 -0
  73. package/src/lib/utils/form-validators-utility.ts +186 -0
  74. package/{public-api.d.ts → src/public-api.ts} +18 -0
  75. package/tsconfig.lib.json +12 -0
  76. package/tsconfig.lib.prod.json +10 -0
  77. package/tsconfig.spec.json +14 -0
  78. package/esm2022/carefirst-library.mjs +0 -2
  79. package/esm2022/lib/components/alert/alert.component.mjs +0 -56
  80. package/esm2022/lib/components/badge/badge.component.mjs +0 -39
  81. package/esm2022/lib/components/button/button.component.mjs +0 -87
  82. package/esm2022/lib/components/calendar/calendar.component.mjs +0 -39
  83. package/esm2022/lib/components/chat-bubble/chat-bubble.component.mjs +0 -31
  84. package/esm2022/lib/components/form-input/form-input.component.mjs +0 -87
  85. package/esm2022/lib/components/form-input-select/form-input-select.component.mjs +0 -46
  86. package/esm2022/lib/components/form-input-text-area/form-input-text-area.component.mjs +0 -61
  87. package/esm2022/lib/components/form-validation/form-validation.component.mjs +0 -20
  88. package/esm2022/lib/components/icon/icon.component.mjs +0 -29
  89. package/esm2022/lib/components/logo/logo.component.mjs +0 -18
  90. package/esm2022/lib/components/notification/notification.component.mjs +0 -22
  91. package/esm2022/lib/components/page/page.component.mjs +0 -31
  92. package/esm2022/lib/components/spacer/spacer.component.mjs +0 -30
  93. package/esm2022/lib/components/spinner/spinner.component.mjs +0 -19
  94. package/esm2022/lib/directives/button-loader.directive.mjs +0 -41
  95. package/esm2022/lib/interfaces/alert.interface.mjs +0 -2
  96. package/esm2022/lib/interfaces/icon.interface.mjs +0 -52
  97. package/esm2022/lib/interfaces/input.interface.mjs +0 -2
  98. package/esm2022/lib/interfaces/notification.interface.mjs +0 -2
  99. package/esm2022/lib/interfaces/spacer.interface.mjs +0 -2
  100. package/esm2022/lib/library.module.mjs +0 -100
  101. package/esm2022/lib/utils/attribute.util.mjs +0 -34
  102. package/esm2022/lib/utils/form-validators-utility.mjs +0 -113
  103. package/esm2022/public-api.mjs +0 -24
  104. package/fesm2022/carefirst-library.mjs +0 -885
  105. package/fesm2022/carefirst-library.mjs.map +0 -1
  106. package/index.d.ts +0 -2
  107. package/lib/components/alert/alert.component.d.ts +0 -14
  108. package/lib/components/badge/badge.component.d.ts +0 -15
  109. package/lib/components/button/button.component.d.ts +0 -30
  110. package/lib/components/calendar/calendar.component.d.ts +0 -15
  111. package/lib/components/chat-bubble/chat-bubble.component.d.ts +0 -13
  112. package/lib/components/form-input/form-input.component.d.ts +0 -37
  113. package/lib/components/form-input-select/form-input-select.component.d.ts +0 -21
  114. package/lib/components/form-input-text-area/form-input-text-area.component.d.ts +0 -27
  115. package/lib/components/form-validation/form-validation.component.d.ts +0 -9
  116. package/lib/components/icon/icon.component.d.ts +0 -13
  117. package/lib/components/logo/logo.component.d.ts +0 -7
  118. package/lib/components/notification/notification.component.d.ts +0 -9
  119. package/lib/components/page/page.component.d.ts +0 -13
  120. package/lib/components/spacer/spacer.component.d.ts +0 -14
  121. package/lib/components/spinner/spinner.component.d.ts +0 -9
  122. package/lib/directives/button-loader.directive.d.ts +0 -12
  123. package/lib/interfaces/alert.interface.d.ts +0 -11
  124. package/lib/interfaces/icon.interface.d.ts +0 -4
  125. package/lib/interfaces/input.interface.d.ts +0 -4
  126. package/lib/interfaces/notification.interface.d.ts +0 -11
  127. package/lib/interfaces/spacer.interface.d.ts +0 -3
  128. package/lib/library.module.d.ts +0 -25
  129. package/lib/utils/attribute.util.d.ts +0 -4
  130. package/lib/utils/form-validators-utility.d.ts +0 -8
@@ -0,0 +1,29 @@
1
+ <!-- ngModel -->
2
+ <ion-textarea
3
+ [style]="'min-height: ' + minHeight + '; max-height: ' + maxHeight"
4
+ *ngIf="!control"
5
+ [placeholder]="placeholder"
6
+ [ngClass]="{ 'text-center': inputTextCenter }"
7
+ [label]="label"
8
+ [labelPlacement]="inputLabelPlacement"
9
+ fill="outline"
10
+ [autocapitalize]="autoCapitalize"
11
+ [autoGrow]="true"
12
+ mode="md"
13
+ (ionInput)="valueChange.emit($event.detail.value ?? undefined)"
14
+ [value]="value"></ion-textarea>
15
+ <!-- Form Control -->
16
+ <ion-textarea
17
+ [style]="'min-height: ' + minHeight + '; max-height: ' + maxHeight"
18
+ *ngIf="control"
19
+ [placeholder]="placeholder"
20
+ [ngClass]="{ 'text-center': inputTextCenter }"
21
+ [label]="label"
22
+ [labelPlacement]="inputLabelPlacement"
23
+ fill="outline"
24
+ [autocapitalize]="autoCapitalize"
25
+ [autoGrow]="true"
26
+ mode="md"
27
+ [formControl]="control"
28
+ (ionInput)="valueChange.emit($event.detail.value ?? undefined)"></ion-textarea>
29
+ <cf-form-validation *ngIf="control" [control]="control"></cf-form-validation>
@@ -0,0 +1,19 @@
1
+ /*===============================================
2
+ ================== Form Items ===================
3
+ ===============================================*/
4
+ ion-textarea {
5
+ font-family: 'Roboto', sans-serif;
6
+ font-weight: 400;
7
+ font-style: normal;
8
+ font-size: 1.6rem;
9
+ color: var(--cf-app-text-color-default);
10
+ text-align: start;
11
+ --border-radius: 8px !important; //--- important overrides the fill option
12
+ --highlight-color-focused: var(--cf-app-color-primary);
13
+ --highlight-color-invalid: var(--cf-app-system-color-error);
14
+ --highlight-color-valid: var(--cf-app-color-primary);
15
+ }
16
+
17
+ ion-textarea.text-center {
18
+ text-align: center;
19
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { FormInputTextAreaComponent } from './form-input-text-area.component';
4
+
5
+ describe('FormInputTextAreaComponent', () => {
6
+ let component: FormInputTextAreaComponent;
7
+ let fixture: ComponentFixture<FormInputTextAreaComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [FormInputTextAreaComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(FormInputTextAreaComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Carefirst Library Form Input Text Area
3
+ *
4
+ * @file form-input-text-area.component
5
+ * @description Contains all the logic for generating a CareFirst Form Input Text Area
6
+ * @author Arno Jansen van Vuuren
7
+ * @since 2023 - 12 - 18
8
+ * @usage <cf-form-input-text-area label="Label Name" %labelPlacement% %textCenter% %autoCapitalize% %(valueChange)="currentValue"% %[(value)]="twoWayComs"% %[control]%="formName.controls.controlName"></cf-form-input-text-area>
9
+ * disable input by disabling the form control
10
+ */
11
+
12
+ import { Component, EventEmitter, Input, Output, type OnChanges, type SimpleChanges } from '@angular/core';
13
+ import type { FormControl } from '@angular/forms';
14
+ //--- Utils
15
+ import { validateStringValue, checkTruthAttribute } from '../../utils/attribute.util';
16
+
17
+ /**==============================================
18
+ * @interface inputTextAreaC
19
+ * @description Define available input values
20
+ */
21
+ const inputTextAreaC = {
22
+ labelPlacement: ['fixed', 'floating', 'stacked', 'start', 'end'],
23
+ autoCapitalize: ['off', 'none', 'on', 'sentences', 'words', 'characters'],
24
+ } as const;
25
+
26
+ @Component({
27
+ selector: 'cf-form-input-text-area',
28
+ templateUrl: './form-input-text-area.component.html',
29
+ styleUrl: './form-input-text-area.component.scss',
30
+ })
31
+ export class FormInputTextAreaComponent implements OnChanges {
32
+ @Input() label!: string;
33
+ @Input() labelPlacement?: (typeof inputTextAreaC.labelPlacement)[number];
34
+ @Input() placeholder?: string | undefined;
35
+ @Input() autoCapitalize?: (typeof inputTextAreaC.autoCapitalize)[number];
36
+ @Input() control?: FormControl | null;
37
+ @Input() textCenter?: boolean | string | undefined;
38
+ @Input() minHeight?: string | 'none' = 'none';
39
+ @Input() maxHeight?: string | 'none' = 'none';
40
+
41
+ //--- ngModel
42
+ @Input() value: string | undefined;
43
+ @Output() valueChange = new EventEmitter<typeof this.value>();
44
+
45
+ //--- Local variables
46
+ inputLabelPlacement: typeof this.labelPlacement;
47
+ inputClear = true;
48
+ inputTextCenter = false;
49
+ inputAutoCapitalize: typeof this.autoCapitalize;
50
+
51
+ /**----------------------------------------------------------------
52
+ * @name ngOnChanges
53
+ * @description Detect changes to input values
54
+ * @param {SimpleChanges} changes
55
+ */
56
+ ngOnChanges(changes: SimpleChanges): void {
57
+ //--- Label Placement
58
+ this.inputLabelPlacement =
59
+ validateStringValue<(typeof inputTextAreaC.labelPlacement)[number]>(
60
+ changes,
61
+ 'labelPlacement',
62
+ inputTextAreaC.labelPlacement.slice(),
63
+ this.inputLabelPlacement
64
+ ) || 'floating';
65
+ //--- Text Center
66
+ this.inputTextCenter = checkTruthAttribute(changes, 'textCenter', this.inputTextCenter);
67
+ //--- Auto Capitalize
68
+ this.inputAutoCapitalize =
69
+ validateStringValue<(typeof inputTextAreaC.autoCapitalize)[number]>(
70
+ changes,
71
+ 'autoCapitalize',
72
+ inputTextAreaC.autoCapitalize.slice(),
73
+ this.inputAutoCapitalize
74
+ ) || 'none';
75
+ }
76
+ }
@@ -0,0 +1,8 @@
1
+ <div *ngIf="control?.dirty && control?.errors" class="form-valid-feedback">
2
+ <div *ngFor="let error of this.control?.errors | keyvalue">
3
+ <p class="body-medium" *ngIf="error.key === 'email'">*Invalid email format</p>
4
+ <p class="body-medium" *ngIf="error.key === 'minlength'">*Length required: {{ error.value.requiredLength - error.value.actualLength }}</p>
5
+ <p class="body-medium" *ngIf="error.key === 'maxlength'">*Max Length: {{ error.value.requiredLength }}</p>
6
+ <p class="body-medium" *ngIf="error.key === 'errorMessage'">*{{ error.value }}</p>
7
+ </div>
8
+ </div>
@@ -0,0 +1,8 @@
1
+ .form-valid-feedback {
2
+ padding: 4px 0 0 10px;
3
+ p {
4
+ font-size: 1.2rem;
5
+ text-align: left;
6
+ color: var(--cf-app-system-color-error);
7
+ }
8
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { FormValidationComponent } from './form-validation.component';
4
+
5
+ describe('FormValidationComponent', () => {
6
+ let component: FormValidationComponent;
7
+ let fixture: ComponentFixture<FormValidationComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [FormValidationComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(FormValidationComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,34 @@
1
+ /**
2
+ * CareFirst Library Form Validation Feedback
3
+ *
4
+ * @file form-validation.component
5
+ * @description Contains all the logic for generating CareFirst Form Validation Feedback
6
+ * @author Arno Jansen van Vuuren
7
+ * @since 2023 - 12 - 05
8
+ * @usage <cf-form-validation [control]="formName.get('controlName')"></cf-form-validation>
9
+ */
10
+
11
+ import { Component, Input, type OnChanges, type SimpleChanges } from '@angular/core';
12
+ //--- Interfaces
13
+ import type { FormControl } from '@angular/forms';
14
+
15
+ @Component({
16
+ selector: 'cf-form-validation',
17
+ templateUrl: './form-validation.component.html',
18
+ styleUrl: './form-validation.component.scss',
19
+ })
20
+ export class FormValidationComponent implements OnChanges {
21
+ //--- Receive form control
22
+ @Input() control!: FormControl | null;
23
+
24
+ /**----------------------------------------------------------------
25
+ * @name ngOnChanges
26
+ * @description Detect changes to input values
27
+ * @param {SimpleChanges} changes
28
+ */
29
+ ngOnChanges(changes: SimpleChanges): void {
30
+ if (changes['control'] && changes['control'].currentValue) {
31
+ this.control = changes['control'].currentValue;
32
+ }
33
+ }
34
+ }