ngx-opalbytes-components 1.21.0 → 1.23.0

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 (28) hide show
  1. package/README.md +173 -0
  2. package/fesm2022/ngx-opalbytes-components.mjs +464 -20
  3. package/fesm2022/ngx-opalbytes-components.mjs.map +1 -1
  4. package/package.json +1 -1
  5. package/src/lib/shared/components/error/error.css +10 -0
  6. package/src/lib/shared/components/error/error.html +5 -0
  7. package/src/lib/shared/components/error/error.spec.ts +76 -0
  8. package/src/lib/shared/components/error/error.stories.ts +61 -0
  9. package/src/lib/shared/components/error/error.ts +33 -0
  10. package/src/lib/shared/components/form-field/error-state-matcher.ts +41 -0
  11. package/src/lib/shared/components/form-field/form-field-control.ts +10 -0
  12. package/src/lib/shared/components/form-field/form-field.css +154 -0
  13. package/src/lib/shared/components/form-field/form-field.html +51 -0
  14. package/src/lib/shared/components/form-field/form-field.spec.ts +114 -0
  15. package/src/lib/shared/components/form-field/form-field.stories.ts +177 -0
  16. package/src/lib/shared/components/form-field/form-field.ts +118 -0
  17. package/src/lib/shared/components/hint/hint.css +10 -0
  18. package/src/lib/shared/components/hint/hint.html +1 -0
  19. package/src/lib/shared/components/hint/hint.spec.ts +22 -0
  20. package/src/lib/shared/components/hint/hint.stories.ts +53 -0
  21. package/src/lib/shared/components/hint/hint.ts +9 -0
  22. package/src/lib/shared/components/index.ts +12 -1
  23. package/src/lib/shared/components/skeleton/skeleton.css +92 -0
  24. package/src/lib/shared/components/skeleton/skeleton.html +3 -0
  25. package/src/lib/shared/components/skeleton/skeleton.spec.ts +22 -0
  26. package/src/lib/shared/components/skeleton/skeleton.stories.ts +131 -0
  27. package/src/lib/shared/components/skeleton/skeleton.ts +46 -0
  28. package/types/ngx-opalbytes-components.d.ts +178 -2
@@ -0,0 +1,46 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, computed, input } from '@angular/core';
3
+
4
+ export type CaoSkeletonVariant = 'rect' | 'circle' | 'text';
5
+
6
+ @Component({
7
+ selector: 'cao-skeleton',
8
+ imports: [CommonModule],
9
+ templateUrl: './skeleton.html',
10
+ styleUrl: './skeleton.css',
11
+ })
12
+ export class CaoSkeletonComponent {
13
+ borderRadius = input('14px');
14
+ width = input('100%');
15
+ height = input('100%');
16
+ bgColor = input<string>("#e2e8f0");
17
+ shine = input<string>("#f8fafc");
18
+ variant = input<CaoSkeletonVariant>('rect');
19
+ speed = input<string>('2s');
20
+ size = input<string>();
21
+ animationDeg = input<string>('90deg');
22
+
23
+ skeletonStyles = computed(() => {
24
+ const styles: Record<string, string> = {
25
+ '--skeleton-width': this.size() || this.width(),
26
+ '--skeleton-height': this.size() || this.height(),
27
+ '--skeleton-speed': this.speed(),
28
+ '--skeleton-animation-deg': this.animationDeg(),
29
+ };
30
+
31
+ if (this.bgColor()) {
32
+ styles['--skeleton-bg'] = this.bgColor()!;
33
+ }
34
+
35
+ if (this.shine()) {
36
+ styles['--skeleton-shine'] = this.shine()!;
37
+ }
38
+
39
+ if (this.variant() !== 'circle') {
40
+ styles['--skeleton-radius'] = this.borderRadius();
41
+ }
42
+
43
+
44
+ return styles;
45
+ });
46
+ }
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { OnInit, EventEmitter, OnChanges, OnDestroy, AfterViewInit, ElementRef, TemplateRef, SimpleChanges, ChangeDetectorRef, Signal, AfterContentInit, QueryList, WritableSignal } from '@angular/core';
3
+ import * as _angular_forms from '@angular/forms';
3
4
  import { ControlValueAccessor, AbstractControl, FormControl } from '@angular/forms';
