@lesterarte/sefin-ui 0.0.3-dev.0 → 0.0.3-dev.10

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.
@@ -1,6 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter } from '@angular/core';
3
- import { ControlValueAccessor } from '@angular/forms';
2
+ import { EventEmitter, OnInit, OnDestroy, OnChanges, ElementRef, SimpleChanges } from '@angular/core';
4
3
 
5
4
  /**
6
5
  * Color design tokens as TypeScript constants
@@ -437,6 +436,124 @@ declare const BRAND_THEME: {
437
436
 
438
437
  type Theme = 'light' | 'dark' | 'brand';
439
438
 
439
+ /**
440
+ * Shared types and interfaces
441
+ */
442
+ type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
443
+ type ButtonSize = 'sm' | 'md' | 'lg';
444
+ type InputSize = 'sm' | 'md' | 'lg';
445
+ type CardVariant = 'default' | 'elevated' | 'outlined';
446
+ interface BaseComponent {
447
+ disabled?: boolean;
448
+ class?: string;
449
+ }
450
+ /**
451
+ * Theme color configuration
452
+ */
453
+ interface ThemeColors {
454
+ primary: string;
455
+ 'primary-dark'?: string;
456
+ 'primary-light'?: string;
457
+ secondary: string;
458
+ 'secondary-dark'?: string;
459
+ 'secondary-light'?: string;
460
+ background: string;
461
+ 'background-elevated'?: string;
462
+ surface: string;
463
+ 'surface-hover'?: string;
464
+ text: string;
465
+ 'text-secondary'?: string;
466
+ 'text-disabled'?: string;
467
+ border: string;
468
+ 'border-focus'?: string;
469
+ success?: string;
470
+ warning?: string;
471
+ error?: string;
472
+ info?: string;
473
+ [key: string]: string | undefined;
474
+ }
475
+ /**
476
+ * Custom theme configuration interface
477
+ * Allows users to create their own themes with custom colors, typography, spacing, etc.
478
+ * Supports both single theme and light/dark variants.
479
+ */
480
+ interface CustomTheme {
481
+ name: string;
482
+ colors: ThemeColors;
483
+ /**
484
+ * Optional light and dark variants for the theme
485
+ * If provided, allows switching between light and dark modes
486
+ */
487
+ variants?: {
488
+ light?: ThemeColors;
489
+ dark?: ThemeColors;
490
+ };
491
+ typography?: {
492
+ fontFamily?: {
493
+ base?: string;
494
+ mono?: string;
495
+ [key: string]: string | undefined;
496
+ };
497
+ fontSize?: {
498
+ xs?: string;
499
+ sm?: string;
500
+ base?: string;
501
+ lg?: string;
502
+ xl?: string;
503
+ '2xl'?: string;
504
+ '3xl'?: string;
505
+ '4xl'?: string;
506
+ '5xl'?: string;
507
+ [key: string]: string | undefined;
508
+ };
509
+ fontWeight?: {
510
+ light?: number;
511
+ normal?: number;
512
+ medium?: number;
513
+ semibold?: number;
514
+ bold?: number;
515
+ [key: string]: number | undefined;
516
+ };
517
+ lineHeight?: {
518
+ tight?: number;
519
+ normal?: number;
520
+ relaxed?: number;
521
+ [key: string]: number | undefined;
522
+ };
523
+ };
524
+ spacing?: {
525
+ xs?: string;
526
+ sm?: string;
527
+ md?: string;
528
+ lg?: string;
529
+ xl?: string;
530
+ '2xl'?: string;
531
+ '3xl'?: string;
532
+ '4xl'?: string;
533
+ '5xl'?: string;
534
+ [key: string]: string | undefined;
535
+ };
536
+ borderRadius?: {
537
+ none?: string;
538
+ sm?: string;
539
+ md?: string;
540
+ lg?: string;
541
+ xl?: string;
542
+ '2xl'?: string;
543
+ full?: string;
544
+ [key: string]: string | undefined;
545
+ };
546
+ shadow?: {
547
+ none?: string;
548
+ sm?: string;
549
+ md?: string;
550
+ lg?: string;
551
+ xl?: string;
552
+ '2xl'?: string;
553
+ [key: string]: string | undefined;
554
+ };
555
+ }
556
+
440
557
  /**
441
558
  * Theme loader utility
442
559
  * Generates CSS variables from design tokens
@@ -444,28 +561,26 @@ type Theme = 'light' | 'dark' | 'brand';
444
561
  declare class ThemeLoader {
445
562
  /**
446
563
  * Load a theme and apply it to the document root
564
+ * @param themeName - Predefined theme name ('light', 'dark', 'brand') or a CustomTheme object
565
+ * @param variant - Optional variant ('light' or 'dark') for CustomTheme with variants support
566
+ */
567
+ static loadTheme(themeName?: Theme | CustomTheme, variant?: 'light' | 'dark'): void;
568
+ /**
569
+ * Load a custom theme variant (light or dark)
570
+ * @param customTheme - CustomTheme object with variants support
571
+ * @param variant - Variant to load ('light' or 'dark')
447
572
  */
