@carefirst/library 1.3.10 → 1.3.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/esm2022/carefirst-library.mjs +2 -0
  2. package/esm2022/lib/components/alert/alert.component.mjs +56 -0
  3. package/esm2022/lib/components/badge/badge.component.mjs +39 -0
  4. package/esm2022/lib/components/button/button.component.mjs +87 -0
  5. package/esm2022/lib/components/calendar/calendar.component.mjs +39 -0
  6. package/esm2022/lib/components/chat-bubble/chat-bubble.component.mjs +31 -0
  7. package/esm2022/lib/components/form-input/form-input.component.mjs +87 -0
  8. package/esm2022/lib/components/form-input-select/form-input-select.component.mjs +46 -0
  9. package/esm2022/lib/components/form-input-text-area/form-input-text-area.component.mjs +61 -0
  10. package/esm2022/lib/components/form-validation/form-validation.component.mjs +20 -0
  11. package/esm2022/lib/components/icon/icon.component.mjs +29 -0
  12. package/esm2022/lib/components/logo/logo.component.mjs +18 -0
  13. package/esm2022/lib/components/notification/notification.component.mjs +22 -0
  14. package/esm2022/lib/components/page/page.component.mjs +31 -0
  15. package/esm2022/lib/components/spacer/spacer.component.mjs +30 -0
  16. package/esm2022/lib/components/spinner/spinner.component.mjs +19 -0
  17. package/esm2022/lib/directives/button-loader.directive.mjs +41 -0
  18. package/esm2022/lib/interfaces/alert.interface.mjs +2 -0
  19. package/esm2022/lib/interfaces/icon.interface.mjs +52 -0
  20. package/esm2022/lib/interfaces/input.interface.mjs +2 -0
  21. package/esm2022/lib/interfaces/notification.interface.mjs +2 -0
  22. package/esm2022/lib/interfaces/spacer.interface.mjs +2 -0
  23. package/esm2022/lib/library.module.mjs +100 -0
  24. package/esm2022/lib/utils/attribute.util.mjs +34 -0
  25. package/esm2022/lib/utils/form-validators-utility.mjs +113 -0
  26. package/esm2022/public-api.mjs +24 -0
  27. package/fesm2022/carefirst-library.mjs +885 -0
  28. package/fesm2022/carefirst-library.mjs.map +1 -0
  29. package/index.d.ts +2 -0
  30. package/lib/components/alert/alert.component.d.ts +14 -0
  31. package/lib/components/badge/badge.component.d.ts +15 -0
  32. package/lib/components/button/button.component.d.ts +30 -0
  33. package/lib/components/calendar/calendar.component.d.ts +15 -0
  34. package/lib/components/chat-bubble/chat-bubble.component.d.ts +13 -0
  35. package/lib/components/form-input/form-input.component.d.ts +37 -0
  36. package/lib/components/form-input-select/form-input-select.component.d.ts +21 -0
  37. package/lib/components/form-input-text-area/form-input-text-area.component.d.ts +27 -0
  38. package/lib/components/form-validation/form-validation.component.d.ts +9 -0
  39. package/lib/components/icon/icon.component.d.ts +13 -0
  40. package/lib/components/logo/logo.component.d.ts +7 -0
  41. package/lib/components/notification/notification.component.d.ts +9 -0
  42. package/lib/components/page/page.component.d.ts +13 -0
  43. package/lib/components/spacer/spacer.component.d.ts +14 -0
  44. package/lib/components/spinner/spinner.component.d.ts +9 -0
  45. package/lib/directives/button-loader.directive.d.ts +12 -0
  46. package/lib/interfaces/alert.interface.d.ts +11 -0
  47. package/lib/interfaces/icon.interface.d.ts +4 -0
  48. package/lib/interfaces/input.interface.d.ts +4 -0
  49. package/lib/interfaces/notification.interface.d.ts +11 -0
  50. package/lib/interfaces/spacer.interface.d.ts +3 -0
  51. package/lib/library.module.d.ts +25 -0
  52. package/lib/utils/attribute.util.d.ts +4 -0
  53. package/lib/utils/form-validators-utility.d.ts +8 -0
  54. package/package.json +14 -11
  55. package/{src/public-api.ts → public-api.d.ts} +0 -18
  56. package/.eslintrc.json +0 -31
  57. package/ng-package.json +0 -8
  58. package/src/lib/components/alert/alert.component.html +0 -0
  59. package/src/lib/components/alert/alert.component.scss +0 -63
  60. package/src/lib/components/alert/alert.component.spec.ts +0 -23
  61. package/src/lib/components/alert/alert.component.ts +0 -73
  62. package/src/lib/components/badge/badge.component.html +0 -5
  63. package/src/lib/components/badge/badge.component.scss +0 -96
  64. package/src/lib/components/badge/badge.component.spec.ts +0 -23
  65. package/src/lib/components/badge/badge.component.ts +0 -61
  66. package/src/lib/components/button/button.component.html +0 -20
  67. package/src/lib/components/button/button.component.scss +0 -153
  68. package/src/lib/components/button/button.component.spec.ts +0 -21
  69. package/src/lib/components/button/button.component.ts +0 -94
  70. package/src/lib/components/calendar/calendar.component.html +0 -9
  71. package/src/lib/components/calendar/calendar.component.scss +0 -34
  72. package/src/lib/components/calendar/calendar.component.spec.ts +0 -23
  73. package/src/lib/components/calendar/calendar.component.ts +0 -53
  74. package/src/lib/components/chat-bubble/chat-bubble.component.html +0 -9
  75. package/src/lib/components/chat-bubble/chat-bubble.component.scss +0 -31
  76. package/src/lib/components/chat-bubble/chat-bubble.component.spec.ts +0 -23
  77. package/src/lib/components/chat-bubble/chat-bubble.component.ts +0 -43
  78. package/src/lib/components/form-input/form-input.component.html +0 -37
  79. package/src/lib/components/form-input/form-input.component.scss +0 -23
  80. package/src/lib/components/form-input/form-input.component.spec.ts +0 -23
  81. package/src/lib/components/form-input/form-input.component.ts +0 -95
  82. package/src/lib/components/form-input-select/form-input-select.component.html +0 -27
  83. package/src/lib/components/form-input-select/form-input-select.component.scss +0 -40
  84. package/src/lib/components/form-input-select/form-input-select.component.spec.ts +0 -23
  85. package/src/lib/components/form-input-select/form-input-select.component.ts +0 -61
  86. package/src/lib/components/form-input-text-area/form-input-text-area.component.html +0 -29
  87. package/src/lib/components/form-input-text-area/form-input-text-area.component.scss +0 -19
  88. package/src/lib/components/form-input-text-area/form-input-text-area.component.spec.ts +0 -23
  89. package/src/lib/components/form-input-text-area/form-input-text-area.component.ts +0 -76
  90. package/src/lib/components/form-validation/form-validation.component.html +0 -8
  91. package/src/lib/components/form-validation/form-validation.component.scss +0 -8
  92. package/src/lib/components/form-validation/form-validation.component.spec.ts +0 -23
  93. package/src/lib/components/form-validation/form-validation.component.ts +0 -34
  94. package/src/lib/components/icon/icon.component.html +0 -529
  95. package/src/lib/components/icon/icon.component.scss +0 -61
  96. package/src/lib/components/icon/icon.component.spec.ts +0 -21
  97. package/src/lib/components/icon/icon.component.ts +0 -40
  98. package/src/lib/components/logo/logo.component.html +0 -10
  99. package/src/lib/components/logo/logo.component.scss +0 -5
  100. package/src/lib/components/logo/logo.component.spec.ts +0 -23
  101. package/src/lib/components/logo/logo.component.ts +0 -21
  102. package/src/lib/components/notification/notification.component.html +0 -39
  103. package/src/lib/components/notification/notification.component.scss +0 -20
  104. package/src/lib/components/notification/notification.component.spec.ts +0 -21
  105. package/src/lib/components/notification/notification.component.ts +0 -23
  106. package/src/lib/components/page/page.component.html +0 -5
  107. package/src/lib/components/page/page.component.scss +0 -35
  108. package/src/lib/components/page/page.component.spec.ts +0 -21
  109. package/src/lib/components/page/page.component.ts +0 -42
  110. package/src/lib/components/spacer/spacer.component.html +0 -4
  111. package/src/lib/components/spacer/spacer.component.scss +0 -27
  112. package/src/lib/components/spacer/spacer.component.spec.ts +0 -21
  113. package/src/lib/components/spacer/spacer.component.ts +0 -43
  114. package/src/lib/components/spinner/spinner.component.html +0 -1
  115. package/src/lib/components/spinner/spinner.component.scss +0 -14
  116. package/src/lib/components/spinner/spinner.component.spec.ts +0 -23
  117. package/src/lib/components/spinner/spinner.component.ts +0 -33
  118. package/src/lib/directives/button-loader.directive.spec.ts +0 -8
  119. package/src/lib/directives/button-loader.directive.ts +0 -77
  120. package/src/lib/interfaces/alert.interface.ts +0 -20
  121. package/src/lib/interfaces/icon.interface.ts +0 -62
  122. package/src/lib/interfaces/input.interface.ts +0 -8
  123. package/src/lib/interfaces/notification.interface.ts +0 -15
  124. package/src/lib/interfaces/spacer.interface.ts +0 -6
  125. package/src/lib/library.module.ts +0 -66
  126. package/src/lib/utils/attribute.util.ts +0 -66
  127. package/src/lib/utils/form-validators-utility.ts +0 -186
  128. package/tsconfig.lib.json +0 -12
  129. package/tsconfig.lib.prod.json +0 -10
  130. package/tsconfig.spec.json +0 -14
