@lesterarte/sefin-ui 0.0.3 → 0.0.4
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.
- package/README.md +70 -5
- package/fesm2022/lesterarte-sefin-ui.mjs +971 -222
- package/fesm2022/lesterarte-sefin-ui.mjs.map +1 -1
- package/package.json +2 -5
- package/types/lesterarte-sefin-ui.d.ts +324 -108
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Output, Input, ChangeDetectionStrategy, Component, forwardRef } from '@angular/core';
|
|
2
|
+
import { EventEmitter, Output, Input, ChangeDetectionStrategy, Component, HostListener, ViewChild, forwardRef } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
@@ -341,41 +341,107 @@ const BRAND_THEME = {
|
|
|
341
341
|
class ThemeLoader {
|
|
342
342
|
/**
|
|
343
343
|
* Load a theme and apply it to the document root
|
|
344
|
+
* @param themeName - Predefined theme name ('light', 'dark', 'brand') or a CustomTheme object
|
|
345
|
+
* @param variant - Optional variant ('light' or 'dark') for CustomTheme with variants support
|
|
344
346
|
*/
|
|
345
|
-
static loadTheme(themeName = 'light') {
|
|
346
|
-
|
|
347
|
+
static loadTheme(themeName = 'light', variant) {
|
|
348
|
+
let theme;
|
|
349
|
+
let colors;
|
|
350
|
+
if (typeof themeName === 'string') {
|
|
351
|
+
theme = this.getTheme(themeName);
|
|
352
|
+
colors = theme.colors;
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
theme = themeName;
|
|
356
|
+
// If variant is specified and theme has variants, use variant colors
|
|
357
|
+
if (variant && theme.variants) {
|
|
358
|
+
const variantColors = theme.variants[variant];
|
|
359
|
+
if (variantColors) {
|
|
360
|
+
colors = variantColors;
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
// Fallback to base colors if variant doesn't exist
|
|
364
|
+
colors = theme.colors;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
// Use base colors if no variant specified or no variants defined
|
|
369
|
+
colors = theme.colors;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
347
372
|
const root = document.documentElement;
|
|
348
373
|
// Apply color tokens
|
|
349
|
-
Object.entries(
|
|
350
|
-
|
|
374
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
375
|
+
if (value) {
|
|
376
|
+
root.style.setProperty(`--sefin-color-${key}`, value);
|
|
377
|
+
}
|
|
351
378
|
});
|
|
352
|
-
// Apply spacing tokens
|
|
353
|
-
|
|
379
|
+
// Apply spacing tokens (use custom if provided, otherwise use defaults)
|
|
380
|
+
const spacingTokens = typeof themeName === 'object' && themeName.spacing
|
|
381
|
+
? { ...SPACING_TOKENS, ...themeName.spacing }
|
|
382
|
+
: SPACING_TOKENS;
|
|
383
|
+
Object.entries(spacingTokens).forEach(([key, value]) => {
|
|
354
384
|
root.style.setProperty(`--sefin-spacing-${key}`, value);
|
|
355
385
|
});
|
|
356
|
-
// Apply typography tokens
|
|
357
|
-
|
|
386
|
+
// Apply typography tokens (use custom if provided, otherwise use defaults)
|
|
387
|
+
const typographyTokens = typeof themeName === 'object' && themeName.typography
|
|
388
|
+
? {
|
|
389
|
+
fontFamily: { ...TYPOGRAPHY_TOKENS.fontFamily, ...themeName.typography.fontFamily },
|
|
390
|
+
fontSize: { ...TYPOGRAPHY_TOKENS.fontSize, ...themeName.typography.fontSize },
|
|
391
|
+
fontWeight: { ...TYPOGRAPHY_TOKENS.fontWeight, ...themeName.typography.fontWeight },
|
|
392
|
+
lineHeight: { ...TYPOGRAPHY_TOKENS.lineHeight, ...themeName.typography.lineHeight },
|
|
393
|
+
}
|
|
394
|
+
: TYPOGRAPHY_TOKENS;
|
|
395
|
+
Object.entries(typographyTokens.fontFamily).forEach(([key, value]) => {
|
|
358
396
|
root.style.setProperty(`--sefin-font-family-${key}`, value);
|
|
359
397
|
});
|
|
360
|
-
Object.entries(
|
|
398
|
+
Object.entries(typographyTokens.fontSize).forEach(([key, value]) => {
|
|
361
399
|
root.style.setProperty(`--sefin-font-size-${key}`, value);
|
|
362
400
|
});
|
|
363
|
-
Object.entries(
|
|
401
|
+
Object.entries(typographyTokens.fontWeight).forEach(([key, value]) => {
|
|
364
402
|
root.style.setProperty(`--sefin-font-weight-${key}`, String(value));
|
|
365
403
|
});
|
|
366
|
-
Object.entries(
|
|
404
|
+
Object.entries(typographyTokens.lineHeight).forEach(([key, value]) => {
|
|
367
405
|
root.style.setProperty(`--sefin-line-height-${key}`, String(value));
|
|
368
406
|
});
|
|
369
|
-
// Apply border radius tokens
|
|
370
|
-
|
|
407
|
+
// Apply border radius tokens (use custom if provided, otherwise use defaults)
|
|
408
|
+
const borderRadiusTokens = typeof themeName === 'object' && themeName.borderRadius
|
|
409
|
+
? { ...BORDER_RADIUS_TOKENS, ...themeName.borderRadius }
|
|
410
|
+
: BORDER_RADIUS_TOKENS;
|
|
411
|
+
Object.entries(borderRadiusTokens).forEach(([key, value]) => {
|
|
371
412
|
root.style.setProperty(`--sefin-radius-${key}`, value);
|
|
372
413
|
});
|
|
373
|
-
// Apply shadow tokens
|
|
374
|
-
|
|
414
|
+
// Apply shadow tokens (use custom if provided, otherwise use defaults)
|
|
415
|
+
const shadowTokens = typeof themeName === 'object' && themeName.shadow
|
|
416
|
+
? { ...SHADOW_TOKENS, ...themeName.shadow }
|
|
417
|
+
: SHADOW_TOKENS;
|
|
418
|
+
Object.entries(shadowTokens).forEach(([key, value]) => {
|
|
375
419
|
root.style.setProperty(`--sefin-shadow-${key}`, value);
|
|
376
420
|
});
|
|
377
421
|
// Set theme attribute for CSS selectors
|
|
378
|
-
|
|
422
|
+
let themeAttribute;
|
|
423
|
+
if (typeof themeName === 'string') {
|
|
424
|
+
themeAttribute = themeName;
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
themeAttribute = variant
|
|
428
|
+
? `${themeName.name}-${variant}`
|
|
429
|
+
: themeName.name;
|
|
430
|
+
}
|
|
431
|
+
root.setAttribute('data-theme', themeAttribute);
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Load a custom theme variant (light or dark)
|
|
435
|
+
* @param customTheme - CustomTheme object with variants support
|
|
436
|
+
* @param variant - Variant to load ('light' or 'dark')
|
|
437
|
+
*/
|
|
438
|
+
static loadThemeVariant(customTheme, variant) {
|
|
439
|
+
if (!customTheme.variants) {
|
|
440
|
+
console.warn(`Theme "${customTheme.name}" does not have variants. Loading base theme.`);
|
|
441
|
+
this.loadTheme(customTheme);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
this.loadTheme(customTheme, variant);
|
|
379
445
|
}
|
|
380
446
|
/**
|
|
381
447
|
* Get theme configuration by name
|
|
@@ -393,37 +459,79 @@ class ThemeLoader {
|
|
|
393
459
|
}
|
|
394
460
|
/**
|
|
395
461
|
* Get all CSS variables as a string (useful for SSR or static generation)
|
|
462
|
+
* @param themeName - Predefined theme name ('light', 'dark', 'brand') or a CustomTheme object
|
|
463
|
+
* @param variant - Optional variant ('light' or 'dark') for CustomTheme with variants support
|
|
396
464
|
*/
|
|
397
|
-
static getThemeCSS(themeName = 'light') {
|
|
398
|
-
|
|
465
|
+
static getThemeCSS(themeName = 'light', variant) {
|
|
466
|
+
let theme;
|
|
467
|
+
let colors;
|
|
468
|
+
if (typeof themeName === 'string') {
|
|
469
|
+
theme = this.getTheme(themeName);
|
|
470
|
+
colors = theme.colors;
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
theme = themeName;
|
|
474
|
+
// If variant is specified and theme has variants, use variant colors
|
|
475
|
+
if (variant && theme.variants) {
|
|
476
|
+
const variantColors = theme.variants[variant];
|
|
477
|
+
if (variantColors) {
|
|
478
|
+
colors = variantColors;
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
colors = theme.colors;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
colors = theme.colors;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
399
488
|
let css = ':root {\n';
|
|
400
489
|
// Color tokens
|
|
401
|
-
Object.entries(
|
|
402
|
-
|
|
490
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
491
|
+
if (value) {
|
|
492
|
+
css += ` --sefin-color-${key}: ${value};\n`;
|
|
493
|
+
}
|
|
403
494
|
});
|
|
404
495
|
// Spacing tokens
|
|
405
|
-
|
|
496
|
+
const spacingTokens = typeof themeName === 'object' && themeName.spacing
|
|
497
|
+
? { ...SPACING_TOKENS, ...themeName.spacing }
|
|
498
|
+
: SPACING_TOKENS;
|
|
499
|
+
Object.entries(spacingTokens).forEach(([key, value]) => {
|
|
406
500
|
css += ` --sefin-spacing-${key}: ${value};\n`;
|
|
407
501
|
});
|
|
408
502
|
// Typography tokens
|
|
409
|
-
|
|
503
|
+
const typographyTokens = typeof themeName === 'object' && themeName.typography
|
|
504
|
+
? {
|
|
505
|
+
fontFamily: { ...TYPOGRAPHY_TOKENS.fontFamily, ...themeName.typography.fontFamily },
|
|
506
|
+
fontSize: { ...TYPOGRAPHY_TOKENS.fontSize, ...themeName.typography.fontSize },
|
|
507
|
+
fontWeight: { ...TYPOGRAPHY_TOKENS.fontWeight, ...themeName.typography.fontWeight },
|
|
508
|
+
lineHeight: { ...TYPOGRAPHY_TOKENS.lineHeight, ...themeName.typography.lineHeight },
|
|
509
|
+
}
|
|
510
|
+
: TYPOGRAPHY_TOKENS;
|
|
511
|
+
Object.entries(typographyTokens.fontFamily).forEach(([key, value]) => {
|
|
410
512
|
css += ` --sefin-font-family-${key}: ${value};\n`;
|
|
411
513
|
});
|
|
412
|
-
Object.entries(
|
|
514
|
+
Object.entries(typographyTokens.fontSize).forEach(([key, value]) => {
|
|
413
515
|
css += ` --sefin-font-size-${key}: ${value};\n`;
|
|
414
516
|
});
|
|
415
|
-
Object.entries(
|
|
517
|
+
Object.entries(typographyTokens.fontWeight).forEach(([key, value]) => {
|
|
416
518
|
css += ` --sefin-font-weight-${key}: ${value};\n`;
|
|
417
519
|
});
|
|
418
|
-
Object.entries(
|
|
520
|
+
Object.entries(typographyTokens.lineHeight).forEach(([key, value]) => {
|
|
419
521
|
css += ` --sefin-line-height-${key}: ${value};\n`;
|
|
420
522
|
});
|
|
421
523
|
// Border radius tokens
|
|
422
|
-
|
|
524
|
+
const borderRadiusTokens = typeof themeName === 'object' && themeName.borderRadius
|
|
525
|
+
? { ...BORDER_RADIUS_TOKENS, ...themeName.borderRadius }
|
|
526
|
+
: BORDER_RADIUS_TOKENS;
|
|
527
|
+
Object.entries(borderRadiusTokens).forEach(([key, value]) => {
|
|
423
528
|
css += ` --sefin-radius-${key}: ${value};\n`;
|
|
424
529
|
});
|
|
425
530
|
// Shadow tokens
|
|
426
|
-
|
|
531
|
+
const shadowTokens = typeof themeName === 'object' && themeName.shadow
|
|
532
|
+
? { ...SHADOW_TOKENS, ...themeName.shadow }
|
|
533
|
+
: SHADOW_TOKENS;
|
|
534
|
+
Object.entries(shadowTokens).forEach(([key, value]) => {
|
|
427
535
|
css += ` --sefin-shadow-${key}: ${value};\n`;
|
|
428
536
|
});
|
|
429
537
|
css += '}\n';
|
|
@@ -444,10 +552,15 @@ class ThemeLoader {
|
|
|
444
552
|
*/
|
|
445
553
|
|
|
446
554
|
class ButtonComponent {
|
|
555
|
+
/** Button variant style. Options: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' */
|
|
447
556
|
variant = 'primary';
|
|
557
|
+
/** Button size. Options: 'sm' | 'md' | 'lg' */
|
|
448
558
|
size = 'md';
|
|
559
|
+
/** Whether the button is disabled */
|
|
449
560
|
disabled = false;
|
|
561
|
+
/** Button type. Options: 'button' | 'submit' | 'reset' */
|
|
450
562
|
type = 'button';
|
|
563
|
+
/** Additional CSS classes */
|
|
451
564
|
class = '';
|
|
452
565
|
clicked = new EventEmitter();
|
|
453
566
|
onClick(event) {
|
|
@@ -467,11 +580,11 @@ class ButtonComponent {
|
|
|
467
580
|
.join(' ');
|
|
468
581
|
}
|
|
469
582
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
470
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: ButtonComponent, isStandalone: true, selector: "sefin-button", inputs: { variant: "variant", size: "size", disabled: "disabled", type: "type", class: "class" }, outputs: { clicked: "clicked" }, ngImport: i0, template: "<button [type]=\"type\" [disabled]=\"disabled\" [class]=\"buttonClasses\" (click)=\"onClick($event)\">\n <ng-content></ng-content>\n</button>\n", styles: [".sefin-button{display:inline-flex;align-items:center;justify-content:center;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-medium
|
|
583
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: ButtonComponent, isStandalone: true, selector: "sefin-button", inputs: { variant: "variant", size: "size", disabled: "disabled", type: "type", class: "class" }, outputs: { clicked: "clicked" }, ngImport: i0, template: "<button [type]=\"type\" [disabled]=\"disabled\" [class]=\"buttonClasses\" (click)=\"onClick($event)\">\n <ng-content></ng-content>\n</button>\n", styles: [".sefin-button{display:inline-flex;align-items:center;justify-content:center;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-medium);line-height:var(--sefin-line-height-normal);border-radius:var(--sefin-radius-md);transition:all .2s ease-in-out;cursor:pointer;outline:none;border:1px solid transparent}.sefin-button:focus-visible{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-button--sm{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);font-size:var(--sefin-font-size-sm);line-height:var(--sefin-line-height-normal);min-height:32px}.sefin-button--md{padding:var(--sefin-spacing-md) var(--sefin-spacing-lg);font-size:var(--sefin-font-size-base);line-height:var(--sefin-line-height-normal);min-height:40px}.sefin-button--lg{padding:var(--sefin-spacing-lg) var(--sefin-spacing-xl);font-size:var(--sefin-font-size-lg);line-height:var(--sefin-line-height-normal);min-height:48px}.sefin-button--primary{background-color:var(--sefin-color-primary);color:#fff}.sefin-button--primary:hover:not(:disabled){background-color:var(--sefin-color-primary-dark)}.sefin-button--primary:active:not(:disabled){transform:translateY(1px)}.sefin-button--secondary{background-color:var(--sefin-color-secondary);color:#fff}.sefin-button--secondary:hover:not(:disabled){background-color:var(--sefin-color-secondary-dark)}.sefin-button--secondary:active:not(:disabled){transform:translateY(1px)}.sefin-button--outline{background-color:transparent;color:var(--sefin-color-primary);border-color:var(--sefin-color-primary)}.sefin-button--outline:hover:not(:disabled){background-color:var(--sefin-color-primary);color:#fff}.sefin-button--ghost{background-color:transparent;color:var(--sefin-color-primary)}.sefin-button--ghost:hover:not(:disabled){background-color:var(--sefin-color-surface-hover)}.sefin-button--danger{background-color:var(--sefin-color-error);color:#fff}.sefin-button--danger:hover:not(:disabled){background-color:var(--sefin-color-error);opacity:.9}.sefin-button--disabled{opacity:.6;cursor:not-allowed;pointer-events:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
471
584
|
}
|
|
472
585
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
473
586
|
type: Component,
|
|
474
|
-
args: [{ selector: 'sefin-button', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button [type]=\"type\" [disabled]=\"disabled\" [class]=\"buttonClasses\" (click)=\"onClick($event)\">\n <ng-content></ng-content>\n</button>\n", styles: [".sefin-button{display:inline-flex;align-items:center;justify-content:center;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-medium
|
|
587
|
+
args: [{ selector: 'sefin-button', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button [type]=\"type\" [disabled]=\"disabled\" [class]=\"buttonClasses\" (click)=\"onClick($event)\">\n <ng-content></ng-content>\n</button>\n", styles: [".sefin-button{display:inline-flex;align-items:center;justify-content:center;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-medium);line-height:var(--sefin-line-height-normal);border-radius:var(--sefin-radius-md);transition:all .2s ease-in-out;cursor:pointer;outline:none;border:1px solid transparent}.sefin-button:focus-visible{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-button--sm{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);font-size:var(--sefin-font-size-sm);line-height:var(--sefin-line-height-normal);min-height:32px}.sefin-button--md{padding:var(--sefin-spacing-md) var(--sefin-spacing-lg);font-size:var(--sefin-font-size-base);line-height:var(--sefin-line-height-normal);min-height:40px}.sefin-button--lg{padding:var(--sefin-spacing-lg) var(--sefin-spacing-xl);font-size:var(--sefin-font-size-lg);line-height:var(--sefin-line-height-normal);min-height:48px}.sefin-button--primary{background-color:var(--sefin-color-primary);color:#fff}.sefin-button--primary:hover:not(:disabled){background-color:var(--sefin-color-primary-dark)}.sefin-button--primary:active:not(:disabled){transform:translateY(1px)}.sefin-button--secondary{background-color:var(--sefin-color-secondary);color:#fff}.sefin-button--secondary:hover:not(:disabled){background-color:var(--sefin-color-secondary-dark)}.sefin-button--secondary:active:not(:disabled){transform:translateY(1px)}.sefin-button--outline{background-color:transparent;color:var(--sefin-color-primary);border-color:var(--sefin-color-primary)}.sefin-button--outline:hover:not(:disabled){background-color:var(--sefin-color-primary);color:#fff}.sefin-button--ghost{background-color:transparent;color:var(--sefin-color-primary)}.sefin-button--ghost:hover:not(:disabled){background-color:var(--sefin-color-surface-hover)}.sefin-button--danger{background-color:var(--sefin-color-error);color:#fff}.sefin-button--danger:hover:not(:disabled){background-color:var(--sefin-color-error);opacity:.9}.sefin-button--disabled{opacity:.6;cursor:not-allowed;pointer-events:none}\n"] }]
|
|
475
588
|
}], propDecorators: { variant: [{
|
|
476
589
|
type: Input
|
|
477
590
|
}], size: [{
|
|
@@ -486,61 +599,481 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
486
599
|
type: Output
|
|
487
600
|
}] } });
|
|
488
601
|
|
|
489
|
-
class
|
|
490
|
-
|
|
602
|
+
class IconButtonComponent {
|
|
603
|
+
/** Button variant style. Options: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' */
|
|
604
|
+
variant = 'primary';
|
|
605
|
+
/** Button size. Options: 'sm' | 'md' | 'lg' */
|
|
606
|
+
size = 'md';
|
|
607
|
+
/** Whether the button is disabled */
|
|
608
|
+
disabled = false;
|
|
609
|
+
/** Button type. Options: 'button' | 'submit' | 'reset' */
|
|
610
|
+
type = 'button';
|
|
611
|
+
/** Additional CSS classes */
|
|
612
|
+
class = '';
|
|
613
|
+
/** Accessibility label for the button */
|
|
614
|
+
ariaLabel = '';
|
|
615
|
+
/** Whether the button should be rounded (circular) */
|
|
616
|
+
rounded = false;
|
|
617
|
+
clicked = new EventEmitter();
|
|
618
|
+
onClick(event) {
|
|
619
|
+
if (!this.disabled) {
|
|
620
|
+
this.clicked.emit(event);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
get buttonClasses() {
|
|
624
|
+
return [
|
|
625
|
+
'sefin-icon-button',
|
|
626
|
+
`sefin-icon-button--${this.variant}`,
|
|
627
|
+
`sefin-icon-button--${this.size}`,
|
|
628
|
+
this.disabled ? 'sefin-icon-button--disabled' : '',
|
|
629
|
+
this.rounded ? 'sefin-icon-button--rounded' : '',
|
|
630
|
+
this.class,
|
|
631
|
+
]
|
|
632
|
+
.filter(Boolean)
|
|
633
|
+
.join(' ');
|
|
634
|
+
}
|
|
635
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: IconButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
636
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: IconButtonComponent, isStandalone: true, selector: "sefin-icon-button", inputs: { variant: "variant", size: "size", disabled: "disabled", type: "type", class: "class", ariaLabel: "ariaLabel", rounded: "rounded" }, outputs: { clicked: "clicked" }, ngImport: i0, template: "<button \n [type]=\"type\" \n [disabled]=\"disabled\" \n [class]=\"buttonClasses\" \n (click)=\"onClick($event)\"\n [attr.aria-label]=\"ariaLabel || null\"\n>\n <ng-content></ng-content>\n</button>\n\n", styles: [".sefin-icon-button{display:inline-flex;align-items:center;justify-content:center;font-family:var(--sefin-font-family-base);border-radius:var(--sefin-radius-md);transition:all .2s ease-in-out;cursor:pointer;outline:none;border:1px solid transparent;padding:0;aspect-ratio:1;flex-shrink:0}.sefin-icon-button:focus-visible{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-icon-button--sm{width:32px;height:32px;min-width:32px;min-height:32px}.sefin-icon-button--md{width:40px;height:40px;min-width:40px;min-height:40px}.sefin-icon-button--lg{width:48px;height:48px;min-width:48px;min-height:48px}.sefin-icon-button--rounded{border-radius:50%}.sefin-icon-button--primary{background-color:var(--sefin-color-primary);color:#fff}.sefin-icon-button--primary:hover:not(:disabled){background-color:var(--sefin-color-primary-dark)}.sefin-icon-button--primary:active:not(:disabled){transform:translateY(1px)}.sefin-icon-button--secondary{background-color:var(--sefin-color-secondary);color:#fff}.sefin-icon-button--secondary:hover:not(:disabled){background-color:var(--sefin-color-secondary-dark)}.sefin-icon-button--secondary:active:not(:disabled){transform:translateY(1px)}.sefin-icon-button--outline{background-color:transparent;color:var(--sefin-color-primary);border-color:var(--sefin-color-primary)}.sefin-icon-button--outline:hover:not(:disabled){background-color:var(--sefin-color-primary);color:#fff}.sefin-icon-button--ghost{background-color:transparent;color:var(--sefin-color-primary)}.sefin-icon-button--ghost:hover:not(:disabled){background-color:var(--sefin-color-surface-hover)}.sefin-icon-button--danger{background-color:var(--sefin-color-error);color:#fff}.sefin-icon-button--danger:hover:not(:disabled){background-color:var(--sefin-color-error);opacity:.9}.sefin-icon-button--disabled{opacity:.6;cursor:not-allowed;pointer-events:none}.sefin-icon-button svg{width:100%;height:100%;display:block}.sefin-icon-button--sm svg{width:16px;height:16px}.sefin-icon-button--md svg{width:20px;height:20px}.sefin-icon-button--lg svg{width:24px;height:24px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
637
|
+
}
|
|
638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: IconButtonComponent, decorators: [{
|
|
639
|
+
type: Component,
|
|
640
|
+
args: [{ selector: 'sefin-icon-button', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n [type]=\"type\" \n [disabled]=\"disabled\" \n [class]=\"buttonClasses\" \n (click)=\"onClick($event)\"\n [attr.aria-label]=\"ariaLabel || null\"\n>\n <ng-content></ng-content>\n</button>\n\n", styles: [".sefin-icon-button{display:inline-flex;align-items:center;justify-content:center;font-family:var(--sefin-font-family-base);border-radius:var(--sefin-radius-md);transition:all .2s ease-in-out;cursor:pointer;outline:none;border:1px solid transparent;padding:0;aspect-ratio:1;flex-shrink:0}.sefin-icon-button:focus-visible{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-icon-button--sm{width:32px;height:32px;min-width:32px;min-height:32px}.sefin-icon-button--md{width:40px;height:40px;min-width:40px;min-height:40px}.sefin-icon-button--lg{width:48px;height:48px;min-width:48px;min-height:48px}.sefin-icon-button--rounded{border-radius:50%}.sefin-icon-button--primary{background-color:var(--sefin-color-primary);color:#fff}.sefin-icon-button--primary:hover:not(:disabled){background-color:var(--sefin-color-primary-dark)}.sefin-icon-button--primary:active:not(:disabled){transform:translateY(1px)}.sefin-icon-button--secondary{background-color:var(--sefin-color-secondary);color:#fff}.sefin-icon-button--secondary:hover:not(:disabled){background-color:var(--sefin-color-secondary-dark)}.sefin-icon-button--secondary:active:not(:disabled){transform:translateY(1px)}.sefin-icon-button--outline{background-color:transparent;color:var(--sefin-color-primary);border-color:var(--sefin-color-primary)}.sefin-icon-button--outline:hover:not(:disabled){background-color:var(--sefin-color-primary);color:#fff}.sefin-icon-button--ghost{background-color:transparent;color:var(--sefin-color-primary)}.sefin-icon-button--ghost:hover:not(:disabled){background-color:var(--sefin-color-surface-hover)}.sefin-icon-button--danger{background-color:var(--sefin-color-error);color:#fff}.sefin-icon-button--danger:hover:not(:disabled){background-color:var(--sefin-color-error);opacity:.9}.sefin-icon-button--disabled{opacity:.6;cursor:not-allowed;pointer-events:none}.sefin-icon-button svg{width:100%;height:100%;display:block}.sefin-icon-button--sm svg{width:16px;height:16px}.sefin-icon-button--md svg{width:20px;height:20px}.sefin-icon-button--lg svg{width:24px;height:24px}\n"] }]
|
|
641
|
+
}], propDecorators: { variant: [{
|
|
642
|
+
type: Input
|
|
643
|
+
}], size: [{
|
|
644
|
+
type: Input
|
|
645
|
+
}], disabled: [{
|
|
646
|
+
type: Input
|
|
647
|
+
}], type: [{
|
|
648
|
+
type: Input
|
|
649
|
+
}], class: [{
|
|
650
|
+
type: Input
|
|
651
|
+
}], ariaLabel: [{
|
|
652
|
+
type: Input
|
|
653
|
+
}], rounded: [{
|
|
654
|
+
type: Input
|
|
655
|
+
}], clicked: [{
|
|
656
|
+
type: Output
|
|
657
|
+
}] } });
|
|
658
|
+
|
|
659
|
+
class LinkComponent {
|
|
660
|
+
/** Link variant style. Options: 'default' | 'primary' | 'secondary' | 'underline' */
|
|
661
|
+
variant = 'default';
|
|
662
|
+
/** Link size. Options: 'sm' | 'md' | 'lg' */
|
|
491
663
|
size = 'md';
|
|
664
|
+
/** Whether the link is disabled */
|
|
665
|
+
disabled = false;
|
|
666
|
+
/** Link URL */
|
|
667
|
+
href;
|
|
668
|
+
/** Link target attribute (e.g., '_blank') */
|
|
669
|
+
target;
|
|
670
|
+
/** Link rel attribute */
|
|
671
|
+
rel;
|
|
672
|
+
/** Additional CSS classes */
|
|
492
673
|
class = '';
|
|
493
|
-
|
|
674
|
+
/** Whether to show underline */
|
|
675
|
+
underline = false;
|
|
676
|
+
get linkClasses() {
|
|
494
677
|
return [
|
|
495
|
-
'sefin-
|
|
496
|
-
`sefin-
|
|
678
|
+
'sefin-link',
|
|
679
|
+
`sefin-link--${this.variant}`,
|
|
680
|
+
`sefin-link--${this.size}`,
|
|
681
|
+
this.disabled ? 'sefin-link--disabled' : '',
|
|
682
|
+
this.underline ? 'sefin-link--underline' : '',
|
|
497
683
|
this.class,
|
|
498
684
|
]
|
|
499
685
|
.filter(Boolean)
|
|
500
686
|
.join(' ');
|
|
501
687
|
}
|
|
502
|
-
|
|
503
|
-
|
|
688
|
+
onClick(event) {
|
|
689
|
+
if (this.disabled) {
|
|
690
|
+
event.preventDefault();
|
|
691
|
+
event.stopPropagation();
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LinkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
695
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: LinkComponent, isStandalone: true, selector: "sefin-link", inputs: { variant: "variant", size: "size", disabled: "disabled", href: "href", target: "target", rel: "rel", class: "class", underline: "underline" }, ngImport: i0, template: "<a\n [class]=\"linkClasses\"\n [href]=\"disabled ? null : (href || '#')\"\n [attr.target]=\"target\"\n [attr.rel]=\"rel\"\n [attr.aria-disabled]=\"disabled ? true : null\"\n (click)=\"onClick($event)\"\n>\n <ng-content></ng-content>\n</a>\n\n", styles: [".sefin-link{display:inline-flex;align-items:center;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);text-decoration:none;transition:all .2s ease-in-out;cursor:pointer;outline:none}.sefin-link:focus-visible{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px;border-radius:2px}.sefin-link--sm{font-size:var(--sefin-font-size-sm)}.sefin-link--md{font-size:var(--sefin-font-size-base)}.sefin-link--lg{font-size:var(--sefin-font-size-lg)}.sefin-link--default{color:var(--sefin-color-text);text-decoration:none}.sefin-link--default:hover:not(.sefin-link--default--disabled){color:var(--sefin-color-primary)}.sefin-link--primary{color:var(--sefin-color-primary);text-decoration:none}.sefin-link--primary:hover:not(.sefin-link--primary--disabled){color:var(--sefin-color-primary-dark)}.sefin-link--primary:active:not(.sefin-link--primary--disabled){color:var(--sefin-color-primary-dark)}.sefin-link--secondary{color:var(--sefin-color-text-secondary);text-decoration:none}.sefin-link--secondary:hover:not(.sefin-link--secondary--disabled){color:var(--sefin-color-primary)}.sefin-link--underline{color:var(--sefin-color-primary);text-decoration:underline;text-underline-offset:2px}.sefin-link--underline:hover:not(.sefin-link--underline--disabled){color:var(--sefin-color-primary-dark);text-decoration-thickness:2px}.sefin-link--underline.sefin-link--default{color:var(--sefin-color-text);text-decoration:underline;text-underline-offset:2px}.sefin-link--underline.sefin-link--default:hover:not(.sefin-link--underline.sefin-link--default--disabled){color:var(--sefin-color-primary);text-decoration-thickness:2px}.sefin-link--disabled{opacity:.6;cursor:not-allowed;pointer-events:none;color:var(--sefin-color-text-disabled)}.sefin-link--disabled:hover{color:var(--sefin-color-text-disabled)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
504
696
|
}
|
|
505
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
697
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LinkComponent, decorators: [{
|
|
506
698
|
type: Component,
|
|
507
|
-
args: [{ selector: 'sefin-
|
|
508
|
-
}], propDecorators: {
|
|
699
|
+
args: [{ selector: 'sefin-link', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.Default, template: "<a\n [class]=\"linkClasses\"\n [href]=\"disabled ? null : (href || '#')\"\n [attr.target]=\"target\"\n [attr.rel]=\"rel\"\n [attr.aria-disabled]=\"disabled ? true : null\"\n (click)=\"onClick($event)\"\n>\n <ng-content></ng-content>\n</a>\n\n", styles: [".sefin-link{display:inline-flex;align-items:center;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);text-decoration:none;transition:all .2s ease-in-out;cursor:pointer;outline:none}.sefin-link:focus-visible{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px;border-radius:2px}.sefin-link--sm{font-size:var(--sefin-font-size-sm)}.sefin-link--md{font-size:var(--sefin-font-size-base)}.sefin-link--lg{font-size:var(--sefin-font-size-lg)}.sefin-link--default{color:var(--sefin-color-text);text-decoration:none}.sefin-link--default:hover:not(.sefin-link--default--disabled){color:var(--sefin-color-primary)}.sefin-link--primary{color:var(--sefin-color-primary);text-decoration:none}.sefin-link--primary:hover:not(.sefin-link--primary--disabled){color:var(--sefin-color-primary-dark)}.sefin-link--primary:active:not(.sefin-link--primary--disabled){color:var(--sefin-color-primary-dark)}.sefin-link--secondary{color:var(--sefin-color-text-secondary);text-decoration:none}.sefin-link--secondary:hover:not(.sefin-link--secondary--disabled){color:var(--sefin-color-primary)}.sefin-link--underline{color:var(--sefin-color-primary);text-decoration:underline;text-underline-offset:2px}.sefin-link--underline:hover:not(.sefin-link--underline--disabled){color:var(--sefin-color-primary-dark);text-decoration-thickness:2px}.sefin-link--underline.sefin-link--default{color:var(--sefin-color-text);text-decoration:underline;text-underline-offset:2px}.sefin-link--underline.sefin-link--default:hover:not(.sefin-link--underline.sefin-link--default--disabled){color:var(--sefin-color-primary);text-decoration-thickness:2px}.sefin-link--disabled{opacity:.6;cursor:not-allowed;pointer-events:none;color:var(--sefin-color-text-disabled)}.sefin-link--disabled:hover{color:var(--sefin-color-text-disabled)}\n"] }]
|
|
700
|
+
}], propDecorators: { variant: [{
|
|
509
701
|
type: Input
|
|
510
702
|
}], size: [{
|
|
511
703
|
type: Input
|
|
704
|
+
}], disabled: [{
|
|
705
|
+
type: Input
|
|
706
|
+
}], href: [{
|
|
707
|
+
type: Input
|
|
708
|
+
}], target: [{
|
|
709
|
+
type: Input
|
|
710
|
+
}], rel: [{
|
|
711
|
+
type: Input
|
|
712
|
+
}], class: [{
|
|
713
|
+
type: Input
|
|
714
|
+
}], underline: [{
|
|
715
|
+
type: Input
|
|
716
|
+
}] } });
|
|
717
|
+
|
|
718
|
+
class StackComponent {
|
|
719
|
+
direction = 'column';
|
|
720
|
+
spacing = 'md';
|
|
721
|
+
align = 'stretch';
|
|
722
|
+
justify = 'start';
|
|
723
|
+
wrap = false;
|
|
724
|
+
class = '';
|
|
725
|
+
get stackClasses() {
|
|
726
|
+
return [
|
|
727
|
+
'sefin-stack',
|
|
728
|
+
`sefin-stack--${this.direction}`,
|
|
729
|
+
`sefin-stack--spacing-${this.spacing}`,
|
|
730
|
+
`sefin-stack--align-${this.align}`,
|
|
731
|
+
`sefin-stack--justify-${this.justify}`,
|
|
732
|
+
this.wrap ? 'sefin-stack--wrap' : '',
|
|
733
|
+
this.class,
|
|
734
|
+
]
|
|
735
|
+
.filter(Boolean)
|
|
736
|
+
.join(' ');
|
|
737
|
+
}
|
|
738
|
+
get spacingValue() {
|
|
739
|
+
const spacingMap = {
|
|
740
|
+
'xs': '4px',
|
|
741
|
+
'sm': '8px',
|
|
742
|
+
'md': '16px',
|
|
743
|
+
'lg': '24px',
|
|
744
|
+
'xl': '32px',
|
|
745
|
+
'2xl': '48px',
|
|
746
|
+
};
|
|
747
|
+
return spacingMap[this.spacing] || spacingMap['md'];
|
|
748
|
+
}
|
|
749
|
+
get stackStyles() {
|
|
750
|
+
return {
|
|
751
|
+
gap: this.spacingValue,
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StackComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
755
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: StackComponent, isStandalone: true, selector: "sefin-stack", inputs: { direction: "direction", spacing: "spacing", align: "align", justify: "justify", wrap: "wrap", class: "class" }, ngImport: i0, template: "<div [class]=\"stackClasses\" [ngStyle]=\"stackStyles\">\n <ng-content></ng-content>\n</div>\n\n", styles: [".sefin-stack{display:flex!important;gap:var(--sefin-spacing-md, 16px)}.sefin-stack--column{flex-direction:column}.sefin-stack--row{flex-direction:row}.sefin-stack--wrap{flex-wrap:wrap}.sefin-stack--spacing-xs{gap:var(--sefin-spacing-xs, 4px)!important}.sefin-stack--spacing-sm{gap:var(--sefin-spacing-sm, 8px)!important}.sefin-stack--spacing-md{gap:var(--sefin-spacing-md, 16px)!important}.sefin-stack--spacing-lg{gap:var(--sefin-spacing-lg, 24px)!important}.sefin-stack--spacing-xl{gap:var(--sefin-spacing-xl, 32px)!important}.sefin-stack--spacing-2xl{gap:var(--sefin-spacing-2xl, 48px)!important}.sefin-stack--align-start{align-items:flex-start}.sefin-stack--align-center{align-items:center}.sefin-stack--align-end{align-items:flex-end}.sefin-stack--align-stretch{align-items:stretch}.sefin-stack--justify-start{justify-content:flex-start}.sefin-stack--justify-center{justify-content:center}.sefin-stack--justify-end{justify-content:flex-end}.sefin-stack--justify-space-between{justify-content:space-between}.sefin-stack--justify-space-around{justify-content:space-around}.sefin-stack--justify-space-evenly{justify-content:space-evenly}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
756
|
+
}
|
|
757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StackComponent, decorators: [{
|
|
758
|
+
type: Component,
|
|
759
|
+
args: [{ selector: 'sefin-stack', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.Default, template: "<div [class]=\"stackClasses\" [ngStyle]=\"stackStyles\">\n <ng-content></ng-content>\n</div>\n\n", styles: [".sefin-stack{display:flex!important;gap:var(--sefin-spacing-md, 16px)}.sefin-stack--column{flex-direction:column}.sefin-stack--row{flex-direction:row}.sefin-stack--wrap{flex-wrap:wrap}.sefin-stack--spacing-xs{gap:var(--sefin-spacing-xs, 4px)!important}.sefin-stack--spacing-sm{gap:var(--sefin-spacing-sm, 8px)!important}.sefin-stack--spacing-md{gap:var(--sefin-spacing-md, 16px)!important}.sefin-stack--spacing-lg{gap:var(--sefin-spacing-lg, 24px)!important}.sefin-stack--spacing-xl{gap:var(--sefin-spacing-xl, 32px)!important}.sefin-stack--spacing-2xl{gap:var(--sefin-spacing-2xl, 48px)!important}.sefin-stack--align-start{align-items:flex-start}.sefin-stack--align-center{align-items:center}.sefin-stack--align-end{align-items:flex-end}.sefin-stack--align-stretch{align-items:stretch}.sefin-stack--justify-start{justify-content:flex-start}.sefin-stack--justify-center{justify-content:center}.sefin-stack--justify-end{justify-content:flex-end}.sefin-stack--justify-space-between{justify-content:space-between}.sefin-stack--justify-space-around{justify-content:space-around}.sefin-stack--justify-space-evenly{justify-content:space-evenly}\n"] }]
|
|
760
|
+
}], propDecorators: { direction: [{
|
|
761
|
+
type: Input
|
|
762
|
+
}], spacing: [{
|
|
763
|
+
type: Input
|
|
764
|
+
}], align: [{
|
|
765
|
+
type: Input
|
|
766
|
+
}], justify: [{
|
|
767
|
+
type: Input
|
|
768
|
+
}], wrap: [{
|
|
769
|
+
type: Input
|
|
512
770
|
}], class: [{
|
|
513
771
|
type: Input
|
|
514
772
|
}] } });
|
|
515
773
|
|
|
516
|
-
class
|
|
517
|
-
|
|
774
|
+
class AutocompleteComponent {
|
|
775
|
+
inputRef;
|
|
776
|
+
dropdownRef;
|
|
777
|
+
containerRef;
|
|
778
|
+
options = [];
|
|
518
779
|
placeholder = '';
|
|
780
|
+
disabled = false;
|
|
781
|
+
size = 'md';
|
|
782
|
+
class = '';
|
|
783
|
+
value = null;
|
|
784
|
+
minChars = 0;
|
|
785
|
+
maxResults = 10;
|
|
786
|
+
valueChange = new EventEmitter();
|
|
787
|
+
optionSelected = new EventEmitter();
|
|
788
|
+
inputChange = new EventEmitter();
|
|
789
|
+
searchText = '';
|
|
790
|
+
filteredOptions = [];
|
|
791
|
+
isOpen = false;
|
|
792
|
+
selectedIndex = -1;
|
|
793
|
+
ngOnInit() {
|
|
794
|
+
if (this.value !== null) {
|
|
795
|
+
const selectedOption = this.options.find((opt) => opt.value === this.value);
|
|
796
|
+
this.searchText = selectedOption?.label || String(this.value);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
ngOnChanges(changes) {
|
|
800
|
+
if (changes['options']) {
|
|
801
|
+
const options = changes['options'].currentValue || [];
|
|
802
|
+
if (this.value !== null) {
|
|
803
|
+
const selectedOption = options.find((opt) => opt.value === this.value);
|
|
804
|
+
if (selectedOption) {
|
|
805
|
+
this.searchText = selectedOption.label;
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
this.searchText = '';
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
if (changes['value']) {
|
|
813
|
+
if (this.value !== null) {
|
|
814
|
+
const selectedOption = this.options.find((opt) => opt.value === this.value);
|
|
815
|
+
this.searchText = selectedOption?.label || String(this.value);
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
this.searchText = '';
|
|
819
|
+
}
|
|
820
|
+
this.filteredOptions = [];
|
|
821
|
+
this.isOpen = false;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
ngOnDestroy() {
|
|
825
|
+
}
|
|
826
|
+
onClickOutside(event) {
|
|
827
|
+
if (this.containerRef?.nativeElement && this.isOpen) {
|
|
828
|
+
const clickedInside = this.containerRef.nativeElement.contains(event.target);
|
|
829
|
+
if (!clickedInside) {
|
|
830
|
+
this.isOpen = false;
|
|
831
|
+
this.selectedIndex = -1;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
onInputChange(value) {
|
|
836
|
+
this.searchText = value;
|
|
837
|
+
this.inputChange.emit(value);
|
|
838
|
+
if (this.options && this.options.length > 0) {
|
|
839
|
+
this.filterOptions();
|
|
840
|
+
this.isOpen = value.length >= this.minChars;
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
this.isOpen = false;
|
|
844
|
+
this.filteredOptions = [];
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
filterOptions() {
|
|
848
|
+
if (!this.options || this.options.length === 0) {
|
|
849
|
+
this.filteredOptions = [];
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
if (this.minChars > 0 &&
|
|
853
|
+
(!this.searchText || this.searchText.length < this.minChars)) {
|
|
854
|
+
this.filteredOptions = [];
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
const searchText = this.searchText || '';
|
|
858
|
+
if (searchText.length === 0) {
|
|
859
|
+
this.filteredOptions = this.options
|
|
860
|
+
.filter((option) => !option.disabled)
|
|
861
|
+
.slice(0, this.maxResults);
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
const searchLower = searchText.toLowerCase();
|
|
865
|
+
this.filteredOptions = this.options
|
|
866
|
+
.filter((option) => {
|
|
867
|
+
if (option.disabled)
|
|
868
|
+
return false;
|
|
869
|
+
return option.label.toLowerCase().includes(searchLower);
|
|
870
|
+
})
|
|
871
|
+
.slice(0, this.maxResults);
|
|
872
|
+
}
|
|
873
|
+
selectOption(option) {
|
|
874
|
+
if (option.disabled)
|
|
875
|
+
return;
|
|
876
|
+
this.searchText = option.label;
|
|
877
|
+
this.value = option.value;
|
|
878
|
+
this.valueChange.emit(option.value);
|
|
879
|
+
this.optionSelected.emit(option);
|
|
880
|
+
this.isOpen = false;
|
|
881
|
+
this.selectedIndex = -1;
|
|
882
|
+
}
|
|
883
|
+
onInputFocus() {
|
|
884
|
+
if (this.disabled)
|
|
885
|
+
return;
|
|
886
|
+
if (this.options &&
|
|
887
|
+
Array.isArray(this.options) &&
|
|
888
|
+
this.options.length > 0) {
|
|
889
|
+
this.filterOptions();
|
|
890
|
+
this.isOpen = this.filteredOptions.length > 0;
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
this.isOpen = false;
|
|
894
|
+
this.filteredOptions = [];
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
onInputBlur() {
|
|
898
|
+
if (this.disabled || !this.searchText) {
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
const exactMatch = this.options.find((option) => !option.disabled &&
|
|
902
|
+
option.label.toLowerCase().trim() === this.searchText.toLowerCase().trim());
|
|
903
|
+
if (!exactMatch) {
|
|
904
|
+
this.searchText = '';
|
|
905
|
+
this.value = null;
|
|
906
|
+
this.valueChange.emit(null);
|
|
907
|
+
this.isOpen = false;
|
|
908
|
+
this.filteredOptions = [];
|
|
909
|
+
this.selectedIndex = -1;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
onKeyDown(event) {
|
|
913
|
+
if (!this.isOpen ||
|
|
914
|
+
!this.filteredOptions ||
|
|
915
|
+
this.filteredOptions.length === 0) {
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
switch (event.key) {
|
|
919
|
+
case 'ArrowDown':
|
|
920
|
+
event.preventDefault();
|
|
921
|
+
this.selectedIndex = Math.min(this.selectedIndex + 1, this.filteredOptions.length - 1);
|
|
922
|
+
setTimeout(() => this.scrollToSelected(), 0);
|
|
923
|
+
break;
|
|
924
|
+
case 'ArrowUp':
|
|
925
|
+
event.preventDefault();
|
|
926
|
+
this.selectedIndex = Math.max(this.selectedIndex - 1, -1);
|
|
927
|
+
setTimeout(() => this.scrollToSelected(), 0);
|
|
928
|
+
break;
|
|
929
|
+
case 'Enter':
|
|
930
|
+
event.preventDefault();
|
|
931
|
+
if (this.selectedIndex >= 0 &&
|
|
932
|
+
this.selectedIndex < this.filteredOptions.length) {
|
|
933
|
+
this.selectOption(this.filteredOptions[this.selectedIndex]);
|
|
934
|
+
}
|
|
935
|
+
break;
|
|
936
|
+
case 'Escape':
|
|
937
|
+
event.preventDefault();
|
|
938
|
+
this.isOpen = false;
|
|
939
|
+
this.selectedIndex = -1;
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
scrollToSelected() {
|
|
944
|
+
try {
|
|
945
|
+
if (this.dropdownRef?.nativeElement && this.selectedIndex >= 0) {
|
|
946
|
+
const selectedElement = this.dropdownRef.nativeElement.querySelector(`[data-index="${this.selectedIndex}"]`);
|
|
947
|
+
if (selectedElement && selectedElement instanceof HTMLElement) {
|
|
948
|
+
selectedElement.scrollIntoView({
|
|
949
|
+
block: 'nearest',
|
|
950
|
+
behavior: 'smooth',
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
catch (error) {
|
|
956
|
+
console.warn('Could not scroll to selected option:', error);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
clearValue() {
|
|
960
|
+
this.searchText = '';
|
|
961
|
+
this.value = null;
|
|
962
|
+
this.valueChange.emit(null);
|
|
963
|
+
this.isOpen = false;
|
|
964
|
+
this.filteredOptions = [];
|
|
965
|
+
if (this.inputRef?.nativeElement) {
|
|
966
|
+
this.inputRef.nativeElement.focus();
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
get inputClasses() {
|
|
970
|
+
return [
|
|
971
|
+
'sefin-autocomplete__input',
|
|
972
|
+
`sefin-autocomplete__input--${this.size}`,
|
|
973
|
+
this.disabled ? 'sefin-autocomplete__input--disabled' : '',
|
|
974
|
+
this.class,
|
|
975
|
+
]
|
|
976
|
+
.filter(Boolean)
|
|
977
|
+
.join(' ');
|
|
978
|
+
}
|
|
979
|
+
get containerClasses() {
|
|
980
|
+
return [
|
|
981
|
+
'sefin-autocomplete',
|
|
982
|
+
this.isOpen && this.filteredOptions.length > 0
|
|
983
|
+
? 'sefin-autocomplete--open'
|
|
984
|
+
: '',
|
|
985
|
+
]
|
|
986
|
+
.filter(Boolean)
|
|
987
|
+
.join(' ');
|
|
988
|
+
}
|
|
989
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
990
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: AutocompleteComponent, isStandalone: true, selector: "sefin-autocomplete", inputs: { options: "options", placeholder: "placeholder", disabled: "disabled", size: "size", class: "class", value: "value", minChars: "minChars", maxResults: "maxResults" }, outputs: { valueChange: "valueChange", optionSelected: "optionSelected", inputChange: "inputChange" }, host: { listeners: { "document:click": "onClickOutside($event)" } }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["inputRef"], descendants: true }, { propertyName: "dropdownRef", first: true, predicate: ["dropdownRef"], descendants: true }, { propertyName: "containerRef", first: true, predicate: ["containerRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div [class]=\"containerClasses\" #containerRef>\n <div class=\"sefin-autocomplete__wrapper\">\n <input\n #inputRef\n type=\"text\"\n [class]=\"inputClasses\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [ngModel]=\"searchText\"\n (ngModelChange)=\"onInputChange($event)\"\n (focus)=\"onInputFocus()\"\n (click)=\"onInputFocus()\"\n (blur)=\"onInputBlur()\"\n (keydown)=\"onKeyDown($event)\"\n autocomplete=\"off\"\n />\n <div class=\"sefin-autocomplete__actions\">\n <button\n *ngIf=\"searchText && !disabled\"\n type=\"button\"\n class=\"sefin-autocomplete__clear\"\n (click)=\"clearValue()\"\n aria-label=\"Clear\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 4L4 12M4 4L12 12\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n <div class=\"sefin-autocomplete__arrow\" [class.sefin-autocomplete__arrow--open]=\"isOpen\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4 6L8 10L12 6\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </div>\n </div>\n </div>\n <div\n *ngIf=\"isOpen && filteredOptions && filteredOptions.length > 0\"\n #dropdownRef\n class=\"sefin-autocomplete__dropdown\"\n >\n <ul class=\"sefin-autocomplete__list\">\n <li\n *ngFor=\"let option of filteredOptions; let i = index\"\n [attr.data-index]=\"i\"\n [class.sefin-autocomplete__option]=\"true\"\n [class.sefin-autocomplete__option--selected]=\"i === selectedIndex\"\n [class.sefin-autocomplete__option--disabled]=\"option.disabled\"\n (click)=\"selectOption(option)\"\n [attr.aria-selected]=\"i === selectedIndex\"\n role=\"option\"\n >\n {{ option.label }}\n </li>\n </ul>\n </div>\n <div\n *ngIf=\"\n isOpen &&\n filteredOptions &&\n filteredOptions.length === 0 &&\n searchText &&\n searchText.length >= minChars\n \"\n class=\"sefin-autocomplete__dropdown sefin-autocomplete__dropdown--empty\"\n >\n <div class=\"sefin-autocomplete__no-results\">\n No se encontraron resultados\n </div>\n </div>\n</div>\n", styles: [".sefin-autocomplete{position:relative;width:100%}.sefin-autocomplete__wrapper{position:relative;display:flex;align-items:center;width:100%}.sefin-autocomplete__input{width:100%;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);background-color:var(--sefin-color-surface);border:1px solid var(--sefin-color-border);border-radius:var(--sefin-radius-md);transition:all .2s ease-in-out;outline:none}.sefin-autocomplete__input::placeholder{color:var(--sefin-color-text-secondary);font-family:var(--sefin-font-family-base)}.sefin-autocomplete__input:focus{border-color:var(--sefin-color-border-focus);box-shadow:0 0 0 3px var(--sefin-color-primary-light)}.sefin-autocomplete__input:disabled{background-color:var(--sefin-color-surface-hover);color:var(--sefin-color-text-disabled);cursor:not-allowed;opacity:.6}.sefin-autocomplete__input--sm{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);padding-right:calc(var(--sefin-spacing-md) * 2.5);font-size:var(--sefin-font-size-sm);line-height:var(--sefin-line-height-normal);min-height:32px}.sefin-autocomplete__input--md{padding:var(--sefin-spacing-md) var(--sefin-spacing-lg);padding-right:calc(var(--sefin-spacing-lg) * 2);font-size:var(--sefin-font-size-base);line-height:var(--sefin-line-height-normal);min-height:40px}.sefin-autocomplete__input--lg{padding:var(--sefin-spacing-lg) var(--sefin-spacing-xl);padding-right:calc(var(--sefin-spacing-xl) * 1.75);font-size:var(--sefin-font-size-lg);line-height:var(--sefin-line-height-normal);min-height:48px}.sefin-autocomplete__input--disabled{cursor:not-allowed}.sefin-autocomplete__actions{position:absolute;right:var(--sefin-spacing-sm);display:flex;align-items:center;gap:var(--sefin-spacing-xs)}.sefin-autocomplete__clear{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:var(--sefin-radius-sm);color:var(--sefin-color-text-secondary);cursor:pointer;transition:all .2s ease-in-out}.sefin-autocomplete__clear:hover{background-color:var(--sefin-color-surface-hover);color:var(--sefin-color-text)}.sefin-autocomplete__clear:focus-visible{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-autocomplete__clear svg{width:16px;height:16px}.sefin-autocomplete__arrow{display:flex;align-items:center;justify-content:center;width:24px;height:24px;color:var(--sefin-color-text-secondary);pointer-events:none;transition:transform .2s ease-in-out}.sefin-autocomplete__arrow svg{width:16px;height:16px}.sefin-autocomplete__arrow--open{transform:rotate(180deg)}.sefin-autocomplete__dropdown{position:absolute;top:calc(100% + var(--sefin-spacing-xs));left:0;right:0;z-index:9999;background-color:var(--sefin-color-surface);border:1px solid var(--sefin-color-border);border-radius:var(--sefin-radius-md);box-shadow:var(--sefin-shadow-lg);max-height:300px;overflow-y:auto}.sefin-autocomplete__dropdown--empty{padding:var(--sefin-spacing-md)}.sefin-autocomplete__list{list-style:none;margin:0;padding:var(--sefin-spacing-xs)}.sefin-autocomplete__option{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);font-family:var(--sefin-font-family-base);font-size:var(--sefin-font-size-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);cursor:pointer;border-radius:var(--sefin-radius-sm);transition:all .15s ease-in-out;-webkit-user-select:none;user-select:none}.sefin-autocomplete__option:hover:not(.sefin-autocomplete__option--disabled){background-color:var(--sefin-color-surface-hover)}.sefin-autocomplete__option--selected{background-color:var(--sefin-color-primary-light);color:var(--sefin-color-primary);font-weight:var(--sefin-font-weight-medium)}.sefin-autocomplete__option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.sefin-autocomplete__no-results{padding:var(--sefin-spacing-md);text-align:center;font-family:var(--sefin-font-family-base);font-size:var(--sefin-font-size-sm);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text-secondary)}.sefin-autocomplete--open .sefin-autocomplete__input{border-color:var(--sefin-color-border-focus)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
991
|
+
}
|
|
992
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
993
|
+
type: Component,
|
|
994
|
+
args: [{ selector: 'sefin-autocomplete', standalone: true, imports: [CommonModule, FormsModule], changeDetection: ChangeDetectionStrategy.Default, template: "<div [class]=\"containerClasses\" #containerRef>\n <div class=\"sefin-autocomplete__wrapper\">\n <input\n #inputRef\n type=\"text\"\n [class]=\"inputClasses\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [ngModel]=\"searchText\"\n (ngModelChange)=\"onInputChange($event)\"\n (focus)=\"onInputFocus()\"\n (click)=\"onInputFocus()\"\n (blur)=\"onInputBlur()\"\n (keydown)=\"onKeyDown($event)\"\n autocomplete=\"off\"\n />\n <div class=\"sefin-autocomplete__actions\">\n <button\n *ngIf=\"searchText && !disabled\"\n type=\"button\"\n class=\"sefin-autocomplete__clear\"\n (click)=\"clearValue()\"\n aria-label=\"Clear\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 4L4 12M4 4L12 12\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n <div class=\"sefin-autocomplete__arrow\" [class.sefin-autocomplete__arrow--open]=\"isOpen\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4 6L8 10L12 6\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </div>\n </div>\n </div>\n <div\n *ngIf=\"isOpen && filteredOptions && filteredOptions.length > 0\"\n #dropdownRef\n class=\"sefin-autocomplete__dropdown\"\n >\n <ul class=\"sefin-autocomplete__list\">\n <li\n *ngFor=\"let option of filteredOptions; let i = index\"\n [attr.data-index]=\"i\"\n [class.sefin-autocomplete__option]=\"true\"\n [class.sefin-autocomplete__option--selected]=\"i === selectedIndex\"\n [class.sefin-autocomplete__option--disabled]=\"option.disabled\"\n (click)=\"selectOption(option)\"\n [attr.aria-selected]=\"i === selectedIndex\"\n role=\"option\"\n >\n {{ option.label }}\n </li>\n </ul>\n </div>\n <div\n *ngIf=\"\n isOpen &&\n filteredOptions &&\n filteredOptions.length === 0 &&\n searchText &&\n searchText.length >= minChars\n \"\n class=\"sefin-autocomplete__dropdown sefin-autocomplete__dropdown--empty\"\n >\n <div class=\"sefin-autocomplete__no-results\">\n No se encontraron resultados\n </div>\n </div>\n</div>\n", styles: [".sefin-autocomplete{position:relative;width:100%}.sefin-autocomplete__wrapper{position:relative;display:flex;align-items:center;width:100%}.sefin-autocomplete__input{width:100%;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);background-color:var(--sefin-color-surface);border:1px solid var(--sefin-color-border);border-radius:var(--sefin-radius-md);transition:all .2s ease-in-out;outline:none}.sefin-autocomplete__input::placeholder{color:var(--sefin-color-text-secondary);font-family:var(--sefin-font-family-base)}.sefin-autocomplete__input:focus{border-color:var(--sefin-color-border-focus);box-shadow:0 0 0 3px var(--sefin-color-primary-light)}.sefin-autocomplete__input:disabled{background-color:var(--sefin-color-surface-hover);color:var(--sefin-color-text-disabled);cursor:not-allowed;opacity:.6}.sefin-autocomplete__input--sm{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);padding-right:calc(var(--sefin-spacing-md) * 2.5);font-size:var(--sefin-font-size-sm);line-height:var(--sefin-line-height-normal);min-height:32px}.sefin-autocomplete__input--md{padding:var(--sefin-spacing-md) var(--sefin-spacing-lg);padding-right:calc(var(--sefin-spacing-lg) * 2);font-size:var(--sefin-font-size-base);line-height:var(--sefin-line-height-normal);min-height:40px}.sefin-autocomplete__input--lg{padding:var(--sefin-spacing-lg) var(--sefin-spacing-xl);padding-right:calc(var(--sefin-spacing-xl) * 1.75);font-size:var(--sefin-font-size-lg);line-height:var(--sefin-line-height-normal);min-height:48px}.sefin-autocomplete__input--disabled{cursor:not-allowed}.sefin-autocomplete__actions{position:absolute;right:var(--sefin-spacing-sm);display:flex;align-items:center;gap:var(--sefin-spacing-xs)}.sefin-autocomplete__clear{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:var(--sefin-radius-sm);color:var(--sefin-color-text-secondary);cursor:pointer;transition:all .2s ease-in-out}.sefin-autocomplete__clear:hover{background-color:var(--sefin-color-surface-hover);color:var(--sefin-color-text)}.sefin-autocomplete__clear:focus-visible{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-autocomplete__clear svg{width:16px;height:16px}.sefin-autocomplete__arrow{display:flex;align-items:center;justify-content:center;width:24px;height:24px;color:var(--sefin-color-text-secondary);pointer-events:none;transition:transform .2s ease-in-out}.sefin-autocomplete__arrow svg{width:16px;height:16px}.sefin-autocomplete__arrow--open{transform:rotate(180deg)}.sefin-autocomplete__dropdown{position:absolute;top:calc(100% + var(--sefin-spacing-xs));left:0;right:0;z-index:9999;background-color:var(--sefin-color-surface);border:1px solid var(--sefin-color-border);border-radius:var(--sefin-radius-md);box-shadow:var(--sefin-shadow-lg);max-height:300px;overflow-y:auto}.sefin-autocomplete__dropdown--empty{padding:var(--sefin-spacing-md)}.sefin-autocomplete__list{list-style:none;margin:0;padding:var(--sefin-spacing-xs)}.sefin-autocomplete__option{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);font-family:var(--sefin-font-family-base);font-size:var(--sefin-font-size-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);cursor:pointer;border-radius:var(--sefin-radius-sm);transition:all .15s ease-in-out;-webkit-user-select:none;user-select:none}.sefin-autocomplete__option:hover:not(.sefin-autocomplete__option--disabled){background-color:var(--sefin-color-surface-hover)}.sefin-autocomplete__option--selected{background-color:var(--sefin-color-primary-light);color:var(--sefin-color-primary);font-weight:var(--sefin-font-weight-medium)}.sefin-autocomplete__option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.sefin-autocomplete__no-results{padding:var(--sefin-spacing-md);text-align:center;font-family:var(--sefin-font-family-base);font-size:var(--sefin-font-size-sm);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text-secondary)}.sefin-autocomplete--open .sefin-autocomplete__input{border-color:var(--sefin-color-border-focus)}\n"] }]
|
|
995
|
+
}], propDecorators: { inputRef: [{
|
|
996
|
+
type: ViewChild,
|
|
997
|
+
args: ['inputRef', { static: false }]
|
|
998
|
+
}], dropdownRef: [{
|
|
999
|
+
type: ViewChild,
|
|
1000
|
+
args: ['dropdownRef', { static: false }]
|
|
1001
|
+
}], containerRef: [{
|
|
1002
|
+
type: ViewChild,
|
|
1003
|
+
args: ['containerRef', { static: false }]
|
|
1004
|
+
}], options: [{
|
|
1005
|
+
type: Input
|
|
1006
|
+
}], placeholder: [{
|
|
1007
|
+
type: Input
|
|
1008
|
+
}], disabled: [{
|
|
1009
|
+
type: Input
|
|
1010
|
+
}], size: [{
|
|
1011
|
+
type: Input
|
|
1012
|
+
}], class: [{
|
|
1013
|
+
type: Input
|
|
1014
|
+
}], value: [{
|
|
1015
|
+
type: Input
|
|
1016
|
+
}], minChars: [{
|
|
1017
|
+
type: Input
|
|
1018
|
+
}], maxResults: [{
|
|
1019
|
+
type: Input
|
|
1020
|
+
}], valueChange: [{
|
|
1021
|
+
type: Output
|
|
1022
|
+
}], optionSelected: [{
|
|
1023
|
+
type: Output
|
|
1024
|
+
}], inputChange: [{
|
|
1025
|
+
type: Output
|
|
1026
|
+
}], onClickOutside: [{
|
|
1027
|
+
type: HostListener,
|
|
1028
|
+
args: ['document:click', ['$event']]
|
|
1029
|
+
}] } });
|
|
1030
|
+
|
|
1031
|
+
class CheckboxComponent {
|
|
1032
|
+
checkboxInput;
|
|
519
1033
|
size = 'md';
|
|
520
1034
|
disabled = false;
|
|
521
|
-
|
|
522
|
-
readonly = false;
|
|
1035
|
+
indeterminate = false;
|
|
523
1036
|
class = '';
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
1037
|
+
label = '';
|
|
1038
|
+
name = '';
|
|
1039
|
+
value = false;
|
|
1040
|
+
valueChange = new EventEmitter();
|
|
1041
|
+
checkedChange = new EventEmitter();
|
|
528
1042
|
onChange = (value) => { };
|
|
529
1043
|
onTouched = () => { };
|
|
530
|
-
|
|
1044
|
+
ngAfterViewInit() {
|
|
1045
|
+
if (this.checkboxInput?.nativeElement && this.indeterminate && !this.value) {
|
|
1046
|
+
this.checkboxInput.nativeElement.indeterminate = true;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
ngOnChanges(changes) {
|
|
1050
|
+
if (this.checkboxInput?.nativeElement && (changes['indeterminate'] || changes['value'])) {
|
|
1051
|
+
this.checkboxInput.nativeElement.indeterminate = this.indeterminate && !this.value;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
onCheckboxChange(event) {
|
|
1055
|
+
if (this.disabled) {
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
531
1058
|
const target = event.target;
|
|
532
|
-
this.value = target.
|
|
1059
|
+
this.value = target.checked;
|
|
1060
|
+
this.indeterminate = false;
|
|
1061
|
+
if (this.checkboxInput?.nativeElement) {
|
|
1062
|
+
this.checkboxInput.nativeElement.indeterminate = false;
|
|
1063
|
+
}
|
|
533
1064
|
this.onChange(this.value);
|
|
534
|
-
}
|
|
535
|
-
onBlur(event) {
|
|
536
1065
|
this.onTouched();
|
|
537
|
-
this.
|
|
538
|
-
|
|
539
|
-
onFocus(event) {
|
|
540
|
-
this.focus.emit(event);
|
|
1066
|
+
this.valueChange.emit(this.value);
|
|
1067
|
+
this.checkedChange.emit(this.value);
|
|
541
1068
|
}
|
|
542
1069
|
writeValue(value) {
|
|
543
|
-
this.value = value
|
|
1070
|
+
this.value = value;
|
|
1071
|
+
if (value) {
|
|
1072
|
+
this.indeterminate = false;
|
|
1073
|
+
if (this.checkboxInput?.nativeElement) {
|
|
1074
|
+
this.checkboxInput.nativeElement.indeterminate = false;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
544
1077
|
}
|
|
545
1078
|
registerOnChange(fn) {
|
|
546
1079
|
this.onChange = fn;
|
|
@@ -551,126 +1084,315 @@ class InputComponent {
|
|
|
551
1084
|
setDisabledState(isDisabled) {
|
|
552
1085
|
this.disabled = isDisabled;
|
|
553
1086
|
}
|
|
554
|
-
get
|
|
1087
|
+
get wrapperClasses() {
|
|
555
1088
|
return [
|
|
556
|
-
'sefin-
|
|
557
|
-
|
|
558
|
-
this.disabled ? 'sefin-input--disabled' : '',
|
|
1089
|
+
'sefin-checkbox__wrapper',
|
|
1090
|
+
this.disabled ? 'sefin-checkbox__wrapper--disabled' : '',
|
|
559
1091
|
this.class,
|
|
560
1092
|
]
|
|
561
1093
|
.filter(Boolean)
|
|
562
1094
|
.join(' ');
|
|
563
1095
|
}
|
|
564
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
565
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type:
|
|
1096
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1097
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: CheckboxComponent, isStandalone: true, selector: "sefin-checkbox", inputs: { size: "size", disabled: "disabled", indeterminate: "indeterminate", class: "class", label: "label", name: "name", value: "value" }, outputs: { valueChange: "valueChange", checkedChange: "checkedChange" }, providers: [
|
|
566
1098
|
{
|
|
567
1099
|
provide: NG_VALUE_ACCESSOR,
|
|
568
|
-
useExisting: forwardRef(() =>
|
|
1100
|
+
useExisting: forwardRef(() => CheckboxComponent),
|
|
569
1101
|
multi: true,
|
|
570
1102
|
},
|
|
571
|
-
], ngImport: i0, template: "<input\n
|
|
1103
|
+
], viewQueries: [{ propertyName: "checkboxInput", first: true, predicate: ["checkboxInput"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<label [class]=\"wrapperClasses\">\n <input\n type=\"checkbox\"\n class=\"sefin-checkbox\"\n [class.sefin-checkbox--sm]=\"size === 'sm'\"\n [class.sefin-checkbox--md]=\"size === 'md'\"\n [class.sefin-checkbox--lg]=\"size === 'lg'\"\n [class.sefin-checkbox--disabled]=\"disabled\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n (change)=\"onCheckboxChange($event)\"\n #checkboxInput\n />\n <span \n class=\"sefin-checkbox__checkmark\" \n [class.sefin-checkbox__checkmark--sm]=\"size === 'sm'\" \n [class.sefin-checkbox__checkmark--md]=\"size === 'md'\" \n [class.sefin-checkbox__checkmark--lg]=\"size === 'lg'\" \n [class.sefin-checkbox__checkmark--checked]=\"value\" \n [class.sefin-checkbox__checkmark--indeterminate]=\"indeterminate && !value\"\n >\n <svg\n *ngIf=\"value\"\n class=\"sefin-checkbox__icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M13.3333 4L6 11.3333L2.66667 8\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n <svg\n *ngIf=\"indeterminate && !value\"\n class=\"sefin-checkbox__icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4 8H12\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n </span>\n <span *ngIf=\"label\" class=\"sefin-checkbox__label\" [class.sefin-checkbox__label--sm]=\"size === 'sm'\" [class.sefin-checkbox__label--md]=\"size === 'md'\" [class.sefin-checkbox__label--lg]=\"size === 'lg'\">{{ label }}</span>\n</label>\n\n\n", styles: [".sefin-checkbox__wrapper{display:inline-flex;align-items:center;gap:var(--sefin-spacing-sm);cursor:pointer;-webkit-user-select:none;user-select:none;position:relative}.sefin-checkbox__wrapper--disabled{cursor:not-allowed;opacity:.6}.sefin-checkbox{position:absolute;opacity:0;cursor:pointer;height:0;width:0}.sefin-checkbox__checkmark{display:flex;align-items:center;justify-content:center;border:2px solid var(--sefin-color-border);background-color:var(--sefin-color-surface);border-radius:var(--sefin-radius-sm);transition:background-color .2s ease-in-out,border-color .2s ease-in-out,color .2s ease-in-out;flex-shrink:0;color:transparent;box-sizing:border-box}.sefin-checkbox__checkmark--checked,.sefin-checkbox__checkmark--indeterminate{background-color:var(--sefin-color-primary);border-color:var(--sefin-color-primary);color:#fff}.sefin-checkbox__checkmark--sm{width:16px;height:16px;min-width:16px;min-height:16px}.sefin-checkbox__checkmark--md{width:20px;height:20px;min-width:20px;min-height:20px}.sefin-checkbox__checkmark--lg{width:24px;height:24px;min-width:24px;min-height:24px}.sefin-checkbox__wrapper:hover .sefin-checkbox__checkmark{border-color:var(--sefin-color-border-focus)}.sefin-checkbox__wrapper--disabled:hover .sefin-checkbox__checkmark{border-color:var(--sefin-color-border)}.sefin-checkbox__wrapper:focus-within .sefin-checkbox__checkmark{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-checkbox__wrapper:focus-within{outline:none}.sefin-checkbox__wrapper--disabled .sefin-checkbox__checkmark{background-color:var(--sefin-color-surface-hover);border-color:var(--sefin-color-border);cursor:not-allowed}.sefin-checkbox__wrapper--disabled .sefin-checkbox__checkmark--checked,.sefin-checkbox__wrapper--disabled .sefin-checkbox__checkmark--indeterminate{background-color:var(--sefin-color-border);border-color:var(--sefin-color-border);opacity:.6}.sefin-checkbox__icon{width:12px;height:12px;stroke-width:2;flex-shrink:0}.sefin-checkbox__checkmark--sm .sefin-checkbox__icon{width:10px;height:10px}.sefin-checkbox__checkmark--md .sefin-checkbox__icon{width:12px;height:12px}.sefin-checkbox__checkmark--lg .sefin-checkbox__icon{width:14px;height:14px}.sefin-checkbox__label{font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);-webkit-user-select:none;user-select:none}.sefin-checkbox__label--sm{font-size:var(--sefin-font-size-sm)}.sefin-checkbox__label--md{font-size:var(--sefin-font-size-base)}.sefin-checkbox__label--lg{font-size:var(--sefin-font-size-lg)}.sefin-checkbox__wrapper--disabled .sefin-checkbox__label{color:var(--sefin-color-text-disabled)}.sefin-checkbox--disabled{cursor:not-allowed}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
572
1104
|
}
|
|
573
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
1105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
574
1106
|
type: Component,
|
|
575
|
-
args: [{ selector: 'sefin-
|
|
1107
|
+
args: [{ selector: 'sefin-checkbox', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.Default, providers: [
|
|
576
1108
|
{
|
|
577
1109
|
provide: NG_VALUE_ACCESSOR,
|
|
578
|
-
useExisting: forwardRef(() =>
|
|
1110
|
+
useExisting: forwardRef(() => CheckboxComponent),
|
|
579
1111
|
multi: true,
|
|
580
1112
|
},
|
|
581
|
-
],
|
|
582
|
-
}], propDecorators: {
|
|
583
|
-
type:
|
|
584
|
-
|
|
585
|
-
type: Input
|
|
1113
|
+
], template: "<label [class]=\"wrapperClasses\">\n <input\n type=\"checkbox\"\n class=\"sefin-checkbox\"\n [class.sefin-checkbox--sm]=\"size === 'sm'\"\n [class.sefin-checkbox--md]=\"size === 'md'\"\n [class.sefin-checkbox--lg]=\"size === 'lg'\"\n [class.sefin-checkbox--disabled]=\"disabled\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n (change)=\"onCheckboxChange($event)\"\n #checkboxInput\n />\n <span \n class=\"sefin-checkbox__checkmark\" \n [class.sefin-checkbox__checkmark--sm]=\"size === 'sm'\" \n [class.sefin-checkbox__checkmark--md]=\"size === 'md'\" \n [class.sefin-checkbox__checkmark--lg]=\"size === 'lg'\" \n [class.sefin-checkbox__checkmark--checked]=\"value\" \n [class.sefin-checkbox__checkmark--indeterminate]=\"indeterminate && !value\"\n >\n <svg\n *ngIf=\"value\"\n class=\"sefin-checkbox__icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M13.3333 4L6 11.3333L2.66667 8\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n <svg\n *ngIf=\"indeterminate && !value\"\n class=\"sefin-checkbox__icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4 8H12\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n </span>\n <span *ngIf=\"label\" class=\"sefin-checkbox__label\" [class.sefin-checkbox__label--sm]=\"size === 'sm'\" [class.sefin-checkbox__label--md]=\"size === 'md'\" [class.sefin-checkbox__label--lg]=\"size === 'lg'\">{{ label }}</span>\n</label>\n\n\n", styles: [".sefin-checkbox__wrapper{display:inline-flex;align-items:center;gap:var(--sefin-spacing-sm);cursor:pointer;-webkit-user-select:none;user-select:none;position:relative}.sefin-checkbox__wrapper--disabled{cursor:not-allowed;opacity:.6}.sefin-checkbox{position:absolute;opacity:0;cursor:pointer;height:0;width:0}.sefin-checkbox__checkmark{display:flex;align-items:center;justify-content:center;border:2px solid var(--sefin-color-border);background-color:var(--sefin-color-surface);border-radius:var(--sefin-radius-sm);transition:background-color .2s ease-in-out,border-color .2s ease-in-out,color .2s ease-in-out;flex-shrink:0;color:transparent;box-sizing:border-box}.sefin-checkbox__checkmark--checked,.sefin-checkbox__checkmark--indeterminate{background-color:var(--sefin-color-primary);border-color:var(--sefin-color-primary);color:#fff}.sefin-checkbox__checkmark--sm{width:16px;height:16px;min-width:16px;min-height:16px}.sefin-checkbox__checkmark--md{width:20px;height:20px;min-width:20px;min-height:20px}.sefin-checkbox__checkmark--lg{width:24px;height:24px;min-width:24px;min-height:24px}.sefin-checkbox__wrapper:hover .sefin-checkbox__checkmark{border-color:var(--sefin-color-border-focus)}.sefin-checkbox__wrapper--disabled:hover .sefin-checkbox__checkmark{border-color:var(--sefin-color-border)}.sefin-checkbox__wrapper:focus-within .sefin-checkbox__checkmark{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-checkbox__wrapper:focus-within{outline:none}.sefin-checkbox__wrapper--disabled .sefin-checkbox__checkmark{background-color:var(--sefin-color-surface-hover);border-color:var(--sefin-color-border);cursor:not-allowed}.sefin-checkbox__wrapper--disabled .sefin-checkbox__checkmark--checked,.sefin-checkbox__wrapper--disabled .sefin-checkbox__checkmark--indeterminate{background-color:var(--sefin-color-border);border-color:var(--sefin-color-border);opacity:.6}.sefin-checkbox__icon{width:12px;height:12px;stroke-width:2;flex-shrink:0}.sefin-checkbox__checkmark--sm .sefin-checkbox__icon{width:10px;height:10px}.sefin-checkbox__checkmark--md .sefin-checkbox__icon{width:12px;height:12px}.sefin-checkbox__checkmark--lg .sefin-checkbox__icon{width:14px;height:14px}.sefin-checkbox__label{font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);-webkit-user-select:none;user-select:none}.sefin-checkbox__label--sm{font-size:var(--sefin-font-size-sm)}.sefin-checkbox__label--md{font-size:var(--sefin-font-size-base)}.sefin-checkbox__label--lg{font-size:var(--sefin-font-size-lg)}.sefin-checkbox__wrapper--disabled .sefin-checkbox__label{color:var(--sefin-color-text-disabled)}.sefin-checkbox--disabled{cursor:not-allowed}\n"] }]
|
|
1114
|
+
}], propDecorators: { checkboxInput: [{
|
|
1115
|
+
type: ViewChild,
|
|
1116
|
+
args: ['checkboxInput', { static: false }]
|
|
586
1117
|
}], size: [{
|
|
587
1118
|
type: Input
|
|
588
1119
|
}], disabled: [{
|
|
589
1120
|
type: Input
|
|
590
|
-
}],
|
|
591
|
-
type: Input
|
|
592
|
-
}], readonly: [{
|
|
1121
|
+
}], indeterminate: [{
|
|
593
1122
|
type: Input
|
|
594
1123
|
}], class: [{
|
|
595
1124
|
type: Input
|
|
596
|
-
}],
|
|
1125
|
+
}], label: [{
|
|
597
1126
|
type: Input
|
|
598
|
-
}],
|
|
599
|
-
type: Output
|
|
600
|
-
}], focus: [{
|
|
601
|
-
type: Output
|
|
602
|
-
}] } });
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* Atoms index
|
|
606
|
-
*/
|
|
607
|
-
|
|
608
|
-
class FormFieldComponent {
|
|
609
|
-
label = '';
|
|
610
|
-
hint = '';
|
|
611
|
-
error = '';
|
|
612
|
-
required = false;
|
|
613
|
-
disabled = false;
|
|
614
|
-
inputId = '';
|
|
615
|
-
inputType = 'text';
|
|
616
|
-
placeholder = '';
|
|
617
|
-
size = 'md';
|
|
618
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
619
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: FormFieldComponent, isStandalone: true, selector: "sefin-form-field", inputs: { label: "label", hint: "hint", error: "error", required: "required", disabled: "disabled", inputId: "inputId", inputType: "inputType", placeholder: "placeholder", size: "size" }, ngImport: i0, template: "<div class=\"sefin-form-field\">\n <label *ngIf=\"label\" [for]=\"inputId\" class=\"sefin-form-field__label\">\n {{ label }}\n <span *ngIf=\"required\" class=\"sefin-form-field__required\">*</span>\n </label>\n <sefin-input\n [id]=\"inputId\"\n [type]=\"inputType\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [size]=\"size\"\n [class.sefin-form-field__input--error]=\"!!error\"\n ></sefin-input>\n <div *ngIf=\"hint && !error\" class=\"sefin-form-field__hint\">{{ hint }}</div>\n <div *ngIf=\"error\" class=\"sefin-form-field__error\">{{ error }}</div>\n</div>\n\n", styles: [".sefin-form-field{display:flex;flex-direction:column;gap:var(--sefin-spacing-sm, 8px);width:100%}.sefin-form-field__label{font-size:var(--sefin-font-size-sm, .875rem);font-weight:var(--sefin-font-weight-medium, 500);color:var(--sefin-color-text)}.sefin-form-field__required{color:var(--sefin-color-error);margin-left:2px}.sefin-form-field__hint{font-size:var(--sefin-font-size-xs, .75rem);color:var(--sefin-color-text-secondary)}.sefin-form-field__error{font-size:var(--sefin-font-size-xs, .75rem);color:var(--sefin-color-error)}.sefin-form-field__input--error{border-color:var(--sefin-color-error)!important}.sefin-form-field__input--error:focus{box-shadow:0 0 0 3px #f443361a!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InputComponent, selector: "sefin-input", inputs: ["type", "placeholder", "size", "disabled", "required", "readonly", "class", "id"], outputs: ["blur", "focus"] }, { kind: "ngmodule", type: FormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
620
|
-
}
|
|
621
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
622
|
-
type: Component,
|
|
623
|
-
args: [{ selector: 'sefin-form-field', standalone: true, imports: [CommonModule, InputComponent, FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"sefin-form-field\">\n <label *ngIf=\"label\" [for]=\"inputId\" class=\"sefin-form-field__label\">\n {{ label }}\n <span *ngIf=\"required\" class=\"sefin-form-field__required\">*</span>\n </label>\n <sefin-input\n [id]=\"inputId\"\n [type]=\"inputType\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [size]=\"size\"\n [class.sefin-form-field__input--error]=\"!!error\"\n ></sefin-input>\n <div *ngIf=\"hint && !error\" class=\"sefin-form-field__hint\">{{ hint }}</div>\n <div *ngIf=\"error\" class=\"sefin-form-field__error\">{{ error }}</div>\n</div>\n\n", styles: [".sefin-form-field{display:flex;flex-direction:column;gap:var(--sefin-spacing-sm, 8px);width:100%}.sefin-form-field__label{font-size:var(--sefin-font-size-sm, .875rem);font-weight:var(--sefin-font-weight-medium, 500);color:var(--sefin-color-text)}.sefin-form-field__required{color:var(--sefin-color-error);margin-left:2px}.sefin-form-field__hint{font-size:var(--sefin-font-size-xs, .75rem);color:var(--sefin-color-text-secondary)}.sefin-form-field__error{font-size:var(--sefin-font-size-xs, .75rem);color:var(--sefin-color-error)}.sefin-form-field__input--error{border-color:var(--sefin-color-error)!important}.sefin-form-field__input--error:focus{box-shadow:0 0 0 3px #f443361a!important}\n"] }]
|
|
624
|
-
}], propDecorators: { label: [{
|
|
1127
|
+
}], name: [{
|
|
625
1128
|
type: Input
|
|
626
|
-
}],
|
|
627
|
-
type: Input
|
|
628
|
-
}], error: [{
|
|
629
|
-
type: Input
|
|
630
|
-
}], required: [{
|
|
631
|
-
type: Input
|
|
632
|
-
}], disabled: [{
|
|
633
|
-
type: Input
|
|
634
|
-
}], inputId: [{
|
|
635
|
-
type: Input
|
|
636
|
-
}], inputType: [{
|
|
637
|
-
type: Input
|
|
638
|
-
}], placeholder: [{
|
|
639
|
-
type: Input
|
|
640
|
-
}], size: [{
|
|
1129
|
+
}], value: [{
|
|
641
1130
|
type: Input
|
|
1131
|
+
}], valueChange: [{
|
|
1132
|
+
type: Output
|
|
1133
|
+
}], checkedChange: [{
|
|
1134
|
+
type: Output
|
|
642
1135
|
}] } });
|
|
643
1136
|
|
|
644
|
-
class
|
|
1137
|
+
class SelectComponent {
|
|
1138
|
+
containerRef;
|
|
1139
|
+
dropdownRef;
|
|
1140
|
+
buttonRef;
|
|
645
1141
|
options = [];
|
|
646
|
-
placeholder = '
|
|
1142
|
+
placeholder = 'Seleccionar...';
|
|
647
1143
|
disabled = false;
|
|
648
1144
|
size = 'md';
|
|
649
|
-
|
|
1145
|
+
class = '';
|
|
1146
|
+
value = null;
|
|
1147
|
+
valueChange = new EventEmitter();
|
|
1148
|
+
optionSelected = new EventEmitter();
|
|
650
1149
|
isOpen = false;
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
1150
|
+
selectedIndex = -1;
|
|
1151
|
+
onChange = (value) => { };
|
|
1152
|
+
onTouched = () => { };
|
|
1153
|
+
ngOnInit() {
|
|
1154
|
+
this.updateSelectedIndex();
|
|
1155
|
+
}
|
|
1156
|
+
ngOnChanges(changes) {
|
|
1157
|
+
if (changes['value'] || changes['options']) {
|
|
1158
|
+
this.updateSelectedIndex();
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
ngOnDestroy() { }
|
|
1162
|
+
onClickOutside(event) {
|
|
1163
|
+
if (this.containerRef?.nativeElement && this.isOpen) {
|
|
1164
|
+
const clickedInside = this.containerRef.nativeElement.contains(event.target);
|
|
1165
|
+
if (!clickedInside) {
|
|
1166
|
+
this.closeDropdown();
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
onEscapeKey(event) {
|
|
1171
|
+
const keyboardEvent = event;
|
|
1172
|
+
if (this.isOpen) {
|
|
1173
|
+
keyboardEvent.preventDefault();
|
|
1174
|
+
this.closeDropdown();
|
|
1175
|
+
this.buttonRef?.nativeElement?.focus();
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
toggleDropdown() {
|
|
1179
|
+
if (this.disabled)
|
|
1180
|
+
return;
|
|
1181
|
+
if (this.isOpen) {
|
|
1182
|
+
this.closeDropdown();
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
this.openDropdown();
|
|
655
1186
|
}
|
|
656
1187
|
}
|
|
1188
|
+
openDropdown() {
|
|
1189
|
+
if (this.disabled || !this.options || this.options.length === 0)
|
|
1190
|
+
return;
|
|
1191
|
+
this.isOpen = true;
|
|
1192
|
+
this.updateSelectedIndex();
|
|
1193
|
+
// If no selection, focus first enabled option
|
|
1194
|
+
if (this.selectedIndex < 0) {
|
|
1195
|
+
const enabledOptions = this.options.filter((opt) => !opt.disabled);
|
|
1196
|
+
if (enabledOptions.length > 0) {
|
|
1197
|
+
this.selectedIndex = this.options.indexOf(enabledOptions[0]);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
// Scroll to selected option when opening
|
|
1201
|
+
setTimeout(() => {
|
|
1202
|
+
this.scrollToSelected();
|
|
1203
|
+
}, 0);
|
|
1204
|
+
}
|
|
1205
|
+
closeDropdown() {
|
|
1206
|
+
this.isOpen = false;
|
|
1207
|
+
this.selectedIndex = -1;
|
|
1208
|
+
}
|
|
657
1209
|
selectOption(option) {
|
|
658
|
-
if (
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
1210
|
+
if (option.disabled)
|
|
1211
|
+
return;
|
|
1212
|
+
this.value = option.value;
|
|
1213
|
+
this.onChange(this.value);
|
|
1214
|
+
this.onTouched();
|
|
1215
|
+
this.valueChange.emit(this.value);
|
|
1216
|
+
this.optionSelected.emit(option);
|
|
1217
|
+
this.closeDropdown();
|
|
1218
|
+
this.buttonRef?.nativeElement?.focus();
|
|
1219
|
+
}
|
|
1220
|
+
onKeyDown(event) {
|
|
1221
|
+
if (this.disabled)
|
|
1222
|
+
return;
|
|
1223
|
+
if (!this.isOpen) {
|
|
1224
|
+
if (event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowDown') {
|
|
1225
|
+
event.preventDefault();
|
|
1226
|
+
this.openDropdown();
|
|
1227
|
+
}
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
if (!this.options || this.options.length === 0)
|
|
1231
|
+
return;
|
|
1232
|
+
const enabledOptions = this.options.filter((opt) => !opt.disabled);
|
|
1233
|
+
switch (event.key) {
|
|
1234
|
+
case 'ArrowDown':
|
|
1235
|
+
event.preventDefault();
|
|
1236
|
+
if (enabledOptions.length === 0)
|
|
1237
|
+
return;
|
|
1238
|
+
let nextIndex = this.selectedIndex + 1;
|
|
1239
|
+
while (nextIndex < this.options.length && this.options[nextIndex].disabled) {
|
|
1240
|
+
nextIndex++;
|
|
1241
|
+
}
|
|
1242
|
+
if (nextIndex < this.options.length) {
|
|
1243
|
+
this.selectedIndex = nextIndex;
|
|
1244
|
+
}
|
|
1245
|
+
else {
|
|
1246
|
+
// Wrap to first enabled option
|
|
1247
|
+
this.selectedIndex = this.options.indexOf(enabledOptions[0]);
|
|
1248
|
+
}
|
|
1249
|
+
setTimeout(() => this.scrollToSelected(), 0);
|
|
1250
|
+
break;
|
|
1251
|
+
case 'ArrowUp':
|
|
1252
|
+
event.preventDefault();
|
|
1253
|
+
if (enabledOptions.length === 0)
|
|
1254
|
+
return;
|
|
1255
|
+
let prevIndex = this.selectedIndex - 1;
|
|
1256
|
+
while (prevIndex >= 0 && this.options[prevIndex].disabled) {
|
|
1257
|
+
prevIndex--;
|
|
1258
|
+
}
|
|
1259
|
+
if (prevIndex >= 0) {
|
|
1260
|
+
this.selectedIndex = prevIndex;
|
|
1261
|
+
}
|
|
1262
|
+
else {
|
|
1263
|
+
// Wrap to last enabled option
|
|
1264
|
+
const lastOption = enabledOptions[enabledOptions.length - 1];
|
|
1265
|
+
this.selectedIndex = this.options.indexOf(lastOption);
|
|
1266
|
+
}
|
|
1267
|
+
setTimeout(() => this.scrollToSelected(), 0);
|
|
1268
|
+
break;
|
|
1269
|
+
case 'Enter':
|
|
1270
|
+
event.preventDefault();
|
|
1271
|
+
if (this.selectedIndex >= 0 && this.selectedIndex < this.options.length) {
|
|
1272
|
+
const option = this.options[this.selectedIndex];
|
|
1273
|
+
if (!option.disabled) {
|
|
1274
|
+
this.selectOption(option);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
break;
|
|
1278
|
+
case 'Escape':
|
|
1279
|
+
event.preventDefault();
|
|
1280
|
+
this.closeDropdown();
|
|
1281
|
+
this.buttonRef?.nativeElement?.focus();
|
|
1282
|
+
break;
|
|
1283
|
+
case 'Home':
|
|
1284
|
+
event.preventDefault();
|
|
1285
|
+
if (enabledOptions.length > 0) {
|
|
1286
|
+
this.selectedIndex = this.options.indexOf(enabledOptions[0]);
|
|
1287
|
+
setTimeout(() => this.scrollToSelected(), 0);
|
|
1288
|
+
}
|
|
1289
|
+
break;
|
|
1290
|
+
case 'End':
|
|
1291
|
+
event.preventDefault();
|
|
1292
|
+
if (enabledOptions.length > 0) {
|
|
1293
|
+
const lastOption = enabledOptions[enabledOptions.length - 1];
|
|
1294
|
+
this.selectedIndex = this.options.indexOf(lastOption);
|
|
1295
|
+
setTimeout(() => this.scrollToSelected(), 0);
|
|
1296
|
+
}
|
|
1297
|
+
break;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
updateSelectedIndex() {
|
|
1301
|
+
if (this.value === null || !this.options) {
|
|
1302
|
+
this.selectedIndex = -1;
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
const index = this.options.findIndex((opt) => opt.value === this.value);
|
|
1306
|
+
this.selectedIndex = index >= 0 ? index : -1;
|
|
1307
|
+
}
|
|
1308
|
+
scrollToSelected() {
|
|
1309
|
+
try {
|
|
1310
|
+
if (this.dropdownRef?.nativeElement &&
|
|
1311
|
+
this.selectedIndex >= 0 &&
|
|
1312
|
+
this.selectedIndex < this.options.length) {
|
|
1313
|
+
const selectedElement = this.dropdownRef.nativeElement.querySelector(`[data-index="${this.selectedIndex}"]`);
|
|
1314
|
+
if (selectedElement && selectedElement instanceof HTMLElement) {
|
|
1315
|
+
selectedElement.scrollIntoView({
|
|
1316
|
+
block: 'nearest',
|
|
1317
|
+
behavior: 'smooth',
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
catch (error) {
|
|
1323
|
+
console.warn('Could not scroll to selected option:', error);
|
|
662
1324
|
}
|
|
663
1325
|
}
|
|
664
|
-
|
|
665
|
-
|
|
1326
|
+
getSelectedLabel() {
|
|
1327
|
+
if (this.value === null || !this.options) {
|
|
1328
|
+
return '';
|
|
1329
|
+
}
|
|
1330
|
+
const selectedOption = this.options.find((opt) => opt.value === this.value);
|
|
1331
|
+
return selectedOption?.label || '';
|
|
1332
|
+
}
|
|
1333
|
+
writeValue(value) {
|
|
1334
|
+
this.value = value;
|
|
1335
|
+
this.updateSelectedIndex();
|
|
1336
|
+
}
|
|
1337
|
+
registerOnChange(fn) {
|
|
1338
|
+
this.onChange = fn;
|
|
1339
|
+
}
|
|
1340
|
+
registerOnTouched(fn) {
|
|
1341
|
+
this.onTouched = fn;
|
|
1342
|
+
}
|
|
1343
|
+
setDisabledState(isDisabled) {
|
|
1344
|
+
this.disabled = isDisabled;
|
|
1345
|
+
if (isDisabled && this.isOpen) {
|
|
1346
|
+
this.closeDropdown();
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
get buttonClasses() {
|
|
1350
|
+
return [
|
|
1351
|
+
'sefin-select__button',
|
|
1352
|
+
`sefin-select__button--${this.size}`,
|
|
1353
|
+
this.disabled ? 'sefin-select__button--disabled' : '',
|
|
1354
|
+
this.isOpen ? 'sefin-select__button--open' : '',
|
|
1355
|
+
this.class,
|
|
1356
|
+
]
|
|
1357
|
+
.filter(Boolean)
|
|
1358
|
+
.join(' ');
|
|
1359
|
+
}
|
|
1360
|
+
get containerClasses() {
|
|
1361
|
+
return [
|
|
1362
|
+
'sefin-select',
|
|
1363
|
+
this.isOpen ? 'sefin-select--open' : '',
|
|
1364
|
+
]
|
|
1365
|
+
.filter(Boolean)
|
|
1366
|
+
.join(' ');
|
|
666
1367
|
}
|
|
667
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
668
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type:
|
|
1368
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1369
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: SelectComponent, isStandalone: true, selector: "sefin-select", inputs: { options: "options", placeholder: "placeholder", disabled: "disabled", size: "size", class: "class", value: "value" }, outputs: { valueChange: "valueChange", optionSelected: "optionSelected" }, host: { listeners: { "document:click": "onClickOutside($event)", "document:keydown.escape": "onEscapeKey($event)" } }, providers: [
|
|
1370
|
+
{
|
|
1371
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1372
|
+
useExisting: forwardRef(() => SelectComponent),
|
|
1373
|
+
multi: true,
|
|
1374
|
+
},
|
|
1375
|
+
], viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["containerRef"], descendants: true }, { propertyName: "dropdownRef", first: true, predicate: ["dropdownRef"], descendants: true }, { propertyName: "buttonRef", first: true, predicate: ["buttonRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div [class]=\"containerClasses\" #containerRef>\n <button\n #buttonRef\n type=\"button\"\n [class]=\"buttonClasses\"\n [disabled]=\"disabled\"\n (click)=\"toggleDropdown()\"\n (keydown)=\"onKeyDown($event)\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-haspopup]=\"true\"\n aria-label=\"Select option\"\n >\n <span class=\"sefin-select__value\" [class.sefin-select__value--placeholder]=\"!getSelectedLabel()\">\n {{ getSelectedLabel() || placeholder }}\n </span>\n <div class=\"sefin-select__arrow\" [class.sefin-select__arrow--open]=\"isOpen\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4 6L8 10L12 6\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </div>\n </button>\n <div\n *ngIf=\"isOpen && options && options.length > 0\"\n #dropdownRef\n class=\"sefin-select__dropdown\"\n role=\"listbox\"\n >\n <ul class=\"sefin-select__list\">\n <li\n *ngFor=\"let option of options; let i = index\"\n [attr.data-index]=\"i\"\n [class.sefin-select__option]=\"true\"\n [class.sefin-select__option--selected]=\"i === selectedIndex\"\n [class.sefin-select__option--disabled]=\"option.disabled\"\n [class.sefin-select__option--active]=\"option.value === value\"\n (click)=\"selectOption(option)\"\n [attr.aria-selected]=\"option.value === value\"\n role=\"option\"\n >\n {{ option.label }}\n </li>\n </ul>\n </div>\n <div\n *ngIf=\"isOpen && (!options || options.length === 0)\"\n class=\"sefin-select__dropdown sefin-select__dropdown--empty\"\n >\n <div class=\"sefin-select__no-options\">\n No hay opciones disponibles\n </div>\n </div>\n</div>\n\n", styles: [".sefin-select{position:relative;width:100%}.sefin-select__button{width:100%;display:flex;align-items:center;justify-content:space-between;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);background-color:var(--sefin-color-surface);border:1px solid var(--sefin-color-border);border-radius:var(--sefin-radius-md);transition:all .2s ease-in-out;outline:none;cursor:pointer;text-align:left;gap:var(--sefin-spacing-sm)}.sefin-select__button:focus-visible{border-color:var(--sefin-color-border-focus);box-shadow:0 0 0 3px var(--sefin-color-primary-light)}.sefin-select__button:hover:not(.sefin-select__button--disabled){border-color:var(--sefin-color-border-focus)}.sefin-select__button--disabled{background-color:var(--sefin-color-surface-hover);color:var(--sefin-color-text-disabled);cursor:not-allowed;opacity:.6}.sefin-select__button--open{border-color:var(--sefin-color-border-focus);box-shadow:0 0 0 3px var(--sefin-color-primary-light)}.sefin-select__button--sm{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);font-size:var(--sefin-font-size-sm);line-height:var(--sefin-line-height-normal);min-height:32px}.sefin-select__button--md{padding:var(--sefin-spacing-md) var(--sefin-spacing-lg);font-size:var(--sefin-font-size-base);line-height:var(--sefin-line-height-normal);min-height:40px}.sefin-select__button--lg{padding:var(--sefin-spacing-lg) var(--sefin-spacing-xl);font-size:var(--sefin-font-size-lg);line-height:var(--sefin-line-height-normal);min-height:48px}.sefin-select__value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sefin-color-text)}.sefin-select__value--placeholder{color:var(--sefin-color-text-secondary)}.sefin-select__arrow{display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--sefin-color-text-secondary);pointer-events:none;transition:transform .2s ease-in-out}.sefin-select__arrow svg{width:16px;height:16px}.sefin-select__arrow--open{transform:rotate(180deg)}.sefin-select__dropdown{position:absolute;top:calc(100% + var(--sefin-spacing-xs));left:0;right:0;z-index:9999;background-color:var(--sefin-color-surface);border:1px solid var(--sefin-color-border);border-radius:var(--sefin-radius-md);box-shadow:var(--sefin-shadow-lg);max-height:300px;overflow-y:auto;overflow-x:hidden}.sefin-select__dropdown--empty{padding:var(--sefin-spacing-md)}.sefin-select__list{list-style:none;margin:0;padding:var(--sefin-spacing-xs)}.sefin-select__option{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);font-family:var(--sefin-font-family-base);font-size:var(--sefin-font-size-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);cursor:pointer;border-radius:var(--sefin-radius-sm);transition:all .15s ease-in-out;-webkit-user-select:none;user-select:none}.sefin-select__option:hover:not(.sefin-select__option--disabled){background-color:var(--sefin-color-surface-hover)}.sefin-select__option--selected,.sefin-select__option--active{background-color:var(--sefin-color-primary-light, var(--sefin-color-surface-hover));color:var(--sefin-color-text);font-weight:var(--sefin-font-weight-medium)}.sefin-select__option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.sefin-select__no-options{padding:var(--sefin-spacing-md);text-align:center;font-family:var(--sefin-font-family-base);font-size:var(--sefin-font-size-sm);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text-secondary)}.sefin-select--open .sefin-select__button{border-color:var(--sefin-color-border-focus)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
669
1376
|
}
|
|
670
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
1377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SelectComponent, decorators: [{
|
|
671
1378
|
type: Component,
|
|
672
|
-
args: [{ selector: 'sefin-
|
|
673
|
-
|
|
1379
|
+
args: [{ selector: 'sefin-select', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.Default, providers: [
|
|
1380
|
+
{
|
|
1381
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1382
|
+
useExisting: forwardRef(() => SelectComponent),
|
|
1383
|
+
multi: true,
|
|
1384
|
+
},
|
|
1385
|
+
], template: "<div [class]=\"containerClasses\" #containerRef>\n <button\n #buttonRef\n type=\"button\"\n [class]=\"buttonClasses\"\n [disabled]=\"disabled\"\n (click)=\"toggleDropdown()\"\n (keydown)=\"onKeyDown($event)\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-haspopup]=\"true\"\n aria-label=\"Select option\"\n >\n <span class=\"sefin-select__value\" [class.sefin-select__value--placeholder]=\"!getSelectedLabel()\">\n {{ getSelectedLabel() || placeholder }}\n </span>\n <div class=\"sefin-select__arrow\" [class.sefin-select__arrow--open]=\"isOpen\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4 6L8 10L12 6\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </div>\n </button>\n <div\n *ngIf=\"isOpen && options && options.length > 0\"\n #dropdownRef\n class=\"sefin-select__dropdown\"\n role=\"listbox\"\n >\n <ul class=\"sefin-select__list\">\n <li\n *ngFor=\"let option of options; let i = index\"\n [attr.data-index]=\"i\"\n [class.sefin-select__option]=\"true\"\n [class.sefin-select__option--selected]=\"i === selectedIndex\"\n [class.sefin-select__option--disabled]=\"option.disabled\"\n [class.sefin-select__option--active]=\"option.value === value\"\n (click)=\"selectOption(option)\"\n [attr.aria-selected]=\"option.value === value\"\n role=\"option\"\n >\n {{ option.label }}\n </li>\n </ul>\n </div>\n <div\n *ngIf=\"isOpen && (!options || options.length === 0)\"\n class=\"sefin-select__dropdown sefin-select__dropdown--empty\"\n >\n <div class=\"sefin-select__no-options\">\n No hay opciones disponibles\n </div>\n </div>\n</div>\n\n", styles: [".sefin-select{position:relative;width:100%}.sefin-select__button{width:100%;display:flex;align-items:center;justify-content:space-between;font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);background-color:var(--sefin-color-surface);border:1px solid var(--sefin-color-border);border-radius:var(--sefin-radius-md);transition:all .2s ease-in-out;outline:none;cursor:pointer;text-align:left;gap:var(--sefin-spacing-sm)}.sefin-select__button:focus-visible{border-color:var(--sefin-color-border-focus);box-shadow:0 0 0 3px var(--sefin-color-primary-light)}.sefin-select__button:hover:not(.sefin-select__button--disabled){border-color:var(--sefin-color-border-focus)}.sefin-select__button--disabled{background-color:var(--sefin-color-surface-hover);color:var(--sefin-color-text-disabled);cursor:not-allowed;opacity:.6}.sefin-select__button--open{border-color:var(--sefin-color-border-focus);box-shadow:0 0 0 3px var(--sefin-color-primary-light)}.sefin-select__button--sm{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);font-size:var(--sefin-font-size-sm);line-height:var(--sefin-line-height-normal);min-height:32px}.sefin-select__button--md{padding:var(--sefin-spacing-md) var(--sefin-spacing-lg);font-size:var(--sefin-font-size-base);line-height:var(--sefin-line-height-normal);min-height:40px}.sefin-select__button--lg{padding:var(--sefin-spacing-lg) var(--sefin-spacing-xl);font-size:var(--sefin-font-size-lg);line-height:var(--sefin-line-height-normal);min-height:48px}.sefin-select__value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sefin-color-text)}.sefin-select__value--placeholder{color:var(--sefin-color-text-secondary)}.sefin-select__arrow{display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--sefin-color-text-secondary);pointer-events:none;transition:transform .2s ease-in-out}.sefin-select__arrow svg{width:16px;height:16px}.sefin-select__arrow--open{transform:rotate(180deg)}.sefin-select__dropdown{position:absolute;top:calc(100% + var(--sefin-spacing-xs));left:0;right:0;z-index:9999;background-color:var(--sefin-color-surface);border:1px solid var(--sefin-color-border);border-radius:var(--sefin-radius-md);box-shadow:var(--sefin-shadow-lg);max-height:300px;overflow-y:auto;overflow-x:hidden}.sefin-select__dropdown--empty{padding:var(--sefin-spacing-md)}.sefin-select__list{list-style:none;margin:0;padding:var(--sefin-spacing-xs)}.sefin-select__option{padding:var(--sefin-spacing-sm) var(--sefin-spacing-md);font-family:var(--sefin-font-family-base);font-size:var(--sefin-font-size-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);cursor:pointer;border-radius:var(--sefin-radius-sm);transition:all .15s ease-in-out;-webkit-user-select:none;user-select:none}.sefin-select__option:hover:not(.sefin-select__option--disabled){background-color:var(--sefin-color-surface-hover)}.sefin-select__option--selected,.sefin-select__option--active{background-color:var(--sefin-color-primary-light, var(--sefin-color-surface-hover));color:var(--sefin-color-text);font-weight:var(--sefin-font-weight-medium)}.sefin-select__option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.sefin-select__no-options{padding:var(--sefin-spacing-md);text-align:center;font-family:var(--sefin-font-family-base);font-size:var(--sefin-font-size-sm);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text-secondary)}.sefin-select--open .sefin-select__button{border-color:var(--sefin-color-border-focus)}\n"] }]
|
|
1386
|
+
}], propDecorators: { containerRef: [{
|
|
1387
|
+
type: ViewChild,
|
|
1388
|
+
args: ['containerRef', { static: false }]
|
|
1389
|
+
}], dropdownRef: [{
|
|
1390
|
+
type: ViewChild,
|
|
1391
|
+
args: ['dropdownRef', { static: false }]
|
|
1392
|
+
}], buttonRef: [{
|
|
1393
|
+
type: ViewChild,
|
|
1394
|
+
args: ['buttonRef', { static: false }]
|
|
1395
|
+
}], options: [{
|
|
674
1396
|
type: Input
|
|
675
1397
|
}], placeholder: [{
|
|
676
1398
|
type: Input
|
|
@@ -678,123 +1400,150 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
678
1400
|
type: Input
|
|
679
1401
|
}], size: [{
|
|
680
1402
|
type: Input
|
|
681
|
-
}],
|
|
1403
|
+
}], class: [{
|
|
1404
|
+
type: Input
|
|
1405
|
+
}], value: [{
|
|
1406
|
+
type: Input
|
|
1407
|
+
}], valueChange: [{
|
|
1408
|
+
type: Output
|
|
1409
|
+
}], optionSelected: [{
|
|
682
1410
|
type: Output
|
|
1411
|
+
}], onClickOutside: [{
|
|
1412
|
+
type: HostListener,
|
|
1413
|
+
args: ['document:click', ['$event']]
|
|
1414
|
+
}], onEscapeKey: [{
|
|
1415
|
+
type: HostListener,
|
|
1416
|
+
args: ['document:keydown.escape', ['$event']]
|
|
683
1417
|
}] } });
|
|
684
1418
|
|
|
685
|
-
class
|
|
686
|
-
|
|
1419
|
+
class SwitchComponent {
|
|
1420
|
+
size = 'md';
|
|
1421
|
+
disabled = false;
|
|
687
1422
|
class = '';
|
|
688
|
-
|
|
1423
|
+
label = '';
|
|
1424
|
+
name = '';
|
|
1425
|
+
value = false;
|
|
1426
|
+
valueChange = new EventEmitter();
|
|
1427
|
+
checkedChange = new EventEmitter();
|
|
1428
|
+
onChange = (value) => { };
|
|
1429
|
+
onTouched = () => { };
|
|
1430
|
+
onSwitchChange(event) {
|
|
1431
|
+
if (this.disabled) {
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
const target = event.target;
|
|
1435
|
+
this.value = target.checked;
|
|
1436
|
+
this.onChange(this.value);
|
|
1437
|
+
this.onTouched();
|
|
1438
|
+
this.valueChange.emit(this.value);
|
|
1439
|
+
this.checkedChange.emit(this.value);
|
|
1440
|
+
}
|
|
1441
|
+
writeValue(value) {
|
|
1442
|
+
this.value = value;
|
|
1443
|
+
}
|
|
1444
|
+
registerOnChange(fn) {
|
|
1445
|
+
this.onChange = fn;
|
|
1446
|
+
}
|
|
1447
|
+
registerOnTouched(fn) {
|
|
1448
|
+
this.onTouched = fn;
|
|
1449
|
+
}
|
|
1450
|
+
setDisabledState(isDisabled) {
|
|
1451
|
+
this.disabled = isDisabled;
|
|
1452
|
+
}
|
|
1453
|
+
get wrapperClasses() {
|
|
689
1454
|
return [
|
|
690
|
-
'sefin-
|
|
691
|
-
|
|
1455
|
+
'sefin-switch__wrapper',
|
|
1456
|
+
this.disabled ? 'sefin-switch__wrapper--disabled' : '',
|
|
692
1457
|
this.class,
|
|
693
1458
|
]
|
|
694
1459
|
.filter(Boolean)
|
|
695
1460
|
.join(' ');
|
|
696
1461
|
}
|
|
697
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
698
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type:
|
|
1462
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1463
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: SwitchComponent, isStandalone: true, selector: "sefin-switch", inputs: { size: "size", disabled: "disabled", class: "class", label: "label", name: "name", value: "value" }, outputs: { valueChange: "valueChange", checkedChange: "checkedChange" }, providers: [
|
|
1464
|
+
{
|
|
1465
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1466
|
+
useExisting: forwardRef(() => SwitchComponent),
|
|
1467
|
+
multi: true,
|
|
1468
|
+
},
|
|
1469
|
+
], ngImport: i0, template: "<label [class]=\"wrapperClasses\">\n <input\n type=\"checkbox\"\n class=\"sefin-switch\"\n [class.sefin-switch--sm]=\"size === 'sm'\"\n [class.sefin-switch--md]=\"size === 'md'\"\n [class.sefin-switch--lg]=\"size === 'lg'\"\n [class.sefin-switch--disabled]=\"disabled\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n (change)=\"onSwitchChange($event)\"\n />\n <span \n class=\"sefin-switch__track\" \n [class.sefin-switch__track--sm]=\"size === 'sm'\" \n [class.sefin-switch__track--md]=\"size === 'md'\" \n [class.sefin-switch__track--lg]=\"size === 'lg'\" \n [class.sefin-switch__track--checked]=\"value\" \n >\n <span \n class=\"sefin-switch__thumb\"\n [class.sefin-switch__thumb--sm]=\"size === 'sm'\"\n [class.sefin-switch__thumb--md]=\"size === 'md'\"\n [class.sefin-switch__thumb--lg]=\"size === 'lg'\"\n ></span>\n </span>\n <span *ngIf=\"label\" class=\"sefin-switch__label\" [class.sefin-switch__label--sm]=\"size === 'sm'\" [class.sefin-switch__label--md]=\"size === 'md'\" [class.sefin-switch__label--lg]=\"size === 'lg'\">{{ label }}</span>\n</label>\n\n", styles: [".sefin-switch__wrapper{display:inline-flex;align-items:center;gap:var(--sefin-spacing-sm);cursor:pointer;-webkit-user-select:none;user-select:none;position:relative}.sefin-switch__wrapper--disabled{cursor:not-allowed;opacity:.6}.sefin-switch{position:absolute;opacity:0;cursor:pointer;height:0;width:0}.sefin-switch__track{position:relative;display:inline-block;background-color:var(--sefin-color-border);border-radius:9999px;transition:background-color .2s ease-in-out;flex-shrink:0;box-sizing:border-box}.sefin-switch__track--checked{background-color:var(--sefin-color-primary)}.sefin-switch__track--sm{width:32px;height:18px}.sefin-switch__track--md{width:40px;height:22px}.sefin-switch__track--lg{width:48px;height:26px}.sefin-switch__thumb{position:absolute;top:50%;left:2px;transform:translateY(-50%);background-color:#fff;border-radius:50%;transition:transform .2s ease-in-out,box-shadow .2s ease-in-out;box-shadow:0 2px 4px #0003;box-sizing:border-box}.sefin-switch__thumb--sm{width:14px;height:14px}.sefin-switch__thumb--md{width:18px;height:18px}.sefin-switch__thumb--lg{width:22px;height:22px}.sefin-switch__track--sm.sefin-switch__track--checked .sefin-switch__thumb{transform:translateY(-50%) translate(14px)}.sefin-switch__track--md.sefin-switch__track--checked .sefin-switch__thumb{transform:translateY(-50%) translate(18px)}.sefin-switch__track--lg.sefin-switch__track--checked .sefin-switch__thumb{transform:translateY(-50%) translate(22px)}.sefin-switch__wrapper:hover .sefin-switch__track:not(.sefin-switch__track--checked){background-color:var(--sefin-color-border-focus)}.sefin-switch__wrapper--disabled:hover .sefin-switch__track{background-color:var(--sefin-color-border)}.sefin-switch__wrapper:focus-within .sefin-switch__track{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-switch__wrapper:focus-within{outline:none}.sefin-switch__wrapper--disabled .sefin-switch__track{background-color:var(--sefin-color-border);cursor:not-allowed}.sefin-switch__wrapper--disabled .sefin-switch__track--checked{background-color:var(--sefin-color-border);opacity:.6}.sefin-switch__wrapper--disabled .sefin-switch__thumb{box-shadow:0 1px 2px #0000001a}.sefin-switch__label{font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);-webkit-user-select:none;user-select:none}.sefin-switch__label--sm{font-size:var(--sefin-font-size-sm)}.sefin-switch__label--md{font-size:var(--sefin-font-size-base)}.sefin-switch__label--lg{font-size:var(--sefin-font-size-lg)}.sefin-switch__wrapper--disabled .sefin-switch__label{color:var(--sefin-color-text-disabled)}.sefin-switch--disabled{cursor:not-allowed}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
699
1470
|
}
|
|
700
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
1471
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SwitchComponent, decorators: [{
|
|
701
1472
|
type: Component,
|
|
702
|
-
args: [{ selector: 'sefin-
|
|
703
|
-
|
|
1473
|
+
args: [{ selector: 'sefin-switch', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.Default, providers: [
|
|
1474
|
+
{
|
|
1475
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1476
|
+
useExisting: forwardRef(() => SwitchComponent),
|
|
1477
|
+
multi: true,
|
|
1478
|
+
},
|
|
1479
|
+
], template: "<label [class]=\"wrapperClasses\">\n <input\n type=\"checkbox\"\n class=\"sefin-switch\"\n [class.sefin-switch--sm]=\"size === 'sm'\"\n [class.sefin-switch--md]=\"size === 'md'\"\n [class.sefin-switch--lg]=\"size === 'lg'\"\n [class.sefin-switch--disabled]=\"disabled\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n (change)=\"onSwitchChange($event)\"\n />\n <span \n class=\"sefin-switch__track\" \n [class.sefin-switch__track--sm]=\"size === 'sm'\" \n [class.sefin-switch__track--md]=\"size === 'md'\" \n [class.sefin-switch__track--lg]=\"size === 'lg'\" \n [class.sefin-switch__track--checked]=\"value\" \n >\n <span \n class=\"sefin-switch__thumb\"\n [class.sefin-switch__thumb--sm]=\"size === 'sm'\"\n [class.sefin-switch__thumb--md]=\"size === 'md'\"\n [class.sefin-switch__thumb--lg]=\"size === 'lg'\"\n ></span>\n </span>\n <span *ngIf=\"label\" class=\"sefin-switch__label\" [class.sefin-switch__label--sm]=\"size === 'sm'\" [class.sefin-switch__label--md]=\"size === 'md'\" [class.sefin-switch__label--lg]=\"size === 'lg'\">{{ label }}</span>\n</label>\n\n", styles: [".sefin-switch__wrapper{display:inline-flex;align-items:center;gap:var(--sefin-spacing-sm);cursor:pointer;-webkit-user-select:none;user-select:none;position:relative}.sefin-switch__wrapper--disabled{cursor:not-allowed;opacity:.6}.sefin-switch{position:absolute;opacity:0;cursor:pointer;height:0;width:0}.sefin-switch__track{position:relative;display:inline-block;background-color:var(--sefin-color-border);border-radius:9999px;transition:background-color .2s ease-in-out;flex-shrink:0;box-sizing:border-box}.sefin-switch__track--checked{background-color:var(--sefin-color-primary)}.sefin-switch__track--sm{width:32px;height:18px}.sefin-switch__track--md{width:40px;height:22px}.sefin-switch__track--lg{width:48px;height:26px}.sefin-switch__thumb{position:absolute;top:50%;left:2px;transform:translateY(-50%);background-color:#fff;border-radius:50%;transition:transform .2s ease-in-out,box-shadow .2s ease-in-out;box-shadow:0 2px 4px #0003;box-sizing:border-box}.sefin-switch__thumb--sm{width:14px;height:14px}.sefin-switch__thumb--md{width:18px;height:18px}.sefin-switch__thumb--lg{width:22px;height:22px}.sefin-switch__track--sm.sefin-switch__track--checked .sefin-switch__thumb{transform:translateY(-50%) translate(14px)}.sefin-switch__track--md.sefin-switch__track--checked .sefin-switch__thumb{transform:translateY(-50%) translate(18px)}.sefin-switch__track--lg.sefin-switch__track--checked .sefin-switch__thumb{transform:translateY(-50%) translate(22px)}.sefin-switch__wrapper:hover .sefin-switch__track:not(.sefin-switch__track--checked){background-color:var(--sefin-color-border-focus)}.sefin-switch__wrapper--disabled:hover .sefin-switch__track{background-color:var(--sefin-color-border)}.sefin-switch__wrapper:focus-within .sefin-switch__track{outline:2px solid var(--sefin-color-border-focus);outline-offset:2px}.sefin-switch__wrapper:focus-within{outline:none}.sefin-switch__wrapper--disabled .sefin-switch__track{background-color:var(--sefin-color-border);cursor:not-allowed}.sefin-switch__wrapper--disabled .sefin-switch__track--checked{background-color:var(--sefin-color-border);opacity:.6}.sefin-switch__wrapper--disabled .sefin-switch__thumb{box-shadow:0 1px 2px #0000001a}.sefin-switch__label{font-family:var(--sefin-font-family-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal);color:var(--sefin-color-text);-webkit-user-select:none;user-select:none}.sefin-switch__label--sm{font-size:var(--sefin-font-size-sm)}.sefin-switch__label--md{font-size:var(--sefin-font-size-base)}.sefin-switch__label--lg{font-size:var(--sefin-font-size-lg)}.sefin-switch__wrapper--disabled .sefin-switch__label{color:var(--sefin-color-text-disabled)}.sefin-switch--disabled{cursor:not-allowed}\n"] }]
|
|
1480
|
+
}], propDecorators: { size: [{
|
|
704
1481
|
type: Input
|
|
705
|
-
}],
|
|
1482
|
+
}], disabled: [{
|
|
706
1483
|
type: Input
|
|
707
|
-
}]
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* Molecules index
|
|
711
|
-
*/
|
|
712
|
-
|
|
713
|
-
class HeaderComponent {
|
|
714
|
-
title = '';
|
|
715
|
-
logo = '';
|
|
716
|
-
showUserMenu = true;
|
|
717
|
-
userName = '';
|
|
718
|
-
logoClick = new EventEmitter();
|
|
719
|
-
menuClick = new EventEmitter();
|
|
720
|
-
userMenuClick = new EventEmitter();
|
|
721
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: HeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
722
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: HeaderComponent, isStandalone: true, selector: "sefin-header", inputs: { title: "title", logo: "logo", showUserMenu: "showUserMenu", userName: "userName" }, outputs: { logoClick: "logoClick", menuClick: "menuClick", userMenuClick: "userMenuClick" }, ngImport: i0, template: "<header class=\"sefin-header\">\n <div class=\"sefin-header__left\">\n <div *ngIf=\"logo\" class=\"sefin-header__logo\" (click)=\"logoClick.emit()\">\n <img [src]=\"logo\" [alt]=\"title\" />\n </div>\n <h1 *ngIf=\"title\" class=\"sefin-header__title\">{{ title }}</h1>\n </div>\n <div class=\"sefin-header__right\">\n <sefin-button\n *ngIf=\"showUserMenu\"\n variant=\"ghost\"\n size=\"md\"\n (clicked)=\"userMenuClick.emit()\"\n class=\"sefin-header__user-menu\"\n >\n <sefin-icon name=\"user\" size=\"md\"></sefin-icon>\n <span *ngIf=\"userName\">{{ userName }}</span>\n </sefin-button>\n <sefin-button\n variant=\"ghost\"\n size=\"md\"\n (clicked)=\"menuClick.emit()\"\n class=\"sefin-header__menu-button\"\n >\n <sefin-icon name=\"menu\" size=\"md\">\u2630</sefin-icon>\n </sefin-button>\n </div>\n</header>\n\n", styles: [".sefin-header{display:flex;align-items:center;justify-content:space-between;padding:var(--sefin-spacing-md, 16px) var(--sefin-spacing-lg, 24px);background-color:var(--sefin-color-surface);border-bottom:1px solid var(--sefin-color-border);box-shadow:var(--sefin-shadow-sm)}.sefin-header__left{display:flex;align-items:center;gap:var(--sefin-spacing-md, 16px)}.sefin-header__logo{cursor:pointer;display:flex;align-items:center}.sefin-header__logo img{height:40px;width:auto}.sefin-header__title{font-size:var(--sefin-font-size-xl, 1.25rem);font-weight:var(--sefin-font-weight-semibold, 600);color:var(--sefin-color-text);margin:0}.sefin-header__right,.sefin-header__user-menu{display:flex;align-items:center;gap:var(--sefin-spacing-sm, 8px)}.sefin-header__menu-button{display:flex;align-items:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "sefin-button", inputs: ["variant", "size", "disabled", "type", "class"], outputs: ["clicked"] }, { kind: "component", type: IconComponent, selector: "sefin-icon", inputs: ["name", "size", "class"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
723
|
-
}
|
|
724
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: HeaderComponent, decorators: [{
|
|
725
|
-
type: Component,
|
|
726
|
-
args: [{ selector: 'sefin-header', standalone: true, imports: [CommonModule, ButtonComponent, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<header class=\"sefin-header\">\n <div class=\"sefin-header__left\">\n <div *ngIf=\"logo\" class=\"sefin-header__logo\" (click)=\"logoClick.emit()\">\n <img [src]=\"logo\" [alt]=\"title\" />\n </div>\n <h1 *ngIf=\"title\" class=\"sefin-header__title\">{{ title }}</h1>\n </div>\n <div class=\"sefin-header__right\">\n <sefin-button\n *ngIf=\"showUserMenu\"\n variant=\"ghost\"\n size=\"md\"\n (clicked)=\"userMenuClick.emit()\"\n class=\"sefin-header__user-menu\"\n >\n <sefin-icon name=\"user\" size=\"md\"></sefin-icon>\n <span *ngIf=\"userName\">{{ userName }}</span>\n </sefin-button>\n <sefin-button\n variant=\"ghost\"\n size=\"md\"\n (clicked)=\"menuClick.emit()\"\n class=\"sefin-header__menu-button\"\n >\n <sefin-icon name=\"menu\" size=\"md\">\u2630</sefin-icon>\n </sefin-button>\n </div>\n</header>\n\n", styles: [".sefin-header{display:flex;align-items:center;justify-content:space-between;padding:var(--sefin-spacing-md, 16px) var(--sefin-spacing-lg, 24px);background-color:var(--sefin-color-surface);border-bottom:1px solid var(--sefin-color-border);box-shadow:var(--sefin-shadow-sm)}.sefin-header__left{display:flex;align-items:center;gap:var(--sefin-spacing-md, 16px)}.sefin-header__logo{cursor:pointer;display:flex;align-items:center}.sefin-header__logo img{height:40px;width:auto}.sefin-header__title{font-size:var(--sefin-font-size-xl, 1.25rem);font-weight:var(--sefin-font-weight-semibold, 600);color:var(--sefin-color-text);margin:0}.sefin-header__right,.sefin-header__user-menu{display:flex;align-items:center;gap:var(--sefin-spacing-sm, 8px)}.sefin-header__menu-button{display:flex;align-items:center}\n"] }]
|
|
727
|
-
}], propDecorators: { title: [{
|
|
1484
|
+
}], class: [{
|
|
728
1485
|
type: Input
|
|
729
|
-
}],
|
|
1486
|
+
}], label: [{
|
|
730
1487
|
type: Input
|
|
731
|
-
}],
|
|
1488
|
+
}], name: [{
|
|
732
1489
|
type: Input
|
|
733
|
-
}],
|
|
1490
|
+
}], value: [{
|
|
734
1491
|
type: Input
|
|
735
|
-
}],
|
|
736
|
-
type: Output
|
|
737
|
-
}], menuClick: [{
|
|
1492
|
+
}], valueChange: [{
|
|
738
1493
|
type: Output
|
|
739
|
-
}],
|
|
1494
|
+
}], checkedChange: [{
|
|
740
1495
|
type: Output
|
|
741
1496
|
}] } });
|
|
742
1497
|
|
|
743
|
-
class
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
this.
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoginFormComponent, decorators: [{
|
|
764
|
-
type: Component,
|
|
765
|
-
args: [{ selector: 'sefin-login-form', standalone: true, imports: [CommonModule, FormsModule, FormFieldComponent, ButtonComponent, CardComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<sefin-card variant=\"elevated\" class=\"sefin-login-form\">\n <h2 class=\"sefin-login-form__title\">Sign In</h2>\n <form (ngSubmit)=\"onSubmit()\" class=\"sefin-login-form__form\">\n <sefin-form-field\n label=\"Email\"\n inputId=\"email\"\n inputType=\"email\"\n placeholder=\"Enter your email\"\n [required]=\"true\"\n [(ngModel)]=\"email\"\n name=\"email\"\n ></sefin-form-field>\n <sefin-form-field\n label=\"Password\"\n inputId=\"password\"\n inputType=\"password\"\n placeholder=\"Enter your password\"\n [required]=\"true\"\n [(ngModel)]=\"password\"\n name=\"password\"\n ></sefin-form-field>\n <div *ngIf=\"error\" class=\"sefin-login-form__error\">{{ error }}</div>\n <sefin-button\n type=\"submit\"\n variant=\"primary\"\n size=\"lg\"\n class=\"sefin-login-form__submit\"\n >\n Sign In\n </sefin-button>\n </form>\n</sefin-card>\n\n", styles: [".sefin-login-form{max-width:400px;width:100%}.sefin-login-form__title{font-size:var(--sefin-font-size-2xl, 1.5rem);font-weight:var(--sefin-font-weight-semibold, 600);margin-bottom:var(--sefin-spacing-xl, 32px);text-align:center}.sefin-login-form__form{display:flex;flex-direction:column;gap:var(--sefin-spacing-lg, 24px)}.sefin-login-form__error{padding:var(--sefin-spacing-md, 16px);background-color:#f443361a;color:var(--sefin-color-error);border-radius:var(--sefin-radius-md, 8px);font-size:var(--sefin-font-size-sm, .875rem)}.sefin-login-form__submit{width:100%;margin-top:var(--sefin-spacing-md, 16px)}\n"] }]
|
|
766
|
-
}], propDecorators: { submit: [{
|
|
767
|
-
type: Output
|
|
768
|
-
}] } });
|
|
769
|
-
|
|
770
|
-
class ToolbarComponent {
|
|
771
|
-
title = '';
|
|
772
|
-
actions = [];
|
|
773
|
-
actionClick = new EventEmitter();
|
|
774
|
-
onActionClick(action) {
|
|
775
|
-
action.action();
|
|
776
|
-
this.actionClick.emit(action);
|
|
1498
|
+
class TypographyComponent {
|
|
1499
|
+
variant = 'p';
|
|
1500
|
+
size;
|
|
1501
|
+
weight;
|
|
1502
|
+
color = 'text';
|
|
1503
|
+
lineHeight;
|
|
1504
|
+
class = '';
|
|
1505
|
+
text;
|
|
1506
|
+
get typographyClasses() {
|
|
1507
|
+
return [
|
|
1508
|
+
'sefin-typography',
|
|
1509
|
+
`sefin-typography--${this.variant}`,
|
|
1510
|
+
this.size ? `sefin-typography--${this.size}` : '',
|
|
1511
|
+
this.weight ? `sefin-typography--${this.weight}` : '',
|
|
1512
|
+
`sefin-typography--${this.color}`,
|
|
1513
|
+
this.lineHeight ? `sefin-typography--line-height-${this.lineHeight}` : '',
|
|
1514
|
+
this.class,
|
|
1515
|
+
]
|
|
1516
|
+
.filter(Boolean)
|
|
1517
|
+
.join(' ');
|
|
777
1518
|
}
|
|
778
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
779
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type:
|
|
1519
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TypographyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1520
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: TypographyComponent, isStandalone: true, selector: "sefin-typography", inputs: { variant: "variant", size: "size", weight: "weight", color: "color", lineHeight: "lineHeight", class: "class", text: "text" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"variant\">\n <h1 *ngSwitchCase=\"'h1'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h1>\n <h2 *ngSwitchCase=\"'h2'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h2>\n <h3 *ngSwitchCase=\"'h3'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h3>\n <h4 *ngSwitchCase=\"'h4'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h4>\n <h5 *ngSwitchCase=\"'h5'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h5>\n <h6 *ngSwitchCase=\"'h6'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h6>\n <p *ngSwitchCase=\"'p'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></p>\n <span *ngSwitchDefault [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></span>\n</ng-container>\n", styles: [".sefin-typography{font-family:var(--sefin-font-family-base);margin:0;padding:0}.sefin-typography--h1{font-size:var(--sefin-font-size-4xl);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h2{font-size:var(--sefin-font-size-3xl);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h3{font-size:var(--sefin-font-size-2xl);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h4{font-size:var(--sefin-font-size-xl);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h5{font-size:var(--sefin-font-size-lg);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h6{font-size:var(--sefin-font-size-base);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--p,.sefin-typography--span{font-size:var(--sefin-font-size-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal)}.sefin-typography--xs{font-size:var(--sefin-font-size-xs)}.sefin-typography--sm{font-size:var(--sefin-font-size-sm)}.sefin-typography--base{font-size:var(--sefin-font-size-base)}.sefin-typography--lg{font-size:var(--sefin-font-size-lg)}.sefin-typography--xl{font-size:var(--sefin-font-size-xl)}.sefin-typography--2xl{font-size:var(--sefin-font-size-2xl)}.sefin-typography--3xl{font-size:var(--sefin-font-size-3xl)}.sefin-typography--4xl{font-size:var(--sefin-font-size-4xl)}.sefin-typography--5xl{font-size:var(--sefin-font-size-5xl)}.sefin-typography--light{font-weight:var(--sefin-font-weight-light)}.sefin-typography--normal{font-weight:var(--sefin-font-weight-normal)}.sefin-typography--medium{font-weight:var(--sefin-font-weight-medium)}.sefin-typography--semibold{font-weight:var(--sefin-font-weight-semibold)}.sefin-typography--bold{font-weight:var(--sefin-font-weight-bold)}.sefin-typography--text{color:var(--sefin-color-text)}.sefin-typography--text-secondary{color:var(--sefin-color-text-secondary)}.sefin-typography--text-disabled{color:var(--sefin-color-text-disabled)}.sefin-typography--primary{color:var(--sefin-color-primary)}.sefin-typography--secondary{color:var(--sefin-color-secondary)}.sefin-typography--success{color:var(--sefin-color-success)}.sefin-typography--warning{color:var(--sefin-color-warning)}.sefin-typography--error{color:var(--sefin-color-error)}.sefin-typography--line-height-tight{line-height:var(--sefin-line-height-tight)}.sefin-typography--line-height-normal{line-height:var(--sefin-line-height-normal)}.sefin-typography--line-height-relaxed{line-height:var(--sefin-line-height-relaxed)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
780
1521
|
}
|
|
781
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type:
|
|
1522
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TypographyComponent, decorators: [{
|
|
782
1523
|
type: Component,
|
|
783
|
-
args: [{ selector: 'sefin-
|
|
784
|
-
}], propDecorators: {
|
|
1524
|
+
args: [{ selector: 'sefin-typography', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.Default, template: "<ng-container [ngSwitch]=\"variant\">\n <h1 *ngSwitchCase=\"'h1'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h1>\n <h2 *ngSwitchCase=\"'h2'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h2>\n <h3 *ngSwitchCase=\"'h3'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h3>\n <h4 *ngSwitchCase=\"'h4'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h4>\n <h5 *ngSwitchCase=\"'h5'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h5>\n <h6 *ngSwitchCase=\"'h6'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></h6>\n <p *ngSwitchCase=\"'p'\" [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></p>\n <span *ngSwitchDefault [class]=\"typographyClasses\">{{ text }}<ng-content></ng-content></span>\n</ng-container>\n", styles: [".sefin-typography{font-family:var(--sefin-font-family-base);margin:0;padding:0}.sefin-typography--h1{font-size:var(--sefin-font-size-4xl);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h2{font-size:var(--sefin-font-size-3xl);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h3{font-size:var(--sefin-font-size-2xl);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h4{font-size:var(--sefin-font-size-xl);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h5{font-size:var(--sefin-font-size-lg);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--h6{font-size:var(--sefin-font-size-base);font-weight:var(--sefin-font-weight-bold);line-height:var(--sefin-line-height-tight)}.sefin-typography--p,.sefin-typography--span{font-size:var(--sefin-font-size-base);font-weight:var(--sefin-font-weight-normal);line-height:var(--sefin-line-height-normal)}.sefin-typography--xs{font-size:var(--sefin-font-size-xs)}.sefin-typography--sm{font-size:var(--sefin-font-size-sm)}.sefin-typography--base{font-size:var(--sefin-font-size-base)}.sefin-typography--lg{font-size:var(--sefin-font-size-lg)}.sefin-typography--xl{font-size:var(--sefin-font-size-xl)}.sefin-typography--2xl{font-size:var(--sefin-font-size-2xl)}.sefin-typography--3xl{font-size:var(--sefin-font-size-3xl)}.sefin-typography--4xl{font-size:var(--sefin-font-size-4xl)}.sefin-typography--5xl{font-size:var(--sefin-font-size-5xl)}.sefin-typography--light{font-weight:var(--sefin-font-weight-light)}.sefin-typography--normal{font-weight:var(--sefin-font-weight-normal)}.sefin-typography--medium{font-weight:var(--sefin-font-weight-medium)}.sefin-typography--semibold{font-weight:var(--sefin-font-weight-semibold)}.sefin-typography--bold{font-weight:var(--sefin-font-weight-bold)}.sefin-typography--text{color:var(--sefin-color-text)}.sefin-typography--text-secondary{color:var(--sefin-color-text-secondary)}.sefin-typography--text-disabled{color:var(--sefin-color-text-disabled)}.sefin-typography--primary{color:var(--sefin-color-primary)}.sefin-typography--secondary{color:var(--sefin-color-secondary)}.sefin-typography--success{color:var(--sefin-color-success)}.sefin-typography--warning{color:var(--sefin-color-warning)}.sefin-typography--error{color:var(--sefin-color-error)}.sefin-typography--line-height-tight{line-height:var(--sefin-line-height-tight)}.sefin-typography--line-height-normal{line-height:var(--sefin-line-height-normal)}.sefin-typography--line-height-relaxed{line-height:var(--sefin-line-height-relaxed)}\n"] }]
|
|
1525
|
+
}], propDecorators: { variant: [{
|
|
785
1526
|
type: Input
|
|
786
|
-
}],
|
|
1527
|
+
}], size: [{
|
|
1528
|
+
type: Input
|
|
1529
|
+
}], weight: [{
|
|
1530
|
+
type: Input
|
|
1531
|
+
}], color: [{
|
|
1532
|
+
type: Input
|
|
1533
|
+
}], lineHeight: [{
|
|
1534
|
+
type: Input
|
|
1535
|
+
}], class: [{
|
|
1536
|
+
type: Input
|
|
1537
|
+
}], text: [{
|
|
787
1538
|
type: Input
|
|
788
|
-
}], actionClick: [{
|
|
789
|
-
type: Output
|
|
790
1539
|
}] } });
|
|
791
1540
|
|
|
792
1541
|
/**
|
|
793
|
-
*
|
|
1542
|
+
* Atoms index
|
|
794
1543
|
*/
|
|
795
1544
|
|
|
796
1545
|
/*
|
|
797
|
-
* Public API Surface of @
|
|
1546
|
+
* Public API Surface of @lesterarte/sefin-ui
|
|
798
1547
|
*/
|
|
799
1548
|
// Design Tokens
|
|
800
1549
|
// Styles (for importing in consuming apps)
|
|
@@ -804,5 +1553,5 @@ const STYLES_PATH = './styles/index.scss';
|
|
|
804
1553
|
* Generated bundle index. Do not edit.
|
|
805
1554
|
*/
|
|
806
1555
|
|
|
807
|
-
export { BORDER_RADIUS_TOKENS, BRAND_THEME, ButtonComponent, COLOR_TOKENS,
|
|
1556
|
+
export { AutocompleteComponent, BORDER_RADIUS_TOKENS, BRAND_THEME, ButtonComponent, COLOR_TOKENS, CheckboxComponent, DARK_THEME, DESIGN_TOKENS, IconButtonComponent, LIGHT_THEME, LinkComponent, SHADOW_TOKENS, SPACING_TOKENS, STYLES_PATH, SelectComponent, StackComponent, SwitchComponent, TYPOGRAPHY_TOKENS, ThemeLoader, TypographyComponent };
|
|
808
1557
|
//# sourceMappingURL=lesterarte-sefin-ui.mjs.map
|