448
- static loadTheme(themeName?: Theme): void;
573
+ static loadThemeVariant(customTheme: CustomTheme, variant: 'light' | 'dark'): void;
449
574
  /**
450
575
  * Get theme configuration by name
451
576
  */
452
577
  private static getTheme;
453
578
  /**
454
579
  * Get all CSS variables as a string (useful for SSR or static generation)
580
+ * @param themeName - Predefined theme name ('light', 'dark', 'brand') or a CustomTheme object
581
+ * @param variant - Optional variant ('light' or 'dark') for CustomTheme with variants support
455
582
  */
456
- static getThemeCSS(themeName?: Theme): string;
457
- }
458
-
459
- /**
460
- * Shared types and interfaces
461
- */
462
- type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
463
- type ButtonSize = 'sm' | 'md' | 'lg';
464
- type InputSize = 'sm' | 'md' | 'lg';
465
- type CardVariant = 'default' | 'elevated' | 'outlined';
466
- interface BaseComponent {
467
- disabled?: boolean;
468
- class?: string;
583
+ static getThemeCSS(themeName?: Theme | CustomTheme, variant?: 'light' | 'dark'): string;
469
584
  }
470
585
 
471
586
  declare class ButtonComponent {
@@ -481,125 +596,49 @@ declare class ButtonComponent {
481
596
  static ɵcmp: i0.ɵɵComponentDeclaration<ButtonComponent, "sefin-button", never, { "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "type": { "alias": "type"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "clicked": "clicked"; }, never, ["*"], true, never>;
482
597
  }
483
598
 
484
- declare class IconComponent {
485
- name: string;
486
- size: 'sm' | 'md' | 'lg';
487
- class: string;
488
- get iconClasses(): string;
489
- static ɵfac: i0.ɵɵFactoryDeclaration<IconComponent, never>;
490
- static ɵcmp: i0.ɵɵComponentDeclaration<IconComponent, "sefin-icon", never, { "name": { "alias": "name"; "required": false; }; "size": { "alias": "size"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
491
- }
492
-
493
- declare class InputComponent implements ControlValueAccessor {
494
- type: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url';
495
- placeholder: string;
496
- size: InputSize;
497
- disabled: boolean;
498
- required: boolean;
499
- readonly: boolean;
500
- class: string;
501
- id: string;
502
- blur: EventEmitter<FocusEvent>;
503
- focus: EventEmitter<FocusEvent>;
504
- value: string;
505
- private onChange;
506
- private onTouched;
507
- onInput(event: Event): void;
508
- onBlur(event: FocusEvent): void;
509
- onFocus(event: FocusEvent): void;
510
- writeValue(value: string): void;
511
- registerOnChange(fn: (value: string) => void): void;
512
- registerOnTouched(fn: () => void): void;
513
- setDisabledState(isDisabled: boolean): void;
514
- get inputClasses(): string;
515
- static ɵfac: i0.ɵɵFactoryDeclaration<InputComponent, never>;
516
- static ɵcmp: i0.ɵɵComponentDeclaration<InputComponent, "sefin-input", never, { "type": { "alias": "type"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "class": { "alias": "class"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, { "blur": "blur"; "focus": "focus"; }, never, never, true, never>;
517
- }
518
-
519
- declare class FormFieldComponent {
599
+ interface AutocompleteOption {
600
+ value: string | number;
520
601
  label: string;
521
- hint: string;
522
- error: string;
523
- required: boolean;
524
- disabled: boolean;
525
- inputId: string;
526
- inputType: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url';
527
- placeholder: string;
528
- size: 'sm' | 'md' | 'lg';
529
- static ɵfac: i0.ɵɵFactoryDeclaration<FormFieldComponent, never>;
530
- static ɵcmp: i0.ɵɵComponentDeclaration<FormFieldComponent, "sefin-form-field", never, { "label": { "alias": "label"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "error": { "alias": "error"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "inputType": { "alias": "inputType"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "size": { "alias": "size"; "required": false; }; }, {}, never, never, true, never>;
531
- }
532
-
533
- interface DropdownOption {
534
- label: string;
535
- value: any;
536
602
  disabled?: boolean;
537
603
  }
538
- declare class DropdownComponent {
539
- options: DropdownOption[];
604
+ declare class AutocompleteComponent implements OnInit, OnDestroy, OnChanges {
605
+ inputRef?: ElementRef<HTMLInputElement>;
606
+ dropdownRef?: ElementRef<HTMLDivElement>;
607
+ containerRef?: ElementRef<HTMLDivElement>;
608
+ options: AutocompleteOption[];
540
609
  placeholder: string;
541
610
  disabled: boolean;
542
- size: 'sm' | 'md' | 'lg';
543
- selectionChange: EventEmitter<any>;
544
- isOpen: boolean;
545
- selectedOption: DropdownOption | null;
546
- toggle(): void;
547
- selectOption(option: DropdownOption): void;
548
- get displayText(): string;
549
- static ɵfac: i0.ɵɵFactoryDeclaration<DropdownComponent, never>;
550
- static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "sefin-dropdown", never, { "options": { "alias": "options"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "size": { "alias": "size"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
551
- }
552
-
553
- declare class CardComponent {
554
- variant: CardVariant;
611
+ size: InputSize;
555
612
  class: string;
556
- get cardClasses(): string;
557
- static ɵfac: i0.ɵɵFactoryDeclaration<CardComponent, never>;
558
- static ɵcmp: i0.ɵɵComponentDeclaration<CardComponent, "sefin-card", never, { "variant": { "alias": "variant"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
559
- }
560
-
561
- declare class HeaderComponent {
562
- title: string;
563
- logo: string;
564
- showUserMenu: boolean;
565
- userName: string;
566
- logoClick: EventEmitter<void>;
567
- menuClick: EventEmitter<void>;
568
- userMenuClick: EventEmitter<void>;
569
- static ɵfac: i0.ɵɵFactoryDeclaration<HeaderComponent, never>;
570
- static ɵcmp: i0.ɵɵComponentDeclaration<HeaderComponent, "sefin-header", never, { "title": { "alias": "title"; "required": false; }; "logo": { "alias": "logo"; "required": false; }; "showUserMenu": { "alias": "showUserMenu"; "required": false; }; "userName": { "alias": "userName"; "required": false; }; }, { "logoClick": "logoClick"; "menuClick": "menuClick"; "userMenuClick": "userMenuClick"; }, never, never, true, never>;
571
- }
572
-
573
- interface LoginCredentials {
574
- email: string;
575
- password: string;
576
- }
577
- declare class LoginFormComponent {
578
- email: string;
579
- password: string;
580
- error: string;
581
- submit: EventEmitter<LoginCredentials>;
582
- onSubmit(): void;
583
- static ɵfac: i0.ɵɵFactoryDeclaration<LoginFormComponent, never>;
584
- static ɵcmp: i0.ɵɵComponentDeclaration<LoginFormComponent, "sefin-login-form", never, {}, { "submit": "submit"; }, never, never, true, never>;
585
- }
586
-
587
- interface ToolbarAction {
588
- label: string;
589
- icon?: string;
590
- variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
591
- action: () => void;
592
- }
593
- declare class ToolbarComponent {
594
- title: string;
595
- actions: ToolbarAction[];
596
- actionClick: EventEmitter<ToolbarAction>;
597
- onActionClick(action: ToolbarAction): void;
598
- static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarComponent, never>;
599
- static ɵcmp: i0.ɵɵComponentDeclaration<ToolbarComponent, "sefin-toolbar", never, { "title": { "alias": "title"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; }, { "actionClick": "actionClick"; }, never, never, true, never>;
613
+ value: string | number | null;
614
+ minChars: number;
615
+ maxResults: number;
616
+ valueChange: EventEmitter<string | number>;
617
+ optionSelected: EventEmitter<AutocompleteOption>;
618
+ inputChange: EventEmitter<string>;
619
+ searchText: string;
620
+ filteredOptions: AutocompleteOption[];
621
+ isOpen: boolean;
622
+ selectedIndex: number;
623
+ ngOnInit(): void;
624
+ ngOnChanges(changes: SimpleChanges): void;
625
+ ngOnDestroy(): void;
626
+ onClickOutside(event: MouseEvent): void;
627
+ onInputChange(value: string): void;
628
+ filterOptions(): void;
629
+ selectOption(option: AutocompleteOption): void;
630
+ onInputFocus(): void;
631
+ onInputBlur(): void;
632
+ onKeyDown(event: KeyboardEvent): void;
633
+ private scrollToSelected;
634
+ clearValue(): void;
635
+ get inputClasses(): string;
636
+ get containerClasses(): string;
637
+ static ɵfac: i0.ɵɵFactoryDeclaration<AutocompleteComponent, never>;
638
+ static ɵcmp: i0.ɵɵComponentDeclaration<AutocompleteComponent, "sefin-autocomplete", never, { "options": { "alias": "options"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "size": { "alias": "size"; "required": false; }; "class": { "alias": "class"; "required": false; }; "value": { "alias": "value"; "required": false; }; "minChars": { "alias": "minChars"; "required": false; }; "maxResults": { "alias": "maxResults"; "required": false; }; }, { "valueChange": "valueChange"; "optionSelected": "optionSelected"; "inputChange": "inputChange"; }, never, never, true, never>;
600
639
  }
601
640
 
602
641
  declare const STYLES_PATH = "./styles/index.scss";
603
642
 
604
- export { BORDER_RADIUS_TOKENS, BRAND_THEME, ButtonComponent, COLOR_TOKENS, CardComponent, DARK_THEME, DESIGN_TOKENS, DropdownComponent, FormFieldComponent, HeaderComponent, IconComponent, InputComponent, LIGHT_THEME, LoginFormComponent, SHADOW_TOKENS, SPACING_TOKENS, STYLES_PATH, TYPOGRAPHY_TOKENS, ThemeLoader, ToolbarComponent };
605
- export type { BaseComponent, BorderRadiusToken, ButtonSize, ButtonVariant, CardVariant, ColorShade, ColorTokenName, DropdownOption, InputSize, LoginCredentials, ShadowToken, SpacingToken, Theme, ToolbarAction, TypographyToken };
643
+ export { AutocompleteComponent, BORDER_RADIUS_TOKENS, BRAND_THEME, ButtonComponent, COLOR_TOKENS, DARK_THEME, DESIGN_TOKENS, LIGHT_THEME, SHADOW_TOKENS, SPACING_TOKENS, STYLES_PATH, TYPOGRAPHY_TOKENS, ThemeLoader };
644
+ export type { AutocompleteOption, BaseComponent, BorderRadiusToken, ButtonSize, ButtonVariant, CardVariant, ColorShade, ColorTokenName, CustomTheme, InputSize, ShadowToken, SpacingToken, Theme, ThemeColors, TypographyToken };