@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,27 +0,0 @@
1
- //--- Screen size breakpoint
2
- $desktop-breakpoint: 768px; //--- Same as ionic md breakpoint
3
-
4
- /*===============================================
5
- ============== Mobile Only Spacer ===============
6
- ===============================================*/
7
- @media not (min-width: $desktop-breakpoint) {
8
- div.mobile-only {
9
- display: block;
10
- }
11
- div.desktop-only {
12
- display: none;
13
- }
14
- }
15
-
16
- /*===============================================
17
- ============== Desktop Only Spacer ==============
18
- ===============================================*/
19
-
20
- @media (min-width: $desktop-breakpoint) {
21
- div.mobile-only {
22
- display: none;
23
- }
24
- div.desktop-only {
25
- display: block;
26
- }
27
- }
@@ -1,21 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { SpacerComponent } from './spacer.component';
4
-
5
- describe('SpacerComponent', () => {
6
- let component: SpacerComponent;
7
- let fixture: ComponentFixture<SpacerComponent>;
8
-
9
- beforeEach(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [SpacerComponent]
12
- });
13
- fixture = TestBed.createComponent(SpacerComponent);
14
- component = fixture.componentInstance;
15
- fixture.detectChanges();
16
- });
17
-
18
- it('should create', () => {
19
- expect(component).toBeTruthy();
20
- });
21
- });
@@ -1,43 +0,0 @@
1
- /**
2
- * CareFirst Library - Spacer
3
- *
4
- * @file spacer.component
5
- * @description Contains all the logic for generating a CareFirst Div Spacer
6
- * @author Jacques Coetzee
7
- * @since 2023 - 11 - 07
8
- * @usage <cf-spacer %default=""% %mobile=""% %desktop=""%>CONTENT</cf-spacer>
9
- */
10
-
11
- import { Component, Input, type OnChanges, type SimpleChanges } from '@angular/core';
12
- import { validateNumberValue } from '../../utils/attribute.util';
13
- import type { SpacerNumberT, SpacerStringT } from '../../interfaces/spacer.interface';
14
-
15
- @Component({
16
- selector: 'cf-spacer',
17
- templateUrl: './spacer.component.html',
18
- styleUrls: ['./spacer.component.scss'],
19
- })
20
- export class SpacerComponent implements OnChanges {
21
- @Input() default?: SpacerStringT | SpacerNumberT | undefined;
22
- @Input() mobile?: SpacerStringT | SpacerNumberT | undefined;
23
- @Input() desktop?: SpacerStringT | SpacerNumberT | undefined;
24
-
25
- //--- Local variables
26
- inputDefault: number | undefined = undefined;
27
- inputMobile: number | undefined = undefined;
28
- inputDesktop: number | undefined = undefined;
29
-
30
- /**----------------------------------------------------------------
31
- * @name ngOnChanges
32
- * @description Update various values on input changes
33
- * @returns {void}
34
- */
35
- ngOnChanges(changes: SimpleChanges): void {
36
- //--- Default
37
- this.inputDefault = validateNumberValue(changes, 'default', this.inputDefault);
38
- //--- Mobile
39
- this.inputMobile = validateNumberValue(changes, 'mobile', this.inputMobile);
40
- //--- Desktop
41
- this.inputDesktop = validateNumberValue(changes, 'desktop', this.inputDesktop);
42
- }
43
- }
@@ -1 +0,0 @@
1
- <div id="spinner" [style]="'font-size: ' + inputSize + 'px'"></div>
@@ -1,14 +0,0 @@
1
- #spinner {
2
- width: 1em;
3
- height: 1em;
4
- border: 0.15em solid var(--cf-app-system-color-outline);
5
- border-radius: 50%;
6
- border-top-color: var(--cf-app-color-accent);
7
- animation: spin 1s linear infinite;
8
-
9
- @keyframes spin {
10
- to {
11
- transform: rotate(360deg);
12
- }
13
- }
14
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { SpinnerComponent } from './spinner.component';
4
-
5
- describe('SpinnerComponent', () => {
6
- let component: SpinnerComponent;
7
- let fixture: ComponentFixture<SpinnerComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [SpinnerComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(SpinnerComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,33 +0,0 @@
1
- /**
2
- * CareFirst Library - Spinner
3
- *
4
- * @file spinner.component
5
- * @description Contains all the logic for generating a CareFirst Spinner
6
- * @author Jacques Coetzee
7
- * @since 2024 - 02 - 23
8
- */
9
-
10
- import { Component, Input, type OnChanges, type SimpleChanges } from '@angular/core';
11
- import { validateNumberValue } from '../../utils/attribute.util';
12
-
13
- @Component({
14
- selector: 'cf-spinner',
15
- templateUrl: './spinner.component.html',
16
- styleUrl: './spinner.component.scss',
17
- })
18
- export class SpinnerComponent implements OnChanges {
19
- @Input() size: number | string = 20;
20
-
21
- //--- Local variables
22
- inputSize: number = 20;
23
-
24
- /**----------------------------------------------------------------
25
- * @name ngOnChanges
26
- * @description Update various values on input changes
27
- * @returns {void}
28
- */
29
- ngOnChanges(changes: SimpleChanges): void {
30
- //--- Size
31
- this.inputSize = validateNumberValue(changes, 'size', this.inputSize) || this.inputSize;
32
- }
33
- }
@@ -1,8 +0,0 @@
1
- import { ButtonLoaderDirective } from './button-loader.directive';
2
-
3
- describe('ButtonLoaderDirective', () => {
4
- it('should create an instance', () => {
5
- const directive = new ButtonLoaderDirective();
6
- expect(directive).toBeTruthy();
7
- });
8
- });
@@ -1,77 +0,0 @@
1
- /**
2
- * Button Loader Directive
3
- *
4
- * @file button-loader.directive
5
- * @description HTML directive used to disable a button while loading
6
- * @author Jacques Coetzee
7
- * @since 2022 - 07 - 22
8
- * @usage Add to any HTML tag: *cfButtonLoader="true"
9
- */
10
-
11
- import { Component, Directive, Input, Renderer2, TemplateRef, ViewContainerRef, ElementRef } from '@angular/core';
12
-
13
- @Directive({
14
- selector: '[cfButtonLoader]',
15
- })
16
- export class ButtonLoaderDirective {
17
- /**----------------------------------------------------------------
18
- * @name Constructor
19
- */
20
- constructor(
21
- private templateRef: TemplateRef<HTMLElement>,
22
- private renderer: Renderer2,
23
- private viewContainer: ViewContainerRef,
24
- private elementRef: ElementRef<HTMLElement>
25
- ) {}
26
-
27
- /**----------------------------------------------------------------
28
- * @name cfButtonLoader
29
- * @description Displays a loading overlay and disables a button
30
- * @param {boolean} loading
31
- */
32
- @Input() set cfButtonLoader(loading: boolean) {
33
- //--- Clear HTML container
34
- this.viewContainer.clear();
35
- //--- Reattach element as child
36
- this.viewContainer.createEmbeddedView(this.templateRef);
37
- if (loading) {
38
- //--- Add loading spinner
39
- this.viewContainer.createComponent(SpinnerComponent);
40
- //--- Set parent container position to relative
41
- this.renderer.setStyle(this.elementRef.nativeElement.parentElement, 'position', 'relative');
42
- }
43
- }
44
- }
45
-
46
- /**==================================================================
47
- * @class SpinnerComponent
48
- * @description The spinner component used to render an ion-spinner on the button
49
- * @author Jacques Coetzee
50
- * @since 2022 - 07 - 22
51
- * ===== */
52
-
53
- @Component({
54
- template: '<div class="loading-spinner"></div>',
55
- styles: [
56
- `
57
- @keyframes spinner {
58
- to {
59
- transform: rotate(360deg);
60
- }
61
- }
62
-
63
- .loading-spinner {
64
- position: absolute;
65
- top: calc(50% - 1em);
66
- left: calc(50% - 1em);
67
- width: 2em;
68
- height: 2em;
69
- border-radius: 50%;
70
- border: 3px solid var(--cf-app-system-color-outline);
71
- border-top-color: var(--cf-app-color-accent);
72
- animation: spinner 1s linear infinite;
73
- }
74
- `,
75
- ],
76
- })
77
- class SpinnerComponent {}
@@ -1,20 +0,0 @@
1
- /**==============================================
2
- * @interface AlertDataI
3
- * @description Defines the properties needed to show a care first alert
4
- */
5
- export interface AlertDataI {
6
- heading: string;
7
- message: string;
8
- alertIdentifier: string | number;
9
- buttonTrue?: string; //--- Default to 'OK'
10
- buttonFalse?: string; //--- Default to 'Cancel'
11
- }
12
-
13
- /**==============================================
14
- * @interface AlertEventI
15
- * @description Defines the structure of the returned event from the alert when a button is clicked
16
- */
17
- export interface AlertEventI {
18
- identifier: string | number;
19
- status: boolean;
20
- }
@@ -1,62 +0,0 @@
1
- /**==============================================
2
- * @interface IconsT
3
- * @description Short description
4
- */
5
- export const iconsC = [
6
- 'home',
7
- 'cog',
8
- 'profile',
9
- 'scan',
10
- 'person',
11
- 'appointment',
12
- 'clock',
13
- 'calendar',
14
- 'email',
15
- 'phone',
16
- 'sign-out',
17
- 'sign-in',
18
- 'close',
19
- 'check-mark',
20
- 'rating-star-blank',
21
- 'rating-star-filled',
22
- 'back-arrow',
23
- 'lock',
24
- 'show-password',
25
- 'hide-password',
26
- 'circle-check',
27
- 'circle-alert',
28
- 'direction-switch',
29
- 'chat-bubbles',
30
- 'phone-down',
31
- 'mic',
32
- 'no-mic',
33
- 'button-forward-arrow',
34
- 'button-check-box',
35
- 'social-media-whatsapp',
36
- 'social-media-facebook',
37
- 'social-media-linkedin',
38
- 'social-media-instagram',
39
- 'social-media-google-mail',
40
- 'instant-video-service',
41
- 'instant-telephonic-service',
42
- 'scheduled-video-service',
43
- 'scheduled-telephonic-service',
44
- 'vital-scan-service',
45
- 'open-back-arrow',
46
- 'open-forward-arrow',
47
- 'open-up-arrow',
48
- 'open-down-arrow',
49
- 'single-document',
50
- 'lightning',
51
- 'microsoft-365',
52
- 'user-dependent',
53
- 'plus',
54
- ] as const;
55
- export type IconsT = (typeof iconsC)[number];
56
-
57
- /**==============================================
58
- * @interface IconColorT
59
- * @description All available colors in CSS classes
60
- */
61
- export const iconColorC = ['primary', 'secondary', 'success', 'warning', 'error', 'white', 'accent'] as const;
62
- export type IconColorT = (typeof iconColorC)[number];
@@ -1,8 +0,0 @@
1
- /**==============================================
2
- * @interface FormInputSelectOptionsI
3
- * @description Structure for the input select options
4
- */
5
- export interface FormInputSelectOptionsI<T> {
6
- displayName: string | number;
7
- value: T;
8
- }
@@ -1,15 +0,0 @@
1
- /**==============================================
2
- * @interface NotificationPayloadI
3
- * @description Setup needed to show a notification
4
- */
5
- export interface NotificationPayloadI {
6
- heading: string;
7
- status: 'success' | 'warning' | 'error'; //--- success=green, warning=yellow, error=red
8
- message?: string;
9
- canClose?: true; //--- Adds a clickable x to hide notification
10
- button?: {
11
- buttonText: string;
12
- buttonClickIdentifier: string | number; //--- user set identifier used to know witch notifications button has been clicked
13
- buttonHeading?: string;
14
- };
15
- }
@@ -1,6 +0,0 @@
1
- /**==============================================
2
- * @description Available Spacer Values
3
- */
4
- export const spacerNumberArray = [4, 8, 12, 16, 24, 32, 38, 48, 72] as const;
5
- export type SpacerNumberT = (typeof spacerNumberArray)[number];
6
- export type SpacerStringT = `${SpacerNumberT}`;
@@ -1,66 +0,0 @@
1
- import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- //--- Modules
4
- import { IonicModule } from '@ionic/angular';
5
- import { ReactiveFormsModule } from '@angular/forms';
6
- //--- Directives
7
- import { ButtonLoaderDirective } from './directives/button-loader.directive';
8
- //--- Components
9
- import { PageComponent } from './components/page/page.component';
10
- import { ButtonComponent } from './components/button/button.component';
11
- import { SpacerComponent } from './components/spacer/spacer.component';
12
- import { IconComponent } from './components/icon/icon.component';
13
- import { NotificationComponent } from './components/notification/notification.component';
14
- import { AlertComponent } from './components/alert/alert.component';
15
- import { LogoComponent } from './components/logo/logo.component';
16
- import { CalendarComponent } from './components/calendar/calendar.component';
17
- import { FormValidationComponent } from './components/form-validation/form-validation.component';
18
- import { FormInputComponent } from './components/form-input/form-input.component';
19
- import { FormInputSelectComponent } from './components/form-input-select/form-input-select.component';
20
- import { FormInputTextAreaComponent } from './components/form-input-text-area/form-input-text-area.component';
21
- import { ChatBubbleComponent } from './components/chat-bubble/chat-bubble.component';
22
- import { BadgeComponent } from './components/badge/badge.component';
23
- import { SpinnerComponent } from './components/spinner/spinner.component';
24
-
25
- @NgModule({
26
- declarations: [
27
- PageComponent,
28
- ButtonComponent,
29
- SpacerComponent,
30
- IconComponent,
31
- ButtonLoaderDirective,
32
- NotificationComponent,
33
- AlertComponent,
34
- LogoComponent,
35
- CalendarComponent,
36
- FormValidationComponent,
37
- FormInputComponent,
38
- FormInputSelectComponent,
39
- FormInputTextAreaComponent,
40
- ChatBubbleComponent,
41
- BadgeComponent,
42
- SpinnerComponent,
43
- ],
44
-
45
- imports: [IonicModule, CommonModule, ReactiveFormsModule],
46
- exports: [
47
- PageComponent,
48
- ButtonComponent,
49
- SpacerComponent,
50
- IconComponent,
51
- ButtonLoaderDirective,
52
- NotificationComponent,
53
- AlertComponent,
54
- LogoComponent,
55
- CalendarComponent,
56
- FormValidationComponent,
57
- FormInputComponent,
58
- FormInputSelectComponent,
59
- FormInputTextAreaComponent,
60
- ChatBubbleComponent,
61
- BadgeComponent,
62
- SpinnerComponent,
63
- ],
64
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
65
- })
66
- export class CareFirstLibraryModule {}
@@ -1,66 +0,0 @@
1
- /**
2
- * Attribute Utility
3
- *
4
- * @file attribute.util
5
- * @description Contains various utility functions pertaining to attribute handling
6
- * @author Jacques Coetzee
7
- * @since 2023 - 11 - 08
8
- */
9
-
10
- import type { SimpleChanges } from '@angular/core';
11
-
12
- /**----------------------------------------------------------------
13
- * @name checkTruthAttribute
14
- * @description Check whether an attribute is either just available or specifically set to boolean value
15
- * @param {SimpleChanges} changes
16
- * @param {string} attribute
17
- * @param {boolean} curVal
18
- * @returns {boolean}
19
- */
20
- export function checkTruthAttribute(changes: SimpleChanges, attribute: string, curVal: boolean): boolean {
21
- if (!(attribute in changes)) return curVal;
22
- const valueChanged = changes[attribute]?.currentValue;
23
- if (typeof valueChanged === 'boolean') {
24
- return valueChanged;
25
- } else if (typeof valueChanged === 'string' && ['true', ''].includes(valueChanged)) {
26
- return true;
27
- }
28
- return false;
29
- }
30
-
31
- /**----------------------------------------------------------------
32
- * @name validateStringValue
33
- * @description Validate whether an attribute is set and contains a specific string option
34
- * @param {SimpleChanges} changes
35
- * @param {string} attribute
36
- * @param {string[]} options
37
- * @param {T | undefined} curVal
38
- * @returns {string | undefined} Returns correct string value or undefined if either not available or not in list
39
- */
40
- export function validateStringValue<T>(changes: SimpleChanges, attribute: string, options: T[], curVal: T | undefined): T | undefined {
41
- if (!(attribute in changes)) return curVal;
42
- const valueChanged = changes[attribute]?.currentValue;
43
- if (valueChanged && options.includes(valueChanged)) {
44
- return valueChanged as T;
45
- }
46
- return undefined;
47
- }
48
-
49
- /**----------------------------------------------------------------
50
- * @name validateNumberValue
51
- * @description Validate whether an attribute is set and contains a specific number value
52
- * @param {SimpleChanges} changes
53
- * @param {string} attribute
54
- * @param {number | undefined} curVal
55
- * @returns {number | undefined} Returns correct number value or undefined if either not available or not a number
56
- */
57
- export function validateNumberValue(changes: SimpleChanges, attribute: string, curVal: number | undefined): number | undefined {
58
- if (!(attribute in changes)) return curVal;
59
- const valueChanged = changes[attribute]?.currentValue;
60
- if (typeof valueChanged === 'number' && valueChanged >= 0) {
61
- return valueChanged;
62
- } else if (typeof valueChanged === 'string' && +valueChanged >= 0) {
63
- return +valueChanged;
64
- }
65
- return undefined;
66
- }