4
5
  import { MatDateRangeInput } from '@angular/material/datepicker';
5
6
  import * as rxjs from 'rxjs';
@@ -460,6 +461,181 @@ declare class CaoKpi {
460
461
  static ɵcmp: i0.ɵɵComponentDeclaration<CaoKpi, "cao-kpi", never, { "kpiData": { "alias": "kpiData"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
461
462
  }
462
463
 
464
+ type CaoSkeletonVariant = 'rect' | 'circle' | 'text';
465
+ declare class CaoSkeletonComponent {
466
+ borderRadius: i0.InputSignal<string>;
467
+ width: i0.InputSignal<string>;
468
+ height: i0.InputSignal<string>;
469
+ bgColor: i0.InputSignal<string>;
470
+ shine: i0.InputSignal<string>;
471
+ variant: i0.InputSignal<CaoSkeletonVariant>;
472
+ speed: i0.InputSignal<string>;
473
+ size: i0.InputSignal<string | undefined>;
474
+ animationDeg: i0.InputSignal<string>;
475
+ skeletonStyles: i0.Signal<Record<string, string>>;
476
+ static ɵfac: i0.ɵɵFactoryDeclaration<CaoSkeletonComponent, never>;
477
+ static ɵcmp: i0.ɵɵComponentDeclaration<CaoSkeletonComponent, "cao-skeleton", never, { "borderRadius": { "alias": "borderRadius"; "required": false; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "bgColor": { "alias": "bgColor"; "required": false; "isSignal": true; }; "shine": { "alias": "shine"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "speed": { "alias": "speed"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "animationDeg": { "alias": "animationDeg"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
478
+ }
479
+
480
+ interface IFormFieldControl<T = any> {
481
+ readonly control: AbstractControl<T> | null | undefined;
482
+ readonly id: string;
483
+ readonly label: string;
484
+ readonly labelInside: boolean;
485
+ readonly disabled: boolean;
486
+ readonly required: boolean;
487
+ }
488
+
489
+ interface IErrorStateMatcher {
490
+ isErrorState(control: AbstractControl | null, formFieldControl: IFormFieldControl | null): boolean;
491
+ }
492
+ declare class ErrorStateMatcher implements IErrorStateMatcher {
493
+ isErrorState(control: AbstractControl | null, formFieldControl: IFormFieldControl | null): boolean;
494
+ }
495
+ declare class ShowOnDirtyErrorStateMatcher implements IErrorStateMatcher {
496
+ isErrorState(control: AbstractControl | null, formFieldControl: IFormFieldControl | null): boolean;
497
+ }
498
+ declare const DEFAULT_ERROR_STATE_MATCHER: ErrorStateMatcher;
499
+
500
+ declare class CaoFormField extends CaoBaseIcon implements IFormFieldControl {
501
+ inputBackground: i0.InputSignal<string | undefined>;
502
+ borderColor: i0.InputSignal<string | undefined>;
503
+ borderWidth: i0.InputSignal<string | undefined>;
504
+ borderRadius: i0.InputSignal<string | undefined>;
505
+ errorColor: i0.InputSignal<string | undefined>;
506
+ labelColor: i0.InputSignal<string | undefined>;
507
+ hintColor: i0.InputSignal<string | undefined>;
508
+ textColor: i0.InputSignal<string | undefined>;
509
+ focusBorderColor: i0.InputSignal<string | undefined>;
510
+ successBorderColor: i0.InputSignal<string | undefined>;
511
+ formFieldStyles: i0.Signal<Record<string, string>>;
512
+ label: string;
513
+ labelInside: boolean;
514
+ hintLabel: string;
515
+ control: AbstractControl | null;
516
+ forId: string;
517
+ errorStateMatcher?: IErrorStateMatcher;
518
+ leadingIcon?: string;
519
+ trailingIcon?: string;
520
+ _isSubmitted: boolean;
521
+ _focused: boolean;
522
+ get id(): string;
523
+ get disabled(): boolean;
524
+ get required(): boolean;
525
+ get floating(): boolean;
526
+ get errorStateActive(): boolean;
527
+ onFocusIn(): void;
528
+ onFocusOut(): void;
529
+ static ɵfac: i0.ɵɵFactoryDeclaration<CaoFormField, never>;
530
+ static ɵcmp: i0.ɵɵComponentDeclaration<CaoFormField, "cao-form-field", never, { "inputBackground": { "alias": "inputBackground"; "required": false; "isSignal": true; }; "borderColor": { "alias": "borderColor"; "required": false; "isSignal": true; }; "borderWidth": { "alias": "borderWidth"; "required": false; "isSignal": true; }; "borderRadius": { "alias": "borderRadius"; "required": false; "isSignal": true; }; "errorColor": { "alias": "errorColor"; "required": false; "isSignal": true; }; "labelColor": { "alias": "labelColor"; "required": false; "isSignal": true; }; "hintColor": { "alias": "hintColor"; "required": false; "isSignal": true; }; "textColor": { "alias": "textColor"; "required": false; "isSignal": true; }; "focusBorderColor": { "alias": "focusBorderColor"; "required": false; "isSignal": true; }; "successBorderColor": { "alias": "successBorderColor"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; }; "labelInside": { "alias": "labelInside"; "required": false; }; "hintLabel": { "alias": "hintLabel"; "required": false; }; "control": { "alias": "control"; "required": false; }; "forId": { "alias": "forId"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "leadingIcon": { "alias": "leadingIcon"; "required": false; }; "trailingIcon": { "alias": "trailingIcon"; "required": false; }; }, {}, never, ["[caoInput]", "cao-input", "input", "select", "textarea", "h2", "*", "cao-hint", "cao-error"], true, never>;
531
+ }
532
+
533
+ declare class CaoHint {
534
+ static ɵfac: i0.ɵɵFactoryDeclaration<CaoHint, never>;
535
+ static ɵcmp: i0.ɵɵComponentDeclaration<CaoHint, "cao-hint", never, {}, {}, never, ["*"], true, never>;
536
+ }
537
+
538
+ declare class CaoError {
539
+ errorStateMatcher?: IErrorStateMatcher;
540
+ private readonly formField;
541
+ get control(): _angular_forms.AbstractControl<any, any, any> | null;
542
+ get hasErrorState(): boolean;
543
+ static ɵfac: i0.ɵɵFactoryDeclaration<CaoError, never>;
544
+ static ɵcmp: i0.ɵɵComponentDeclaration<CaoError, "cao-error", never, { "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; }, {}, never, ["*"], true, never>;
545
+ }
546
+
547
+ type CaoCardVariant = "horizontal" | "square";
548
+ interface ICaoCardBadge {
549
+ label: string;
550
+ color?: string;
551
+ borderColor?: string;
552
+ bg?: string;
553
+ }
554
+ interface ICaoCardMeta {
555
+ icon: string;
556
+ label: string;
557
+ }
558
+ interface ICaoCardAvatar {
559
+ initials?: string;
560
+ src?: string;
561
+ color?: string;
562
+ }
563
+ declare class CaoCardComponent {
564
+ variant: CaoCardVariant;
565
+ title?: string;
566
+ subtitle?: string;
567
+ detail?: string;
568
+ detailColor?: string;
569
+ icon?: string;
570
+ avatar?: ICaoCardAvatar;
571
+ meta?: ICaoCardMeta[];
572
+ badge?: ICaoCardBadge;
573
+ selected: boolean;
574
+ clickable: boolean;
575
+ bgColor: string;
576
+ borderColor: string;
577
+ readonly cardClick: EventEmitter<void>;
578
+ get avatarBg(): string;
579
+ handleClick(): void;
580
+ handleKeydown(event: KeyboardEvent): void;
581
+ static ɵfac: i0.ɵɵFactoryDeclaration<CaoCardComponent, never>;
582
+ static ɵcmp: i0.ɵɵComponentDeclaration<CaoCardComponent, "cao-card", never, { "variant": { "alias": "variant"; "required": false; }; "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "detail": { "alias": "detail"; "required": false; }; "detailColor": { "alias": "detailColor"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "avatar": { "alias": "avatar"; "required": false; }; "meta": { "alias": "meta"; "required": false; }; "badge": { "alias": "badge"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "clickable": { "alias": "clickable"; "required": false; }; "bgColor": { "alias": "bgColor"; "required": false; }; "borderColor": { "alias": "borderColor"; "required": false; }; }, { "cardClick": "cardClick"; }, never, ["*"], true, never>;
583
+ }
584
+
585
+ declare class CaoBaseToggleComponent {
586
+ type: string;
587
+ placeholder: string;
588
+ inputClass: string;
589
+ value: string | number | boolean | Date;
590
+ errorMessage: string;
591
+ isDisabled: boolean;
592
+ maxLength?: number;
593
+ searchMode: boolean;
594
+ showBorder: boolean;
595
+ isLucideIcon: boolean;
596
+ iconColor: string;
597
+ mask?: string;
598
+ control?: AbstractControl | null;
599
+ tooltip: string;
600
+ dataCy?: string;
601
+ textareaRows?: string;
602
+ decimalMarker: "." | "," | [".", ","];
603
+ thousandSeparator: string;
604
+ allowNegativeNumbers: boolean;
605
+ separatorLimit: string;
606
+ set leadingIcon(value: string);
607
+ set trailingIcon(value: string);
608
+ readonly valueChange: EventEmitter<string>;
609
+ readonly searchClick: EventEmitter<void>;
610
+ readonly inputChange: EventEmitter<string>;
611
+ isFocused: boolean;
612
+ icon: boolean;
613
+ _leadingIcon?: string;
614
+ _trailingIcon?: string;
615
+ onChange: any;
616
+ onTouched: any;
617
+ get hasError(): boolean;
618
+ controlName: string;
619
+ get controlNameValue(): string;
620
+ onInput(event: Event): void;
621
+ onInputChange(event: Event): void;
622
+ onFocus(): void;
623
+ onBlur(): void;
624
+ onSearchClick(): void;
625
+ writeValue(value: string | null | undefined): void;
626
+ registerOnChange(fn: any): void;
627
+ registerOnTouched(fn: any): void;
628
+ setDisabledState(isDisabled: boolean): void;
629
+ isChecked: boolean;
630
+ checkedTextPlaceholder: string;
631
+ uncheckedTextPlaceholder: string;
632
+ readonly statusChanged: EventEmitter<CaoBaseToggleComponent>;
633
+ checkboxInput: HTMLInputElement;
634
+ onToggleCheckbox(): void;
635
+ static ɵfac: i0.ɵɵFactoryDeclaration<CaoBaseToggleComponent, never>;
636
+ static ɵcmp: i0.ɵɵComponentDeclaration<CaoBaseToggleComponent, "cao-base-toggle", never, { "type": { "alias": "type"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; "value": { "alias": "value"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "isDisabled": { "alias": "isDisabled"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "searchMode": { "alias": "searchMode"; "required": false; }; "showBorder": { "alias": "showBorder"; "required": false; }; "isLucideIcon": { "alias": "isLucideIcon"; "required": false; }; "iconColor": { "alias": "iconColor"; "required": false; }; "mask": { "alias": "mask"; "required": false; }; "control": { "alias": "control"; "required": false; }; "tooltip": { "alias": "tooltip"; "required": false; }; "dataCy": { "alias": "dataCy"; "required": false; }; "textareaRows": { "alias": "textareaRows"; "required": false; }; "decimalMarker": { "alias": "decimalMarker"; "required": false; }; "thousandSeparator": { "alias": "thousandSeparator"; "required": false; }; "allowNegativeNumbers": { "alias": "allowNegativeNumbers"; "required": false; }; "separatorLimit": { "alias": "separatorLimit"; "required": false; }; "leadingIcon": { "alias": "leadingIcon"; "required": false; }; "trailingIcon": { "alias": "trailingIcon"; "required": false; }; "controlName": { "alias": "controlName"; "required": false; }; "isChecked": { "alias": "isChecked"; "required": false; }; "checkedTextPlaceholder": { "alias": "checkedTextPlaceholder"; "required": false; }; "uncheckedTextPlaceholder": { "alias": "uncheckedTextPlaceholder"; "required": false; }; }, { "valueChange": "valueChange"; "searchClick": "searchClick"; "inputChange": "inputChange"; "statusChanged": "statusChanged"; }, never, never, true, never>;
637
+ }
638
+
463
639
  type ModalType = "validation" | "finger" | "facial" | "clinic" | "graph" | "restriction" | "default";
464
640
  interface IModal {
465
641
  status: boolean;
@@ -852,5 +1028,5 @@ declare class BaseAlertService {
852
1028
  static ɵprov: i0.ɵɵInjectableDeclaration<BaseAlertService>;
853
1029
  }
854
1030
 
855
- export { BaseAlert, BaseAlertService, BaseDialog, BaseDialogService, BaseFilterTablePaginatedService, BaseFilterTableService, BaseModal, BaseModalService, BasePaginationService, BaseTable, BaseTablePaginated, BaseTableService, BaseTimeRange, CaoAutocompleteComponent, CaoBaseButtonComponent, CaoBaseIcon, CaoBaseInput, CaoDropDownComponent, CaoKpi, CaoTabGroup, CaoTabPanel, Footer, LinksButton, Paginator, StepComponent, StepperComponent, TablePaginatedService, TimePicker, getPtBrPaginatorIntlBasePaginated, getPtBrPaginatorIntlBaseTable };
856
- export type { AlertType, CaoTypeInputs, DialogType, IAlertConfig, ICaoAutoCompleteOption, ICaoDropDownOption, ICaoImage, ICaoKPI, ICaoTabChangeEvent, IColumnButton, IColumnConfig, IColumnPaginatedButton, IColumnPaginatedConfig, IDialogConfig, IModal, INavContent, INavLink, ITableConfig, ITablePaginatedConfig, ModalType, ModalTypeClass, ModalTypeSize };
1031
+ export { BaseAlert, BaseAlertService, BaseDialog, BaseDialogService, BaseFilterTablePaginatedService, BaseFilterTableService, BaseModal, BaseModalService, BasePaginationService, BaseTable, BaseTablePaginated, BaseTableService, BaseTimeRange, CaoAutocompleteComponent, CaoBaseButtonComponent, CaoBaseIcon, CaoBaseInput, CaoBaseToggleComponent, CaoCardComponent, CaoDropDownComponent, CaoError, CaoFormField, CaoHint, CaoKpi, CaoSkeletonComponent, CaoTabGroup, CaoTabPanel, DEFAULT_ERROR_STATE_MATCHER, ErrorStateMatcher, Footer, LinksButton, Paginator, ShowOnDirtyErrorStateMatcher, StepComponent, StepperComponent, TablePaginatedService, TimePicker, getPtBrPaginatorIntlBasePaginated, getPtBrPaginatorIntlBaseTable };
1032
+ export type { AlertType, CaoCardVariant, CaoSkeletonVariant, CaoTypeInputs, DialogType, IAlertConfig, ICaoAutoCompleteOption, ICaoCardAvatar, ICaoCardBadge, ICaoCardMeta, ICaoDropDownOption, ICaoImage, ICaoKPI, ICaoTabChangeEvent, IColumnButton, IColumnConfig, IColumnPaginatedButton, IColumnPaginatedConfig, IDialogConfig, IErrorStateMatcher, IFormFieldControl, IModal, INavContent, INavLink, ITableConfig, ITablePaginatedConfig, ModalType, ModalTypeClass, ModalTypeSize };