@@ -1,73 +0,0 @@
1
- /**
2
- * CareFirst Library Alert
3
- *
4
- * @file alert.component
5
- * @description Contains all the logic for generating a CareFirst Alert
6
- * @author Arno Jansen van Vuuren
7
- * @since 2023 - 11 - 30
8
- * @usage <cf-alert data="{heading, message, buttonTrue, buttonFalse}" (alertEvent)></cf-alert>
9
- */
10
-
11
- import { Component, Input, Output, type OnChanges, type SimpleChanges, EventEmitter } from '@angular/core';
12
- import { AlertController } from '@ionic/angular';
13
- import type { AlertDataI, AlertEventI } from '../../interfaces/alert.interface';
14
-
15
- @Component({
16
- selector: 'cf-alert',
17
- templateUrl: './alert.component.html',
18
- styleUrl: './alert.component.scss',
19
- })
20
- export class AlertComponent implements OnChanges {
21
- @Input() data: AlertDataI | undefined = undefined;
22
- @Output() alertEvent = new EventEmitter<AlertEventI>();
23
-
24
- /**----------------------------------------------------------------
25
- * @name constructor
26
- */
27
- constructor(private readonly alertController: AlertController) {}
28
-
29
- /**----------------------------------------------------------------
30
- * @name ngOnchange
31
- * @description Update various values on component input changes
32
- * @returns {void}
33
- */
34
- ngOnChanges(changes: SimpleChanges): void {
35
- const val = changes['data']?.currentValue as typeof this.data;
36
- if (val) this.showAlert(val);
37
- }
38
-
39
- /**----------------------------------------------------------------
40
- * @name showAlert
41
- * @description Show
42
- * @param {AlertDataI} data
43
- * @returns {Promise<void>}
44
- */
45
- async showAlert(data: AlertDataI): Promise<void> {
46
- const alert = await this.alertController.create({
47
- header: data.heading,
48
- message: data.message,
49
- cssClass: 'care-first-alert',
50
- mode: 'md',
51
- backdropDismiss: false,
52
- buttons: [
53
- {
54
- text: data.buttonFalse || 'Cancel',
55
- handler: () => {
56
- this.alertEvent.emit({ identifier: data.alertIdentifier, status: false });
57
- alert.dismiss();
58
- },
59
- cssClass: 'alert-button-cancel',
60
- },
61
- {
62
- text: data.buttonTrue || 'OK',
63
- handler: () => {
64
- this.alertEvent.emit({ identifier: data.alertIdentifier, status: true });
65
- alert.dismiss();
66
- },
67
- cssClass: 'alert-button-confirm',
68
- },
69
- ],
70
- });
71
- alert.present();
72
- }
73
- }
@@ -1,5 +0,0 @@
1
- <div [className]="'cf-badge-' + inputType">
2
- <cf-icon *ngIf="inputIcon && inputType !== 'feedback-busy'" [icon]="inputIcon" [height]="12"></cf-icon>
3
- <ion-spinner *ngIf="inputType === 'feedback-busy'"></ion-spinner>
4
- <p><ng-content></ng-content></p>
5
- </div>
@@ -1,96 +0,0 @@
1
- /*===============================================
2
- ===================== Tags ======================
3
- ===============================================*/
4
-
5
- div[class^='cf-badge-'] {
6
- //--- Default Colours
7
- --cf-badge-background: var(--cf-app-color-primary);
8
- --cf-badge-text-color: var(--cf-app-text-color-light);
9
- --cf-badge-border-color: var(--cf-badge-background);
10
-
11
- --cf-svg-overwrite-stroke-color: var(--cf-badge-text-color); //--- Comes from Icon Library
12
-
13
- display: flex;
14
- flex-direction: row;
15
- gap: 8px;
16
- justify-content: center;
17
- align-items: center;
18
- padding: 8px 16px;
19
- border-radius: 6px;
20
- width: fit-content;
21
-
22
- background: var(--cf-badge-background);
23
- border: 0.2rem solid var(--cf-badge-border-color);
24
- > p {
25
- width: fit-content;
26
- font-size: 1.2rem;
27
- font-weight: 500;
28
- font-style: normal;
29
- line-height: auto;
30
- color: var(--cf-badge-text-color);
31
- }
32
- }
33
-
34
- /*===============================================
35
- ================== Variations ===================
36
- ===============================================*/
37
-
38
- div.cf-badge-feedback-primary {
39
- --cf-badge-background: var(--cf-app-color-primary);
40
- --cf-badge-text-color: var(--cf-app-text-color-light);
41
- --cf-badge-border-color: var(--cf-badge-background);
42
- }
43
-
44
- div.cf-badge-alert {
45
- --cf-badge-background: var(--cf-app-system-color-error);
46
- --cf-badge-text-color: var(--cf-app-text-color-light);
47
- --cf-badge-border-color: var(--cf-app-system-color-error);
48
- }
49
-
50
- div.cf-badge-accent {
51
- --cf-badge-background: var(--cf-app-color-accent);
52
- --cf-badge-text-color: var(--cf-app-text-color-light);
53
- --cf-badge-border-color: var(--cf-app-color-accent);
54
- }
55
-
56
- div.cf-badge-warning {
57
- --cf-badge-background: var(--cf-app-system-color-warning);
58
- --cf-badge-text-color: var(--cf-app-text-color-grey);
59
- --cf-badge-border-color: var(--cf-app-system-color-warning);
60
- }
61
-
62
- div.cf-badge-disabled {
63
- --cf-badge-background: var(--cf-app-system-color-disabled);
64
- --cf-badge-text-color: var(--cf-app-text-color-grey);
65
- --cf-badge-border-color: var(--cf-app-system-color-disabled);
66
- }
67
-
68
- div.cf-badge-feedback-success {
69
- --cf-badge-background: var(--cf-app-system-color-light-success);
70
- --cf-badge-text-color: var(--cf-app-system-color-success);
71
- --cf-badge-border-color: var(--cf-app-system-color-success);
72
- }
73
-
74
- div.cf-badge-feedback-error {
75
- --cf-badge-background: var(--cf-app-system-color-light-error);
76
- --cf-badge-text-color: var(--cf-app-system-color-error);
77
- --cf-badge-border-color: var(--cf-app-system-color-error);
78
- }
79
-
80
- div.cf-badge-feedback-warning {
81
- --cf-badge-background: var(--cf-app-system-color-light-warning);
82
- --cf-badge-text-color: var(--cf-app-system-color-warning);
83
- --cf-badge-border-color: var(--cf-app-system-color-warning);
84
- }
85
-
86
- div.cf-badge-feedback-busy {
87
- --cf-badge-background: var(--cf-app-system-color-light-warning);
88
- --cf-badge-text-color: var(--cf-app-system-color-warning);
89
- --cf-badge-border-color: var(--cf-app-system-color-warning);
90
-
91
- ion-spinner {
92
- color: var(--cf-app-system-color-warning);
93
- height: 1.2rem;
94
- width: 1.2rem;
95
- }
96
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { BadgeComponent } from './badge.component';
4
-
5
- describe('BadgeComponent', () => {
6
- let component: BadgeComponent;
7
- let fixture: ComponentFixture<BadgeComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [BadgeComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(BadgeComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,61 +0,0 @@
1
- /**
2
- * CareFirst Chat Badge
3
- *
4
- * @file badge.component
5
- * @description Contains all the logic for generating a CareFirst Chat Badge
6
- * @author Jacques Coetzee
7
- * @since 2024 - 02 - 22
8
- * @usage <cf-badge type="BadgeTypeT" %icon%="IconsT"></cf-badge>
9
- */
10
-
11
- import { Component, Input, type OnChanges, type SimpleChanges } from '@angular/core';
12
- //--- Utils
13
- import { validateStringValue } from '../../utils/attribute.util';
14
- //--- Interfaces
15
- import { iconsC, type IconsT } from '../../interfaces/icon.interface';
16
-
17
- /**==============================================
18
- * @interface BadgeTypeT
19
- * @description Types of badges available
20
- */
21
- const badgeTypeC = [
22
- 'primary',
23
- 'alert',
24
- 'accent',
25
- 'warning',
26
- 'disabled',
27
- 'feedback-success',
28
- 'feedback-error',
29
- 'feedback-warning',
30
- 'feedback-busy',
31
- ] as const;
32
- type BadgeTypeT = (typeof badgeTypeC)[number];
33
-
34
- /**==============================================
35
- * @name BadgeComponent
36
- * */
37
- @Component({
38
- selector: 'cf-badge',
39
- templateUrl: './badge.component.html',
40
- styleUrl: './badge.component.scss',
41
- })
42
- export class BadgeComponent implements OnChanges {
43
- @Input() type: BadgeTypeT = 'primary';
44
- @Input() icon?: IconsT | undefined;
45
-
46
- //--- Local variables
47
- inputType: typeof this.type = 'primary';
48
- inputIcon: typeof this.icon | undefined = undefined;
49
-
50
- /**----------------------------------------------------------------
51
- * @name ngOnChanges
52
- * @description Update various values on input changes
53
- * @returns {void}
54
- */
55
- ngOnChanges(changes: SimpleChanges): void {
56
- //--- Type
57
- this.inputType = validateStringValue<BadgeTypeT>(changes, 'type', badgeTypeC.slice(), this.inputType) || 'primary';
58
- //--- Icon Start
59
- this.inputIcon = validateStringValue<IconsT>(changes, 'icon', iconsC.slice(), this.inputIcon);
60
- }
61
- }
@@ -1,20 +0,0 @@
1
- <ion-button
2
- [style]="'--custom-color: ' + inputCustomColor"
3
- [ngClass]="{
4
- 'cf-button-primary': inputType === 'primary',
5
- 'cf-button-secondary': inputType === 'secondary',
6
- 'cf-button-tertiary': inputType === 'tertiary',
7
- 'text-large': inputFontSize === 'large',
8
- 'text-small': inputFontSize === 'small',
9
- alert: inputAlert,
10
- action: inputAction,
11
- snug: inputSnug
12
- }"
13
- mode="md"
14
- [disabled]="inputDisabled">
15
- <cf-icon *ngIf="inputIconStart" [icon]="inputIconStart" style="--cf-svg-overwrite-stroke-color: var(--button-text-color)"></cf-icon>
16
- <p *cfButtonLoader="inputLoading">
17
- <ng-content></ng-content>
18
- </p>
19
- <cf-icon *ngIf="inputIconEnd" [icon]="inputIconEnd" style="--cf-svg-overwrite-stroke-color: var(--button-text-color)"></cf-icon>
20
- </ion-button>
@@ -1,153 +0,0 @@
1
- /*===============================================
2
- ==================== Buttons ====================
3
- ===============================================*/
4
-
5
- ion-button[class^='cf-button-'] {
6
- --custom-color: var(--cf-app-color-primary);
7
- --core: var(--custom-color, var(--cf-app-color-primary));
8
- width: 100%;
9
- min-height: 5.6rem;
10
- border-radius: 1rem 0.4rem 1rem 1rem;
11
- text-transform: capitalize;
12
- overflow: hidden;
13
- margin: 0;
14
- --padding-top: 1.6rem;
15
- --padding-bottom: 1.6rem;
16
- --padding-start: 2.4rem;
17
- --padding-end: 2.4rem;
18
- font-size: 1.2rem;
19
-
20
- > p {
21
- width: fit-content;
22
- font-weight: 500;
23
- font-style: normal;
24
- line-height: auto;
25
- }
26
-
27
- > :not(:first-child) {
28
- margin-left: 2rem;
29
- }
30
- }
31
- ion-button[class^='cf-button-']::part(native) {
32
- border-radius: 1rem 0.4rem 1rem 1rem;
33
- box-shadow: none;
34
- }
35
-
36
- //------------- Action button class -------------
37
- //--- *Add to any 'cf-button-' class: %action% %snug%
38
- ion-button[class^='cf-button-'].action {
39
- border-radius: 0.6rem;
40
- min-height: 3.6rem;
41
- --padding-top: 0.6rem;
42
- --padding-bottom: 0.6rem;
43
- --padding-start: 2rem;
44
- --padding-end: 2rem;
45
- }
46
- ion-button[class^='cf-button-'].action::part(native) {
47
- border-radius: 0.6rem;
48
- }
49
-
50
- ion-button[class^='cf-button-'].snug {
51
- width: fit-content;
52
- min-height: fit-content;
53
- }
54
-
55
- //--------------------- Font --------------------
56
- ion-button[class^='cf-button-'].text-large {
57
- font-size: 1.6rem;
58
- }
59
- ion-button[class^='cf-button-'].text-small {
60
- font-size: 1rem;
61
- }
62
-
63
- /*===============================================
64
- ==================== Primary ====================
65
- ===============================================*/
66
-
67
- .cf-button-primary {
68
- --background: var(--core);
69
- --button-text-color: var(--cf-app-text-color-light);
70
- p {
71
- color: var(--button-text-color);
72
- }
73
- }
74
-
75
- .cf-button-primary[class*='disabled'] {
76
- opacity: 100%;
77
- --background: var(--cf-app-system-color-disabled);
78
- --button-text-color: #9d9d9d;
79
- p {
80
- color: var(--button-text-color);
81
- }
82
- }
83
-
84
- .cf-button-primary.alert:not([class*='disabled']) {
85
- --background: var(--cf-app-system-color-error);
86
- --button-text-color: var(--cf-app-text-color-light);
87
- p {
88
- color: var(--button-text-color);
89
- }
90
- }
91
-
92
- /*===============================================
93
- =================== Secondary ===================
94
- ===============================================*/
95
-
96
- .cf-button-secondary {
97
- --background: transparent;
98
- --button-text-color: var(--core);
99
- p {
100
- color: var(--button-text-color);
101
- }
102
- }
103
- .cf-button-secondary::part(native) {
104
- border: 0.2rem solid var(--core);
105
- }
106
-
107
- .cf-button-secondary[class*='disabled'] {
108
- opacity: 100%;
109
- --button-text-color: var(--cf-app-system-color-disabled);
110
- p {
111
- color: var(--button-text-color);
112
- }
113
- }
114
- .cf-button-secondary[class*='disabled']::part(native) {
115
- border: 0.2rem solid var(--cf-app-system-color-disabled);
116
- }
117
-
118
- .cf-button-secondary.alert:not([class*='disabled']) {
119
- --button-text-color: var(--cf-app-system-color-error);
120
- p {
121
- color: var(--button-text-color);
122
- }
123
- }
124
- .cf-button-secondary.alert:not([class*='disabled'])::part(native) {
125
- border: 0.2rem solid var(--cf-app-system-color-error);
126
- }
127
-
128
- /*===============================================
129
- =================== Tertiary ====================
130
- ===============================================*/
131
-
132
- .cf-button-tertiary {
133
- --background: transparent;
134
- --button-text-color: var(--core);
135
- p {
136
- color: var(--button-text-color);
137
- }
138
- }
139
-
140
- .cf-button-tertiary[class*='disabled'] {
141
- opacity: 100%;
142
- --button-text-color: var(--cf-app-system-color-disabled);
143
- p {
144
- color: var(--button-text-color);
145
- }
146
- }
147
-
148
- .cf-button-tertiary.alert:not([class*='disabled']) {
149
- --button-text-color: var(--cf-app-system-color-error);
150
- p {
151
- color: var(--button-text-color);
152
- }
153
- }
@@ -1,21 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ButtonComponent } from './button.component';
4
-
5
- describe('ButtonComponent', () => {
6
- let component: ButtonComponent;
7
- let fixture: ComponentFixture<ButtonComponent>;
8
-
9
- beforeEach(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ButtonComponent]
12
- });
13
- fixture = TestBed.createComponent(ButtonComponent);
14
- component = fixture.componentInstance;
15
- fixture.detectChanges();
16
- });
17
-
18
- it('should create', () => {
19
- expect(component).toBeTruthy();
20
- });
21
- });
@@ -1,94 +0,0 @@
1
- /**
2
- * CareFirst Library - Button
3
- *
4
- * @file button.component
5
- * @description Contains all the logic for generating a CareFirst Button
6
- * @author Jacques Coetzee
7
- * @since 2023 - 11 - 07
8
- * @usage <cf-btn type="'primary' | 'secondary' | 'tertiary'" fontSize="'small' | 'large'" %customColor="var() | hex"% %disabled% %alert% %action% %snug%>TEXT</cf-btn>
9
- */
10
-
11
- import { Component, Input, type SimpleChanges, type OnChanges, HostBinding } from '@angular/core';
12
- import { checkTruthAttribute, validateStringValue } from '../../utils/attribute.util';
13
- import { iconsC, type IconsT } from '../../interfaces/icon.interface';
14
-
15
- @Component({
16
- selector: 'cf-btn',
17
- templateUrl: './button.component.html',
18
- styleUrls: ['./button.component.scss'],
19
- })
20
- export class ButtonComponent implements OnChanges {
21
- @Input() type: 'primary' | 'secondary' | 'tertiary' = 'primary';
22
- @Input() disabled?: boolean | string | undefined;
23
- @Input() alert?: boolean | string | undefined;
24
- @Input() action?: boolean | string | undefined;
25
- @Input() snug?: boolean | string | undefined;
26
- @Input() fontSize?: 'small' | 'large';
27
- @Input() iconStart?: IconsT | undefined;
28
- @Input() iconEnd?: IconsT | undefined;
29
- @Input() loading?: boolean | string | undefined;
30
- @Input() customColor?: string | undefined;
31
-
32
- @HostBinding('style.pointer-events') get parentEvents(): string {
33
- if (this.disabled) {
34
- return 'none';
35
- }
36
- return 'auto';
37
- }
38
-
39
- //--- Local variables
40
- inputType: typeof this.type = 'primary';
41
- inputFontSize: typeof this.fontSize | undefined = undefined;
42
- inputDisabled = false;
43
- inputAlert = false;
44
- inputAction = false;
45
- inputSnug = false;
46
- inputIconStart: typeof this.iconStart | undefined = undefined;
47
- inputIconEnd: typeof this.iconEnd | undefined = undefined;
48
- inputLoading = false;
49
- inputCustomColor = '';
50
-
51
- /**----------------------------------------------------------------
52
- * @name ngOnChanges
53
- * @description Update various values on input changes
54
- * @returns {void}
55
- */
56
- ngOnChanges(changes: SimpleChanges): void {
57
- //--- Type
58
- this.inputType =
59
- validateStringValue<'primary' | 'secondary' | 'tertiary'>(changes, 'type', ['primary', 'secondary', 'tertiary'], this.inputType) || 'primary';
60
- //--- Font Size
61
- this.inputFontSize = validateStringValue<'small' | 'large'>(changes, 'fontSize', ['small', 'large'], this.inputFontSize);
62
- //--- Disabled
63
- this.inputDisabled = checkTruthAttribute(changes, 'disabled', this.inputDisabled);
64
- //--- Alert
65
- this.inputAlert = checkTruthAttribute(changes, 'alert', this.inputAlert);
66
- //--- Action
67
- this.inputAction = checkTruthAttribute(changes, 'action', this.inputAction);
68
- //--- Snug
69
- this.inputSnug = checkTruthAttribute(changes, 'snug', this.inputSnug);
70
- //--- Icon Start
71
- this.inputIconStart = validateStringValue<IconsT>(changes, 'iconStart', iconsC.slice(), this.inputIconStart);
72
- //--- Icon Start
73
- this.inputIconEnd = validateStringValue<IconsT>(changes, 'iconEnd', iconsC.slice(), this.inputIconEnd);
74
- //--- Loading
75
- this.inputLoading = checkTruthAttribute(changes, 'loading', this.inputLoading);
76
- //--- Custom color
77
- if (changes['customColor']?.currentValue) this.inputCustomColor = this.checkCustomColor(changes['customColor'].currentValue);
78
- }
79
-
80
- /**----------------------------------------------------------------
81
- * @name checkCustomColor
82
- * @description Check if the custom color is valid
83
- * @param {string} color
84
- * @returns {string}
85
- */
86
- checkCustomColor(color: string): string {
87
- //--- Check for a css variable
88
- if (color.startsWith('var')) return color;
89
- //--- Check hex
90
- if (color.startsWith('#') && (color.length === 4 || color.length === 7) && color.split('').every((char) => char.match(/[#0-9a-fA-F]+/)))
91
- return color;
92
- return '';
93
- }
94
- }
@@ -1,9 +0,0 @@
1
- <ion-datetime
2
- [class]="inputColor"
3
- mode="ios"
4
- firstDayOfWeek="1"
5
- [min]="min"
6
- [max]="max"
7
- [presentation]="inputTime ? 'date-time' : 'date'"
8
- (ionChange)="setValue($event.detail.value)">
9
- </ion-datetime>
@@ -1,34 +0,0 @@
1
- ion-datetime {
2
- --background: var(--cf-app-background-light);
3
- color: var(--cf-app-text-color-default);
4
- }
5
-
6
- ion-datetime::part(calendar-day) {
7
- font-size: 1.6rem;
8
- }
9
-
10
- ion-datetime::part(month-year-button) {
11
- font-size: 1.8rem;
12
- font-weight: 900;
13
- color: var(--cf-app-text-color-default);
14
- }
15
-
16
- ion-datetime.accent::part(today) {
17
- border: 1px solid var(--cf-app-color-accent);
18
- color: var(--cf-app-color-accent);
19
- }
20
-
21
- ion-datetime.accent::part(active) {
22
- background-color: var(--cf-app-color-accent);
23
- color: var(--cf-app-text-color-light);
24
- }
25
-
26
- ion-datetime.success::part(today) {
27
- border: 1px solid var(--cf-app-color-primary);
28
- color: var(--cf-app-text-color-default);
29
- }
30
-
31
- ion-datetime.success::part(active) {
32
- background-color: var(--cf-app-system-color-success);
33
- color: var(--cf-app-text-color-light);
34
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { CalendarComponent } from './calendar.component';
4
-
5
- describe('CalendarComponent', () => {
6
- let component: CalendarComponent;
7
- let fixture: ComponentFixture<CalendarComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [CalendarComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(CalendarComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,53 +0,0 @@
1
- /**
2
- * CareFirst Library Calendar
3
- *
4
- * @file calendar.component
5
- * @description Contains all the logic for generating a CareFirst Calendar
6
- * @author Arno Jansen van Vuuren
7
- * @since 2023 - 12 - 01
8
- * @usage <cf-calendar %displayTime% %color%="success | accent" %min% %max%></cf-calendar>
9
- */
10
-
11
- import { Component, EventEmitter, Input, Output, type OnChanges, type SimpleChanges } from '@angular/core';
12
- import dayjs from 'dayjs';
13
- //--- Utils
14
- import { checkTruthAttribute, validateStringValue } from '../../utils/attribute.util';
15
-
16
- @Component({
17
- selector: 'cf-calendar',
18
- templateUrl: './calendar.component.html',
19
- styleUrl: './calendar.component.scss',
20
- })
21
- export class CalendarComponent implements OnChanges {
22
- @Input() displayTime?: boolean | string | undefined;
23
- @Input() color?: 'success' | 'accent';
24
- @Input() min?: string | undefined = undefined;
25
- @Input() max?: string | undefined = undefined;
26
- @Output() value = new EventEmitter<string>();
27
-
28
- //--- Local variables
29
- inputTime = false;
30
- inputColor: typeof this.color = 'accent';
31
-
32
- /**----------------------------------------------------------------
33
- * @name ngOnChanges
34
- * @description Update various values on component input changes
35
- * @returns {void}
36
- */
37
- ngOnChanges(changes: SimpleChanges): void {
38
- //--- Display Time
39
- this.inputTime = checkTruthAttribute(changes, 'displayTime', this.inputTime);
40
- //--- Color
41
- this.inputColor = validateStringValue<'success' | 'accent'>(changes, 'color', ['success', 'accent'], this.inputColor) || 'accent';
42
- }
43
-
44
- /**----------------------------------------------------------------
45
- * @name setValue
46
- * @description Emit the selected date value
47
- * @param {string | string[] | null | undefined} value
48
- * @returns {void}
49
- */
50
- setValue(value: string | string[] | null | undefined): void {
51
- if (typeof value === 'string') this.value.emit(dayjs(value).format('YYYY-MM-DD' + (this.inputTime ? ' HH:mm' : '')));
52
- }
53
- }
@@ -1,9 +0,0 @@
1
- <div id="container" [ngClass]="inputType">
2
- <div id="message">
3
- <p class="body-extra-small">{{ inputDate }}</p>
4
- <cf-spacer default="4"></cf-spacer>
5
- <div id="bubble">
6
- <p class="body-extra-small">{{ inputMessage }}</p>
7
- </div>
8
- </div>
9
- </div>