@sonny-ui/core 0.1.0-alpha.1 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -32
- package/fesm2022/sonny-ui-core.mjs +3031 -42
- package/fesm2022/sonny-ui-core.mjs.map +1 -1
- package/package.json +8 -5
- package/schematics/ng-add/schema.json +1 -1
- package/schematics/ng-generate/component/index.js +1 -1
- package/schematics/ng-generate/component/schema.json +1 -1
- package/src/lib/accordion/accordion.directives.spec.ts +173 -0
- package/src/lib/accordion/accordion.directives.ts +147 -0
- package/src/lib/accordion/index.ts +8 -0
- package/src/lib/alert/alert.directives.spec.ts +154 -0
- package/src/lib/alert/alert.directives.ts +70 -0
- package/src/lib/alert/alert.variants.ts +25 -0
- package/src/lib/alert/index.ts +6 -0
- package/src/lib/avatar/avatar.component.spec.ts +75 -0
- package/src/lib/avatar/avatar.component.ts +44 -0
- package/src/lib/avatar/avatar.variants.ts +26 -0
- package/src/lib/avatar/index.ts +2 -0
- package/src/lib/badge/badge.directive.spec.ts +74 -0
- package/src/lib/badge/badge.directive.ts +18 -0
- package/src/lib/badge/badge.variants.ts +29 -0
- package/src/lib/badge/index.ts +2 -0
- package/src/lib/breadcrumb/breadcrumb.directives.spec.ts +80 -0
- package/src/lib/breadcrumb/breadcrumb.directives.ts +84 -0
- package/src/lib/breadcrumb/index.ts +8 -0
- package/src/lib/button/button.directive.spec.ts +92 -0
- package/src/lib/button/button.directive.ts +29 -0
- package/src/lib/button/button.variants.ts +30 -0
- package/src/lib/button/index.ts +2 -0
- package/src/lib/button-group/button-group.directive.spec.ts +46 -0
- package/src/lib/button-group/button-group.directive.ts +20 -0
- package/src/lib/button-group/button-group.variants.ts +18 -0
- package/src/lib/button-group/index.ts +2 -0
- package/src/lib/calendar/calendar.component.spec.ts +105 -0
- package/src/lib/calendar/calendar.component.ts +231 -0
- package/src/lib/calendar/index.ts +1 -0
- package/src/lib/card/card.directives.spec.ts +104 -0
- package/src/lib/card/card.directives.ts +78 -0
- package/src/lib/card/card.variants.ts +28 -0
- package/src/lib/card/index.ts +9 -0
- package/src/lib/carousel/carousel.directives.spec.ts +85 -0
- package/src/lib/carousel/carousel.directives.ts +164 -0
- package/src/lib/carousel/index.ts +8 -0
- package/src/lib/chat-bubble/chat-bubble.directives.spec.ts +52 -0
- package/src/lib/chat-bubble/chat-bubble.directives.ts +102 -0
- package/src/lib/chat-bubble/index.ts +11 -0
- package/src/lib/checkbox/checkbox.directive.spec.ts +57 -0
- package/src/lib/checkbox/checkbox.directive.ts +17 -0
- package/src/lib/checkbox/checkbox.variants.ts +19 -0
- package/src/lib/checkbox/index.ts +2 -0
- package/src/lib/combobox/combobox.component.spec.ts +151 -0
- package/src/lib/combobox/combobox.component.ts +279 -0
- package/src/lib/combobox/combobox.variants.ts +19 -0
- package/src/lib/combobox/index.ts +2 -0
- package/src/lib/diff/diff.component.spec.ts +47 -0
- package/src/lib/diff/diff.component.ts +83 -0
- package/src/lib/diff/index.ts +1 -0
- package/src/lib/divider/divider.component.spec.ts +48 -0
- package/src/lib/divider/divider.component.ts +52 -0
- package/src/lib/divider/divider.variants.ts +22 -0
- package/src/lib/divider/index.ts +2 -0
- package/src/lib/dock/dock.directives.spec.ts +85 -0
- package/src/lib/dock/dock.directives.ts +83 -0
- package/src/lib/dock/index.ts +1 -0
- package/src/lib/drawer/drawer.directives.spec.ts +62 -0
- package/src/lib/drawer/drawer.directives.ts +83 -0
- package/src/lib/drawer/index.ts +8 -0
- package/src/lib/dropdown/dropdown.directives.spec.ts +106 -0
- package/src/lib/dropdown/dropdown.directives.ts +143 -0
- package/src/lib/dropdown/dropdown.variants.ts +27 -0
- package/src/lib/dropdown/index.ts +15 -0
- package/src/lib/fab/fab.directives.spec.ts +60 -0
- package/src/lib/fab/fab.directives.ts +80 -0
- package/src/lib/fab/index.ts +8 -0
- package/src/lib/fieldset/fieldset.directives.spec.ts +74 -0
- package/src/lib/fieldset/fieldset.directives.ts +52 -0
- package/src/lib/fieldset/fieldset.variants.ts +15 -0
- package/src/lib/fieldset/index.ts +6 -0
- package/src/lib/file-input/file-input.component.spec.ts +114 -0
- package/src/lib/file-input/file-input.component.ts +168 -0
- package/src/lib/file-input/file-input.variants.ts +25 -0
- package/src/lib/file-input/index.ts +6 -0
- package/src/lib/indicator/index.ts +6 -0
- package/src/lib/indicator/indicator.directives.spec.ts +64 -0
- package/src/lib/indicator/indicator.directives.ts +61 -0
- package/src/lib/input/index.ts +3 -0
- package/src/lib/input/input.directive.spec.ts +103 -0
- package/src/lib/input/input.directive.ts +26 -0
- package/src/lib/input/input.variants.ts +42 -0
- package/src/lib/input/label.directive.ts +17 -0
- package/src/lib/kbd/index.ts +2 -0
- package/src/lib/kbd/kbd.directive.spec.ts +42 -0
- package/src/lib/kbd/kbd.directive.ts +19 -0
- package/src/lib/kbd/kbd.variants.ts +19 -0
- package/src/lib/link/index.ts +2 -0
- package/src/lib/link/link.directive.spec.ts +41 -0
- package/src/lib/link/link.directive.ts +19 -0
- package/src/lib/link/link.variants.ts +20 -0
- package/src/lib/list/index.ts +8 -0
- package/src/lib/list/list.directives.spec.ts +65 -0
- package/src/lib/list/list.directives.ts +86 -0
- package/src/lib/loader/index.ts +2 -0
- package/src/lib/loader/loader.component.spec.ts +58 -0
- package/src/lib/loader/loader.component.ts +48 -0
- package/src/lib/loader/loader.variants.ts +21 -0
- package/src/lib/modal/dialog-ref.ts +19 -0
- package/src/lib/modal/dialog.directives.ts +90 -0
- package/src/lib/modal/dialog.service.spec.ts +52 -0
- package/src/lib/modal/dialog.service.ts +61 -0
- package/src/lib/modal/dialog.types.ts +16 -0
- package/src/lib/modal/index.ts +11 -0
- package/src/lib/navbar/index.ts +7 -0
- package/src/lib/navbar/navbar.directives.spec.ts +59 -0
- package/src/lib/navbar/navbar.directives.ts +61 -0
- package/src/lib/pagination/index.ts +6 -0
- package/src/lib/pagination/pagination.component.spec.ts +59 -0
- package/src/lib/pagination/pagination.component.ts +144 -0
- package/src/lib/pagination/pagination.variants.ts +31 -0
- package/src/lib/progress/index.ts +7 -0
- package/src/lib/progress/progress.component.spec.ts +117 -0
- package/src/lib/progress/progress.component.ts +65 -0
- package/src/lib/progress/progress.variants.ts +43 -0
- package/src/lib/radial-progress/index.ts +5 -0
- package/src/lib/radial-progress/radial-progress.component.spec.ts +41 -0
- package/src/lib/radial-progress/radial-progress.component.ts +71 -0
- package/src/lib/radio/index.ts +2 -0
- package/src/lib/radio/radio.directive.spec.ts +46 -0
- package/src/lib/radio/radio.directive.ts +17 -0
- package/src/lib/radio/radio.variants.ts +19 -0
- package/src/lib/rating/index.ts +2 -0
- package/src/lib/rating/rating.component.spec.ts +157 -0
- package/src/lib/rating/rating.component.ts +171 -0
- package/src/lib/rating/rating.variants.ts +20 -0
- package/src/lib/select/index.ts +2 -0
- package/src/lib/select/select.component.spec.ts +112 -0
- package/src/lib/select/select.component.ts +250 -0
- package/src/lib/select/select.variants.ts +19 -0
- package/src/lib/sheet/index.ts +10 -0
- package/src/lib/sheet/sheet-ref.ts +18 -0
- package/src/lib/sheet/sheet.component.spec.ts +67 -0
- package/src/lib/sheet/sheet.directives.ts +75 -0
- package/src/lib/sheet/sheet.service.ts +100 -0
- package/src/lib/sheet/sheet.types.ts +23 -0
- package/src/lib/skeleton/index.ts +2 -0
- package/src/lib/skeleton/skeleton.directive.spec.ts +63 -0
- package/src/lib/skeleton/skeleton.directive.ts +22 -0
- package/src/lib/skeleton/skeleton.variants.ts +27 -0
- package/src/lib/slider/index.ts +2 -0
- package/src/lib/slider/slider.component.spec.ts +104 -0
- package/src/lib/slider/slider.component.ts +188 -0
- package/src/lib/slider/slider.variants.ts +25 -0
- package/src/lib/stat/index.ts +8 -0
- package/src/lib/stat/stat.directives.spec.ts +60 -0
- package/src/lib/stat/stat.directives.ts +84 -0
- package/src/lib/status/index.ts +2 -0
- package/src/lib/status/status.directive.spec.ts +43 -0
- package/src/lib/status/status.directive.ts +38 -0
- package/src/lib/status/status.variants.ts +26 -0
- package/src/lib/steps/index.ts +8 -0
- package/src/lib/steps/steps.directives.spec.ts +52 -0
- package/src/lib/steps/steps.directives.ts +80 -0
- package/src/lib/switch/index.ts +2 -0
- package/src/lib/switch/switch.component.spec.ts +98 -0
- package/src/lib/switch/switch.component.ts +84 -0
- package/src/lib/switch/switch.variants.ts +31 -0
- package/src/lib/table/index.ts +12 -0
- package/src/lib/table/table.directives.spec.ts +111 -0
- package/src/lib/table/table.directives.ts +134 -0
- package/src/lib/table/table.variants.ts +36 -0
- package/src/lib/tabs/index.ts +8 -0
- package/src/lib/tabs/tabs.directives.spec.ts +136 -0
- package/src/lib/tabs/tabs.directives.ts +130 -0
- package/src/lib/tabs/tabs.variants.ts +17 -0
- package/src/lib/textarea/index.ts +7 -0
- package/src/lib/textarea/textarea.directive.spec.ts +84 -0
- package/src/lib/textarea/textarea.directive.ts +72 -0
- package/src/lib/textarea/textarea.variants.ts +34 -0
- package/src/lib/timeline/index.ts +11 -0
- package/src/lib/timeline/timeline.directives.spec.ts +55 -0
- package/src/lib/timeline/timeline.directives.ts +90 -0
- package/src/lib/toast/index.ts +3 -0
- package/src/lib/toast/toast.service.spec.ts +71 -0
- package/src/lib/toast/toast.service.ts +60 -0
- package/src/lib/toast/toast.variants.ts +38 -0
- package/src/lib/toast/toaster.component.spec.ts +38 -0
- package/src/lib/toast/toaster.component.ts +82 -0
- package/src/lib/toggle/index.ts +2 -0
- package/src/lib/toggle/toggle.directive.spec.ts +100 -0
- package/src/lib/toggle/toggle.directive.ts +73 -0
- package/src/lib/toggle/toggle.variants.ts +25 -0
- package/src/lib/tooltip/index.ts +2 -0
- package/src/lib/tooltip/tooltip.directive.spec.ts +113 -0
- package/src/lib/tooltip/tooltip.directive.ts +131 -0
- package/src/lib/tooltip/tooltip.variants.ts +20 -0
- package/src/lib/validator/index.ts +5 -0
- package/src/lib/validator/validator.directives.spec.ts +47 -0
- package/src/lib/validator/validator.directives.ts +52 -0
- package/types/sonny-ui-core.d.ts +878 -11
|
@@ -3,9 +3,10 @@ import { twMerge } from 'tailwind-merge';
|
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
export { cva } from 'class-variance-authority';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { InjectionToken, makeEnvironmentProviders, inject, PLATFORM_ID, signal, computed, Injectable, input, Directive, Component, model, viewChild,
|
|
6
|
+
import { InjectionToken, makeEnvironmentProviders, inject, PLATFORM_ID, signal, computed, Injectable, input, Directive, ChangeDetectionStrategy, Component, ElementRef, model, viewChild, effect, forwardRef, HostListener, Injector, afterNextRender, Renderer2, output, contentChildren } from '@angular/core';
|
|
7
7
|
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
8
8
|
import { Dialog, DialogRef } from '@angular/cdk/dialog';
|
|
9
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
10
|
import { createGlobalPositionStrategy } from '@angular/cdk/overlay';
|
|
10
11
|
|
|
11
12
|
function cn(...inputs) {
|
|
@@ -382,6 +383,7 @@ class SnyToasterComponent {
|
|
|
382
383
|
[class]="toastClasses[toast.variant ?? 'default']"
|
|
383
384
|
role="alert"
|
|
384
385
|
aria-live="polite"
|
|
386
|
+
aria-atomic="true"
|
|
385
387
|
>
|
|
386
388
|
<div class="grid gap-1">
|
|
387
389
|
<div class="text-sm font-semibold">{{ toast.title }}</div>
|
|
@@ -409,13 +411,14 @@ class SnyToasterComponent {
|
|
|
409
411
|
</div>
|
|
410
412
|
}
|
|
411
413
|
</div>
|
|
412
|
-
`, isInline: true });
|
|
414
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
413
415
|
}
|
|
414
416
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyToasterComponent, decorators: [{
|
|
415
417
|
type: Component,
|
|
416
418
|
args: [{
|
|
417
419
|
selector: 'sny-toaster',
|
|
418
420
|
standalone: true,
|
|
421
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
419
422
|
template: `
|
|
420
423
|
<div [class]="containerClass()" role="region" aria-label="Notifications" tabindex="-1">
|
|
421
424
|
@for (toast of visibleToasts(); track toast.id) {
|
|
@@ -423,6 +426,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
423
426
|
[class]="toastClasses[toast.variant ?? 'default']"
|
|
424
427
|
role="alert"
|
|
425
428
|
aria-live="polite"
|
|
429
|
+
aria-atomic="true"
|
|
426
430
|
>
|
|
427
431
|
<div class="grid gap-1">
|
|
428
432
|
<div class="text-sm font-semibold">{{ toast.title }}</div>
|
|
@@ -622,6 +626,7 @@ const SNY_ACCORDION_ITEM = new InjectionToken('SnyAccordionItem');
|
|
|
622
626
|
class SnyAccordionDirective {
|
|
623
627
|
multi = input(false, ...(ngDevMode ? [{ debugName: "multi" }] : /* istanbul ignore next */ []));
|
|
624
628
|
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
629
|
+
elRef = inject(ElementRef);
|
|
625
630
|
_openItems = signal(new Set(), ...(ngDevMode ? [{ debugName: "_openItems" }] : /* istanbul ignore next */ []));
|
|
626
631
|
computedClass = computed(() => cn('divide-y divide-border', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
627
632
|
isOpen(id) {
|
|
@@ -641,16 +646,53 @@ class SnyAccordionDirective {
|
|
|
641
646
|
return next;
|
|
642
647
|
});
|
|
643
648
|
}
|
|
649
|
+
onKeydown(event) {
|
|
650
|
+
const target = event.target;
|
|
651
|
+
if (!target.hasAttribute('snyaccordiontrigger') && !target.closest('[snyAccordionTrigger]'))
|
|
652
|
+
return;
|
|
653
|
+
const triggers = Array.from(this.elRef.nativeElement.querySelectorAll('[snyAccordionTrigger]'));
|
|
654
|
+
if (triggers.length === 0)
|
|
655
|
+
return;
|
|
656
|
+
const currentIndex = triggers.indexOf(target.closest('[snyAccordionTrigger]') || target);
|
|
657
|
+
if (currentIndex === -1)
|
|
658
|
+
return;
|
|
659
|
+
let nextIndex = null;
|
|
660
|
+
switch (event.key) {
|
|
661
|
+
case 'ArrowDown':
|
|
662
|
+
event.preventDefault();
|
|
663
|
+
nextIndex = (currentIndex + 1) % triggers.length;
|
|
664
|
+
break;
|
|
665
|
+
case 'ArrowUp':
|
|
666
|
+
event.preventDefault();
|
|
667
|
+
nextIndex = (currentIndex - 1 + triggers.length) % triggers.length;
|
|
668
|
+
break;
|
|
669
|
+
case 'Home':
|
|
670
|
+
event.preventDefault();
|
|
671
|
+
nextIndex = 0;
|
|
672
|
+
break;
|
|
673
|
+
case 'End':
|
|
674
|
+
event.preventDefault();
|
|
675
|
+
nextIndex = triggers.length - 1;
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
if (nextIndex !== null) {
|
|
679
|
+
triggers[nextIndex].focus();
|
|
680
|
+
}
|
|
681
|
+
}
|
|
644
682
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAccordionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
645
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAccordionDirective, isStandalone: true, selector: "[snyAccordion]", inputs: { multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_ACCORDION, useExisting: SnyAccordionDirective }], ngImport: i0 });
|
|
683
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAccordionDirective, isStandalone: true, selector: "[snyAccordion]", inputs: { multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_ACCORDION, useExisting: SnyAccordionDirective }], exportAs: ["snyAccordion"], ngImport: i0 });
|
|
646
684
|
}
|
|
647
685
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAccordionDirective, decorators: [{
|
|
648
686
|
type: Directive,
|
|
649
687
|
args: [{
|
|
650
688
|
selector: '[snyAccordion]',
|
|
651
689
|
standalone: true,
|
|
690
|
+
exportAs: 'snyAccordion',
|
|
652
691
|
providers: [{ provide: SNY_ACCORDION, useExisting: SnyAccordionDirective }],
|
|
653
|
-
host: {
|
|
692
|
+
host: {
|
|
693
|
+
'[class]': 'computedClass()',
|
|
694
|
+
'(keydown)': 'onKeydown($event)',
|
|
695
|
+
},
|
|
654
696
|
}]
|
|
655
697
|
}], propDecorators: { multi: [{ type: i0.Input, args: [{ isSignal: true, alias: "multi", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
656
698
|
class SnyAccordionItemDirective {
|
|
@@ -663,13 +705,14 @@ class SnyAccordionItemDirective {
|
|
|
663
705
|
this.accordion.toggle(this.value());
|
|
664
706
|
}
|
|
665
707
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAccordionItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
666
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAccordionItemDirective, isStandalone: true, selector: "[snyAccordionItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_ACCORDION_ITEM, useExisting: SnyAccordionItemDirective }], ngImport: i0 });
|
|
708
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAccordionItemDirective, isStandalone: true, selector: "[snyAccordionItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_ACCORDION_ITEM, useExisting: SnyAccordionItemDirective }], exportAs: ["snyAccordionItem"], ngImport: i0 });
|
|
667
709
|
}
|
|
668
710
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAccordionItemDirective, decorators: [{
|
|
669
711
|
type: Directive,
|
|
670
712
|
args: [{
|
|
671
713
|
selector: '[snyAccordionItem]',
|
|
672
714
|
standalone: true,
|
|
715
|
+
exportAs: 'snyAccordionItem',
|
|
673
716
|
providers: [{ provide: SNY_ACCORDION_ITEM, useExisting: SnyAccordionItemDirective }],
|
|
674
717
|
host: { '[class]': 'computedClass()' },
|
|
675
718
|
}]
|
|
@@ -679,7 +722,7 @@ class SnyAccordionTriggerDirective {
|
|
|
679
722
|
item = inject(SNY_ACCORDION_ITEM);
|
|
680
723
|
computedClass = computed(() => cn('flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline cursor-pointer [&>svg]:transition-transform', this.item.isOpen() && '[&>svg]:rotate-180', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
681
724
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAccordionTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
682
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAccordionTriggerDirective, isStandalone: true, selector: "[snyAccordionTrigger]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "item.toggle()" }, properties: { "class": "computedClass()", "attr.aria-expanded": "item.isOpen()" } }, ngImport: i0 });
|
|
725
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAccordionTriggerDirective, isStandalone: true, selector: "[snyAccordionTrigger]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "tabindex": "0" }, listeners: { "click": "item.toggle()" }, properties: { "class": "computedClass()", "attr.aria-expanded": "item.isOpen()" } }, ngImport: i0 });
|
|
683
726
|
}
|
|
684
727
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAccordionTriggerDirective, decorators: [{
|
|
685
728
|
type: Directive,
|
|
@@ -689,6 +732,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
689
732
|
host: {
|
|
690
733
|
'[class]': 'computedClass()',
|
|
691
734
|
'[attr.aria-expanded]': 'item.isOpen()',
|
|
735
|
+
'tabindex': '0',
|
|
692
736
|
'(click)': 'item.toggle()',
|
|
693
737
|
},
|
|
694
738
|
}]
|
|
@@ -761,13 +805,14 @@ class SnyAvatarComponent {
|
|
|
761
805
|
} @else {
|
|
762
806
|
<span class="font-medium text-muted-foreground">{{ fallbackText() }}</span>
|
|
763
807
|
}
|
|
764
|
-
`, isInline: true });
|
|
808
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
765
809
|
}
|
|
766
810
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAvatarComponent, decorators: [{
|
|
767
811
|
type: Component,
|
|
768
812
|
args: [{
|
|
769
813
|
selector: 'sny-avatar',
|
|
770
814
|
standalone: true,
|
|
815
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
771
816
|
host: { '[class]': 'computedClass()' },
|
|
772
817
|
template: `
|
|
773
818
|
@if (src() && !error()) {
|
|
@@ -1003,12 +1048,39 @@ class SnyComboboxComponent {
|
|
|
1003
1048
|
open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
1004
1049
|
query = signal('', ...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
1005
1050
|
activeIndex = signal(0, ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
1051
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
1006
1052
|
triggerRef = viewChild('triggerEl', ...(ngDevMode ? [{ debugName: "triggerRef" }] : /* istanbul ignore next */ []));
|
|
1007
1053
|
searchRef = viewChild('searchEl', ...(ngDevMode ? [{ debugName: "searchRef" }] : /* istanbul ignore next */ []));
|
|
1008
1054
|
dropdownRef = viewChild('dropdownEl', ...(ngDevMode ? [{ debugName: "dropdownRef" }] : /* istanbul ignore next */ []));
|
|
1009
1055
|
elRef = inject(ElementRef);
|
|
1010
1056
|
scrollHandler = null;
|
|
1011
1057
|
resizeHandler = null;
|
|
1058
|
+
_onChange = () => { };
|
|
1059
|
+
onTouched = () => { };
|
|
1060
|
+
_writing = false;
|
|
1061
|
+
constructor() {
|
|
1062
|
+
effect(() => {
|
|
1063
|
+
const val = this.value();
|
|
1064
|
+
if (this._writing) {
|
|
1065
|
+
this._writing = false;
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
this._onChange(val);
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
writeValue(val) {
|
|
1072
|
+
this._writing = true;
|
|
1073
|
+
this.value.set(val ?? '');
|
|
1074
|
+
}
|
|
1075
|
+
registerOnChange(fn) {
|
|
1076
|
+
this._onChange = fn;
|
|
1077
|
+
}
|
|
1078
|
+
registerOnTouched(fn) {
|
|
1079
|
+
this.onTouched = fn;
|
|
1080
|
+
}
|
|
1081
|
+
setDisabledState(_isDisabled) {
|
|
1082
|
+
this._disabledByCva.set(_isDisabled);
|
|
1083
|
+
}
|
|
1012
1084
|
selectedLabel = computed(() => {
|
|
1013
1085
|
const v = this.value();
|
|
1014
1086
|
if (!v)
|
|
@@ -1122,7 +1194,9 @@ class SnyComboboxComponent {
|
|
|
1122
1194
|
}
|
|
1123
1195
|
}
|
|
1124
1196
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyComboboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1125
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyComboboxComponent, isStandalone: true, selector: "sny-combobox", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)" }, classAttribute: "relative inline-block w-full" },
|
|
1197
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyComboboxComponent, isStandalone: true, selector: "sny-combobox", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)" }, classAttribute: "relative inline-block w-full" }, providers: [
|
|
1198
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyComboboxComponent), multi: true },
|
|
1199
|
+
], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true, isSignal: true }, { propertyName: "searchRef", first: true, predicate: ["searchEl"], descendants: true, isSignal: true }, { propertyName: "dropdownRef", first: true, predicate: ["dropdownEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1126
1200
|
<!-- Trigger button -->
|
|
1127
1201
|
<button
|
|
1128
1202
|
#triggerEl
|
|
@@ -1132,6 +1206,7 @@ class SnyComboboxComponent {
|
|
|
1132
1206
|
aria-haspopup="listbox"
|
|
1133
1207
|
[class]="triggerClass()"
|
|
1134
1208
|
(click)="toggle()"
|
|
1209
|
+
(blur)="onTouched()"
|
|
1135
1210
|
>
|
|
1136
1211
|
<span [class]="selectedLabel() ? '' : 'text-muted-foreground'">
|
|
1137
1212
|
{{ selectedLabel() || placeholder() }}
|
|
@@ -1185,16 +1260,20 @@ class SnyComboboxComponent {
|
|
|
1185
1260
|
}
|
|
1186
1261
|
</div>
|
|
1187
1262
|
}
|
|
1188
|
-
`, isInline: true });
|
|
1263
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1189
1264
|
}
|
|
1190
1265
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyComboboxComponent, decorators: [{
|
|
1191
1266
|
type: Component,
|
|
1192
1267
|
args: [{
|
|
1193
1268
|
selector: 'sny-combobox',
|
|
1194
1269
|
standalone: true,
|
|
1270
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1195
1271
|
host: {
|
|
1196
1272
|
class: 'relative inline-block w-full',
|
|
1197
1273
|
},
|
|
1274
|
+
providers: [
|
|
1275
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyComboboxComponent), multi: true },
|
|
1276
|
+
],
|
|
1198
1277
|
template: `
|
|
1199
1278
|
<!-- Trigger button -->
|
|
1200
1279
|
<button
|
|
@@ -1205,6 +1284,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1205
1284
|
aria-haspopup="listbox"
|
|
1206
1285
|
[class]="triggerClass()"
|
|
1207
1286
|
(click)="toggle()"
|
|
1287
|
+
(blur)="onTouched()"
|
|
1208
1288
|
>
|
|
1209
1289
|
<span [class]="selectedLabel() ? '' : 'text-muted-foreground'">
|
|
1210
1290
|
{{ selectedLabel() || placeholder() }}
|
|
@@ -1260,7 +1340,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1260
1340
|
}
|
|
1261
1341
|
`,
|
|
1262
1342
|
}]
|
|
1263
|
-
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], triggerRef: [{ type: i0.ViewChild, args: ['triggerEl', { isSignal: true }] }], searchRef: [{ type: i0.ViewChild, args: ['searchEl', { isSignal: true }] }], dropdownRef: [{ type: i0.ViewChild, args: ['dropdownEl', { isSignal: true }] }], onDocumentClick: [{
|
|
1343
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], triggerRef: [{ type: i0.ViewChild, args: ['triggerEl', { isSignal: true }] }], searchRef: [{ type: i0.ViewChild, args: ['searchEl', { isSignal: true }] }], dropdownRef: [{ type: i0.ViewChild, args: ['dropdownEl', { isSignal: true }] }], onDocumentClick: [{
|
|
1264
1344
|
type: HostListener,
|
|
1265
1345
|
args: ['document:click', ['$event']]
|
|
1266
1346
|
}] } });
|
|
@@ -1291,14 +1371,18 @@ class SnySkeletonDirective {
|
|
|
1291
1371
|
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
1292
1372
|
computedClass = computed(() => cn(skeletonVariants({ variant: this.variant(), size: this.size() }), this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
1293
1373
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySkeletonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1294
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnySkeletonDirective, isStandalone: true, selector: "[snySkeleton]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
1374
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnySkeletonDirective, isStandalone: true, selector: "[snySkeleton]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-busy": "true", "aria-hidden": "true" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
1295
1375
|
}
|
|
1296
1376
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySkeletonDirective, decorators: [{
|
|
1297
1377
|
type: Directive,
|
|
1298
1378
|
args: [{
|
|
1299
1379
|
selector: '[snySkeleton]',
|
|
1300
1380
|
standalone: true,
|
|
1301
|
-
host: {
|
|
1381
|
+
host: {
|
|
1382
|
+
'[class]': 'computedClass()',
|
|
1383
|
+
'aria-busy': 'true',
|
|
1384
|
+
'aria-hidden': 'true',
|
|
1385
|
+
},
|
|
1302
1386
|
}]
|
|
1303
1387
|
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
1304
1388
|
|
|
@@ -1359,42 +1443,78 @@ class SnySwitchComponent {
|
|
|
1359
1443
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1360
1444
|
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1361
1445
|
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
1446
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
1447
|
+
isDisabled = computed(() => this.disabled() || this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1448
|
+
_onChange = () => { };
|
|
1449
|
+
onTouched = () => { };
|
|
1450
|
+
_writing = false;
|
|
1451
|
+
constructor() {
|
|
1452
|
+
effect(() => {
|
|
1453
|
+
const val = this.checked();
|
|
1454
|
+
if (this._writing) {
|
|
1455
|
+
this._writing = false;
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
this._onChange(val);
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
writeValue(val) {
|
|
1462
|
+
this._writing = true;
|
|
1463
|
+
this.checked.set(val ?? false);
|
|
1464
|
+
}
|
|
1465
|
+
registerOnChange(fn) {
|
|
1466
|
+
this._onChange = fn;
|
|
1467
|
+
}
|
|
1468
|
+
registerOnTouched(fn) {
|
|
1469
|
+
this.onTouched = fn;
|
|
1470
|
+
}
|
|
1471
|
+
setDisabledState(isDisabled) {
|
|
1472
|
+
this._disabledByCva.set(isDisabled);
|
|
1473
|
+
}
|
|
1362
1474
|
trackClass = computed(() => cn(switchTrackVariants({ size: this.size() }), this.checked() ? 'bg-primary' : 'bg-input', this.class()), ...(ngDevMode ? [{ debugName: "trackClass" }] : /* istanbul ignore next */ []));
|
|
1363
1475
|
thumbClass = computed(() => cn('pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform', switchThumbSize[this.size()], this.checked() ? switchThumbTranslate[this.size()] : 'translate-x-0'), ...(ngDevMode ? [{ debugName: "thumbClass" }] : /* istanbul ignore next */ []));
|
|
1364
1476
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1365
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.5", type: SnySwitchComponent, isStandalone: true, selector: "sny-switch", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { classAttribute: "inline-flex" },
|
|
1477
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.5", type: SnySwitchComponent, isStandalone: true, selector: "sny-switch", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { classAttribute: "inline-flex" }, providers: [
|
|
1478
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnySwitchComponent), multi: true },
|
|
1479
|
+
], ngImport: i0, template: `
|
|
1366
1480
|
<button
|
|
1367
1481
|
type="button"
|
|
1368
1482
|
role="switch"
|
|
1369
1483
|
[attr.aria-checked]="checked()"
|
|
1370
|
-
[disabled]="
|
|
1484
|
+
[disabled]="isDisabled()"
|
|
1371
1485
|
[class]="trackClass()"
|
|
1372
1486
|
(click)="checked.set(!checked())"
|
|
1487
|
+
(blur)="onTouched()"
|
|
1373
1488
|
>
|
|
1374
1489
|
<span [class]="thumbClass()"></span>
|
|
1375
1490
|
</button>
|
|
1376
|
-
`, isInline: true });
|
|
1491
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1377
1492
|
}
|
|
1378
1493
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySwitchComponent, decorators: [{
|
|
1379
1494
|
type: Component,
|
|
1380
1495
|
args: [{
|
|
1381
1496
|
selector: 'sny-switch',
|
|
1382
1497
|
standalone: true,
|
|
1498
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1383
1499
|
host: { class: 'inline-flex' },
|
|
1500
|
+
providers: [
|
|
1501
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnySwitchComponent), multi: true },
|
|
1502
|
+
],
|
|
1384
1503
|
template: `
|
|
1385
1504
|
<button
|
|
1386
1505
|
type="button"
|
|
1387
1506
|
role="switch"
|
|
1388
1507
|
[attr.aria-checked]="checked()"
|
|
1389
|
-
[disabled]="
|
|
1508
|
+
[disabled]="isDisabled()"
|
|
1390
1509
|
[class]="trackClass()"
|
|
1391
1510
|
(click)="checked.set(!checked())"
|
|
1511
|
+
(blur)="onTouched()"
|
|
1392
1512
|
>
|
|
1393
1513
|
<span [class]="thumbClass()"></span>
|
|
1394
1514
|
</button>
|
|
1395
1515
|
`,
|
|
1396
1516
|
}]
|
|
1397
|
-
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
1517
|
+
}], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
1398
1518
|
|
|
1399
1519
|
const toggleVariants = cva('inline-flex items-center justify-center rounded-sm text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', {
|
|
1400
1520
|
variants: {
|
|
@@ -1419,22 +1539,62 @@ class SnyToggleDirective {
|
|
|
1419
1539
|
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1420
1540
|
pressed = model(false, ...(ngDevMode ? [{ debugName: "pressed" }] : /* istanbul ignore next */ []));
|
|
1421
1541
|
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
1542
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
1543
|
+
isDisabled = computed(() => this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1544
|
+
_onChange = () => { };
|
|
1545
|
+
onTouched = () => { };
|
|
1546
|
+
_writing = false;
|
|
1547
|
+
constructor() {
|
|
1548
|
+
effect(() => {
|
|
1549
|
+
const val = this.pressed();
|
|
1550
|
+
if (this._writing) {
|
|
1551
|
+
this._writing = false;
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
this._onChange(val);
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
writeValue(val) {
|
|
1558
|
+
this._writing = true;
|
|
1559
|
+
this.pressed.set(val ?? false);
|
|
1560
|
+
}
|
|
1561
|
+
registerOnChange(fn) {
|
|
1562
|
+
this._onChange = fn;
|
|
1563
|
+
}
|
|
1564
|
+
registerOnTouched(fn) {
|
|
1565
|
+
this.onTouched = fn;
|
|
1566
|
+
}
|
|
1567
|
+
setDisabledState(isDisabled) {
|
|
1568
|
+
this._disabledByCva.set(isDisabled);
|
|
1569
|
+
}
|
|
1570
|
+
toggle() {
|
|
1571
|
+
if (this.isDisabled())
|
|
1572
|
+
return;
|
|
1573
|
+
this.pressed.set(!this.pressed());
|
|
1574
|
+
}
|
|
1422
1575
|
computedClass = computed(() => cn(toggleVariants({ variant: this.variant(), size: this.size() }), this.pressed() ? 'bg-accent text-accent-foreground' : '', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
1423
1576
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyToggleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1424
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyToggleDirective, isStandalone: true, selector: "button[snyToggle]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, pressed: { classPropertyName: "pressed", publicName: "pressed", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pressed: "pressedChange" }, host: { listeners: { "click": "
|
|
1577
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyToggleDirective, isStandalone: true, selector: "button[snyToggle]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, pressed: { classPropertyName: "pressed", publicName: "pressed", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pressed: "pressedChange" }, host: { listeners: { "click": "toggle()", "blur": "onTouched()" }, properties: { "class": "computedClass()", "attr.aria-pressed": "pressed()", "attr.disabled": "isDisabled() || null" } }, providers: [
|
|
1578
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyToggleDirective), multi: true },
|
|
1579
|
+
], ngImport: i0 });
|
|
1425
1580
|
}
|
|
1426
1581
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyToggleDirective, decorators: [{
|
|
1427
1582
|
type: Directive,
|
|
1428
1583
|
args: [{
|
|
1429
1584
|
selector: 'button[snyToggle]',
|
|
1430
1585
|
standalone: true,
|
|
1586
|
+
providers: [
|
|
1587
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyToggleDirective), multi: true },
|
|
1588
|
+
],
|
|
1431
1589
|
host: {
|
|
1432
1590
|
'[class]': 'computedClass()',
|
|
1433
1591
|
'[attr.aria-pressed]': 'pressed()',
|
|
1434
|
-
'
|
|
1592
|
+
'[attr.disabled]': 'isDisabled() || null',
|
|
1593
|
+
'(click)': 'toggle()',
|
|
1594
|
+
'(blur)': 'onTouched()',
|
|
1435
1595
|
},
|
|
1436
1596
|
}]
|
|
1437
|
-
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], pressed: [{ type: i0.Input, args: [{ isSignal: true, alias: "pressed", required: false }] }, { type: i0.Output, args: ["pressedChange"] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
1597
|
+
}], ctorParameters: () => [], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], pressed: [{ type: i0.Input, args: [{ isSignal: true, alias: "pressed", required: false }] }, { type: i0.Output, args: ["pressedChange"] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
1438
1598
|
|
|
1439
1599
|
const sliderTrackVariants = cva('relative w-full rounded-full bg-secondary cursor-pointer', {
|
|
1440
1600
|
variants: {
|
|
@@ -1462,19 +1622,47 @@ class SnySliderComponent {
|
|
|
1462
1622
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1463
1623
|
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1464
1624
|
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
1625
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
1626
|
+
isDisabled = computed(() => this.disabled() || this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1465
1627
|
trackRef = viewChild('trackEl', ...(ngDevMode ? [{ debugName: "trackRef" }] : /* istanbul ignore next */ []));
|
|
1466
1628
|
moveHandler = null;
|
|
1467
1629
|
upHandler = null;
|
|
1630
|
+
_onChange = () => { };
|
|
1631
|
+
onTouched = () => { };
|
|
1632
|
+
_writing = false;
|
|
1633
|
+
constructor() {
|
|
1634
|
+
effect(() => {
|
|
1635
|
+
const val = this.value();
|
|
1636
|
+
if (this._writing) {
|
|
1637
|
+
this._writing = false;
|
|
1638
|
+
return;
|
|
1639
|
+
}
|
|
1640
|
+
this._onChange(val);
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
writeValue(val) {
|
|
1644
|
+
this._writing = true;
|
|
1645
|
+
this.value.set(val ?? 0);
|
|
1646
|
+
}
|
|
1647
|
+
registerOnChange(fn) {
|
|
1648
|
+
this._onChange = fn;
|
|
1649
|
+
}
|
|
1650
|
+
registerOnTouched(fn) {
|
|
1651
|
+
this.onTouched = fn;
|
|
1652
|
+
}
|
|
1653
|
+
setDisabledState(isDisabled) {
|
|
1654
|
+
this._disabledByCva.set(isDisabled);
|
|
1655
|
+
}
|
|
1468
1656
|
percentage = computed(() => {
|
|
1469
1657
|
const range = this.max() - this.min();
|
|
1470
1658
|
if (range <= 0)
|
|
1471
1659
|
return 0;
|
|
1472
1660
|
return ((this.value() - this.min()) / range) * 100;
|
|
1473
1661
|
}, ...(ngDevMode ? [{ debugName: "percentage" }] : /* istanbul ignore next */ []));
|
|
1474
|
-
trackClass = computed(() => cn(sliderTrackVariants({ size: this.size() }), this.
|
|
1662
|
+
trackClass = computed(() => cn(sliderTrackVariants({ size: this.size() }), this.isDisabled() && 'opacity-50 cursor-not-allowed', this.class()), ...(ngDevMode ? [{ debugName: "trackClass" }] : /* istanbul ignore next */ []));
|
|
1475
1663
|
thumbClass = computed(() => cn('absolute top-1/2 -translate-x-1/2 -translate-y-1/2 block rounded-full border-2 border-primary bg-background shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', sliderThumbSize[this.size()]), ...(ngDevMode ? [{ debugName: "thumbClass" }] : /* istanbul ignore next */ []));
|
|
1476
1664
|
updateValueFromPosition(clientX) {
|
|
1477
|
-
if (this.
|
|
1665
|
+
if (this.isDisabled())
|
|
1478
1666
|
return;
|
|
1479
1667
|
const track = this.trackRef()?.nativeElement;
|
|
1480
1668
|
if (!track)
|
|
@@ -1486,7 +1674,7 @@ class SnySliderComponent {
|
|
|
1486
1674
|
this.value.set(Math.max(this.min(), Math.min(this.max(), stepped)));
|
|
1487
1675
|
}
|
|
1488
1676
|
onTrackMousedown(event) {
|
|
1489
|
-
if (this.
|
|
1677
|
+
if (this.isDisabled())
|
|
1490
1678
|
return;
|
|
1491
1679
|
event.preventDefault();
|
|
1492
1680
|
this.updateValueFromPosition(event.clientX);
|
|
@@ -1494,24 +1682,30 @@ class SnySliderComponent {
|
|
|
1494
1682
|
const clientX = e instanceof MouseEvent ? e.clientX : e.touches[0].clientX;
|
|
1495
1683
|
this.updateValueFromPosition(clientX);
|
|
1496
1684
|
};
|
|
1497
|
-
this.upHandler = () =>
|
|
1685
|
+
this.upHandler = () => {
|
|
1686
|
+
this.onTouched();
|
|
1687
|
+
this.removeListeners();
|
|
1688
|
+
};
|
|
1498
1689
|
document.addEventListener('mousemove', this.moveHandler);
|
|
1499
1690
|
document.addEventListener('mouseup', this.upHandler);
|
|
1500
1691
|
}
|
|
1501
1692
|
onTrackTouchstart(event) {
|
|
1502
|
-
if (this.
|
|
1693
|
+
if (this.isDisabled())
|
|
1503
1694
|
return;
|
|
1504
1695
|
this.updateValueFromPosition(event.touches[0].clientX);
|
|
1505
1696
|
this.moveHandler = (e) => {
|
|
1506
1697
|
const clientX = e instanceof MouseEvent ? e.clientX : e.touches[0].clientX;
|
|
1507
1698
|
this.updateValueFromPosition(clientX);
|
|
1508
1699
|
};
|
|
1509
|
-
this.upHandler = () =>
|
|
1700
|
+
this.upHandler = () => {
|
|
1701
|
+
this.onTouched();
|
|
1702
|
+
this.removeListeners();
|
|
1703
|
+
};
|
|
1510
1704
|
document.addEventListener('touchmove', this.moveHandler, { passive: true });
|
|
1511
1705
|
document.addEventListener('touchend', this.upHandler);
|
|
1512
1706
|
}
|
|
1513
1707
|
onKeydown(event) {
|
|
1514
|
-
if (this.
|
|
1708
|
+
if (this.isDisabled())
|
|
1515
1709
|
return;
|
|
1516
1710
|
const step = this.step();
|
|
1517
1711
|
switch (event.key) {
|
|
@@ -1551,7 +1745,9 @@ class SnySliderComponent {
|
|
|
1551
1745
|
this.removeListeners();
|
|
1552
1746
|
}
|
|
1553
1747
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1554
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.5", type: SnySliderComponent, isStandalone: true, selector: "sny-slider", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, classAttribute: "block" },
|
|
1748
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.5", type: SnySliderComponent, isStandalone: true, selector: "sny-slider", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, classAttribute: "block" }, providers: [
|
|
1749
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnySliderComponent), multi: true },
|
|
1750
|
+
], viewQueries: [{ propertyName: "trackRef", first: true, predicate: ["trackEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1555
1751
|
<div
|
|
1556
1752
|
#trackEl
|
|
1557
1753
|
[class]="trackClass()"
|
|
@@ -1565,23 +1761,28 @@ class SnySliderComponent {
|
|
|
1565
1761
|
[attr.aria-valuemin]="min()"
|
|
1566
1762
|
[attr.aria-valuemax]="max()"
|
|
1567
1763
|
[attr.aria-valuenow]="value()"
|
|
1568
|
-
[disabled]="
|
|
1764
|
+
[disabled]="isDisabled()"
|
|
1569
1765
|
[class]="thumbClass()"
|
|
1570
1766
|
[style.left.%]="percentage()"
|
|
1571
1767
|
tabindex="0"
|
|
1768
|
+
(blur)="onTouched()"
|
|
1572
1769
|
></button>
|
|
1573
1770
|
</div>
|
|
1574
|
-
`, isInline: true });
|
|
1771
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1575
1772
|
}
|
|
1576
1773
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySliderComponent, decorators: [{
|
|
1577
1774
|
type: Component,
|
|
1578
1775
|
args: [{
|
|
1579
1776
|
selector: 'sny-slider',
|
|
1580
1777
|
standalone: true,
|
|
1778
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1581
1779
|
host: {
|
|
1582
1780
|
class: 'block',
|
|
1583
1781
|
'(keydown)': 'onKeydown($event)',
|
|
1584
1782
|
},
|
|
1783
|
+
providers: [
|
|
1784
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnySliderComponent), multi: true },
|
|
1785
|
+
],
|
|
1585
1786
|
template: `
|
|
1586
1787
|
<div
|
|
1587
1788
|
#trackEl
|
|
@@ -1596,15 +1797,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1596
1797
|
[attr.aria-valuemin]="min()"
|
|
1597
1798
|
[attr.aria-valuemax]="max()"
|
|
1598
1799
|
[attr.aria-valuenow]="value()"
|
|
1599
|
-
[disabled]="
|
|
1800
|
+
[disabled]="isDisabled()"
|
|
1600
1801
|
[class]="thumbClass()"
|
|
1601
1802
|
[style.left.%]="percentage()"
|
|
1602
1803
|
tabindex="0"
|
|
1804
|
+
(blur)="onTouched()"
|
|
1603
1805
|
></button>
|
|
1604
1806
|
</div>
|
|
1605
1807
|
`,
|
|
1606
1808
|
}]
|
|
1607
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], trackRef: [{ type: i0.ViewChild, args: ['trackEl', { isSignal: true }] }] } });
|
|
1809
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], trackRef: [{ type: i0.ViewChild, args: ['trackEl', { isSignal: true }] }] } });
|
|
1608
1810
|
|
|
1609
1811
|
const loaderVariants = cva('inline-flex items-center justify-center text-current', {
|
|
1610
1812
|
variants: {
|
|
@@ -1650,13 +1852,14 @@ class SnyLoaderComponent {
|
|
|
1650
1852
|
</span>
|
|
1651
1853
|
}
|
|
1652
1854
|
}
|
|
1653
|
-
`, isInline: true });
|
|
1855
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1654
1856
|
}
|
|
1655
1857
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyLoaderComponent, decorators: [{
|
|
1656
1858
|
type: Component,
|
|
1657
1859
|
args: [{
|
|
1658
1860
|
selector: 'sny-loader',
|
|
1659
1861
|
standalone: true,
|
|
1862
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1660
1863
|
host: {
|
|
1661
1864
|
'[class]': 'computedClass()',
|
|
1662
1865
|
role: 'status',
|
|
@@ -1699,22 +1902,56 @@ class SnyTabsDirective {
|
|
|
1699
1902
|
this.value.set(value);
|
|
1700
1903
|
}
|
|
1701
1904
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTabsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1702
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTabsDirective, isStandalone: true, selector: "[snyTabs]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_TABS, useExisting: SnyTabsDirective }], ngImport: i0 });
|
|
1905
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTabsDirective, isStandalone: true, selector: "[snyTabs]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_TABS, useExisting: SnyTabsDirective }], exportAs: ["snyTabs"], ngImport: i0 });
|
|
1703
1906
|
}
|
|
1704
1907
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTabsDirective, decorators: [{
|
|
1705
1908
|
type: Directive,
|
|
1706
1909
|
args: [{
|
|
1707
1910
|
selector: '[snyTabs]',
|
|
1708
1911
|
standalone: true,
|
|
1912
|
+
exportAs: 'snyTabs',
|
|
1709
1913
|
providers: [{ provide: SNY_TABS, useExisting: SnyTabsDirective }],
|
|
1710
1914
|
host: { '[class]': 'computedClass()' },
|
|
1711
1915
|
}]
|
|
1712
1916
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
1713
1917
|
class SnyTabsListDirective {
|
|
1714
1918
|
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
1919
|
+
elRef = inject(ElementRef);
|
|
1715
1920
|
computedClass = computed(() => cn('inline-flex h-10 items-center justify-center rounded-sm bg-muted p-1 text-muted-foreground', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
1921
|
+
onKeydown(event) {
|
|
1922
|
+
const triggers = Array.from(this.elRef.nativeElement.querySelectorAll('[role="tab"]'));
|
|
1923
|
+
if (triggers.length === 0)
|
|
1924
|
+
return;
|
|
1925
|
+
const currentIndex = triggers.indexOf(document.activeElement);
|
|
1926
|
+
if (currentIndex === -1)
|
|
1927
|
+
return;
|
|
1928
|
+
let nextIndex = null;
|
|
1929
|
+
switch (event.key) {
|
|
1930
|
+
case 'ArrowRight':
|
|
1931
|
+
case 'ArrowDown':
|
|
1932
|
+
event.preventDefault();
|
|
1933
|
+
nextIndex = (currentIndex + 1) % triggers.length;
|
|
1934
|
+
break;
|
|
1935
|
+
case 'ArrowLeft':
|
|
1936
|
+
case 'ArrowUp':
|
|
1937
|
+
event.preventDefault();
|
|
1938
|
+
nextIndex = (currentIndex - 1 + triggers.length) % triggers.length;
|
|
1939
|
+
break;
|
|
1940
|
+
case 'Home':
|
|
1941
|
+
event.preventDefault();
|
|
1942
|
+
nextIndex = 0;
|
|
1943
|
+
break;
|
|
1944
|
+
case 'End':
|
|
1945
|
+
event.preventDefault();
|
|
1946
|
+
nextIndex = triggers.length - 1;
|
|
1947
|
+
break;
|
|
1948
|
+
}
|
|
1949
|
+
if (nextIndex !== null) {
|
|
1950
|
+
triggers[nextIndex].focus();
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1716
1953
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTabsListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1717
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTabsListDirective, isStandalone: true, selector: "[snyTabsList]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tablist" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
1954
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTabsListDirective, isStandalone: true, selector: "[snyTabsList]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tablist" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
1718
1955
|
}
|
|
1719
1956
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTabsListDirective, decorators: [{
|
|
1720
1957
|
type: Directive,
|
|
@@ -1724,6 +1961,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1724
1961
|
host: {
|
|
1725
1962
|
role: 'tablist',
|
|
1726
1963
|
'[class]': 'computedClass()',
|
|
1964
|
+
'(keydown)': 'onKeydown($event)',
|
|
1727
1965
|
},
|
|
1728
1966
|
}]
|
|
1729
1967
|
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
@@ -1736,7 +1974,7 @@ class SnyTabsTriggerDirective {
|
|
|
1736
1974
|
? 'bg-background text-foreground shadow-sm'
|
|
1737
1975
|
: 'hover:bg-background/50', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
1738
1976
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTabsTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1739
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTabsTriggerDirective, isStandalone: true, selector: "[snyTabsTrigger]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tab" }, listeners: { "click": "tabs.select(value())" }, properties: { "class": "computedClass()", "attr.aria-selected": "isActive()" } }, ngImport: i0 });
|
|
1977
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTabsTriggerDirective, isStandalone: true, selector: "[snyTabsTrigger]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tab" }, listeners: { "click": "tabs.select(value())" }, properties: { "class": "computedClass()", "attr.aria-selected": "isActive()", "attr.tabindex": "isActive() ? 0 : -1" } }, ngImport: i0 });
|
|
1740
1978
|
}
|
|
1741
1979
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTabsTriggerDirective, decorators: [{
|
|
1742
1980
|
type: Directive,
|
|
@@ -1747,6 +1985,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1747
1985
|
role: 'tab',
|
|
1748
1986
|
'[class]': 'computedClass()',
|
|
1749
1987
|
'[attr.aria-selected]': 'isActive()',
|
|
1988
|
+
'[attr.tabindex]': 'isActive() ? 0 : -1',
|
|
1750
1989
|
'(click)': 'tabs.select(value())',
|
|
1751
1990
|
},
|
|
1752
1991
|
}]
|
|
@@ -1804,11 +2043,39 @@ class SnySelectComponent {
|
|
|
1804
2043
|
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1805
2044
|
open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
1806
2045
|
activeIndex = signal(0, ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
2046
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
2047
|
+
isDisabled = computed(() => this.disabled() || this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1807
2048
|
triggerRef = viewChild('triggerEl', ...(ngDevMode ? [{ debugName: "triggerRef" }] : /* istanbul ignore next */ []));
|
|
1808
2049
|
dropdownRef = viewChild('dropdownEl', ...(ngDevMode ? [{ debugName: "dropdownRef" }] : /* istanbul ignore next */ []));
|
|
1809
2050
|
elRef = inject(ElementRef);
|
|
1810
2051
|
scrollHandler = null;
|
|
1811
2052
|
resizeHandler = null;
|
|
2053
|
+
_onChange = () => { };
|
|
2054
|
+
onTouched = () => { };
|
|
2055
|
+
_writing = false;
|
|
2056
|
+
constructor() {
|
|
2057
|
+
effect(() => {
|
|
2058
|
+
const val = this.value();
|
|
2059
|
+
if (this._writing) {
|
|
2060
|
+
this._writing = false;
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
this._onChange(val);
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
writeValue(val) {
|
|
2067
|
+
this._writing = true;
|
|
2068
|
+
this.value.set(val ?? '');
|
|
2069
|
+
}
|
|
2070
|
+
registerOnChange(fn) {
|
|
2071
|
+
this._onChange = fn;
|
|
2072
|
+
}
|
|
2073
|
+
registerOnTouched(fn) {
|
|
2074
|
+
this.onTouched = fn;
|
|
2075
|
+
}
|
|
2076
|
+
setDisabledState(isDisabled) {
|
|
2077
|
+
this._disabledByCva.set(isDisabled);
|
|
2078
|
+
}
|
|
1812
2079
|
selectedLabel = computed(() => {
|
|
1813
2080
|
const v = this.value();
|
|
1814
2081
|
if (!v)
|
|
@@ -1913,17 +2180,20 @@ class SnySelectComponent {
|
|
|
1913
2180
|
}
|
|
1914
2181
|
}
|
|
1915
2182
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1916
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnySelectComponent, isStandalone: true, selector: "sny-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)" }, classAttribute: "relative inline-block w-full" },
|
|
2183
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnySelectComponent, isStandalone: true, selector: "sny-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)" }, classAttribute: "relative inline-block w-full" }, providers: [
|
|
2184
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnySelectComponent), multi: true },
|
|
2185
|
+
], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true, isSignal: true }, { propertyName: "dropdownRef", first: true, predicate: ["dropdownEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1917
2186
|
<button
|
|
1918
2187
|
#triggerEl
|
|
1919
2188
|
type="button"
|
|
1920
2189
|
role="combobox"
|
|
1921
2190
|
[attr.aria-expanded]="open()"
|
|
1922
2191
|
aria-haspopup="listbox"
|
|
1923
|
-
[disabled]="
|
|
2192
|
+
[disabled]="isDisabled()"
|
|
1924
2193
|
[class]="triggerClass()"
|
|
1925
2194
|
(click)="toggle()"
|
|
1926
2195
|
(keydown)="onTriggerKeydown($event)"
|
|
2196
|
+
(blur)="onTouched()"
|
|
1927
2197
|
>
|
|
1928
2198
|
<span [class]="selectedLabel() ? '' : 'text-muted-foreground'">
|
|
1929
2199
|
{{ selectedLabel() || placeholder() }}
|
|
@@ -1956,16 +2226,20 @@ class SnySelectComponent {
|
|
|
1956
2226
|
</ul>
|
|
1957
2227
|
</div>
|
|
1958
2228
|
}
|
|
1959
|
-
`, isInline: true });
|
|
2229
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1960
2230
|
}
|
|
1961
2231
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySelectComponent, decorators: [{
|
|
1962
2232
|
type: Component,
|
|
1963
2233
|
args: [{
|
|
1964
2234
|
selector: 'sny-select',
|
|
1965
2235
|
standalone: true,
|
|
2236
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1966
2237
|
host: {
|
|
1967
2238
|
class: 'relative inline-block w-full',
|
|
1968
2239
|
},
|
|
2240
|
+
providers: [
|
|
2241
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnySelectComponent), multi: true },
|
|
2242
|
+
],
|
|
1969
2243
|
template: `
|
|
1970
2244
|
<button
|
|
1971
2245
|
#triggerEl
|
|
@@ -1973,10 +2247,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1973
2247
|
role="combobox"
|
|
1974
2248
|
[attr.aria-expanded]="open()"
|
|
1975
2249
|
aria-haspopup="listbox"
|
|
1976
|
-
[disabled]="
|
|
2250
|
+
[disabled]="isDisabled()"
|
|
1977
2251
|
[class]="triggerClass()"
|
|
1978
2252
|
(click)="toggle()"
|
|
1979
2253
|
(keydown)="onTriggerKeydown($event)"
|
|
2254
|
+
(blur)="onTouched()"
|
|
1980
2255
|
>
|
|
1981
2256
|
<span [class]="selectedLabel() ? '' : 'text-muted-foreground'">
|
|
1982
2257
|
{{ selectedLabel() || placeholder() }}
|
|
@@ -2011,7 +2286,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
2011
2286
|
}
|
|
2012
2287
|
`,
|
|
2013
2288
|
}]
|
|
2014
|
-
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], triggerRef: [{ type: i0.ViewChild, args: ['triggerEl', { isSignal: true }] }], dropdownRef: [{ type: i0.ViewChild, args: ['dropdownEl', { isSignal: true }] }], onDocumentClick: [{
|
|
2289
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], triggerRef: [{ type: i0.ViewChild, args: ['triggerEl', { isSignal: true }] }], dropdownRef: [{ type: i0.ViewChild, args: ['dropdownEl', { isSignal: true }] }], onDocumentClick: [{
|
|
2015
2290
|
type: HostListener,
|
|
2016
2291
|
args: ['document:click', ['$event']]
|
|
2017
2292
|
}] } });
|
|
@@ -2352,6 +2627,2720 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
2352
2627
|
}]
|
|
2353
2628
|
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2354
2629
|
|
|
2630
|
+
const alertVariants = cva('relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground', {
|
|
2631
|
+
variants: {
|
|
2632
|
+
variant: {
|
|
2633
|
+
default: 'bg-background text-foreground border-border',
|
|
2634
|
+
destructive: 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive bg-destructive/10',
|
|
2635
|
+
success: 'border-green-500/50 text-green-700 dark:text-green-400 dark:border-green-500 [&>svg]:text-green-600 bg-green-50 dark:bg-green-950/30',
|
|
2636
|
+
warning: 'border-yellow-500/50 text-yellow-700 dark:text-yellow-400 dark:border-yellow-500 [&>svg]:text-yellow-600 bg-yellow-50 dark:bg-yellow-950/30',
|
|
2637
|
+
info: 'border-blue-500/50 text-blue-700 dark:text-blue-400 dark:border-blue-500 [&>svg]:text-blue-600 bg-blue-50 dark:bg-blue-950/30',
|
|
2638
|
+
},
|
|
2639
|
+
},
|
|
2640
|
+
defaultVariants: {
|
|
2641
|
+
variant: 'default',
|
|
2642
|
+
},
|
|
2643
|
+
});
|
|
2644
|
+
|
|
2645
|
+
class SnyAlertDirective {
|
|
2646
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
2647
|
+
dismissible = input(false, ...(ngDevMode ? [{ debugName: "dismissible" }] : /* istanbul ignore next */ []));
|
|
2648
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
2649
|
+
visible = signal(true, ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
2650
|
+
role = computed(() => {
|
|
2651
|
+
const v = this.variant();
|
|
2652
|
+
return v === 'destructive' || v === 'warning' || v === 'info' ? 'alert' : 'status';
|
|
2653
|
+
}, ...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
2654
|
+
ariaLive = computed(() => {
|
|
2655
|
+
const v = this.variant();
|
|
2656
|
+
return v === 'destructive' || v === 'warning' ? 'assertive' : 'polite';
|
|
2657
|
+
}, ...(ngDevMode ? [{ debugName: "ariaLive" }] : /* istanbul ignore next */ []));
|
|
2658
|
+
computedClass = computed(() => cn(alertVariants({ variant: this.variant() }), this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2659
|
+
dismiss() {
|
|
2660
|
+
this.visible.set(false);
|
|
2661
|
+
}
|
|
2662
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAlertDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2663
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAlertDirective, isStandalone: true, selector: "[snyAlert]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()", "attr.role": "role()", "attr.aria-live": "ariaLive()", "style.display": "visible() ? null : \"none\"" } }, exportAs: ["snyAlert"], ngImport: i0 });
|
|
2664
|
+
}
|
|
2665
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAlertDirective, decorators: [{
|
|
2666
|
+
type: Directive,
|
|
2667
|
+
args: [{
|
|
2668
|
+
selector: '[snyAlert]',
|
|
2669
|
+
exportAs: 'snyAlert',
|
|
2670
|
+
standalone: true,
|
|
2671
|
+
host: {
|
|
2672
|
+
'[class]': 'computedClass()',
|
|
2673
|
+
'[attr.role]': 'role()',
|
|
2674
|
+
'[attr.aria-live]': 'ariaLive()',
|
|
2675
|
+
'[style.display]': 'visible() ? null : "none"',
|
|
2676
|
+
},
|
|
2677
|
+
}]
|
|
2678
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], dismissible: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissible", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2679
|
+
class SnyAlertTitleDirective {
|
|
2680
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
2681
|
+
computedClass = computed(() => cn('mb-1 font-medium leading-none tracking-tight', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2682
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAlertTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2683
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAlertTitleDirective, isStandalone: true, selector: "[snyAlertTitle]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
2684
|
+
}
|
|
2685
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAlertTitleDirective, decorators: [{
|
|
2686
|
+
type: Directive,
|
|
2687
|
+
args: [{
|
|
2688
|
+
selector: '[snyAlertTitle]',
|
|
2689
|
+
standalone: true,
|
|
2690
|
+
host: {
|
|
2691
|
+
'[class]': 'computedClass()',
|
|
2692
|
+
},
|
|
2693
|
+
}]
|
|
2694
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2695
|
+
class SnyAlertDescriptionDirective {
|
|
2696
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
2697
|
+
computedClass = computed(() => cn('text-sm [&_p]:leading-relaxed', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2698
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAlertDescriptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2699
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyAlertDescriptionDirective, isStandalone: true, selector: "[snyAlertDescription]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
2700
|
+
}
|
|
2701
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAlertDescriptionDirective, decorators: [{
|
|
2702
|
+
type: Directive,
|
|
2703
|
+
args: [{
|
|
2704
|
+
selector: '[snyAlertDescription]',
|
|
2705
|
+
standalone: true,
|
|
2706
|
+
host: {
|
|
2707
|
+
'[class]': 'computedClass()',
|
|
2708
|
+
},
|
|
2709
|
+
}]
|
|
2710
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2711
|
+
|
|
2712
|
+
const textareaVariants = cva('flex w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50', {
|
|
2713
|
+
variants: {
|
|
2714
|
+
variant: {
|
|
2715
|
+
default: 'border-input',
|
|
2716
|
+
error: 'border-destructive focus-visible:ring-destructive text-destructive placeholder:text-destructive/60',
|
|
2717
|
+
},
|
|
2718
|
+
textareaSize: {
|
|
2719
|
+
sm: 'min-h-[60px] text-xs',
|
|
2720
|
+
md: 'min-h-[80px] text-sm',
|
|
2721
|
+
lg: 'min-h-[120px] text-base',
|
|
2722
|
+
},
|
|
2723
|
+
resize: {
|
|
2724
|
+
none: 'resize-none',
|
|
2725
|
+
vertical: 'resize-y',
|
|
2726
|
+
horizontal: 'resize-x',
|
|
2727
|
+
both: 'resize',
|
|
2728
|
+
},
|
|
2729
|
+
},
|
|
2730
|
+
defaultVariants: {
|
|
2731
|
+
variant: 'default',
|
|
2732
|
+
textareaSize: 'md',
|
|
2733
|
+
resize: 'vertical',
|
|
2734
|
+
},
|
|
2735
|
+
});
|
|
2736
|
+
|
|
2737
|
+
class SnyTextareaDirective {
|
|
2738
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
2739
|
+
textareaSize = input('md', ...(ngDevMode ? [{ debugName: "textareaSize" }] : /* istanbul ignore next */ []));
|
|
2740
|
+
resize = input('vertical', ...(ngDevMode ? [{ debugName: "resize" }] : /* istanbul ignore next */ []));
|
|
2741
|
+
autoResize = input(false, ...(ngDevMode ? [{ debugName: "autoResize" }] : /* istanbul ignore next */ []));
|
|
2742
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
2743
|
+
el = inject((ElementRef));
|
|
2744
|
+
computedClass = computed(() => cn(textareaVariants({
|
|
2745
|
+
variant: this.variant(),
|
|
2746
|
+
textareaSize: this.textareaSize(),
|
|
2747
|
+
resize: this.autoResize() ? 'none' : this.resize(),
|
|
2748
|
+
}), this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2749
|
+
constructor() {
|
|
2750
|
+
afterNextRender(() => {
|
|
2751
|
+
if (this.autoResize()) {
|
|
2752
|
+
this.adjustHeight();
|
|
2753
|
+
}
|
|
2754
|
+
});
|
|
2755
|
+
effect(() => {
|
|
2756
|
+
if (this.autoResize()) {
|
|
2757
|
+
this.adjustHeight();
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
onInput() {
|
|
2762
|
+
if (this.autoResize()) {
|
|
2763
|
+
this.adjustHeight();
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
adjustHeight() {
|
|
2767
|
+
const textarea = this.el.nativeElement;
|
|
2768
|
+
textarea.style.height = 'auto';
|
|
2769
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
2770
|
+
}
|
|
2771
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTextareaDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2772
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTextareaDirective, isStandalone: true, selector: "textarea[snyTextarea]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, textareaSize: { classPropertyName: "textareaSize", publicName: "textareaSize", isSignal: true, isRequired: false, transformFunction: null }, resize: { classPropertyName: "resize", publicName: "resize", isSignal: true, isRequired: false, transformFunction: null }, autoResize: { classPropertyName: "autoResize", publicName: "autoResize", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "onInput()" }, properties: { "class": "computedClass()", "attr.aria-invalid": "variant() === \"error\" || null" } }, ngImport: i0 });
|
|
2773
|
+
}
|
|
2774
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTextareaDirective, decorators: [{
|
|
2775
|
+
type: Directive,
|
|
2776
|
+
args: [{
|
|
2777
|
+
selector: 'textarea[snyTextarea]',
|
|
2778
|
+
standalone: true,
|
|
2779
|
+
host: {
|
|
2780
|
+
'[class]': 'computedClass()',
|
|
2781
|
+
'[attr.aria-invalid]': 'variant() === "error" || null',
|
|
2782
|
+
'(input)': 'onInput()',
|
|
2783
|
+
},
|
|
2784
|
+
}]
|
|
2785
|
+
}], ctorParameters: () => [], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], textareaSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "textareaSize", required: false }] }], resize: [{ type: i0.Input, args: [{ isSignal: true, alias: "resize", required: false }] }], autoResize: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoResize", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2786
|
+
|
|
2787
|
+
const progressTrackVariants = cva('relative w-full overflow-hidden rounded-full bg-secondary', {
|
|
2788
|
+
variants: {
|
|
2789
|
+
size: {
|
|
2790
|
+
sm: 'h-1.5',
|
|
2791
|
+
md: 'h-2.5',
|
|
2792
|
+
lg: 'h-4',
|
|
2793
|
+
},
|
|
2794
|
+
},
|
|
2795
|
+
defaultVariants: {
|
|
2796
|
+
size: 'md',
|
|
2797
|
+
},
|
|
2798
|
+
});
|
|
2799
|
+
const progressBarVariants = cva('h-full rounded-full transition-all duration-300 ease-in-out', {
|
|
2800
|
+
variants: {
|
|
2801
|
+
variant: {
|
|
2802
|
+
default: 'bg-primary',
|
|
2803
|
+
success: 'bg-green-600 dark:bg-green-500',
|
|
2804
|
+
warning: 'bg-yellow-500 dark:bg-yellow-400',
|
|
2805
|
+
error: 'bg-destructive',
|
|
2806
|
+
info: 'bg-blue-600 dark:bg-blue-500',
|
|
2807
|
+
},
|
|
2808
|
+
indeterminate: {
|
|
2809
|
+
true: 'animate-progress-indeterminate w-1/3',
|
|
2810
|
+
false: '',
|
|
2811
|
+
},
|
|
2812
|
+
},
|
|
2813
|
+
defaultVariants: {
|
|
2814
|
+
variant: 'default',
|
|
2815
|
+
indeterminate: false,
|
|
2816
|
+
},
|
|
2817
|
+
});
|
|
2818
|
+
|
|
2819
|
+
class SnyProgressComponent {
|
|
2820
|
+
value = input(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2821
|
+
max = input(100, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
2822
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
2823
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2824
|
+
indeterminate = input(false, ...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
2825
|
+
label = input('Progress', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2826
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
2827
|
+
percentage = computed(() => Math.min(100, (this.value() / this.max()) * 100), ...(ngDevMode ? [{ debugName: "percentage" }] : /* istanbul ignore next */ []));
|
|
2828
|
+
trackClass = computed(() => cn(progressTrackVariants({ size: this.size() }), this.class()), ...(ngDevMode ? [{ debugName: "trackClass" }] : /* istanbul ignore next */ []));
|
|
2829
|
+
barClass = computed(() => cn(progressBarVariants({
|
|
2830
|
+
variant: this.variant(),
|
|
2831
|
+
indeterminate: this.indeterminate(),
|
|
2832
|
+
})), ...(ngDevMode ? [{ debugName: "barClass" }] : /* istanbul ignore next */ []));
|
|
2833
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyProgressComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2834
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.5", type: SnyProgressComponent, isStandalone: true, selector: "sny-progress", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar" }, properties: { "attr.aria-valuenow": "indeterminate() ? null : value()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "max()", "attr.aria-label": "label()", "class": "\"w-full\"" } }, ngImport: i0, template: `
|
|
2835
|
+
<div [class]="trackClass()">
|
|
2836
|
+
<div
|
|
2837
|
+
[class]="barClass()"
|
|
2838
|
+
[style.width.%]="indeterminate() ? null : percentage()"
|
|
2839
|
+
></div>
|
|
2840
|
+
</div>
|
|
2841
|
+
`, isInline: true, styles: ["@keyframes progress-indeterminate{0%{transform:translate(-100%)}to{transform:translate(400%)}}:host .animate-progress-indeterminate{animation:progress-indeterminate 1.5s ease-in-out infinite}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2842
|
+
}
|
|
2843
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyProgressComponent, decorators: [{
|
|
2844
|
+
type: Component,
|
|
2845
|
+
args: [{ selector: 'sny-progress', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2846
|
+
'role': 'progressbar',
|
|
2847
|
+
'[attr.aria-valuenow]': 'indeterminate() ? null : value()',
|
|
2848
|
+
'[attr.aria-valuemin]': '0',
|
|
2849
|
+
'[attr.aria-valuemax]': 'max()',
|
|
2850
|
+
'[attr.aria-label]': 'label()',
|
|
2851
|
+
'[class]': '"w-full"',
|
|
2852
|
+
}, template: `
|
|
2853
|
+
<div [class]="trackClass()">
|
|
2854
|
+
<div
|
|
2855
|
+
[class]="barClass()"
|
|
2856
|
+
[style.width.%]="indeterminate() ? null : percentage()"
|
|
2857
|
+
></div>
|
|
2858
|
+
</div>
|
|
2859
|
+
`, styles: ["@keyframes progress-indeterminate{0%{transform:translate(-100%)}to{transform:translate(400%)}}:host .animate-progress-indeterminate{animation:progress-indeterminate 1.5s ease-in-out infinite}\n"] }]
|
|
2860
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2861
|
+
|
|
2862
|
+
const tooltipVariants = cva('z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95', {
|
|
2863
|
+
variants: {
|
|
2864
|
+
position: {
|
|
2865
|
+
top: 'slide-in-from-bottom-2',
|
|
2866
|
+
bottom: 'slide-in-from-top-2',
|
|
2867
|
+
left: 'slide-in-from-right-2',
|
|
2868
|
+
right: 'slide-in-from-left-2',
|
|
2869
|
+
},
|
|
2870
|
+
},
|
|
2871
|
+
defaultVariants: {
|
|
2872
|
+
position: 'top',
|
|
2873
|
+
},
|
|
2874
|
+
});
|
|
2875
|
+
|
|
2876
|
+
let tooltipIdCounter = 0;
|
|
2877
|
+
class SnyTooltipDirective {
|
|
2878
|
+
snyTooltip = input.required(...(ngDevMode ? [{ debugName: "snyTooltip" }] : /* istanbul ignore next */ []));
|
|
2879
|
+
tooltipPosition = input('top', ...(ngDevMode ? [{ debugName: "tooltipPosition" }] : /* istanbul ignore next */ []));
|
|
2880
|
+
tooltipDelay = input(300, ...(ngDevMode ? [{ debugName: "tooltipDelay" }] : /* istanbul ignore next */ []));
|
|
2881
|
+
tooltipDisabled = input(false, ...(ngDevMode ? [{ debugName: "tooltipDisabled" }] : /* istanbul ignore next */ []));
|
|
2882
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
2883
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
2884
|
+
tooltipId = `sny-tooltip-${++tooltipIdCounter}`;
|
|
2885
|
+
el = inject((ElementRef));
|
|
2886
|
+
renderer = inject(Renderer2);
|
|
2887
|
+
showTimeout = null;
|
|
2888
|
+
tooltipEl = null;
|
|
2889
|
+
constructor() {
|
|
2890
|
+
afterNextRender(() => {
|
|
2891
|
+
// cleanup handled in ngOnDestroy
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
show() {
|
|
2895
|
+
if (this.tooltipDisabled())
|
|
2896
|
+
return;
|
|
2897
|
+
this.showTimeout = setTimeout(() => {
|
|
2898
|
+
this.createTooltip();
|
|
2899
|
+
this.isOpen.set(true);
|
|
2900
|
+
}, this.tooltipDelay());
|
|
2901
|
+
}
|
|
2902
|
+
hide() {
|
|
2903
|
+
if (this.showTimeout) {
|
|
2904
|
+
clearTimeout(this.showTimeout);
|
|
2905
|
+
this.showTimeout = null;
|
|
2906
|
+
}
|
|
2907
|
+
this.destroyTooltip();
|
|
2908
|
+
this.isOpen.set(false);
|
|
2909
|
+
}
|
|
2910
|
+
ngOnDestroy() {
|
|
2911
|
+
this.hide();
|
|
2912
|
+
}
|
|
2913
|
+
createTooltip() {
|
|
2914
|
+
if (this.tooltipEl)
|
|
2915
|
+
return;
|
|
2916
|
+
const tooltip = this.renderer.createElement('div');
|
|
2917
|
+
tooltip.id = this.tooltipId;
|
|
2918
|
+
tooltip.setAttribute('role', 'tooltip');
|
|
2919
|
+
tooltip.className = cn(tooltipVariants({ position: this.tooltipPosition() }), 'fixed pointer-events-none', this.class());
|
|
2920
|
+
tooltip.textContent = this.snyTooltip();
|
|
2921
|
+
this.renderer.appendChild(document.body, tooltip);
|
|
2922
|
+
this.tooltipEl = tooltip;
|
|
2923
|
+
this.positionTooltip();
|
|
2924
|
+
}
|
|
2925
|
+
positionTooltip() {
|
|
2926
|
+
if (!this.tooltipEl)
|
|
2927
|
+
return;
|
|
2928
|
+
const hostRect = this.el.nativeElement.getBoundingClientRect();
|
|
2929
|
+
const tooltipRect = this.tooltipEl.getBoundingClientRect();
|
|
2930
|
+
const position = this.tooltipPosition();
|
|
2931
|
+
const gap = 8;
|
|
2932
|
+
let top = 0;
|
|
2933
|
+
let left = 0;
|
|
2934
|
+
switch (position) {
|
|
2935
|
+
case 'top':
|
|
2936
|
+
top = hostRect.top - tooltipRect.height - gap;
|
|
2937
|
+
left = hostRect.left + (hostRect.width - tooltipRect.width) / 2;
|
|
2938
|
+
break;
|
|
2939
|
+
case 'bottom':
|
|
2940
|
+
top = hostRect.bottom + gap;
|
|
2941
|
+
left = hostRect.left + (hostRect.width - tooltipRect.width) / 2;
|
|
2942
|
+
break;
|
|
2943
|
+
case 'left':
|
|
2944
|
+
top = hostRect.top + (hostRect.height - tooltipRect.height) / 2;
|
|
2945
|
+
left = hostRect.left - tooltipRect.width - gap;
|
|
2946
|
+
break;
|
|
2947
|
+
case 'right':
|
|
2948
|
+
top = hostRect.top + (hostRect.height - tooltipRect.height) / 2;
|
|
2949
|
+
left = hostRect.right + gap;
|
|
2950
|
+
break;
|
|
2951
|
+
}
|
|
2952
|
+
this.tooltipEl.style.top = `${top}px`;
|
|
2953
|
+
this.tooltipEl.style.left = `${left}px`;
|
|
2954
|
+
}
|
|
2955
|
+
destroyTooltip() {
|
|
2956
|
+
if (this.tooltipEl) {
|
|
2957
|
+
this.tooltipEl.remove();
|
|
2958
|
+
this.tooltipEl = null;
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2962
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTooltipDirective, isStandalone: true, selector: "[snyTooltip]", inputs: { snyTooltip: { classPropertyName: "snyTooltip", publicName: "snyTooltip", isSignal: true, isRequired: true, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipDelay: { classPropertyName: "tooltipDelay", publicName: "tooltipDelay", isSignal: true, isRequired: false, transformFunction: null }, tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "show()", "mouseleave": "hide()", "focus": "show()", "blur": "hide()", "keydown.escape": "hide()" }, properties: { "attr.aria-describedby": "isOpen() ? tooltipId : null" } }, exportAs: ["snyTooltip"], ngImport: i0 });
|
|
2963
|
+
}
|
|
2964
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTooltipDirective, decorators: [{
|
|
2965
|
+
type: Directive,
|
|
2966
|
+
args: [{
|
|
2967
|
+
selector: '[snyTooltip]',
|
|
2968
|
+
standalone: true,
|
|
2969
|
+
exportAs: 'snyTooltip',
|
|
2970
|
+
host: {
|
|
2971
|
+
'(mouseenter)': 'show()',
|
|
2972
|
+
'(mouseleave)': 'hide()',
|
|
2973
|
+
'(focus)': 'show()',
|
|
2974
|
+
'(blur)': 'hide()',
|
|
2975
|
+
'(keydown.escape)': 'hide()',
|
|
2976
|
+
'[attr.aria-describedby]': 'isOpen() ? tooltipId : null',
|
|
2977
|
+
},
|
|
2978
|
+
}]
|
|
2979
|
+
}], ctorParameters: () => [], propDecorators: { snyTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "snyTooltip", required: true }] }], tooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPosition", required: false }] }], tooltipDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDelay", required: false }] }], tooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDisabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2980
|
+
|
|
2981
|
+
const dropdownContentVariants = cva('z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md', {
|
|
2982
|
+
variants: {},
|
|
2983
|
+
defaultVariants: {},
|
|
2984
|
+
});
|
|
2985
|
+
const dropdownItemVariants = cva('relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[active]:bg-accent data-[active]:text-accent-foreground', {
|
|
2986
|
+
variants: {
|
|
2987
|
+
variant: {
|
|
2988
|
+
default: '',
|
|
2989
|
+
destructive: 'text-destructive data-[active]:bg-destructive/10 data-[active]:text-destructive',
|
|
2990
|
+
},
|
|
2991
|
+
},
|
|
2992
|
+
defaultVariants: {
|
|
2993
|
+
variant: 'default',
|
|
2994
|
+
},
|
|
2995
|
+
});
|
|
2996
|
+
|
|
2997
|
+
const SNY_DROPDOWN = new InjectionToken('SnyDropdown');
|
|
2998
|
+
class SnyDropdownDirective {
|
|
2999
|
+
elementRef = inject(ElementRef);
|
|
3000
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
3001
|
+
toggle() { this.isOpen.update((v) => !v); }
|
|
3002
|
+
open() { this.isOpen.set(true); }
|
|
3003
|
+
close() { this.isOpen.set(false); }
|
|
3004
|
+
onDocumentClick(event) {
|
|
3005
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
3006
|
+
this.close();
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
onEscape() {
|
|
3010
|
+
this.close();
|
|
3011
|
+
}
|
|
3012
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3013
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: SnyDropdownDirective, isStandalone: true, selector: "[snyDropdown]", host: { listeners: { "document:click": "onDocumentClick($event)", "keydown.escape": "onEscape()" }, properties: { "class": "\"relative inline-block\"" } }, providers: [{ provide: SNY_DROPDOWN, useExisting: SnyDropdownDirective }], exportAs: ["snyDropdown"], ngImport: i0 });
|
|
3014
|
+
}
|
|
3015
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDropdownDirective, decorators: [{
|
|
3016
|
+
type: Directive,
|
|
3017
|
+
args: [{
|
|
3018
|
+
selector: '[snyDropdown]',
|
|
3019
|
+
standalone: true,
|
|
3020
|
+
exportAs: 'snyDropdown',
|
|
3021
|
+
providers: [{ provide: SNY_DROPDOWN, useExisting: SnyDropdownDirective }],
|
|
3022
|
+
host: {
|
|
3023
|
+
'[class]': '"relative inline-block"',
|
|
3024
|
+
},
|
|
3025
|
+
}]
|
|
3026
|
+
}], propDecorators: { onDocumentClick: [{
|
|
3027
|
+
type: HostListener,
|
|
3028
|
+
args: ['document:click', ['$event']]
|
|
3029
|
+
}], onEscape: [{
|
|
3030
|
+
type: HostListener,
|
|
3031
|
+
args: ['keydown.escape']
|
|
3032
|
+
}] } });
|
|
3033
|
+
class SnyDropdownTriggerDirective {
|
|
3034
|
+
dropdown = inject(SNY_DROPDOWN);
|
|
3035
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDropdownTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3036
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: SnyDropdownTriggerDirective, isStandalone: true, selector: "[snyDropdownTrigger]", host: { listeners: { "click": "dropdown.toggle()" }, properties: { "attr.aria-expanded": "dropdown.isOpen()", "attr.aria-haspopup": "\"menu\"" } }, ngImport: i0 });
|
|
3037
|
+
}
|
|
3038
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDropdownTriggerDirective, decorators: [{
|
|
3039
|
+
type: Directive,
|
|
3040
|
+
args: [{
|
|
3041
|
+
selector: '[snyDropdownTrigger]',
|
|
3042
|
+
standalone: true,
|
|
3043
|
+
host: {
|
|
3044
|
+
'(click)': 'dropdown.toggle()',
|
|
3045
|
+
'[attr.aria-expanded]': 'dropdown.isOpen()',
|
|
3046
|
+
'[attr.aria-haspopup]': '"menu"',
|
|
3047
|
+
},
|
|
3048
|
+
}]
|
|
3049
|
+
}] });
|
|
3050
|
+
class SnyDropdownContentDirective {
|
|
3051
|
+
dropdown = inject(SNY_DROPDOWN);
|
|
3052
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3053
|
+
computedClass = computed(() => cn(dropdownContentVariants(), 'absolute mt-1 left-0 animate-in fade-in-0 zoom-in-95', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3054
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDropdownContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3055
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyDropdownContentDirective, isStandalone: true, selector: "[snyDropdownContent]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "menu" }, properties: { "class": "computedClass()", "style.display": "dropdown.isOpen() ? \"\" : \"none\"" } }, ngImport: i0 });
|
|
3056
|
+
}
|
|
3057
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDropdownContentDirective, decorators: [{
|
|
3058
|
+
type: Directive,
|
|
3059
|
+
args: [{
|
|
3060
|
+
selector: '[snyDropdownContent]',
|
|
3061
|
+
standalone: true,
|
|
3062
|
+
host: {
|
|
3063
|
+
'role': 'menu',
|
|
3064
|
+
'[class]': 'computedClass()',
|
|
3065
|
+
'[style.display]': 'dropdown.isOpen() ? "" : "none"',
|
|
3066
|
+
},
|
|
3067
|
+
}]
|
|
3068
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3069
|
+
class SnyMenuContentDirective {
|
|
3070
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3071
|
+
computedClass = computed(() => cn(dropdownContentVariants(), this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3072
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyMenuContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3073
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyMenuContentDirective, isStandalone: true, selector: "[snyMenuContent]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3074
|
+
}
|
|
3075
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyMenuContentDirective, decorators: [{
|
|
3076
|
+
type: Directive,
|
|
3077
|
+
args: [{
|
|
3078
|
+
selector: '[snyMenuContent]',
|
|
3079
|
+
standalone: true,
|
|
3080
|
+
host: {
|
|
3081
|
+
'[class]': 'computedClass()',
|
|
3082
|
+
},
|
|
3083
|
+
}]
|
|
3084
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3085
|
+
class SnyMenuItemDirective {
|
|
3086
|
+
dropdown = inject(SNY_DROPDOWN, { optional: true });
|
|
3087
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3088
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3089
|
+
computedClass = computed(() => cn(dropdownItemVariants({ variant: this.variant() }), 'cursor-pointer hover:bg-accent hover:text-accent-foreground', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3090
|
+
onClick() {
|
|
3091
|
+
this.dropdown?.close();
|
|
3092
|
+
}
|
|
3093
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyMenuItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3094
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyMenuItemDirective, isStandalone: true, selector: "[snyMenuItem]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "menuitem" }, listeners: { "click": "onClick()" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3095
|
+
}
|
|
3096
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyMenuItemDirective, decorators: [{
|
|
3097
|
+
type: Directive,
|
|
3098
|
+
args: [{
|
|
3099
|
+
selector: '[snyMenuItem]',
|
|
3100
|
+
standalone: true,
|
|
3101
|
+
host: {
|
|
3102
|
+
'role': 'menuitem',
|
|
3103
|
+
'[class]': 'computedClass()',
|
|
3104
|
+
'(click)': 'onClick()',
|
|
3105
|
+
},
|
|
3106
|
+
}]
|
|
3107
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3108
|
+
class SnyMenuSeparatorDirective {
|
|
3109
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3110
|
+
computedClass = computed(() => cn('-mx-1 my-1 h-px bg-muted', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3111
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyMenuSeparatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3112
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyMenuSeparatorDirective, isStandalone: true, selector: "[snyMenuSeparator]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "separator" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3113
|
+
}
|
|
3114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyMenuSeparatorDirective, decorators: [{
|
|
3115
|
+
type: Directive,
|
|
3116
|
+
args: [{
|
|
3117
|
+
selector: '[snyMenuSeparator]',
|
|
3118
|
+
standalone: true,
|
|
3119
|
+
host: {
|
|
3120
|
+
'role': 'separator',
|
|
3121
|
+
'[class]': 'computedClass()',
|
|
3122
|
+
},
|
|
3123
|
+
}]
|
|
3124
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3125
|
+
class SnyMenuLabelDirective {
|
|
3126
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3127
|
+
computedClass = computed(() => cn('px-2 py-1.5 text-sm font-semibold', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3128
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyMenuLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3129
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyMenuLabelDirective, isStandalone: true, selector: "[snyMenuLabel]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3130
|
+
}
|
|
3131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyMenuLabelDirective, decorators: [{
|
|
3132
|
+
type: Directive,
|
|
3133
|
+
args: [{
|
|
3134
|
+
selector: '[snyMenuLabel]',
|
|
3135
|
+
standalone: true,
|
|
3136
|
+
host: {
|
|
3137
|
+
'[class]': 'computedClass()',
|
|
3138
|
+
},
|
|
3139
|
+
}]
|
|
3140
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3141
|
+
|
|
3142
|
+
const fileInputVariants = cva('flex w-full cursor-pointer items-center gap-2 rounded-md border bg-background px-3 py-2 text-sm ring-offset-background transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50', {
|
|
3143
|
+
variants: {
|
|
3144
|
+
variant: {
|
|
3145
|
+
default: 'border-input',
|
|
3146
|
+
error: 'border-destructive focus-visible:ring-destructive',
|
|
3147
|
+
},
|
|
3148
|
+
size: {
|
|
3149
|
+
sm: 'h-8 text-xs',
|
|
3150
|
+
md: 'h-10 text-sm',
|
|
3151
|
+
lg: 'h-12 text-base',
|
|
3152
|
+
},
|
|
3153
|
+
},
|
|
3154
|
+
defaultVariants: {
|
|
3155
|
+
variant: 'default',
|
|
3156
|
+
size: 'md',
|
|
3157
|
+
},
|
|
3158
|
+
});
|
|
3159
|
+
|
|
3160
|
+
class SnyFileInputComponent {
|
|
3161
|
+
accept = input('', ...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
|
|
3162
|
+
multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
3163
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
3164
|
+
placeholder = input('Choose file...', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
3165
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3166
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3167
|
+
maxSize = input(0, ...(ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []));
|
|
3168
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3169
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
3170
|
+
fileChange = output();
|
|
3171
|
+
error = output();
|
|
3172
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
3173
|
+
isDisabled = computed(() => this.disabled() || this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
3174
|
+
fileInputRef = viewChild('fileInput', ...(ngDevMode ? [{ debugName: "fileInputRef" }] : /* istanbul ignore next */ []));
|
|
3175
|
+
isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "isDragOver" }] : /* istanbul ignore next */ []));
|
|
3176
|
+
_onChange = () => { };
|
|
3177
|
+
onTouched = () => { };
|
|
3178
|
+
_writing = false;
|
|
3179
|
+
constructor() {
|
|
3180
|
+
effect(() => {
|
|
3181
|
+
const val = this.value();
|
|
3182
|
+
if (this._writing) {
|
|
3183
|
+
this._writing = false;
|
|
3184
|
+
return;
|
|
3185
|
+
}
|
|
3186
|
+
this._onChange(val);
|
|
3187
|
+
});
|
|
3188
|
+
}
|
|
3189
|
+
writeValue(val) {
|
|
3190
|
+
this._writing = true;
|
|
3191
|
+
this.value.set(val ?? null);
|
|
3192
|
+
}
|
|
3193
|
+
registerOnChange(fn) {
|
|
3194
|
+
this._onChange = fn;
|
|
3195
|
+
}
|
|
3196
|
+
registerOnTouched(fn) {
|
|
3197
|
+
this.onTouched = fn;
|
|
3198
|
+
}
|
|
3199
|
+
setDisabledState(isDisabled) {
|
|
3200
|
+
this._disabledByCva.set(isDisabled);
|
|
3201
|
+
}
|
|
3202
|
+
fileName = computed(() => {
|
|
3203
|
+
const files = this.value();
|
|
3204
|
+
if (!files || files.length === 0)
|
|
3205
|
+
return this.placeholder();
|
|
3206
|
+
if (files.length === 1)
|
|
3207
|
+
return files[0].name;
|
|
3208
|
+
return `${files.length} files selected`;
|
|
3209
|
+
}, ...(ngDevMode ? [{ debugName: "fileName" }] : /* istanbul ignore next */ []));
|
|
3210
|
+
labelClass = computed(() => cn(fileInputVariants({ variant: this.variant(), size: this.size() }), this.isDragOver() && 'ring-2 ring-ring', this.class()), ...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
3211
|
+
onFileSelected(event) {
|
|
3212
|
+
const input = event.target;
|
|
3213
|
+
if (input.files) {
|
|
3214
|
+
this.processFiles(input.files);
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
onDragOver(event) {
|
|
3218
|
+
event.preventDefault();
|
|
3219
|
+
if (!this.isDisabled()) {
|
|
3220
|
+
this.isDragOver.set(true);
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
onDragLeave(event) {
|
|
3224
|
+
event.preventDefault();
|
|
3225
|
+
this.isDragOver.set(false);
|
|
3226
|
+
}
|
|
3227
|
+
onDrop(event) {
|
|
3228
|
+
event.preventDefault();
|
|
3229
|
+
this.isDragOver.set(false);
|
|
3230
|
+
if (!this.isDisabled() && event.dataTransfer?.files) {
|
|
3231
|
+
this.processFiles(event.dataTransfer.files);
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
clear() {
|
|
3235
|
+
this.value.set(null);
|
|
3236
|
+
const inputEl = this.fileInputRef()?.nativeElement;
|
|
3237
|
+
if (inputEl)
|
|
3238
|
+
inputEl.value = '';
|
|
3239
|
+
}
|
|
3240
|
+
processFiles(files) {
|
|
3241
|
+
const maxSize = this.maxSize();
|
|
3242
|
+
if (maxSize > 0) {
|
|
3243
|
+
for (let i = 0; i < files.length; i++) {
|
|
3244
|
+
if (files[i].size > maxSize) {
|
|
3245
|
+
this.error.emit(`File "${files[i].name}" exceeds maximum size of ${maxSize} bytes`);
|
|
3246
|
+
return;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
this.value.set(files);
|
|
3251
|
+
this.fileChange.emit(files);
|
|
3252
|
+
}
|
|
3253
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFileInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3254
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.5", type: SnyFileInputComponent, isStandalone: true, selector: "sny-file-input", inputs: { accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", fileChange: "fileChange", error: "error" }, host: { properties: { "class": "\"w-full\"" } }, providers: [
|
|
3255
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyFileInputComponent), multi: true },
|
|
3256
|
+
], viewQueries: [{ propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
3257
|
+
<label
|
|
3258
|
+
[class]="labelClass()"
|
|
3259
|
+
(dragover)="onDragOver($event)"
|
|
3260
|
+
(dragleave)="onDragLeave($event)"
|
|
3261
|
+
(drop)="onDrop($event)"
|
|
3262
|
+
>
|
|
3263
|
+
<input
|
|
3264
|
+
#fileInput
|
|
3265
|
+
type="file"
|
|
3266
|
+
class="sr-only"
|
|
3267
|
+
[accept]="accept()"
|
|
3268
|
+
[multiple]="multiple()"
|
|
3269
|
+
[disabled]="isDisabled()"
|
|
3270
|
+
[attr.aria-label]="placeholder()"
|
|
3271
|
+
[attr.aria-invalid]="variant() === 'error' || null"
|
|
3272
|
+
(change)="onFileSelected($event)"
|
|
3273
|
+
(blur)="onTouched()"
|
|
3274
|
+
/>
|
|
3275
|
+
<span class="truncate text-muted-foreground">{{ fileName() }}</span>
|
|
3276
|
+
</label>
|
|
3277
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3278
|
+
}
|
|
3279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFileInputComponent, decorators: [{
|
|
3280
|
+
type: Component,
|
|
3281
|
+
args: [{
|
|
3282
|
+
selector: 'sny-file-input',
|
|
3283
|
+
standalone: true,
|
|
3284
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3285
|
+
host: {
|
|
3286
|
+
'[class]': '"w-full"',
|
|
3287
|
+
},
|
|
3288
|
+
providers: [
|
|
3289
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyFileInputComponent), multi: true },
|
|
3290
|
+
],
|
|
3291
|
+
template: `
|
|
3292
|
+
<label
|
|
3293
|
+
[class]="labelClass()"
|
|
3294
|
+
(dragover)="onDragOver($event)"
|
|
3295
|
+
(dragleave)="onDragLeave($event)"
|
|
3296
|
+
(drop)="onDrop($event)"
|
|
3297
|
+
>
|
|
3298
|
+
<input
|
|
3299
|
+
#fileInput
|
|
3300
|
+
type="file"
|
|
3301
|
+
class="sr-only"
|
|
3302
|
+
[accept]="accept()"
|
|
3303
|
+
[multiple]="multiple()"
|
|
3304
|
+
[disabled]="isDisabled()"
|
|
3305
|
+
[attr.aria-label]="placeholder()"
|
|
3306
|
+
[attr.aria-invalid]="variant() === 'error' || null"
|
|
3307
|
+
(change)="onFileSelected($event)"
|
|
3308
|
+
(blur)="onTouched()"
|
|
3309
|
+
/>
|
|
3310
|
+
<span class="truncate text-muted-foreground">{{ fileName() }}</span>
|
|
3311
|
+
</label>
|
|
3312
|
+
`,
|
|
3313
|
+
}]
|
|
3314
|
+
}], ctorParameters: () => [], propDecorators: { accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], fileChange: [{ type: i0.Output, args: ["fileChange"] }], error: [{ type: i0.Output, args: ["error"] }], fileInputRef: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }] } });
|
|
3315
|
+
|
|
3316
|
+
const fieldsetVariants = cva('space-y-4', {
|
|
3317
|
+
variants: {
|
|
3318
|
+
variant: {
|
|
3319
|
+
default: '',
|
|
3320
|
+
bordered: 'rounded-lg border border-border p-4',
|
|
3321
|
+
},
|
|
3322
|
+
},
|
|
3323
|
+
defaultVariants: {
|
|
3324
|
+
variant: 'default',
|
|
3325
|
+
},
|
|
3326
|
+
});
|
|
3327
|
+
|
|
3328
|
+
class SnyFieldsetDirective {
|
|
3329
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3330
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
3331
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3332
|
+
computedClass = computed(() => cn(fieldsetVariants({ variant: this.variant() }), this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3333
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFieldsetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3334
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyFieldsetDirective, isStandalone: true, selector: "fieldset[snyFieldset]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()", "attr.disabled": "disabled() || null", "attr.aria-disabled": "disabled() || null" } }, ngImport: i0 });
|
|
3335
|
+
}
|
|
3336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFieldsetDirective, decorators: [{
|
|
3337
|
+
type: Directive,
|
|
3338
|
+
args: [{
|
|
3339
|
+
selector: 'fieldset[snyFieldset]',
|
|
3340
|
+
standalone: true,
|
|
3341
|
+
host: {
|
|
3342
|
+
'[class]': 'computedClass()',
|
|
3343
|
+
'[attr.disabled]': 'disabled() || null',
|
|
3344
|
+
'[attr.aria-disabled]': 'disabled() || null',
|
|
3345
|
+
},
|
|
3346
|
+
}]
|
|
3347
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3348
|
+
class SnyFieldsetLegendDirective {
|
|
3349
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3350
|
+
computedClass = computed(() => cn('text-sm font-medium leading-none', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3351
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFieldsetLegendDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3352
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyFieldsetLegendDirective, isStandalone: true, selector: "legend[snyFieldsetLegend]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3353
|
+
}
|
|
3354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFieldsetLegendDirective, decorators: [{
|
|
3355
|
+
type: Directive,
|
|
3356
|
+
args: [{
|
|
3357
|
+
selector: 'legend[snyFieldsetLegend]',
|
|
3358
|
+
standalone: true,
|
|
3359
|
+
host: {
|
|
3360
|
+
'[class]': 'computedClass()',
|
|
3361
|
+
},
|
|
3362
|
+
}]
|
|
3363
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3364
|
+
class SnyFieldsetContentDirective {
|
|
3365
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3366
|
+
computedClass = computed(() => cn('space-y-2', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3367
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFieldsetContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3368
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyFieldsetContentDirective, isStandalone: true, selector: "[snyFieldsetContent]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3369
|
+
}
|
|
3370
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFieldsetContentDirective, decorators: [{
|
|
3371
|
+
type: Directive,
|
|
3372
|
+
args: [{
|
|
3373
|
+
selector: '[snyFieldsetContent]',
|
|
3374
|
+
standalone: true,
|
|
3375
|
+
host: {
|
|
3376
|
+
'[class]': 'computedClass()',
|
|
3377
|
+
},
|
|
3378
|
+
}]
|
|
3379
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3380
|
+
|
|
3381
|
+
const ratingVariants = cva('inline-flex items-center gap-0.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded', {
|
|
3382
|
+
variants: {
|
|
3383
|
+
size: {
|
|
3384
|
+
sm: '[&_svg]:w-4 [&_svg]:h-4',
|
|
3385
|
+
md: '[&_svg]:w-5 [&_svg]:h-5',
|
|
3386
|
+
lg: '[&_svg]:w-7 [&_svg]:h-7',
|
|
3387
|
+
},
|
|
3388
|
+
},
|
|
3389
|
+
defaultVariants: {
|
|
3390
|
+
size: 'md',
|
|
3391
|
+
},
|
|
3392
|
+
});
|
|
3393
|
+
|
|
3394
|
+
class SnyRatingComponent {
|
|
3395
|
+
value = model(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
3396
|
+
max = input(5, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
3397
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
3398
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3399
|
+
ratingVariant = input('star', ...(ngDevMode ? [{ debugName: "ratingVariant" }] : /* istanbul ignore next */ []));
|
|
3400
|
+
half = input(false, ...(ngDevMode ? [{ debugName: "half" }] : /* istanbul ignore next */ []));
|
|
3401
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3402
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
3403
|
+
isDisabled = computed(() => this.readonly() || this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
3404
|
+
hoverValue = signal(null, ...(ngDevMode ? [{ debugName: "hoverValue" }] : /* istanbul ignore next */ []));
|
|
3405
|
+
_onChange = () => { };
|
|
3406
|
+
onTouched = () => { };
|
|
3407
|
+
_writing = false;
|
|
3408
|
+
constructor() {
|
|
3409
|
+
effect(() => {
|
|
3410
|
+
const val = this.value();
|
|
3411
|
+
if (this._writing) {
|
|
3412
|
+
this._writing = false;
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
this._onChange(val);
|
|
3416
|
+
});
|
|
3417
|
+
}
|
|
3418
|
+
writeValue(val) {
|
|
3419
|
+
this._writing = true;
|
|
3420
|
+
this.value.set(val ?? 0);
|
|
3421
|
+
}
|
|
3422
|
+
registerOnChange(fn) {
|
|
3423
|
+
this._onChange = fn;
|
|
3424
|
+
}
|
|
3425
|
+
registerOnTouched(fn) {
|
|
3426
|
+
this.onTouched = fn;
|
|
3427
|
+
}
|
|
3428
|
+
setDisabledState(isDisabled) {
|
|
3429
|
+
this._disabledByCva.set(isDisabled);
|
|
3430
|
+
}
|
|
3431
|
+
displayValue = computed(() => this.hoverValue() ?? this.value(), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
3432
|
+
stars = computed(() => {
|
|
3433
|
+
const display = this.displayValue();
|
|
3434
|
+
const m = this.max();
|
|
3435
|
+
return Array.from({ length: m }, (_, i) => {
|
|
3436
|
+
let fill;
|
|
3437
|
+
if (i + 1 <= display) {
|
|
3438
|
+
fill = 'full';
|
|
3439
|
+
}
|
|
3440
|
+
else if (this.half() && i + 0.5 <= display) {
|
|
3441
|
+
fill = 'half';
|
|
3442
|
+
}
|
|
3443
|
+
else {
|
|
3444
|
+
fill = 'empty';
|
|
3445
|
+
}
|
|
3446
|
+
return { index: i, fill };
|
|
3447
|
+
});
|
|
3448
|
+
}, ...(ngDevMode ? [{ debugName: "stars" }] : /* istanbul ignore next */ []));
|
|
3449
|
+
computedClass = computed(() => cn(ratingVariants({ size: this.size() }), this.isDisabled() && 'pointer-events-none', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3450
|
+
starClass(star) {
|
|
3451
|
+
const base = 'cursor-pointer transition-colors';
|
|
3452
|
+
switch (star.fill) {
|
|
3453
|
+
case 'full':
|
|
3454
|
+
return cn(base, 'fill-yellow-400 stroke-yellow-400');
|
|
3455
|
+
case 'half':
|
|
3456
|
+
return cn(base, 'fill-yellow-400/50 stroke-yellow-400');
|
|
3457
|
+
case 'empty':
|
|
3458
|
+
return cn(base, 'fill-none stroke-muted-foreground');
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
onStarClick(index) {
|
|
3462
|
+
if (this.isDisabled())
|
|
3463
|
+
return;
|
|
3464
|
+
this.value.set(index);
|
|
3465
|
+
}
|
|
3466
|
+
onStarHover(index) {
|
|
3467
|
+
if (this.isDisabled())
|
|
3468
|
+
return;
|
|
3469
|
+
this.hoverValue.set(index);
|
|
3470
|
+
}
|
|
3471
|
+
onMouseLeave() {
|
|
3472
|
+
this.hoverValue.set(null);
|
|
3473
|
+
}
|
|
3474
|
+
onKeydown(event) {
|
|
3475
|
+
if (this.isDisabled())
|
|
3476
|
+
return;
|
|
3477
|
+
const step = this.half() ? 0.5 : 1;
|
|
3478
|
+
switch (event.key) {
|
|
3479
|
+
case 'ArrowRight':
|
|
3480
|
+
case 'ArrowUp':
|
|
3481
|
+
event.preventDefault();
|
|
3482
|
+
this.value.update((v) => Math.min(this.max(), v + step));
|
|
3483
|
+
break;
|
|
3484
|
+
case 'ArrowLeft':
|
|
3485
|
+
case 'ArrowDown':
|
|
3486
|
+
event.preventDefault();
|
|
3487
|
+
this.value.update((v) => Math.max(0, v - step));
|
|
3488
|
+
break;
|
|
3489
|
+
case 'Home':
|
|
3490
|
+
event.preventDefault();
|
|
3491
|
+
this.value.set(0);
|
|
3492
|
+
break;
|
|
3493
|
+
case 'End':
|
|
3494
|
+
event.preventDefault();
|
|
3495
|
+
this.value.set(this.max());
|
|
3496
|
+
break;
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyRatingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3500
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyRatingComponent, isStandalone: true, selector: "sny-rating", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, ratingVariant: { classPropertyName: "ratingVariant", publicName: "ratingVariant", isSignal: true, isRequired: false, transformFunction: null }, half: { classPropertyName: "half", publicName: "half", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "slider", "tabindex": "0" }, listeners: { "keydown": "onKeydown($event)", "mouseleave": "onMouseLeave()", "blur": "onTouched()" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "max()", "attr.aria-label": "\"Rating\"", "attr.aria-readonly": "readonly() || null", "class": "computedClass()" } }, providers: [
|
|
3501
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyRatingComponent), multi: true },
|
|
3502
|
+
], ngImport: i0, template: `
|
|
3503
|
+
@for (star of stars(); track star.index) {
|
|
3504
|
+
<svg
|
|
3505
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3506
|
+
viewBox="0 0 24 24"
|
|
3507
|
+
[class]="starClass(star)"
|
|
3508
|
+
(click)="onStarClick(star.index + 1)"
|
|
3509
|
+
(mouseenter)="onStarHover(star.index + 1)"
|
|
3510
|
+
>
|
|
3511
|
+
@if (ratingVariant() === 'star') {
|
|
3512
|
+
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
|
|
3513
|
+
} @else {
|
|
3514
|
+
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
|
|
3515
|
+
}
|
|
3516
|
+
</svg>
|
|
3517
|
+
}
|
|
3518
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3519
|
+
}
|
|
3520
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyRatingComponent, decorators: [{
|
|
3521
|
+
type: Component,
|
|
3522
|
+
args: [{
|
|
3523
|
+
selector: 'sny-rating',
|
|
3524
|
+
standalone: true,
|
|
3525
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3526
|
+
host: {
|
|
3527
|
+
'role': 'slider',
|
|
3528
|
+
'tabindex': '0',
|
|
3529
|
+
'[attr.aria-valuenow]': 'value()',
|
|
3530
|
+
'[attr.aria-valuemin]': '0',
|
|
3531
|
+
'[attr.aria-valuemax]': 'max()',
|
|
3532
|
+
'[attr.aria-label]': '"Rating"',
|
|
3533
|
+
'[attr.aria-readonly]': 'readonly() || null',
|
|
3534
|
+
'[class]': 'computedClass()',
|
|
3535
|
+
'(keydown)': 'onKeydown($event)',
|
|
3536
|
+
'(mouseleave)': 'onMouseLeave()',
|
|
3537
|
+
'(blur)': 'onTouched()',
|
|
3538
|
+
},
|
|
3539
|
+
providers: [
|
|
3540
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyRatingComponent), multi: true },
|
|
3541
|
+
],
|
|
3542
|
+
template: `
|
|
3543
|
+
@for (star of stars(); track star.index) {
|
|
3544
|
+
<svg
|
|
3545
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3546
|
+
viewBox="0 0 24 24"
|
|
3547
|
+
[class]="starClass(star)"
|
|
3548
|
+
(click)="onStarClick(star.index + 1)"
|
|
3549
|
+
(mouseenter)="onStarHover(star.index + 1)"
|
|
3550
|
+
>
|
|
3551
|
+
@if (ratingVariant() === 'star') {
|
|
3552
|
+
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
|
|
3553
|
+
} @else {
|
|
3554
|
+
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
|
|
3555
|
+
}
|
|
3556
|
+
</svg>
|
|
3557
|
+
}
|
|
3558
|
+
`,
|
|
3559
|
+
}]
|
|
3560
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], ratingVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "ratingVariant", required: false }] }], half: [{ type: i0.Input, args: [{ isSignal: true, alias: "half", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3561
|
+
|
|
3562
|
+
class SnyNavbarDirective {
|
|
3563
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3564
|
+
sticky = input(false, ...(ngDevMode ? [{ debugName: "sticky" }] : /* istanbul ignore next */ []));
|
|
3565
|
+
ariaLabel = input('Main navigation', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
3566
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3567
|
+
computedClass = computed(() => {
|
|
3568
|
+
const v = this.variant();
|
|
3569
|
+
const base = 'flex items-center justify-between px-4 py-2 w-full bg-background';
|
|
3570
|
+
const variantClass = v === 'bordered' ? 'border-b border-border' :
|
|
3571
|
+
v === 'floating' ? 'mx-4 mt-2 rounded-lg border border-border shadow-sm' :
|
|
3572
|
+
'';
|
|
3573
|
+
const stickyClass = this.sticky() ? 'sticky top-0 z-50' : '';
|
|
3574
|
+
return cn(base, variantClass, stickyClass, this.class());
|
|
3575
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3576
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNavbarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3577
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyNavbarDirective, isStandalone: true, selector: "[snyNavbar]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, sticky: { classPropertyName: "sticky", publicName: "sticky", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "navigation" }, properties: { "attr.aria-label": "ariaLabel()", "class": "computedClass()" } }, ngImport: i0 });
|
|
3578
|
+
}
|
|
3579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNavbarDirective, decorators: [{
|
|
3580
|
+
type: Directive,
|
|
3581
|
+
args: [{
|
|
3582
|
+
selector: '[snyNavbar]',
|
|
3583
|
+
standalone: true,
|
|
3584
|
+
host: {
|
|
3585
|
+
'role': 'navigation',
|
|
3586
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
3587
|
+
'[class]': 'computedClass()',
|
|
3588
|
+
},
|
|
3589
|
+
}]
|
|
3590
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], sticky: [{ type: i0.Input, args: [{ isSignal: true, alias: "sticky", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3591
|
+
class SnyNavbarBrandDirective {
|
|
3592
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3593
|
+
computedClass = computed(() => cn('flex items-center gap-2 font-bold text-lg', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3594
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNavbarBrandDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3595
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyNavbarBrandDirective, isStandalone: true, selector: "[snyNavbarBrand]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3596
|
+
}
|
|
3597
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNavbarBrandDirective, decorators: [{
|
|
3598
|
+
type: Directive,
|
|
3599
|
+
args: [{
|
|
3600
|
+
selector: '[snyNavbarBrand]',
|
|
3601
|
+
standalone: true,
|
|
3602
|
+
host: { '[class]': 'computedClass()' },
|
|
3603
|
+
}]
|
|
3604
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3605
|
+
class SnyNavbarContentDirective {
|
|
3606
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3607
|
+
computedClass = computed(() => cn('flex items-center gap-1', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3608
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNavbarContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3609
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyNavbarContentDirective, isStandalone: true, selector: "[snyNavbarContent]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3610
|
+
}
|
|
3611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNavbarContentDirective, decorators: [{
|
|
3612
|
+
type: Directive,
|
|
3613
|
+
args: [{
|
|
3614
|
+
selector: '[snyNavbarContent]',
|
|
3615
|
+
standalone: true,
|
|
3616
|
+
host: { '[class]': 'computedClass()' },
|
|
3617
|
+
}]
|
|
3618
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3619
|
+
class SnyNavbarEndDirective {
|
|
3620
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3621
|
+
computedClass = computed(() => cn('flex items-center gap-2 ml-auto', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3622
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNavbarEndDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3623
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyNavbarEndDirective, isStandalone: true, selector: "[snyNavbarEnd]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3624
|
+
}
|
|
3625
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNavbarEndDirective, decorators: [{
|
|
3626
|
+
type: Directive,
|
|
3627
|
+
args: [{
|
|
3628
|
+
selector: '[snyNavbarEnd]',
|
|
3629
|
+
standalone: true,
|
|
3630
|
+
host: { '[class]': 'computedClass()' },
|
|
3631
|
+
}]
|
|
3632
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3633
|
+
|
|
3634
|
+
const SNY_DRAWER = new InjectionToken('SnyDrawer');
|
|
3635
|
+
class SnyDrawerLayoutComponent {
|
|
3636
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3637
|
+
overlay = input(true, ...(ngDevMode ? [{ debugName: "overlay" }] : /* istanbul ignore next */ []));
|
|
3638
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
3639
|
+
computedClass = computed(() => cn('relative flex h-full w-full overflow-hidden', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3640
|
+
toggle() { this.isOpen.update((v) => !v); }
|
|
3641
|
+
open() { this.isOpen.set(true); }
|
|
3642
|
+
close() { this.isOpen.set(false); }
|
|
3643
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDrawerLayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3644
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyDrawerLayoutComponent, isStandalone: true, selector: "[snyDrawerLayout]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, overlay: { classPropertyName: "overlay", publicName: "overlay", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_DRAWER, useExisting: SnyDrawerLayoutComponent }], exportAs: ["snyDrawerLayout"], ngImport: i0, template: `
|
|
3645
|
+
<ng-content />
|
|
3646
|
+
@if (isOpen() && overlay()) {
|
|
3647
|
+
<div
|
|
3648
|
+
class="fixed inset-0 z-30 bg-black/50 transition-opacity"
|
|
3649
|
+
(click)="close()"
|
|
3650
|
+
></div>
|
|
3651
|
+
}
|
|
3652
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3653
|
+
}
|
|
3654
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDrawerLayoutComponent, decorators: [{
|
|
3655
|
+
type: Component,
|
|
3656
|
+
args: [{
|
|
3657
|
+
selector: '[snyDrawerLayout]',
|
|
3658
|
+
standalone: true,
|
|
3659
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3660
|
+
exportAs: 'snyDrawerLayout',
|
|
3661
|
+
providers: [{ provide: SNY_DRAWER, useExisting: SnyDrawerLayoutComponent }],
|
|
3662
|
+
host: {
|
|
3663
|
+
'[class]': 'computedClass()',
|
|
3664
|
+
},
|
|
3665
|
+
template: `
|
|
3666
|
+
<ng-content />
|
|
3667
|
+
@if (isOpen() && overlay()) {
|
|
3668
|
+
<div
|
|
3669
|
+
class="fixed inset-0 z-30 bg-black/50 transition-opacity"
|
|
3670
|
+
(click)="close()"
|
|
3671
|
+
></div>
|
|
3672
|
+
}
|
|
3673
|
+
`,
|
|
3674
|
+
}]
|
|
3675
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], overlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlay", required: false }] }] } });
|
|
3676
|
+
/** @deprecated Use SnyDrawerLayoutComponent instead */
|
|
3677
|
+
const SnyDrawerLayoutDirective = SnyDrawerLayoutComponent;
|
|
3678
|
+
class SnyDrawerContentDirective {
|
|
3679
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3680
|
+
computedClass = computed(() => cn('flex-1 overflow-auto', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3681
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDrawerContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3682
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyDrawerContentDirective, isStandalone: true, selector: "[snyDrawerContent]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3683
|
+
}
|
|
3684
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDrawerContentDirective, decorators: [{
|
|
3685
|
+
type: Directive,
|
|
3686
|
+
args: [{
|
|
3687
|
+
selector: '[snyDrawerContent]',
|
|
3688
|
+
standalone: true,
|
|
3689
|
+
host: {
|
|
3690
|
+
'[class]': 'computedClass()',
|
|
3691
|
+
},
|
|
3692
|
+
}]
|
|
3693
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3694
|
+
class SnyDrawerSideDirective {
|
|
3695
|
+
drawer = inject(SNY_DRAWER);
|
|
3696
|
+
side = input('left', ...(ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []));
|
|
3697
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3698
|
+
computedClass = computed(() => {
|
|
3699
|
+
const isOpen = this.drawer.isOpen();
|
|
3700
|
+
const s = this.side();
|
|
3701
|
+
const base = 'fixed inset-y-0 z-40 w-64 bg-background border-r border-border transition-transform duration-300 ease-in-out';
|
|
3702
|
+
const sideClass = s === 'left' ? 'left-0' : 'right-0 border-l border-r-0';
|
|
3703
|
+
const transformClass = isOpen
|
|
3704
|
+
? 'translate-x-0'
|
|
3705
|
+
: s === 'left' ? '-translate-x-full' : 'translate-x-full';
|
|
3706
|
+
return cn(base, sideClass, transformClass, this.class());
|
|
3707
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3708
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDrawerSideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3709
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyDrawerSideDirective, isStandalone: true, selector: "[snyDrawerSide]", inputs: { side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "navigation", "aria-label": "Sidebar navigation" }, properties: { "attr.aria-modal": "drawer.overlay() && drawer.isOpen() || null", "class": "computedClass()" } }, ngImport: i0 });
|
|
3710
|
+
}
|
|
3711
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDrawerSideDirective, decorators: [{
|
|
3712
|
+
type: Directive,
|
|
3713
|
+
args: [{
|
|
3714
|
+
selector: '[snyDrawerSide]',
|
|
3715
|
+
standalone: true,
|
|
3716
|
+
host: {
|
|
3717
|
+
'role': 'navigation',
|
|
3718
|
+
'aria-label': 'Sidebar navigation',
|
|
3719
|
+
'[attr.aria-modal]': 'drawer.overlay() && drawer.isOpen() || null',
|
|
3720
|
+
'[class]': 'computedClass()',
|
|
3721
|
+
},
|
|
3722
|
+
}]
|
|
3723
|
+
}], propDecorators: { side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3724
|
+
|
|
3725
|
+
const paginationItemVariants = cva('inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50', {
|
|
3726
|
+
variants: {
|
|
3727
|
+
variant: {
|
|
3728
|
+
default: 'bg-background hover:bg-accent hover:text-accent-foreground',
|
|
3729
|
+
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
3730
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
3731
|
+
},
|
|
3732
|
+
size: {
|
|
3733
|
+
sm: 'h-8 w-8 text-xs',
|
|
3734
|
+
md: 'h-9 w-9',
|
|
3735
|
+
lg: 'h-10 w-10',
|
|
3736
|
+
},
|
|
3737
|
+
active: {
|
|
3738
|
+
true: 'bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground',
|
|
3739
|
+
false: '',
|
|
3740
|
+
},
|
|
3741
|
+
},
|
|
3742
|
+
defaultVariants: {
|
|
3743
|
+
variant: 'default',
|
|
3744
|
+
size: 'md',
|
|
3745
|
+
active: false,
|
|
3746
|
+
},
|
|
3747
|
+
});
|
|
3748
|
+
|
|
3749
|
+
function computePageRange(totalPages, currentPage, siblingCount, boundaryCount) {
|
|
3750
|
+
const range = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
3751
|
+
const startPages = range(1, Math.min(boundaryCount, totalPages));
|
|
3752
|
+
const endPages = range(Math.max(totalPages - boundaryCount + 1, boundaryCount + 1), totalPages);
|
|
3753
|
+
const siblingsStart = Math.max(Math.min(currentPage - siblingCount, totalPages - boundaryCount - siblingCount * 2 - 1), boundaryCount + 2);
|
|
3754
|
+
const siblingsEnd = Math.min(Math.max(currentPage + siblingCount, boundaryCount + siblingCount * 2 + 2), endPages.length > 0 ? endPages[0] - 2 : totalPages - 1);
|
|
3755
|
+
const result = [...startPages];
|
|
3756
|
+
if (siblingsStart > boundaryCount + 2) {
|
|
3757
|
+
result.push('ellipsis');
|
|
3758
|
+
}
|
|
3759
|
+
else if (boundaryCount + 1 < totalPages - boundaryCount) {
|
|
3760
|
+
result.push(boundaryCount + 1);
|
|
3761
|
+
}
|
|
3762
|
+
result.push(...range(siblingsStart, siblingsEnd));
|
|
3763
|
+
if (siblingsEnd < totalPages - boundaryCount - 1) {
|
|
3764
|
+
result.push('ellipsis');
|
|
3765
|
+
}
|
|
3766
|
+
else if (totalPages - boundaryCount > boundaryCount) {
|
|
3767
|
+
result.push(totalPages - boundaryCount);
|
|
3768
|
+
}
|
|
3769
|
+
result.push(...endPages);
|
|
3770
|
+
return [...new Set(result)].sort((a, b) => {
|
|
3771
|
+
if (a === 'ellipsis')
|
|
3772
|
+
return 0;
|
|
3773
|
+
if (b === 'ellipsis')
|
|
3774
|
+
return 0;
|
|
3775
|
+
return a - b;
|
|
3776
|
+
});
|
|
3777
|
+
}
|
|
3778
|
+
class SnyPaginationComponent {
|
|
3779
|
+
currentPage = model(1, ...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
|
|
3780
|
+
totalPages = input.required(...(ngDevMode ? [{ debugName: "totalPages" }] : /* istanbul ignore next */ []));
|
|
3781
|
+
siblingCount = input(1, ...(ngDevMode ? [{ debugName: "siblingCount" }] : /* istanbul ignore next */ []));
|
|
3782
|
+
boundaryCount = input(1, ...(ngDevMode ? [{ debugName: "boundaryCount" }] : /* istanbul ignore next */ []));
|
|
3783
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3784
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3785
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3786
|
+
pages = computed(() => computePageRange(this.totalPages(), this.currentPage(), this.siblingCount(), this.boundaryCount()), ...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
|
|
3787
|
+
hasPrev = computed(() => this.currentPage() > 1, ...(ngDevMode ? [{ debugName: "hasPrev" }] : /* istanbul ignore next */ []));
|
|
3788
|
+
hasNext = computed(() => this.currentPage() < this.totalPages(), ...(ngDevMode ? [{ debugName: "hasNext" }] : /* istanbul ignore next */ []));
|
|
3789
|
+
goToPage(page) {
|
|
3790
|
+
if (page === 'ellipsis')
|
|
3791
|
+
return;
|
|
3792
|
+
this.currentPage.set(page);
|
|
3793
|
+
}
|
|
3794
|
+
prev() {
|
|
3795
|
+
if (this.hasPrev())
|
|
3796
|
+
this.currentPage.update((p) => p - 1);
|
|
3797
|
+
}
|
|
3798
|
+
next() {
|
|
3799
|
+
if (this.hasNext())
|
|
3800
|
+
this.currentPage.update((p) => p + 1);
|
|
3801
|
+
}
|
|
3802
|
+
pageClass(page) {
|
|
3803
|
+
return cn(paginationItemVariants({
|
|
3804
|
+
variant: this.variant(),
|
|
3805
|
+
size: this.size(),
|
|
3806
|
+
active: page === this.currentPage(),
|
|
3807
|
+
}));
|
|
3808
|
+
}
|
|
3809
|
+
navBtnClass() {
|
|
3810
|
+
return cn(paginationItemVariants({ variant: this.variant(), size: this.size(), active: false }));
|
|
3811
|
+
}
|
|
3812
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3813
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyPaginationComponent, isStandalone: true, selector: "sny-pagination", inputs: { currentPage: { classPropertyName: "currentPage", publicName: "currentPage", isSignal: true, isRequired: false, transformFunction: null }, totalPages: { classPropertyName: "totalPages", publicName: "totalPages", isSignal: true, isRequired: true, transformFunction: null }, siblingCount: { classPropertyName: "siblingCount", publicName: "siblingCount", isSignal: true, isRequired: false, transformFunction: null }, boundaryCount: { classPropertyName: "boundaryCount", publicName: "boundaryCount", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { currentPage: "currentPageChange" }, host: { attributes: { "role": "navigation", "aria-label": "Pagination" } }, ngImport: i0, template: `
|
|
3814
|
+
<div class="flex items-center gap-1">
|
|
3815
|
+
<button
|
|
3816
|
+
[class]="navBtnClass()"
|
|
3817
|
+
[disabled]="!hasPrev()"
|
|
3818
|
+
[attr.aria-label]="'Go to previous page'"
|
|
3819
|
+
(click)="prev()"
|
|
3820
|
+
>
|
|
3821
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>
|
|
3822
|
+
</button>
|
|
3823
|
+
|
|
3824
|
+
@for (page of pages(); track $index) {
|
|
3825
|
+
@if (page === 'ellipsis') {
|
|
3826
|
+
<span class="flex h-9 w-9 items-center justify-center" aria-hidden="true">...</span>
|
|
3827
|
+
} @else {
|
|
3828
|
+
<button
|
|
3829
|
+
[class]="pageClass(page)"
|
|
3830
|
+
[attr.aria-label]="'Page ' + page"
|
|
3831
|
+
[attr.aria-current]="page === currentPage() ? 'page' : null"
|
|
3832
|
+
(click)="goToPage(page)"
|
|
3833
|
+
>
|
|
3834
|
+
{{ page }}
|
|
3835
|
+
</button>
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
<button
|
|
3840
|
+
[class]="navBtnClass()"
|
|
3841
|
+
[disabled]="!hasNext()"
|
|
3842
|
+
[attr.aria-label]="'Go to next page'"
|
|
3843
|
+
(click)="next()"
|
|
3844
|
+
>
|
|
3845
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>
|
|
3846
|
+
</button>
|
|
3847
|
+
</div>
|
|
3848
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3849
|
+
}
|
|
3850
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyPaginationComponent, decorators: [{
|
|
3851
|
+
type: Component,
|
|
3852
|
+
args: [{
|
|
3853
|
+
selector: 'sny-pagination',
|
|
3854
|
+
standalone: true,
|
|
3855
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3856
|
+
host: {
|
|
3857
|
+
'role': 'navigation',
|
|
3858
|
+
'aria-label': 'Pagination',
|
|
3859
|
+
},
|
|
3860
|
+
template: `
|
|
3861
|
+
<div class="flex items-center gap-1">
|
|
3862
|
+
<button
|
|
3863
|
+
[class]="navBtnClass()"
|
|
3864
|
+
[disabled]="!hasPrev()"
|
|
3865
|
+
[attr.aria-label]="'Go to previous page'"
|
|
3866
|
+
(click)="prev()"
|
|
3867
|
+
>
|
|
3868
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>
|
|
3869
|
+
</button>
|
|
3870
|
+
|
|
3871
|
+
@for (page of pages(); track $index) {
|
|
3872
|
+
@if (page === 'ellipsis') {
|
|
3873
|
+
<span class="flex h-9 w-9 items-center justify-center" aria-hidden="true">...</span>
|
|
3874
|
+
} @else {
|
|
3875
|
+
<button
|
|
3876
|
+
[class]="pageClass(page)"
|
|
3877
|
+
[attr.aria-label]="'Page ' + page"
|
|
3878
|
+
[attr.aria-current]="page === currentPage() ? 'page' : null"
|
|
3879
|
+
(click)="goToPage(page)"
|
|
3880
|
+
>
|
|
3881
|
+
{{ page }}
|
|
3882
|
+
</button>
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3886
|
+
<button
|
|
3887
|
+
[class]="navBtnClass()"
|
|
3888
|
+
[disabled]="!hasNext()"
|
|
3889
|
+
[attr.aria-label]="'Go to next page'"
|
|
3890
|
+
(click)="next()"
|
|
3891
|
+
>
|
|
3892
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>
|
|
3893
|
+
</button>
|
|
3894
|
+
</div>
|
|
3895
|
+
`,
|
|
3896
|
+
}]
|
|
3897
|
+
}], propDecorators: { currentPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "currentPage", required: false }] }, { type: i0.Output, args: ["currentPageChange"] }], totalPages: [{ type: i0.Input, args: [{ isSignal: true, alias: "totalPages", required: true }] }], siblingCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "siblingCount", required: false }] }], boundaryCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundaryCount", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3898
|
+
|
|
3899
|
+
const dividerVariants = cva('shrink-0 bg-border', {
|
|
3900
|
+
variants: {
|
|
3901
|
+
orientation: {
|
|
3902
|
+
horizontal: 'h-[1px] w-full',
|
|
3903
|
+
vertical: 'h-full w-[1px]',
|
|
3904
|
+
},
|
|
3905
|
+
variant: {
|
|
3906
|
+
solid: '',
|
|
3907
|
+
dashed: 'border-dashed',
|
|
3908
|
+
dotted: 'border-dotted',
|
|
3909
|
+
},
|
|
3910
|
+
},
|
|
3911
|
+
defaultVariants: {
|
|
3912
|
+
orientation: 'horizontal',
|
|
3913
|
+
variant: 'solid',
|
|
3914
|
+
},
|
|
3915
|
+
});
|
|
3916
|
+
|
|
3917
|
+
class SnyDividerComponent {
|
|
3918
|
+
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
3919
|
+
variant = input('solid', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3920
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
3921
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3922
|
+
hasLabel = computed(() => !!this.label(), ...(ngDevMode ? [{ debugName: "hasLabel" }] : /* istanbul ignore next */ []));
|
|
3923
|
+
dividerClass = computed(() => cn(dividerVariants({ orientation: this.orientation(), variant: this.variant() }), this.class()), ...(ngDevMode ? [{ debugName: "dividerClass" }] : /* istanbul ignore next */ []));
|
|
3924
|
+
lineClass = computed(() => cn('flex-1 bg-border', this.orientation() === 'horizontal' ? 'h-[1px]' : 'w-[1px]'), ...(ngDevMode ? [{ debugName: "lineClass" }] : /* istanbul ignore next */ []));
|
|
3925
|
+
labelContainerClass = computed(() => cn('flex items-center', this.orientation() === 'horizontal' ? 'flex-row' : 'flex-col', this.class()), ...(ngDevMode ? [{ debugName: "labelContainerClass" }] : /* istanbul ignore next */ []));
|
|
3926
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDividerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3927
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyDividerComponent, isStandalone: true, selector: "sny-divider", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "separator" }, properties: { "attr.aria-orientation": "orientation()" } }, ngImport: i0, template: `
|
|
3928
|
+
@if (hasLabel()) {
|
|
3929
|
+
<div [class]="labelContainerClass()">
|
|
3930
|
+
<div [class]="lineClass()"></div>
|
|
3931
|
+
<span class="px-2 text-xs text-muted-foreground">{{ label() }}</span>
|
|
3932
|
+
<div [class]="lineClass()"></div>
|
|
3933
|
+
</div>
|
|
3934
|
+
} @else {
|
|
3935
|
+
<div [class]="dividerClass()"></div>
|
|
3936
|
+
}
|
|
3937
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3938
|
+
}
|
|
3939
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDividerComponent, decorators: [{
|
|
3940
|
+
type: Component,
|
|
3941
|
+
args: [{
|
|
3942
|
+
selector: 'sny-divider',
|
|
3943
|
+
standalone: true,
|
|
3944
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3945
|
+
host: {
|
|
3946
|
+
'role': 'separator',
|
|
3947
|
+
'[attr.aria-orientation]': 'orientation()',
|
|
3948
|
+
},
|
|
3949
|
+
template: `
|
|
3950
|
+
@if (hasLabel()) {
|
|
3951
|
+
<div [class]="labelContainerClass()">
|
|
3952
|
+
<div [class]="lineClass()"></div>
|
|
3953
|
+
<span class="px-2 text-xs text-muted-foreground">{{ label() }}</span>
|
|
3954
|
+
<div [class]="lineClass()"></div>
|
|
3955
|
+
</div>
|
|
3956
|
+
} @else {
|
|
3957
|
+
<div [class]="dividerClass()"></div>
|
|
3958
|
+
}
|
|
3959
|
+
`,
|
|
3960
|
+
}]
|
|
3961
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3962
|
+
|
|
3963
|
+
const SNY_STEPS = new InjectionToken('SnySteps');
|
|
3964
|
+
class SnyStepDirective {
|
|
3965
|
+
status = input('default', ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
3966
|
+
icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
3967
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
3968
|
+
computedClass = computed(() => {
|
|
3969
|
+
const s = this.status();
|
|
3970
|
+
const base = 'flex items-center gap-2';
|
|
3971
|
+
// Step indicator via before: pseudo-element
|
|
3972
|
+
const indicatorBase = 'before:flex before:items-center before:justify-center before:w-8 before:h-8 before:rounded-full before:border-2 before:text-xs before:shrink-0';
|
|
3973
|
+
const statusIndicator = s === 'completed' ? 'before:bg-primary before:border-primary before:text-primary-foreground before:content-["✓"]' :
|
|
3974
|
+
s === 'active' ? 'before:border-primary before:text-primary before:content-["●"]' :
|
|
3975
|
+
s === 'error' ? 'before:border-destructive before:text-destructive before:content-["!"]' :
|
|
3976
|
+
'before:border-muted-foreground/30 before:text-muted-foreground before:content-["○"]';
|
|
3977
|
+
const statusClass = s === 'completed' ? 'text-primary' :
|
|
3978
|
+
s === 'active' ? 'text-primary font-medium' :
|
|
3979
|
+
s === 'error' ? 'text-destructive' :
|
|
3980
|
+
'text-muted-foreground';
|
|
3981
|
+
return cn(base, indicatorBase, statusIndicator, statusClass, this.class());
|
|
3982
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3983
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStepDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3984
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyStepDirective, isStandalone: true, selector: "[snyStep]", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "listitem" }, properties: { "class": "computedClass()", "attr.aria-current": "status() === \"active\" ? \"step\" : null" } }, ngImport: i0 });
|
|
3985
|
+
}
|
|
3986
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStepDirective, decorators: [{
|
|
3987
|
+
type: Directive,
|
|
3988
|
+
args: [{
|
|
3989
|
+
selector: '[snyStep]',
|
|
3990
|
+
standalone: true,
|
|
3991
|
+
host: {
|
|
3992
|
+
'role': 'listitem',
|
|
3993
|
+
'[class]': 'computedClass()',
|
|
3994
|
+
'[attr.aria-current]': 'status() === "active" ? "step" : null',
|
|
3995
|
+
},
|
|
3996
|
+
}]
|
|
3997
|
+
}], propDecorators: { status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3998
|
+
class SnyStepsDirective {
|
|
3999
|
+
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
4000
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
4001
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4002
|
+
steps = contentChildren(SnyStepDirective, ...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
4003
|
+
activeIndex = computed(() => {
|
|
4004
|
+
const s = this.steps();
|
|
4005
|
+
return s.findIndex((step) => step.status() === 'active');
|
|
4006
|
+
}, ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
4007
|
+
computedClass = computed(() => {
|
|
4008
|
+
const o = this.orientation();
|
|
4009
|
+
const s = this.size();
|
|
4010
|
+
const base = 'flex';
|
|
4011
|
+
const orientationClass = o === 'horizontal'
|
|
4012
|
+
? 'flex-row items-center gap-2 [&>*+*]:before:content-[""] [&>*+*]:before:flex-1 [&>*+*]:before:h-px [&>*+*]:before:bg-border [&>*+*]:before:mx-2 [&>*+*]:before:min-w-[2rem]'
|
|
4013
|
+
: 'flex-col gap-2 [&>*+*]:before:content-[""] [&>*+*]:before:w-px [&>*+*]:before:h-4 [&>*+*]:before:bg-border [&>*+*]:before:ml-4';
|
|
4014
|
+
const sizeClass = s === 'sm' ? 'text-xs' : s === 'lg' ? 'text-base' : 'text-sm';
|
|
4015
|
+
return cn(base, orientationClass, sizeClass, this.class());
|
|
4016
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4017
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStepsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4018
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.5", type: SnyStepsDirective, isStandalone: true, selector: "[snySteps]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "list", "aria-label": "Progress steps" }, properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_STEPS, useExisting: SnyStepsDirective }], queries: [{ propertyName: "steps", predicate: SnyStepDirective, isSignal: true }], exportAs: ["snySteps"], ngImport: i0 });
|
|
4019
|
+
}
|
|
4020
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStepsDirective, decorators: [{
|
|
4021
|
+
type: Directive,
|
|
4022
|
+
args: [{
|
|
4023
|
+
selector: '[snySteps]',
|
|
4024
|
+
standalone: true,
|
|
4025
|
+
exportAs: 'snySteps',
|
|
4026
|
+
providers: [{ provide: SNY_STEPS, useExisting: SnyStepsDirective }],
|
|
4027
|
+
host: {
|
|
4028
|
+
'role': 'list',
|
|
4029
|
+
'aria-label': 'Progress steps',
|
|
4030
|
+
'[class]': 'computedClass()',
|
|
4031
|
+
},
|
|
4032
|
+
}]
|
|
4033
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], steps: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SnyStepDirective), { isSignal: true }] }] } });
|
|
4034
|
+
|
|
4035
|
+
const SNY_STAT = new InjectionToken('SnyStat');
|
|
4036
|
+
let statIdCounter = 0;
|
|
4037
|
+
class SnyStatDirective {
|
|
4038
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4039
|
+
titleId = `sny-stat-title-${++statIdCounter}`;
|
|
4040
|
+
computedClass = computed(() => cn('flex flex-col gap-0.5', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4041
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4042
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyStatDirective, isStandalone: true, selector: "[snyStat]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_STAT, useExisting: SnyStatDirective }], ngImport: i0 });
|
|
4043
|
+
}
|
|
4044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatDirective, decorators: [{
|
|
4045
|
+
type: Directive,
|
|
4046
|
+
args: [{
|
|
4047
|
+
selector: '[snyStat]',
|
|
4048
|
+
standalone: true,
|
|
4049
|
+
providers: [{ provide: SNY_STAT, useExisting: SnyStatDirective }],
|
|
4050
|
+
host: { '[class]': 'computedClass()' },
|
|
4051
|
+
}]
|
|
4052
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4053
|
+
class SnyStatTitleDirective {
|
|
4054
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4055
|
+
stat = inject(SNY_STAT);
|
|
4056
|
+
computedClass = computed(() => cn('text-sm text-muted-foreground', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4057
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4058
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyStatTitleDirective, isStandalone: true, selector: "[snyStatTitle]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()", "id": "stat.titleId" } }, ngImport: i0 });
|
|
4059
|
+
}
|
|
4060
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatTitleDirective, decorators: [{
|
|
4061
|
+
type: Directive,
|
|
4062
|
+
args: [{
|
|
4063
|
+
selector: '[snyStatTitle]',
|
|
4064
|
+
standalone: true,
|
|
4065
|
+
host: {
|
|
4066
|
+
'[class]': 'computedClass()',
|
|
4067
|
+
'[id]': 'stat.titleId',
|
|
4068
|
+
},
|
|
4069
|
+
}]
|
|
4070
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4071
|
+
class SnyStatValueDirective {
|
|
4072
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4073
|
+
stat = inject(SNY_STAT);
|
|
4074
|
+
computedClass = computed(() => cn('text-2xl font-bold', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4075
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatValueDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4076
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyStatValueDirective, isStandalone: true, selector: "[snyStatValue]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()", "attr.aria-labelledby": "stat.titleId" } }, ngImport: i0 });
|
|
4077
|
+
}
|
|
4078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatValueDirective, decorators: [{
|
|
4079
|
+
type: Directive,
|
|
4080
|
+
args: [{
|
|
4081
|
+
selector: '[snyStatValue]',
|
|
4082
|
+
standalone: true,
|
|
4083
|
+
host: {
|
|
4084
|
+
'[class]': 'computedClass()',
|
|
4085
|
+
'[attr.aria-labelledby]': 'stat.titleId',
|
|
4086
|
+
},
|
|
4087
|
+
}]
|
|
4088
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4089
|
+
class SnyStatDescriptionDirective {
|
|
4090
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4091
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4092
|
+
computedClass = computed(() => {
|
|
4093
|
+
const v = this.variant();
|
|
4094
|
+
const variantClass = v === 'success' ? 'text-green-600 dark:text-green-400' :
|
|
4095
|
+
v === 'error' ? 'text-destructive' :
|
|
4096
|
+
'text-muted-foreground';
|
|
4097
|
+
return cn('text-xs', variantClass, this.class());
|
|
4098
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4099
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatDescriptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4100
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyStatDescriptionDirective, isStandalone: true, selector: "[snyStatDescription]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4101
|
+
}
|
|
4102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatDescriptionDirective, decorators: [{
|
|
4103
|
+
type: Directive,
|
|
4104
|
+
args: [{
|
|
4105
|
+
selector: '[snyStatDescription]',
|
|
4106
|
+
standalone: true,
|
|
4107
|
+
host: { '[class]': 'computedClass()' },
|
|
4108
|
+
}]
|
|
4109
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4110
|
+
class SnyStatFigureDirective {
|
|
4111
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4112
|
+
computedClass = computed(() => cn('text-muted-foreground', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4113
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatFigureDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4114
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyStatFigureDirective, isStandalone: true, selector: "[snyStatFigure]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4115
|
+
}
|
|
4116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatFigureDirective, decorators: [{
|
|
4117
|
+
type: Directive,
|
|
4118
|
+
args: [{
|
|
4119
|
+
selector: '[snyStatFigure]',
|
|
4120
|
+
standalone: true,
|
|
4121
|
+
host: { '[class]': 'computedClass()' },
|
|
4122
|
+
}]
|
|
4123
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4124
|
+
|
|
4125
|
+
const SNY_TIMELINE = new InjectionToken('SnyTimeline');
|
|
4126
|
+
class SnyTimelineItemDirective {
|
|
4127
|
+
connect = input('both', ...(ngDevMode ? [{ debugName: "connect" }] : /* istanbul ignore next */ []));
|
|
4128
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4129
|
+
computedClass = computed(() => cn('relative flex gap-4', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4131
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTimelineItemDirective, isStandalone: true, selector: "[snyTimelineItem]", inputs: { connect: { classPropertyName: "connect", publicName: "connect", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "listitem" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4132
|
+
}
|
|
4133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineItemDirective, decorators: [{
|
|
4134
|
+
type: Directive,
|
|
4135
|
+
args: [{
|
|
4136
|
+
selector: '[snyTimelineItem]',
|
|
4137
|
+
standalone: true,
|
|
4138
|
+
host: { 'role': 'listitem', '[class]': 'computedClass()' },
|
|
4139
|
+
}]
|
|
4140
|
+
}], propDecorators: { connect: [{ type: i0.Input, args: [{ isSignal: true, alias: "connect", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4141
|
+
class SnyTimelineStartDirective {
|
|
4142
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4143
|
+
computedClass = computed(() => cn('text-sm text-muted-foreground min-w-[80px] text-right', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4144
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineStartDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4145
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTimelineStartDirective, isStandalone: true, selector: "[snyTimelineStart]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4146
|
+
}
|
|
4147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineStartDirective, decorators: [{
|
|
4148
|
+
type: Directive,
|
|
4149
|
+
args: [{
|
|
4150
|
+
selector: '[snyTimelineStart]',
|
|
4151
|
+
standalone: true,
|
|
4152
|
+
host: { '[class]': 'computedClass()' },
|
|
4153
|
+
}]
|
|
4154
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4155
|
+
class SnyTimelineMiddleDirective {
|
|
4156
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4157
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4158
|
+
computedClass = computed(() => {
|
|
4159
|
+
const v = this.variant();
|
|
4160
|
+
const variantClass = v === 'primary' ? 'bg-primary' :
|
|
4161
|
+
v === 'success' ? 'bg-green-600 dark:bg-green-500' :
|
|
4162
|
+
v === 'error' ? 'bg-destructive' :
|
|
4163
|
+
'bg-border';
|
|
4164
|
+
return cn('flex flex-col items-center', variantClass, this.class());
|
|
4165
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4166
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineMiddleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4167
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTimelineMiddleDirective, isStandalone: true, selector: "[snyTimelineMiddle]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4168
|
+
}
|
|
4169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineMiddleDirective, decorators: [{
|
|
4170
|
+
type: Directive,
|
|
4171
|
+
args: [{
|
|
4172
|
+
selector: '[snyTimelineMiddle]',
|
|
4173
|
+
standalone: true,
|
|
4174
|
+
host: { '[class]': 'computedClass()', 'aria-hidden': 'true' },
|
|
4175
|
+
}]
|
|
4176
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4177
|
+
class SnyTimelineEndDirective {
|
|
4178
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4179
|
+
computedClass = computed(() => cn('flex-1 pb-8', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4180
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineEndDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4181
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyTimelineEndDirective, isStandalone: true, selector: "[snyTimelineEnd]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4182
|
+
}
|
|
4183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineEndDirective, decorators: [{
|
|
4184
|
+
type: Directive,
|
|
4185
|
+
args: [{
|
|
4186
|
+
selector: '[snyTimelineEnd]',
|
|
4187
|
+
standalone: true,
|
|
4188
|
+
host: { '[class]': 'computedClass()' },
|
|
4189
|
+
}]
|
|
4190
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4191
|
+
class SnyTimelineDirective {
|
|
4192
|
+
orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
4193
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4194
|
+
items = contentChildren(SnyTimelineItemDirective, ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
4195
|
+
computedClass = computed(() => {
|
|
4196
|
+
const o = this.orientation();
|
|
4197
|
+
return cn('relative', o === 'vertical' ? 'flex flex-col' : 'flex flex-row', this.class());
|
|
4198
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4199
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4200
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.5", type: SnyTimelineDirective, isStandalone: true, selector: "[snyTimeline]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "list", "aria-label": "Timeline" }, properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_TIMELINE, useExisting: SnyTimelineDirective }], queries: [{ propertyName: "items", predicate: SnyTimelineItemDirective, isSignal: true }], exportAs: ["snyTimeline"], ngImport: i0 });
|
|
4201
|
+
}
|
|
4202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTimelineDirective, decorators: [{
|
|
4203
|
+
type: Directive,
|
|
4204
|
+
args: [{
|
|
4205
|
+
selector: '[snyTimeline]',
|
|
4206
|
+
standalone: true,
|
|
4207
|
+
exportAs: 'snyTimeline',
|
|
4208
|
+
providers: [{ provide: SNY_TIMELINE, useExisting: SnyTimelineDirective }],
|
|
4209
|
+
host: {
|
|
4210
|
+
'role': 'list',
|
|
4211
|
+
'aria-label': 'Timeline',
|
|
4212
|
+
'[class]': 'computedClass()',
|
|
4213
|
+
},
|
|
4214
|
+
}]
|
|
4215
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SnyTimelineItemDirective), { isSignal: true }] }] } });
|
|
4216
|
+
|
|
4217
|
+
const kbdVariants = cva('pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium text-muted-foreground', {
|
|
4218
|
+
variants: {
|
|
4219
|
+
size: {
|
|
4220
|
+
sm: 'h-5 text-[10px]',
|
|
4221
|
+
md: 'h-6 text-xs',
|
|
4222
|
+
lg: 'h-7 text-sm',
|
|
4223
|
+
},
|
|
4224
|
+
},
|
|
4225
|
+
defaultVariants: {
|
|
4226
|
+
size: 'md',
|
|
4227
|
+
},
|
|
4228
|
+
});
|
|
4229
|
+
|
|
4230
|
+
class SnyKbdDirective {
|
|
4231
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
4232
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4233
|
+
computedClass = computed(() => cn(kbdVariants({ size: this.size() }), this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4234
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyKbdDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4235
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyKbdDirective, isStandalone: true, selector: "kbd[snyKbd]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4236
|
+
}
|
|
4237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyKbdDirective, decorators: [{
|
|
4238
|
+
type: Directive,
|
|
4239
|
+
args: [{
|
|
4240
|
+
selector: 'kbd[snyKbd]',
|
|
4241
|
+
standalone: true,
|
|
4242
|
+
host: {
|
|
4243
|
+
'[class]': 'computedClass()',
|
|
4244
|
+
},
|
|
4245
|
+
}]
|
|
4246
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4247
|
+
|
|
4248
|
+
class SnyListDirective {
|
|
4249
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4250
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4251
|
+
computedClass = computed(() => {
|
|
4252
|
+
const v = this.variant();
|
|
4253
|
+
const variantClass = v === 'bordered' ? 'divide-y divide-border border rounded-md' :
|
|
4254
|
+
v === 'hover' ? '[&>[snyListItem]]:hover:bg-accent' :
|
|
4255
|
+
'';
|
|
4256
|
+
return cn('flex flex-col', variantClass, this.class());
|
|
4257
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4258
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4259
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyListDirective, isStandalone: true, selector: "[snyList]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "list" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4260
|
+
}
|
|
4261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListDirective, decorators: [{
|
|
4262
|
+
type: Directive,
|
|
4263
|
+
args: [{
|
|
4264
|
+
selector: '[snyList]',
|
|
4265
|
+
standalone: true,
|
|
4266
|
+
host: {
|
|
4267
|
+
'role': 'list',
|
|
4268
|
+
'[class]': 'computedClass()',
|
|
4269
|
+
},
|
|
4270
|
+
}]
|
|
4271
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4272
|
+
class SnyListItemDirective {
|
|
4273
|
+
active = input(false, ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
4274
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
4275
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4276
|
+
computedClass = computed(() => cn('flex items-center gap-3 px-3 py-2 transition-colors', this.active() && 'bg-accent text-accent-foreground', this.disabled() && 'opacity-50 pointer-events-none', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4277
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4278
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyListItemDirective, isStandalone: true, selector: "[snyListItem]", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "listitem" }, properties: { "class": "computedClass()", "attr.aria-disabled": "disabled() || null" } }, ngImport: i0 });
|
|
4279
|
+
}
|
|
4280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListItemDirective, decorators: [{
|
|
4281
|
+
type: Directive,
|
|
4282
|
+
args: [{
|
|
4283
|
+
selector: '[snyListItem]',
|
|
4284
|
+
standalone: true,
|
|
4285
|
+
host: {
|
|
4286
|
+
'role': 'listitem',
|
|
4287
|
+
'[class]': 'computedClass()',
|
|
4288
|
+
'[attr.aria-disabled]': 'disabled() || null',
|
|
4289
|
+
},
|
|
4290
|
+
}]
|
|
4291
|
+
}], propDecorators: { active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4292
|
+
class SnyListItemIconDirective {
|
|
4293
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4294
|
+
computedClass = computed(() => cn('flex-shrink-0 text-muted-foreground', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4295
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListItemIconDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4296
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyListItemIconDirective, isStandalone: true, selector: "[snyListItemIcon]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4297
|
+
}
|
|
4298
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListItemIconDirective, decorators: [{
|
|
4299
|
+
type: Directive,
|
|
4300
|
+
args: [{
|
|
4301
|
+
selector: '[snyListItemIcon]',
|
|
4302
|
+
standalone: true,
|
|
4303
|
+
host: { '[class]': 'computedClass()' },
|
|
4304
|
+
}]
|
|
4305
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4306
|
+
class SnyListItemContentDirective {
|
|
4307
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4308
|
+
computedClass = computed(() => cn('flex-1 min-w-0', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4309
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListItemContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4310
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyListItemContentDirective, isStandalone: true, selector: "[snyListItemContent]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4311
|
+
}
|
|
4312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListItemContentDirective, decorators: [{
|
|
4313
|
+
type: Directive,
|
|
4314
|
+
args: [{
|
|
4315
|
+
selector: '[snyListItemContent]',
|
|
4316
|
+
standalone: true,
|
|
4317
|
+
host: { '[class]': 'computedClass()' },
|
|
4318
|
+
}]
|
|
4319
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4320
|
+
class SnyListItemActionDirective {
|
|
4321
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4322
|
+
computedClass = computed(() => cn('flex-shrink-0', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4323
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListItemActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4324
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyListItemActionDirective, isStandalone: true, selector: "[snyListItemAction]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4325
|
+
}
|
|
4326
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyListItemActionDirective, decorators: [{
|
|
4327
|
+
type: Directive,
|
|
4328
|
+
args: [{
|
|
4329
|
+
selector: '[snyListItemAction]',
|
|
4330
|
+
standalone: true,
|
|
4331
|
+
host: { '[class]': 'computedClass()' },
|
|
4332
|
+
}]
|
|
4333
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4334
|
+
|
|
4335
|
+
const statusVariants = cva('inline-block rounded-full', {
|
|
4336
|
+
variants: {
|
|
4337
|
+
variant: {
|
|
4338
|
+
default: 'bg-primary',
|
|
4339
|
+
success: 'bg-green-500',
|
|
4340
|
+
warning: 'bg-yellow-500',
|
|
4341
|
+
error: 'bg-destructive',
|
|
4342
|
+
info: 'bg-blue-500',
|
|
4343
|
+
neutral: 'bg-muted-foreground',
|
|
4344
|
+
},
|
|
4345
|
+
size: {
|
|
4346
|
+
xs: 'h-1.5 w-1.5',
|
|
4347
|
+
sm: 'h-2 w-2',
|
|
4348
|
+
md: 'h-2.5 w-2.5',
|
|
4349
|
+
},
|
|
4350
|
+
},
|
|
4351
|
+
defaultVariants: {
|
|
4352
|
+
variant: 'default',
|
|
4353
|
+
size: 'md',
|
|
4354
|
+
},
|
|
4355
|
+
});
|
|
4356
|
+
|
|
4357
|
+
const variantLabels = {
|
|
4358
|
+
default: 'Active',
|
|
4359
|
+
success: 'Online',
|
|
4360
|
+
warning: 'Away',
|
|
4361
|
+
error: 'Error',
|
|
4362
|
+
info: 'Info',
|
|
4363
|
+
neutral: 'Offline',
|
|
4364
|
+
};
|
|
4365
|
+
class SnyStatusDirective {
|
|
4366
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4367
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
4368
|
+
pulse = input(false, ...(ngDevMode ? [{ debugName: "pulse" }] : /* istanbul ignore next */ []));
|
|
4369
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4370
|
+
ariaLabel = computed(() => variantLabels[this.variant()], ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
4371
|
+
computedClass = computed(() => cn(statusVariants({ variant: this.variant(), size: this.size() }), this.pulse() && 'animate-pulse', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4372
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4373
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyStatusDirective, isStandalone: true, selector: "[snyStatus]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, pulse: { classPropertyName: "pulse", publicName: "pulse", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "attr.aria-label": "ariaLabel()", "class": "computedClass()" } }, ngImport: i0 });
|
|
4374
|
+
}
|
|
4375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyStatusDirective, decorators: [{
|
|
4376
|
+
type: Directive,
|
|
4377
|
+
args: [{
|
|
4378
|
+
selector: '[snyStatus]',
|
|
4379
|
+
standalone: true,
|
|
4380
|
+
host: {
|
|
4381
|
+
'role': 'status',
|
|
4382
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
4383
|
+
'[class]': 'computedClass()',
|
|
4384
|
+
},
|
|
4385
|
+
}]
|
|
4386
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], pulse: [{ type: i0.Input, args: [{ isSignal: true, alias: "pulse", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4387
|
+
|
|
4388
|
+
const positionMap$1 = {
|
|
4389
|
+
'top-start': 'top-0 left-0 -translate-x-1/2 -translate-y-1/2',
|
|
4390
|
+
'top-center': 'top-0 left-1/2 -translate-x-1/2 -translate-y-1/2',
|
|
4391
|
+
'top-end': 'top-0 right-0 translate-x-1/2 -translate-y-1/2',
|
|
4392
|
+
'middle-start': 'top-1/2 left-0 -translate-x-1/2 -translate-y-1/2',
|
|
4393
|
+
'middle-end': 'top-1/2 right-0 translate-x-1/2 -translate-y-1/2',
|
|
4394
|
+
'bottom-start': 'bottom-0 left-0 -translate-x-1/2 translate-y-1/2',
|
|
4395
|
+
'bottom-center': 'bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2',
|
|
4396
|
+
'bottom-end': 'bottom-0 right-0 translate-x-1/2 translate-y-1/2',
|
|
4397
|
+
};
|
|
4398
|
+
const variantMap = {
|
|
4399
|
+
default: 'bg-primary text-primary-foreground',
|
|
4400
|
+
primary: 'bg-primary text-primary-foreground',
|
|
4401
|
+
secondary: 'bg-secondary text-secondary-foreground',
|
|
4402
|
+
success: 'bg-green-600 text-white dark:bg-green-500',
|
|
4403
|
+
warning: 'bg-yellow-500 text-white dark:bg-yellow-400 dark:text-black',
|
|
4404
|
+
error: 'bg-destructive text-destructive-foreground',
|
|
4405
|
+
};
|
|
4406
|
+
class SnyIndicatorDirective {
|
|
4407
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4408
|
+
computedClass = computed(() => cn('relative inline-flex', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4409
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4410
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyIndicatorDirective, isStandalone: true, selector: "[snyIndicator]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4411
|
+
}
|
|
4412
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyIndicatorDirective, decorators: [{
|
|
4413
|
+
type: Directive,
|
|
4414
|
+
args: [{
|
|
4415
|
+
selector: '[snyIndicator]',
|
|
4416
|
+
standalone: true,
|
|
4417
|
+
host: { '[class]': 'computedClass()' },
|
|
4418
|
+
}]
|
|
4419
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4420
|
+
class SnyIndicatorBadgeDirective {
|
|
4421
|
+
position = input('top-end', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
4422
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4423
|
+
ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
4424
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4425
|
+
computedClass = computed(() => cn('absolute z-10 inline-flex items-center justify-center rounded-full text-xs font-bold min-w-[1.25rem] h-5 px-1', positionMap$1[this.position()], variantMap[this.variant()], this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4426
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyIndicatorBadgeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4427
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyIndicatorBadgeDirective, isStandalone: true, selector: "[snyIndicatorBadge]", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()", "attr.aria-label": "ariaLabel() || null" } }, ngImport: i0 });
|
|
4428
|
+
}
|
|
4429
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyIndicatorBadgeDirective, decorators: [{
|
|
4430
|
+
type: Directive,
|
|
4431
|
+
args: [{
|
|
4432
|
+
selector: '[snyIndicatorBadge]',
|
|
4433
|
+
standalone: true,
|
|
4434
|
+
host: {
|
|
4435
|
+
'[class]': 'computedClass()',
|
|
4436
|
+
'[attr.aria-label]': 'ariaLabel() || null',
|
|
4437
|
+
},
|
|
4438
|
+
}]
|
|
4439
|
+
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4440
|
+
|
|
4441
|
+
const SNY_CHAT_BUBBLE = new InjectionToken('SnyChatBubble');
|
|
4442
|
+
class SnyChatBubbleDirective {
|
|
4443
|
+
align = input('start', ...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
4444
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4445
|
+
computedClass = computed(() => cn('flex gap-3 mb-4', this.align() === 'end' && 'flex-row-reverse', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4446
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4447
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyChatBubbleDirective, isStandalone: true, selector: "[snyChatBubble]", inputs: { align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "article" }, properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_CHAT_BUBBLE, useExisting: SnyChatBubbleDirective }], ngImport: i0 });
|
|
4448
|
+
}
|
|
4449
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleDirective, decorators: [{
|
|
4450
|
+
type: Directive,
|
|
4451
|
+
args: [{
|
|
4452
|
+
selector: '[snyChatBubble]',
|
|
4453
|
+
standalone: true,
|
|
4454
|
+
providers: [{ provide: SNY_CHAT_BUBBLE, useExisting: SnyChatBubbleDirective }],
|
|
4455
|
+
host: {
|
|
4456
|
+
'role': 'article',
|
|
4457
|
+
'[class]': 'computedClass()',
|
|
4458
|
+
},
|
|
4459
|
+
}]
|
|
4460
|
+
}], propDecorators: { align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4461
|
+
class SnyChatBubbleAvatarDirective {
|
|
4462
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4463
|
+
computedClass = computed(() => cn('flex-shrink-0 w-10 h-10 rounded-full overflow-hidden', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4464
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleAvatarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4465
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyChatBubbleAvatarDirective, isStandalone: true, selector: "[snyChatBubbleAvatar]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4466
|
+
}
|
|
4467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleAvatarDirective, decorators: [{
|
|
4468
|
+
type: Directive,
|
|
4469
|
+
args: [{
|
|
4470
|
+
selector: '[snyChatBubbleAvatar]',
|
|
4471
|
+
standalone: true,
|
|
4472
|
+
host: { '[class]': 'computedClass()' },
|
|
4473
|
+
}]
|
|
4474
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4475
|
+
class SnyChatBubbleHeaderDirective {
|
|
4476
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4477
|
+
computedClass = computed(() => cn('text-xs text-muted-foreground mb-1', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4478
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4479
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyChatBubbleHeaderDirective, isStandalone: true, selector: "[snyChatBubbleHeader]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4480
|
+
}
|
|
4481
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleHeaderDirective, decorators: [{
|
|
4482
|
+
type: Directive,
|
|
4483
|
+
args: [{
|
|
4484
|
+
selector: '[snyChatBubbleHeader]',
|
|
4485
|
+
standalone: true,
|
|
4486
|
+
host: { '[class]': 'computedClass()' },
|
|
4487
|
+
}]
|
|
4488
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4489
|
+
class SnyChatBubbleContentDirective {
|
|
4490
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4491
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4492
|
+
computedClass = computed(() => {
|
|
4493
|
+
const v = this.variant();
|
|
4494
|
+
const variantClass = v === 'primary' ? 'bg-primary text-primary-foreground' :
|
|
4495
|
+
v === 'secondary' ? 'bg-blue-100 text-blue-900 dark:bg-blue-900 dark:text-blue-100' :
|
|
4496
|
+
v === 'accent' ? 'bg-violet-100 text-violet-900 dark:bg-violet-900 dark:text-violet-100' :
|
|
4497
|
+
'bg-muted';
|
|
4498
|
+
return cn('rounded-lg px-3 py-2 text-sm max-w-[80%]', variantClass, this.class());
|
|
4499
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4500
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4501
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyChatBubbleContentDirective, isStandalone: true, selector: "[snyChatBubbleContent]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4502
|
+
}
|
|
4503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleContentDirective, decorators: [{
|
|
4504
|
+
type: Directive,
|
|
4505
|
+
args: [{
|
|
4506
|
+
selector: '[snyChatBubbleContent]',
|
|
4507
|
+
standalone: true,
|
|
4508
|
+
host: { '[class]': 'computedClass()' },
|
|
4509
|
+
}]
|
|
4510
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4511
|
+
class SnyChatBubbleFooterDirective {
|
|
4512
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4513
|
+
computedClass = computed(() => cn('text-xs text-muted-foreground mt-1', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4514
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleFooterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4515
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyChatBubbleFooterDirective, isStandalone: true, selector: "[snyChatBubbleFooter]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4516
|
+
}
|
|
4517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleFooterDirective, decorators: [{
|
|
4518
|
+
type: Directive,
|
|
4519
|
+
args: [{
|
|
4520
|
+
selector: '[snyChatBubbleFooter]',
|
|
4521
|
+
standalone: true,
|
|
4522
|
+
host: { '[class]': 'computedClass()' },
|
|
4523
|
+
}]
|
|
4524
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4525
|
+
class SnyChatBubbleBodyDirective {
|
|
4526
|
+
chatBubble = inject(SNY_CHAT_BUBBLE);
|
|
4527
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4528
|
+
computedClass = computed(() => cn('flex flex-col', this.chatBubble.align() === 'end' && 'items-end', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4529
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleBodyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4530
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyChatBubbleBodyDirective, isStandalone: true, selector: "[snyChatBubbleBody]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4531
|
+
}
|
|
4532
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyChatBubbleBodyDirective, decorators: [{
|
|
4533
|
+
type: Directive,
|
|
4534
|
+
args: [{
|
|
4535
|
+
selector: '[snyChatBubbleBody]',
|
|
4536
|
+
standalone: true,
|
|
4537
|
+
host: { '[class]': 'computedClass()' },
|
|
4538
|
+
}]
|
|
4539
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4540
|
+
|
|
4541
|
+
const SNY_CAROUSEL = new InjectionToken('SnyCarousel');
|
|
4542
|
+
class SnyCarouselItemDirective {
|
|
4543
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4544
|
+
computedClass = computed(() => cn('min-w-0 shrink-0 grow-0 basis-full pl-4', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4545
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4546
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyCarouselItemDirective, isStandalone: true, selector: "[snyCarouselItem]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-roledescription": "\"slide\"", "class": "computedClass()" } }, ngImport: i0 });
|
|
4547
|
+
}
|
|
4548
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselItemDirective, decorators: [{
|
|
4549
|
+
type: Directive,
|
|
4550
|
+
args: [{
|
|
4551
|
+
selector: '[snyCarouselItem]',
|
|
4552
|
+
standalone: true,
|
|
4553
|
+
host: {
|
|
4554
|
+
'role': 'group',
|
|
4555
|
+
'[attr.aria-roledescription]': '"slide"',
|
|
4556
|
+
'[class]': 'computedClass()',
|
|
4557
|
+
},
|
|
4558
|
+
}]
|
|
4559
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4560
|
+
class SnyCarouselContentDirective {
|
|
4561
|
+
carousel = inject(SNY_CAROUSEL);
|
|
4562
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4563
|
+
computedClass = computed(() => cn('flex -ml-4 transition-transform duration-300 ease-in-out', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4564
|
+
transformStyle = computed(() => `translateX(-${this.carousel.currentIndex() * 100}%)`, ...(ngDevMode ? [{ debugName: "transformStyle" }] : /* istanbul ignore next */ []));
|
|
4565
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4566
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyCarouselContentDirective, isStandalone: true, selector: "[snyCarouselContent]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()", "style.transform": "transformStyle()" } }, ngImport: i0 });
|
|
4567
|
+
}
|
|
4568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselContentDirective, decorators: [{
|
|
4569
|
+
type: Directive,
|
|
4570
|
+
args: [{
|
|
4571
|
+
selector: '[snyCarouselContent]',
|
|
4572
|
+
standalone: true,
|
|
4573
|
+
host: {
|
|
4574
|
+
'[class]': 'computedClass()',
|
|
4575
|
+
'[style.transform]': 'transformStyle()',
|
|
4576
|
+
},
|
|
4577
|
+
}]
|
|
4578
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4579
|
+
class SnyCarouselDirective {
|
|
4580
|
+
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
4581
|
+
loop = input(false, ...(ngDevMode ? [{ debugName: "loop" }] : /* istanbul ignore next */ []));
|
|
4582
|
+
autoplay = input(0, ...(ngDevMode ? [{ debugName: "autoplay" }] : /* istanbul ignore next */ []));
|
|
4583
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4584
|
+
items = contentChildren(SnyCarouselItemDirective, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: true });
|
|
4585
|
+
currentIndex = signal(0, ...(ngDevMode ? [{ debugName: "currentIndex" }] : /* istanbul ignore next */ []));
|
|
4586
|
+
totalItems = computed(() => this.items().length, ...(ngDevMode ? [{ debugName: "totalItems" }] : /* istanbul ignore next */ []));
|
|
4587
|
+
autoplayInterval = null;
|
|
4588
|
+
constructor() {
|
|
4589
|
+
effect(() => {
|
|
4590
|
+
const ms = this.autoplay();
|
|
4591
|
+
this.clearAutoplay();
|
|
4592
|
+
if (ms > 0) {
|
|
4593
|
+
this.autoplayInterval = setInterval(() => this.next(), ms);
|
|
4594
|
+
}
|
|
4595
|
+
});
|
|
4596
|
+
}
|
|
4597
|
+
next() {
|
|
4598
|
+
const total = this.totalItems();
|
|
4599
|
+
if (total === 0)
|
|
4600
|
+
return;
|
|
4601
|
+
this.currentIndex.update((i) => {
|
|
4602
|
+
if (i >= total - 1)
|
|
4603
|
+
return this.loop() ? 0 : i;
|
|
4604
|
+
return i + 1;
|
|
4605
|
+
});
|
|
4606
|
+
}
|
|
4607
|
+
prev() {
|
|
4608
|
+
const total = this.totalItems();
|
|
4609
|
+
if (total === 0)
|
|
4610
|
+
return;
|
|
4611
|
+
this.currentIndex.update((i) => {
|
|
4612
|
+
if (i <= 0)
|
|
4613
|
+
return this.loop() ? total - 1 : i;
|
|
4614
|
+
return i - 1;
|
|
4615
|
+
});
|
|
4616
|
+
}
|
|
4617
|
+
goTo(index) {
|
|
4618
|
+
this.currentIndex.set(Math.max(0, Math.min(index, this.totalItems() - 1)));
|
|
4619
|
+
}
|
|
4620
|
+
onKeydown(event) {
|
|
4621
|
+
switch (event.key) {
|
|
4622
|
+
case 'ArrowLeft':
|
|
4623
|
+
event.preventDefault();
|
|
4624
|
+
this.prev();
|
|
4625
|
+
break;
|
|
4626
|
+
case 'ArrowRight':
|
|
4627
|
+
event.preventDefault();
|
|
4628
|
+
this.next();
|
|
4629
|
+
break;
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4632
|
+
ngOnDestroy() {
|
|
4633
|
+
this.clearAutoplay();
|
|
4634
|
+
}
|
|
4635
|
+
clearAutoplay() {
|
|
4636
|
+
if (this.autoplayInterval) {
|
|
4637
|
+
clearInterval(this.autoplayInterval);
|
|
4638
|
+
this.autoplayInterval = null;
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
4641
|
+
computedClass = computed(() => cn('relative overflow-hidden', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4642
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4643
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.5", type: SnyCarouselDirective, isStandalone: true, selector: "[snyCarousel]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, loop: { classPropertyName: "loop", publicName: "loop", isSignal: true, isRequired: false, transformFunction: null }, autoplay: { classPropertyName: "autoplay", publicName: "autoplay", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region", "aria-label": "Carousel", "tabindex": "0" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.aria-roledescription": "\"carousel\"", "class": "computedClass()" } }, providers: [{ provide: SNY_CAROUSEL, useExisting: SnyCarouselDirective }], queries: [{ propertyName: "items", predicate: SnyCarouselItemDirective, descendants: true, isSignal: true }], exportAs: ["snyCarousel"], ngImport: i0 });
|
|
4644
|
+
}
|
|
4645
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselDirective, decorators: [{
|
|
4646
|
+
type: Directive,
|
|
4647
|
+
args: [{
|
|
4648
|
+
selector: '[snyCarousel]',
|
|
4649
|
+
standalone: true,
|
|
4650
|
+
exportAs: 'snyCarousel',
|
|
4651
|
+
providers: [{ provide: SNY_CAROUSEL, useExisting: SnyCarouselDirective }],
|
|
4652
|
+
host: {
|
|
4653
|
+
'role': 'region',
|
|
4654
|
+
'[attr.aria-roledescription]': '"carousel"',
|
|
4655
|
+
'aria-label': 'Carousel',
|
|
4656
|
+
'tabindex': '0',
|
|
4657
|
+
'[class]': 'computedClass()',
|
|
4658
|
+
'(keydown)': 'onKeydown($event)',
|
|
4659
|
+
},
|
|
4660
|
+
}]
|
|
4661
|
+
}], ctorParameters: () => [], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], loop: [{ type: i0.Input, args: [{ isSignal: true, alias: "loop", required: false }] }], autoplay: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoplay", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SnyCarouselItemDirective), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
4662
|
+
class SnyCarouselPrevDirective {
|
|
4663
|
+
carousel = inject(SNY_CAROUSEL);
|
|
4664
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4665
|
+
computedClass = computed(() => cn('absolute left-2 top-1/2 -translate-y-1/2 z-10', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4666
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselPrevDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4667
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyCarouselPrevDirective, isStandalone: true, selector: "[snyCarouselPrev]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "carousel.prev()" }, properties: { "attr.aria-label": "\"Previous slide\"", "class": "computedClass()" } }, ngImport: i0 });
|
|
4668
|
+
}
|
|
4669
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselPrevDirective, decorators: [{
|
|
4670
|
+
type: Directive,
|
|
4671
|
+
args: [{
|
|
4672
|
+
selector: '[snyCarouselPrev]',
|
|
4673
|
+
standalone: true,
|
|
4674
|
+
host: {
|
|
4675
|
+
'(click)': 'carousel.prev()',
|
|
4676
|
+
'[attr.aria-label]': '"Previous slide"',
|
|
4677
|
+
'[class]': 'computedClass()',
|
|
4678
|
+
},
|
|
4679
|
+
}]
|
|
4680
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4681
|
+
class SnyCarouselNextDirective {
|
|
4682
|
+
carousel = inject(SNY_CAROUSEL);
|
|
4683
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4684
|
+
computedClass = computed(() => cn('absolute right-2 top-1/2 -translate-y-1/2 z-10', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4685
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselNextDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4686
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyCarouselNextDirective, isStandalone: true, selector: "[snyCarouselNext]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "carousel.next()" }, properties: { "attr.aria-label": "\"Next slide\"", "class": "computedClass()" } }, ngImport: i0 });
|
|
4687
|
+
}
|
|
4688
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCarouselNextDirective, decorators: [{
|
|
4689
|
+
type: Directive,
|
|
4690
|
+
args: [{
|
|
4691
|
+
selector: '[snyCarouselNext]',
|
|
4692
|
+
standalone: true,
|
|
4693
|
+
host: {
|
|
4694
|
+
'(click)': 'carousel.next()',
|
|
4695
|
+
'[attr.aria-label]': '"Next slide"',
|
|
4696
|
+
'[class]': 'computedClass()',
|
|
4697
|
+
},
|
|
4698
|
+
}]
|
|
4699
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4700
|
+
|
|
4701
|
+
class SnyDockDirective {
|
|
4702
|
+
position = input('bottom', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
4703
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4704
|
+
elRef = inject(ElementRef);
|
|
4705
|
+
computedClass = computed(() => cn('fixed left-1/2 -translate-x-1/2 z-50 flex items-center gap-1 rounded-full border bg-background/80 backdrop-blur-sm px-3 py-2 shadow-lg', this.position() === 'bottom' ? 'bottom-4' : 'top-4', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4706
|
+
onKeydown(event) {
|
|
4707
|
+
const items = Array.from(this.elRef.nativeElement.querySelectorAll('[snyDockItem]'));
|
|
4708
|
+
if (items.length === 0)
|
|
4709
|
+
return;
|
|
4710
|
+
const currentIndex = items.indexOf(document.activeElement);
|
|
4711
|
+
if (currentIndex === -1)
|
|
4712
|
+
return;
|
|
4713
|
+
let nextIndex = null;
|
|
4714
|
+
switch (event.key) {
|
|
4715
|
+
case 'ArrowRight':
|
|
4716
|
+
event.preventDefault();
|
|
4717
|
+
nextIndex = (currentIndex + 1) % items.length;
|
|
4718
|
+
break;
|
|
4719
|
+
case 'ArrowLeft':
|
|
4720
|
+
event.preventDefault();
|
|
4721
|
+
nextIndex = (currentIndex - 1 + items.length) % items.length;
|
|
4722
|
+
break;
|
|
4723
|
+
case 'Home':
|
|
4724
|
+
event.preventDefault();
|
|
4725
|
+
nextIndex = 0;
|
|
4726
|
+
break;
|
|
4727
|
+
case 'End':
|
|
4728
|
+
event.preventDefault();
|
|
4729
|
+
nextIndex = items.length - 1;
|
|
4730
|
+
break;
|
|
4731
|
+
}
|
|
4732
|
+
if (nextIndex !== null) {
|
|
4733
|
+
items[nextIndex].focus();
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDockDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4737
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyDockDirective, isStandalone: true, selector: "[snyDock]", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "toolbar", "aria-label": "Dock" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
4738
|
+
}
|
|
4739
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDockDirective, decorators: [{
|
|
4740
|
+
type: Directive,
|
|
4741
|
+
args: [{
|
|
4742
|
+
selector: '[snyDock]',
|
|
4743
|
+
standalone: true,
|
|
4744
|
+
host: {
|
|
4745
|
+
'role': 'toolbar',
|
|
4746
|
+
'aria-label': 'Dock',
|
|
4747
|
+
'[class]': 'computedClass()',
|
|
4748
|
+
'(keydown)': 'onKeydown($event)',
|
|
4749
|
+
},
|
|
4750
|
+
}]
|
|
4751
|
+
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4752
|
+
class SnyDockItemDirective {
|
|
4753
|
+
active = input(false, ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
4754
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4755
|
+
computedClass = computed(() => cn('inline-flex items-center justify-center rounded-full p-2 transition-all hover:scale-110', this.active() && 'bg-primary text-primary-foreground', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4756
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDockItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4757
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyDockItemDirective, isStandalone: true, selector: "[snyDockItem]", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()", "attr.tabindex": "active() ? 0 : -1" } }, ngImport: i0 });
|
|
4758
|
+
}
|
|
4759
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDockItemDirective, decorators: [{
|
|
4760
|
+
type: Directive,
|
|
4761
|
+
args: [{
|
|
4762
|
+
selector: '[snyDockItem]',
|
|
4763
|
+
standalone: true,
|
|
4764
|
+
host: {
|
|
4765
|
+
'[class]': 'computedClass()',
|
|
4766
|
+
'[attr.tabindex]': 'active() ? 0 : -1',
|
|
4767
|
+
},
|
|
4768
|
+
}]
|
|
4769
|
+
}], propDecorators: { active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4770
|
+
|
|
4771
|
+
const SNY_FAB = new InjectionToken('SnyFab');
|
|
4772
|
+
const positionMap = {
|
|
4773
|
+
'bottom-right': 'fixed bottom-6 right-6',
|
|
4774
|
+
'bottom-left': 'fixed bottom-6 left-6',
|
|
4775
|
+
'top-right': 'fixed top-6 right-6',
|
|
4776
|
+
'top-left': 'fixed top-6 left-6',
|
|
4777
|
+
};
|
|
4778
|
+
class SnyFabDirective {
|
|
4779
|
+
position = input('bottom-right', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
4780
|
+
direction = input('up', ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
|
|
4781
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4782
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
4783
|
+
toggle() { this.isOpen.update((v) => !v); }
|
|
4784
|
+
open() { this.isOpen.set(true); }
|
|
4785
|
+
close() { this.isOpen.set(false); }
|
|
4786
|
+
computedClass = computed(() => cn('z-50 flex flex-col items-center gap-2', positionMap[this.position()], this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4787
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFabDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4788
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyFabDirective, isStandalone: true, selector: "[snyFab]", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, providers: [{ provide: SNY_FAB, useExisting: SnyFabDirective }], exportAs: ["snyFab"], ngImport: i0 });
|
|
4789
|
+
}
|
|
4790
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFabDirective, decorators: [{
|
|
4791
|
+
type: Directive,
|
|
4792
|
+
args: [{
|
|
4793
|
+
selector: '[snyFab]',
|
|
4794
|
+
standalone: true,
|
|
4795
|
+
exportAs: 'snyFab',
|
|
4796
|
+
providers: [{ provide: SNY_FAB, useExisting: SnyFabDirective }],
|
|
4797
|
+
host: { '[class]': 'computedClass()' },
|
|
4798
|
+
}]
|
|
4799
|
+
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4800
|
+
class SnyFabTriggerDirective {
|
|
4801
|
+
fab = inject(SNY_FAB);
|
|
4802
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4803
|
+
computedClass = computed(() => cn('inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg h-14 w-14 hover:bg-primary/90 transition-transform', this.fab.isOpen() && 'rotate-45', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4804
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFabTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4805
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyFabTriggerDirective, isStandalone: true, selector: "[snyFabTrigger]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-label": "Quick actions" }, listeners: { "click": "fab.toggle()" }, properties: { "attr.aria-expanded": "fab.isOpen()", "attr.aria-haspopup": "\"menu\"", "class": "computedClass()" } }, ngImport: i0 });
|
|
4806
|
+
}
|
|
4807
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFabTriggerDirective, decorators: [{
|
|
4808
|
+
type: Directive,
|
|
4809
|
+
args: [{
|
|
4810
|
+
selector: '[snyFabTrigger]',
|
|
4811
|
+
standalone: true,
|
|
4812
|
+
host: {
|
|
4813
|
+
'(click)': 'fab.toggle()',
|
|
4814
|
+
'[attr.aria-expanded]': 'fab.isOpen()',
|
|
4815
|
+
'[attr.aria-haspopup]': '"menu"',
|
|
4816
|
+
'aria-label': 'Quick actions',
|
|
4817
|
+
'[class]': 'computedClass()',
|
|
4818
|
+
},
|
|
4819
|
+
}]
|
|
4820
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4821
|
+
class SnyFabActionDirective {
|
|
4822
|
+
fab = inject(SNY_FAB);
|
|
4823
|
+
ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
4824
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4825
|
+
computedClass = computed(() => cn('inline-flex items-center justify-center rounded-full bg-secondary text-secondary-foreground shadow-md h-10 w-10 transition-all', this.fab.isOpen() ? 'scale-100 opacity-100' : 'scale-0 opacity-0', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
4826
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFabActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4827
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyFabActionDirective, isStandalone: true, selector: "[snyFabAction]", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "menuitem" }, properties: { "attr.aria-label": "ariaLabel() || null", "class": "computedClass()" } }, ngImport: i0 });
|
|
4828
|
+
}
|
|
4829
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFabActionDirective, decorators: [{
|
|
4830
|
+
type: Directive,
|
|
4831
|
+
args: [{
|
|
4832
|
+
selector: '[snyFabAction]',
|
|
4833
|
+
standalone: true,
|
|
4834
|
+
host: {
|
|
4835
|
+
'role': 'menuitem',
|
|
4836
|
+
'[attr.aria-label]': 'ariaLabel() || null',
|
|
4837
|
+
'[class]': 'computedClass()',
|
|
4838
|
+
},
|
|
4839
|
+
}]
|
|
4840
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4841
|
+
|
|
4842
|
+
const sizeMap = { sm: 48, md: 72, lg: 96 };
|
|
4843
|
+
const variantColorMap = {
|
|
4844
|
+
default: 'stroke-primary',
|
|
4845
|
+
success: 'stroke-green-600 dark:stroke-green-500',
|
|
4846
|
+
warning: 'stroke-yellow-500',
|
|
4847
|
+
error: 'stroke-destructive',
|
|
4848
|
+
info: 'stroke-blue-600 dark:stroke-blue-500',
|
|
4849
|
+
};
|
|
4850
|
+
class SnyRadialProgressComponent {
|
|
4851
|
+
value = input(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
4852
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
4853
|
+
thickness = input(4, ...(ngDevMode ? [{ debugName: "thickness" }] : /* istanbul ignore next */ []));
|
|
4854
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4855
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4856
|
+
svgSize = computed(() => sizeMap[this.size()], ...(ngDevMode ? [{ debugName: "svgSize" }] : /* istanbul ignore next */ []));
|
|
4857
|
+
radius = computed(() => (this.svgSize() - this.thickness()) / 2, ...(ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []));
|
|
4858
|
+
circumference = computed(() => 2 * Math.PI * this.radius(), ...(ngDevMode ? [{ debugName: "circumference" }] : /* istanbul ignore next */ []));
|
|
4859
|
+
offset = computed(() => this.circumference() - (this.value() / 100) * this.circumference(), ...(ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []));
|
|
4860
|
+
strokeClass = computed(() => variantColorMap[this.variant()], ...(ngDevMode ? [{ debugName: "strokeClass" }] : /* istanbul ignore next */ []));
|
|
4861
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyRadialProgressComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4862
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.5", type: SnyRadialProgressComponent, isStandalone: true, selector: "sny-radial-progress", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, thickness: { classPropertyName: "thickness", publicName: "thickness", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "100", "class": "\"inline-flex items-center justify-center\"" } }, ngImport: i0, template: `
|
|
4863
|
+
<div class="relative" [style.width.px]="svgSize()" [style.height.px]="svgSize()">
|
|
4864
|
+
<svg [attr.width]="svgSize()" [attr.height]="svgSize()" class="-rotate-90">
|
|
4865
|
+
<circle
|
|
4866
|
+
[attr.cx]="svgSize() / 2"
|
|
4867
|
+
[attr.cy]="svgSize() / 2"
|
|
4868
|
+
[attr.r]="radius()"
|
|
4869
|
+
fill="none"
|
|
4870
|
+
class="stroke-muted"
|
|
4871
|
+
[attr.stroke-width]="thickness()"
|
|
4872
|
+
/>
|
|
4873
|
+
<circle
|
|
4874
|
+
[attr.cx]="svgSize() / 2"
|
|
4875
|
+
[attr.cy]="svgSize() / 2"
|
|
4876
|
+
[attr.r]="radius()"
|
|
4877
|
+
fill="none"
|
|
4878
|
+
[class]="strokeClass()"
|
|
4879
|
+
[attr.stroke-width]="thickness()"
|
|
4880
|
+
[attr.stroke-dasharray]="circumference()"
|
|
4881
|
+
[attr.stroke-dashoffset]="offset()"
|
|
4882
|
+
stroke-linecap="round"
|
|
4883
|
+
class="transition-all duration-300"
|
|
4884
|
+
/>
|
|
4885
|
+
</svg>
|
|
4886
|
+
<div class="absolute inset-0 flex items-center justify-center">
|
|
4887
|
+
<ng-content />
|
|
4888
|
+
</div>
|
|
4889
|
+
</div>
|
|
4890
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4891
|
+
}
|
|
4892
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyRadialProgressComponent, decorators: [{
|
|
4893
|
+
type: Component,
|
|
4894
|
+
args: [{
|
|
4895
|
+
selector: 'sny-radial-progress',
|
|
4896
|
+
standalone: true,
|
|
4897
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4898
|
+
host: {
|
|
4899
|
+
'role': 'progressbar',
|
|
4900
|
+
'[attr.aria-valuenow]': 'value()',
|
|
4901
|
+
'[attr.aria-valuemin]': '0',
|
|
4902
|
+
'[attr.aria-valuemax]': '100',
|
|
4903
|
+
'[class]': '"inline-flex items-center justify-center"',
|
|
4904
|
+
},
|
|
4905
|
+
template: `
|
|
4906
|
+
<div class="relative" [style.width.px]="svgSize()" [style.height.px]="svgSize()">
|
|
4907
|
+
<svg [attr.width]="svgSize()" [attr.height]="svgSize()" class="-rotate-90">
|
|
4908
|
+
<circle
|
|
4909
|
+
[attr.cx]="svgSize() / 2"
|
|
4910
|
+
[attr.cy]="svgSize() / 2"
|
|
4911
|
+
[attr.r]="radius()"
|
|
4912
|
+
fill="none"
|
|
4913
|
+
class="stroke-muted"
|
|
4914
|
+
[attr.stroke-width]="thickness()"
|
|
4915
|
+
/>
|
|
4916
|
+
<circle
|
|
4917
|
+
[attr.cx]="svgSize() / 2"
|
|
4918
|
+
[attr.cy]="svgSize() / 2"
|
|
4919
|
+
[attr.r]="radius()"
|
|
4920
|
+
fill="none"
|
|
4921
|
+
[class]="strokeClass()"
|
|
4922
|
+
[attr.stroke-width]="thickness()"
|
|
4923
|
+
[attr.stroke-dasharray]="circumference()"
|
|
4924
|
+
[attr.stroke-dashoffset]="offset()"
|
|
4925
|
+
stroke-linecap="round"
|
|
4926
|
+
class="transition-all duration-300"
|
|
4927
|
+
/>
|
|
4928
|
+
</svg>
|
|
4929
|
+
<div class="absolute inset-0 flex items-center justify-center">
|
|
4930
|
+
<ng-content />
|
|
4931
|
+
</div>
|
|
4932
|
+
</div>
|
|
4933
|
+
`,
|
|
4934
|
+
}]
|
|
4935
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], thickness: [{ type: i0.Input, args: [{ isSignal: true, alias: "thickness", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4936
|
+
|
|
4937
|
+
class SnyDiffComponent {
|
|
4938
|
+
value = model(50, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
4939
|
+
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
4940
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
4941
|
+
isDragging = signal(false, ...(ngDevMode ? [{ debugName: "isDragging" }] : /* istanbul ignore next */ []));
|
|
4942
|
+
onPointerDown(event) {
|
|
4943
|
+
this.isDragging.set(true);
|
|
4944
|
+
event.target.setPointerCapture?.(event.pointerId);
|
|
4945
|
+
this.updateValue(event);
|
|
4946
|
+
}
|
|
4947
|
+
onPointerMove(event) {
|
|
4948
|
+
if (!this.isDragging())
|
|
4949
|
+
return;
|
|
4950
|
+
this.updateValue(event);
|
|
4951
|
+
}
|
|
4952
|
+
onPointerUp() {
|
|
4953
|
+
this.isDragging.set(false);
|
|
4954
|
+
}
|
|
4955
|
+
onKeydown(event) {
|
|
4956
|
+
switch (event.key) {
|
|
4957
|
+
case 'ArrowLeft':
|
|
4958
|
+
event.preventDefault();
|
|
4959
|
+
this.value.update((v) => Math.max(0, v - 5));
|
|
4960
|
+
break;
|
|
4961
|
+
case 'ArrowRight':
|
|
4962
|
+
event.preventDefault();
|
|
4963
|
+
this.value.update((v) => Math.min(100, v + 5));
|
|
4964
|
+
break;
|
|
4965
|
+
}
|
|
4966
|
+
}
|
|
4967
|
+
updateValue(event) {
|
|
4968
|
+
const target = event.currentTarget.closest('sny-diff');
|
|
4969
|
+
if (!target)
|
|
4970
|
+
return;
|
|
4971
|
+
const rect = target.getBoundingClientRect();
|
|
4972
|
+
const x = event.clientX - rect.left;
|
|
4973
|
+
const pct = Math.max(0, Math.min(100, (x / rect.width) * 100));
|
|
4974
|
+
this.value.set(Math.round(pct));
|
|
4975
|
+
}
|
|
4976
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDiffComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4977
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.5", type: SnyDiffComponent, isStandalone: true, selector: "sny-diff", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "pointerdown": "onPointerDown($event)", "pointermove": "onPointerMove($event)", "pointerup": "onPointerUp()", "keydown": "onKeydown($event)" }, properties: { "class": "\"relative overflow-hidden select-none w-full\"" } }, ngImport: i0, template: `
|
|
4978
|
+
<div class="relative w-full" [style.aspect-ratio]="'16/9'">
|
|
4979
|
+
<div class="absolute inset-0">
|
|
4980
|
+
<ng-content select="[snyDiffAfter]" />
|
|
4981
|
+
</div>
|
|
4982
|
+
<div class="absolute inset-0 overflow-hidden" [style.width.%]="value()">
|
|
4983
|
+
<ng-content select="[snyDiffBefore]" />
|
|
4984
|
+
</div>
|
|
4985
|
+
<div
|
|
4986
|
+
class="absolute top-0 bottom-0 w-1 bg-foreground cursor-col-resize z-10"
|
|
4987
|
+
[style.left.%]="value()"
|
|
4988
|
+
role="slider"
|
|
4989
|
+
tabindex="0"
|
|
4990
|
+
[attr.aria-valuenow]="value()"
|
|
4991
|
+
aria-valuemin="0"
|
|
4992
|
+
aria-valuemax="100"
|
|
4993
|
+
aria-label="Comparison slider"
|
|
4994
|
+
>
|
|
4995
|
+
<div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 rounded-full bg-foreground/80 flex items-center justify-center text-background text-xs">
|
|
4996
|
+
⇔
|
|
4997
|
+
</div>
|
|
4998
|
+
</div>
|
|
4999
|
+
</div>
|
|
5000
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5001
|
+
}
|
|
5002
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyDiffComponent, decorators: [{
|
|
5003
|
+
type: Component,
|
|
5004
|
+
args: [{
|
|
5005
|
+
selector: 'sny-diff',
|
|
5006
|
+
standalone: true,
|
|
5007
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
5008
|
+
host: {
|
|
5009
|
+
'[class]': '"relative overflow-hidden select-none w-full"',
|
|
5010
|
+
'(pointerdown)': 'onPointerDown($event)',
|
|
5011
|
+
'(pointermove)': 'onPointerMove($event)',
|
|
5012
|
+
'(pointerup)': 'onPointerUp()',
|
|
5013
|
+
'(keydown)': 'onKeydown($event)',
|
|
5014
|
+
},
|
|
5015
|
+
template: `
|
|
5016
|
+
<div class="relative w-full" [style.aspect-ratio]="'16/9'">
|
|
5017
|
+
<div class="absolute inset-0">
|
|
5018
|
+
<ng-content select="[snyDiffAfter]" />
|
|
5019
|
+
</div>
|
|
5020
|
+
<div class="absolute inset-0 overflow-hidden" [style.width.%]="value()">
|
|
5021
|
+
<ng-content select="[snyDiffBefore]" />
|
|
5022
|
+
</div>
|
|
5023
|
+
<div
|
|
5024
|
+
class="absolute top-0 bottom-0 w-1 bg-foreground cursor-col-resize z-10"
|
|
5025
|
+
[style.left.%]="value()"
|
|
5026
|
+
role="slider"
|
|
5027
|
+
tabindex="0"
|
|
5028
|
+
[attr.aria-valuenow]="value()"
|
|
5029
|
+
aria-valuemin="0"
|
|
5030
|
+
aria-valuemax="100"
|
|
5031
|
+
aria-label="Comparison slider"
|
|
5032
|
+
>
|
|
5033
|
+
<div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 rounded-full bg-foreground/80 flex items-center justify-center text-background text-xs">
|
|
5034
|
+
⇔
|
|
5035
|
+
</div>
|
|
5036
|
+
</div>
|
|
5037
|
+
</div>
|
|
5038
|
+
`,
|
|
5039
|
+
}]
|
|
5040
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5041
|
+
|
|
5042
|
+
const linkVariants = cva('inline-flex items-center gap-1 underline-offset-4 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded', {
|
|
5043
|
+
variants: {
|
|
5044
|
+
variant: {
|
|
5045
|
+
default: 'text-foreground underline hover:text-foreground/80',
|
|
5046
|
+
primary: 'text-primary underline hover:text-primary/80',
|
|
5047
|
+
secondary: 'text-muted-foreground underline hover:text-foreground',
|
|
5048
|
+
hover: 'text-foreground no-underline hover:underline',
|
|
5049
|
+
},
|
|
5050
|
+
},
|
|
5051
|
+
defaultVariants: {
|
|
5052
|
+
variant: 'default',
|
|
5053
|
+
},
|
|
5054
|
+
});
|
|
5055
|
+
|
|
5056
|
+
class SnyLinkDirective {
|
|
5057
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
5058
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
5059
|
+
computedClass = computed(() => cn(linkVariants({ variant: this.variant() }), this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
5060
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyLinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
5061
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyLinkDirective, isStandalone: true, selector: "a[snyLink]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
5062
|
+
}
|
|
5063
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyLinkDirective, decorators: [{
|
|
5064
|
+
type: Directive,
|
|
5065
|
+
args: [{
|
|
5066
|
+
selector: 'a[snyLink]',
|
|
5067
|
+
standalone: true,
|
|
5068
|
+
host: {
|
|
5069
|
+
'[class]': 'computedClass()',
|
|
5070
|
+
},
|
|
5071
|
+
}]
|
|
5072
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5073
|
+
|
|
5074
|
+
class SnyCalendarComponent {
|
|
5075
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
5076
|
+
min = input(undefined, ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
5077
|
+
max = input(undefined, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
5078
|
+
locale = input('en-US', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
5079
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
5080
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
5081
|
+
viewDate = signal(new Date(), ...(ngDevMode ? [{ debugName: "viewDate" }] : /* istanbul ignore next */ []));
|
|
5082
|
+
weekDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
5083
|
+
_onChange = () => { };
|
|
5084
|
+
onTouched = () => { };
|
|
5085
|
+
_writing = false;
|
|
5086
|
+
constructor() {
|
|
5087
|
+
effect(() => {
|
|
5088
|
+
const val = this.value();
|
|
5089
|
+
if (this._writing) {
|
|
5090
|
+
this._writing = false;
|
|
5091
|
+
return;
|
|
5092
|
+
}
|
|
5093
|
+
this._onChange(val);
|
|
5094
|
+
});
|
|
5095
|
+
}
|
|
5096
|
+
writeValue(val) {
|
|
5097
|
+
this._writing = true;
|
|
5098
|
+
this.value.set(val ?? null);
|
|
5099
|
+
if (val) {
|
|
5100
|
+
this.viewDate.set(new Date(val.getFullYear(), val.getMonth(), 1));
|
|
5101
|
+
}
|
|
5102
|
+
}
|
|
5103
|
+
registerOnChange(fn) {
|
|
5104
|
+
this._onChange = fn;
|
|
5105
|
+
}
|
|
5106
|
+
registerOnTouched(fn) {
|
|
5107
|
+
this.onTouched = fn;
|
|
5108
|
+
}
|
|
5109
|
+
setDisabledState(isDisabled) {
|
|
5110
|
+
this._disabledByCva.set(isDisabled);
|
|
5111
|
+
}
|
|
5112
|
+
monthYearLabel = computed(() => {
|
|
5113
|
+
const d = this.viewDate();
|
|
5114
|
+
return d.toLocaleDateString(this.locale(), { month: 'long', year: 'numeric' });
|
|
5115
|
+
}, ...(ngDevMode ? [{ debugName: "monthYearLabel" }] : /* istanbul ignore next */ []));
|
|
5116
|
+
days = computed(() => {
|
|
5117
|
+
const view = this.viewDate();
|
|
5118
|
+
const year = view.getFullYear();
|
|
5119
|
+
const month = view.getMonth();
|
|
5120
|
+
const today = new Date();
|
|
5121
|
+
const selected = this.value();
|
|
5122
|
+
const minDate = this.min();
|
|
5123
|
+
const maxDate = this.max();
|
|
5124
|
+
const firstDay = new Date(year, month, 1);
|
|
5125
|
+
const startDay = firstDay.getDay();
|
|
5126
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
5127
|
+
const daysInPrevMonth = new Date(year, month, 0).getDate();
|
|
5128
|
+
const days = [];
|
|
5129
|
+
// Previous month
|
|
5130
|
+
for (let i = startDay - 1; i >= 0; i--) {
|
|
5131
|
+
const date = new Date(year, month - 1, daysInPrevMonth - i);
|
|
5132
|
+
days.push(this.createDay(date, false, today, selected, minDate, maxDate));
|
|
5133
|
+
}
|
|
5134
|
+
// Current month
|
|
5135
|
+
for (let d = 1; d <= daysInMonth; d++) {
|
|
5136
|
+
const date = new Date(year, month, d);
|
|
5137
|
+
days.push(this.createDay(date, true, today, selected, minDate, maxDate));
|
|
5138
|
+
}
|
|
5139
|
+
// Next month fill
|
|
5140
|
+
const remaining = 42 - days.length;
|
|
5141
|
+
for (let d = 1; d <= remaining; d++) {
|
|
5142
|
+
const date = new Date(year, month + 1, d);
|
|
5143
|
+
days.push(this.createDay(date, false, today, selected, minDate, maxDate));
|
|
5144
|
+
}
|
|
5145
|
+
return days;
|
|
5146
|
+
}, ...(ngDevMode ? [{ debugName: "days" }] : /* istanbul ignore next */ []));
|
|
5147
|
+
prevMonth() {
|
|
5148
|
+
this.viewDate.update((d) => new Date(d.getFullYear(), d.getMonth() - 1, 1));
|
|
5149
|
+
}
|
|
5150
|
+
nextMonth() {
|
|
5151
|
+
this.viewDate.update((d) => new Date(d.getFullYear(), d.getMonth() + 1, 1));
|
|
5152
|
+
}
|
|
5153
|
+
selectDate(date) {
|
|
5154
|
+
this.value.set(date);
|
|
5155
|
+
this.onTouched();
|
|
5156
|
+
}
|
|
5157
|
+
onKeydown(event) {
|
|
5158
|
+
// Simplified keyboard navigation
|
|
5159
|
+
switch (event.key) {
|
|
5160
|
+
case 'ArrowLeft':
|
|
5161
|
+
event.preventDefault();
|
|
5162
|
+
this.navigateDays(-1);
|
|
5163
|
+
break;
|
|
5164
|
+
case 'ArrowRight':
|
|
5165
|
+
event.preventDefault();
|
|
5166
|
+
this.navigateDays(1);
|
|
5167
|
+
break;
|
|
5168
|
+
case 'ArrowUp':
|
|
5169
|
+
event.preventDefault();
|
|
5170
|
+
this.navigateDays(-7);
|
|
5171
|
+
break;
|
|
5172
|
+
case 'ArrowDown':
|
|
5173
|
+
event.preventDefault();
|
|
5174
|
+
this.navigateDays(7);
|
|
5175
|
+
break;
|
|
5176
|
+
}
|
|
5177
|
+
}
|
|
5178
|
+
dayClass(day) {
|
|
5179
|
+
return cn('inline-flex items-center justify-center rounded-md text-sm h-8 w-8 transition-colors', day.isCurrentMonth ? 'text-foreground' : 'text-muted-foreground/50', day.isToday && !day.isSelected && 'bg-accent font-bold', day.isSelected && 'bg-primary text-primary-foreground', day.isDisabled && 'opacity-50 cursor-not-allowed', !day.isDisabled && !day.isSelected && 'hover:bg-accent cursor-pointer');
|
|
5180
|
+
}
|
|
5181
|
+
navigateDays(offset) {
|
|
5182
|
+
const current = this.value() ?? new Date();
|
|
5183
|
+
const next = new Date(current);
|
|
5184
|
+
next.setDate(next.getDate() + offset);
|
|
5185
|
+
this.value.set(next);
|
|
5186
|
+
this.viewDate.set(new Date(next.getFullYear(), next.getMonth(), 1));
|
|
5187
|
+
}
|
|
5188
|
+
createDay(date, isCurrentMonth, today, selected, minDate, maxDate) {
|
|
5189
|
+
const isToday = this.isSameDay(date, today);
|
|
5190
|
+
const isSelected = selected ? this.isSameDay(date, selected) : false;
|
|
5191
|
+
const isDisabled = this._disabledByCva() ||
|
|
5192
|
+
(minDate ? date < minDate : false) || (maxDate ? date > maxDate : false);
|
|
5193
|
+
return { date, day: date.getDate(), isCurrentMonth, isToday, isSelected, isDisabled };
|
|
5194
|
+
}
|
|
5195
|
+
isSameDay(a, b) {
|
|
5196
|
+
return (a.getFullYear() === b.getFullYear() &&
|
|
5197
|
+
a.getMonth() === b.getMonth() &&
|
|
5198
|
+
a.getDate() === b.getDate());
|
|
5199
|
+
}
|
|
5200
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5201
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyCalendarComponent, isStandalone: true, selector: "sny-calendar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "\"inline-block p-3 rounded-md border bg-background\"" } }, providers: [
|
|
5202
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyCalendarComponent), multi: true },
|
|
5203
|
+
], ngImport: i0, template: `
|
|
5204
|
+
<div class="flex items-center justify-between mb-4">
|
|
5205
|
+
<button
|
|
5206
|
+
class="inline-flex items-center justify-center rounded-md text-sm h-7 w-7 hover:bg-accent"
|
|
5207
|
+
(click)="prevMonth()"
|
|
5208
|
+
aria-label="Previous month"
|
|
5209
|
+
>
|
|
5210
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m15 18-6-6 6-6"/></svg>
|
|
5211
|
+
</button>
|
|
5212
|
+
<span class="text-sm font-medium">{{ monthYearLabel() }}</span>
|
|
5213
|
+
<button
|
|
5214
|
+
class="inline-flex items-center justify-center rounded-md text-sm h-7 w-7 hover:bg-accent"
|
|
5215
|
+
(click)="nextMonth()"
|
|
5216
|
+
aria-label="Next month"
|
|
5217
|
+
>
|
|
5218
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m9 18 6-6-6-6"/></svg>
|
|
5219
|
+
</button>
|
|
5220
|
+
</div>
|
|
5221
|
+
|
|
5222
|
+
<div role="grid" aria-label="Calendar" class="grid grid-cols-7 gap-0">
|
|
5223
|
+
@for (dayName of weekDays; track dayName) {
|
|
5224
|
+
<div class="text-center text-xs text-muted-foreground font-medium py-1">{{ dayName }}</div>
|
|
5225
|
+
}
|
|
5226
|
+
@for (day of days(); track day.date.getTime()) {
|
|
5227
|
+
<button
|
|
5228
|
+
[class]="dayClass(day)"
|
|
5229
|
+
[disabled]="day.isDisabled"
|
|
5230
|
+
[attr.aria-selected]="day.isSelected || null"
|
|
5231
|
+
[attr.aria-current]="day.isToday ? 'date' : null"
|
|
5232
|
+
[attr.aria-disabled]="day.isDisabled || null"
|
|
5233
|
+
(click)="selectDate(day.date)"
|
|
5234
|
+
>
|
|
5235
|
+
{{ day.day }}
|
|
5236
|
+
</button>
|
|
5237
|
+
}
|
|
5238
|
+
</div>
|
|
5239
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5240
|
+
}
|
|
5241
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyCalendarComponent, decorators: [{
|
|
5242
|
+
type: Component,
|
|
5243
|
+
args: [{
|
|
5244
|
+
selector: 'sny-calendar',
|
|
5245
|
+
standalone: true,
|
|
5246
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
5247
|
+
host: {
|
|
5248
|
+
'[class]': '"inline-block p-3 rounded-md border bg-background"',
|
|
5249
|
+
'(keydown)': 'onKeydown($event)',
|
|
5250
|
+
},
|
|
5251
|
+
providers: [
|
|
5252
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyCalendarComponent), multi: true },
|
|
5253
|
+
],
|
|
5254
|
+
template: `
|
|
5255
|
+
<div class="flex items-center justify-between mb-4">
|
|
5256
|
+
<button
|
|
5257
|
+
class="inline-flex items-center justify-center rounded-md text-sm h-7 w-7 hover:bg-accent"
|
|
5258
|
+
(click)="prevMonth()"
|
|
5259
|
+
aria-label="Previous month"
|
|
5260
|
+
>
|
|
5261
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m15 18-6-6 6-6"/></svg>
|
|
5262
|
+
</button>
|
|
5263
|
+
<span class="text-sm font-medium">{{ monthYearLabel() }}</span>
|
|
5264
|
+
<button
|
|
5265
|
+
class="inline-flex items-center justify-center rounded-md text-sm h-7 w-7 hover:bg-accent"
|
|
5266
|
+
(click)="nextMonth()"
|
|
5267
|
+
aria-label="Next month"
|
|
5268
|
+
>
|
|
5269
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m9 18 6-6-6-6"/></svg>
|
|
5270
|
+
</button>
|
|
5271
|
+
</div>
|
|
5272
|
+
|
|
5273
|
+
<div role="grid" aria-label="Calendar" class="grid grid-cols-7 gap-0">
|
|
5274
|
+
@for (dayName of weekDays; track dayName) {
|
|
5275
|
+
<div class="text-center text-xs text-muted-foreground font-medium py-1">{{ dayName }}</div>
|
|
5276
|
+
}
|
|
5277
|
+
@for (day of days(); track day.date.getTime()) {
|
|
5278
|
+
<button
|
|
5279
|
+
[class]="dayClass(day)"
|
|
5280
|
+
[disabled]="day.isDisabled"
|
|
5281
|
+
[attr.aria-selected]="day.isSelected || null"
|
|
5282
|
+
[attr.aria-current]="day.isToday ? 'date' : null"
|
|
5283
|
+
[attr.aria-disabled]="day.isDisabled || null"
|
|
5284
|
+
(click)="selectDate(day.date)"
|
|
5285
|
+
>
|
|
5286
|
+
{{ day.day }}
|
|
5287
|
+
</button>
|
|
5288
|
+
}
|
|
5289
|
+
</div>
|
|
5290
|
+
`,
|
|
5291
|
+
}]
|
|
5292
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5293
|
+
|
|
5294
|
+
class SnyValidatorDirective {
|
|
5295
|
+
control = input(null, ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
5296
|
+
state = input('default', ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
5297
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
5298
|
+
errors = computed(() => this.control()?.errors ?? null, ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
|
|
5299
|
+
showErrors = computed(() => {
|
|
5300
|
+
const c = this.control();
|
|
5301
|
+
return c ? c.touched && c.invalid : false;
|
|
5302
|
+
}, ...(ngDevMode ? [{ debugName: "showErrors" }] : /* istanbul ignore next */ []));
|
|
5303
|
+
computedClass = computed(() => cn('flex flex-col gap-1 mt-1', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
5304
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyValidatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
5305
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyValidatorDirective, isStandalone: true, selector: "[snyValidator]", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
5306
|
+
}
|
|
5307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyValidatorDirective, decorators: [{
|
|
5308
|
+
type: Directive,
|
|
5309
|
+
args: [{
|
|
5310
|
+
selector: '[snyValidator]',
|
|
5311
|
+
standalone: true,
|
|
5312
|
+
host: { '[class]': 'computedClass()' },
|
|
5313
|
+
}]
|
|
5314
|
+
}], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5315
|
+
class SnyValidatorHintDirective {
|
|
5316
|
+
when = input('', ...(ngDevMode ? [{ debugName: "when" }] : /* istanbul ignore next */ []));
|
|
5317
|
+
type = input('error', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
5318
|
+
/** @deprecated Use `type` instead */
|
|
5319
|
+
variant = input(undefined, ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
5320
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
5321
|
+
computedClass = computed(() => {
|
|
5322
|
+
const v = this.variant() ?? this.type();
|
|
5323
|
+
const variantClass = v === 'success' ? 'text-green-600 dark:text-green-400' :
|
|
5324
|
+
v === 'warning' ? 'text-amber-600 dark:text-amber-400' :
|
|
5325
|
+
v === 'info' ? 'text-blue-600 dark:text-blue-400' :
|
|
5326
|
+
'text-destructive';
|
|
5327
|
+
return cn('text-xs', variantClass, this.class());
|
|
5328
|
+
}, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
5329
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyValidatorHintDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
5330
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyValidatorHintDirective, isStandalone: true, selector: "[snyValidatorHint]", inputs: { when: { classPropertyName: "when", publicName: "when", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "alert" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
5331
|
+
}
|
|
5332
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyValidatorHintDirective, decorators: [{
|
|
5333
|
+
type: Directive,
|
|
5334
|
+
args: [{
|
|
5335
|
+
selector: '[snyValidatorHint]',
|
|
5336
|
+
standalone: true,
|
|
5337
|
+
host: {
|
|
5338
|
+
'role': 'alert',
|
|
5339
|
+
'[class]': 'computedClass()',
|
|
5340
|
+
},
|
|
5341
|
+
}]
|
|
5342
|
+
}], propDecorators: { when: [{ type: i0.Input, args: [{ isSignal: true, alias: "when", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5343
|
+
|
|
2355
5344
|
/*
|
|
2356
5345
|
* Public API Surface of @sonny-ui/core
|
|
2357
5346
|
*/
|
|
@@ -2361,5 +5350,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
2361
5350
|
* Generated bundle index. Do not edit.
|
|
2362
5351
|
*/
|
|
2363
5352
|
|
|
2364
|
-
export { SNY_ACCORDION, SNY_ACCORDION_ITEM, SNY_CONFIG, SNY_DIALOG_DATA, SNY_SHEET_DATA, SNY_TABLE, SNY_TABS, SnyAccordionContentDirective, SnyAccordionDirective, SnyAccordionItemDirective, SnyAccordionTriggerDirective, SnyAvatarComponent, SnyBadgeDirective, SnyBreadcrumbDirective, SnyBreadcrumbItemDirective, SnyBreadcrumbLinkDirective, SnyBreadcrumbListDirective, SnyBreadcrumbPageDirective, SnyBreadcrumbSeparatorDirective, SnyButtonDirective, SnyButtonGroupDirective, SnyCardContentDirective, SnyCardDescriptionDirective, SnyCardDirective, SnyCardFooterDirective, SnyCardHeaderDirective, SnyCardTitleDirective, SnyCheckboxDirective, SnyComboboxComponent, SnyDialogCloseDirective, SnyDialogContentDirective, SnyDialogDescriptionDirective, SnyDialogFooterDirective, SnyDialogHeaderDirective, SnyDialogRef, SnyDialogService, SnyDialogTitleDirective, SnyInputDirective, SnyLabelDirective, SnyLoaderComponent, SnyRadioDirective, SnySelectComponent, SnySheetCloseDirective, SnySheetContentDirective, SnySheetDescriptionDirective, SnySheetHeaderDirective, SnySheetRef, SnySheetService, SnySheetTitleDirective, SnySkeletonDirective, SnySliderComponent, SnySwitchComponent, SnyTableBodyDirective, SnyTableCaptionDirective, SnyTableCellDirective, SnyTableDirective, SnyTableFooterDirective, SnyTableHeadDirective, SnyTableHeaderDirective, SnyTableRowDirective, SnyTabsContentDirective, SnyTabsDirective, SnyTabsListDirective, SnyTabsTriggerDirective, SnyToastService, SnyToasterComponent, SnyToggleDirective, ThemeService, avatarVariants, badgeVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxVariants, cn, comboboxTriggerVariants, inputVariants, labelVariants, loaderVariants, provideSonnyUI, radioVariants, selectTriggerVariants, skeletonVariants, sliderTrackVariants, switchTrackVariants, tableCellVariants, tableVariants, tabsListVariants, tabsTriggerVariants, toastVariants, toggleVariants };
|
|
5353
|
+
export { SNY_ACCORDION, SNY_ACCORDION_ITEM, SNY_CAROUSEL, SNY_CHAT_BUBBLE, SNY_CONFIG, SNY_DIALOG_DATA, SNY_DRAWER, SNY_DROPDOWN, SNY_FAB, SNY_SHEET_DATA, SNY_STEPS, SNY_TABLE, SNY_TABS, SNY_TIMELINE, SnyAccordionContentDirective, SnyAccordionDirective, SnyAccordionItemDirective, SnyAccordionTriggerDirective, SnyAlertDescriptionDirective, SnyAlertDirective, SnyAlertTitleDirective, SnyAvatarComponent, SnyBadgeDirective, SnyBreadcrumbDirective, SnyBreadcrumbItemDirective, SnyBreadcrumbLinkDirective, SnyBreadcrumbListDirective, SnyBreadcrumbPageDirective, SnyBreadcrumbSeparatorDirective, SnyButtonDirective, SnyButtonGroupDirective, SnyCalendarComponent, SnyCardContentDirective, SnyCardDescriptionDirective, SnyCardDirective, SnyCardFooterDirective, SnyCardHeaderDirective, SnyCardTitleDirective, SnyCarouselContentDirective, SnyCarouselDirective, SnyCarouselItemDirective, SnyCarouselNextDirective, SnyCarouselPrevDirective, SnyChatBubbleAvatarDirective, SnyChatBubbleBodyDirective, SnyChatBubbleContentDirective, SnyChatBubbleDirective, SnyChatBubbleFooterDirective, SnyChatBubbleHeaderDirective, SnyCheckboxDirective, SnyComboboxComponent, SnyDialogCloseDirective, SnyDialogContentDirective, SnyDialogDescriptionDirective, SnyDialogFooterDirective, SnyDialogHeaderDirective, SnyDialogRef, SnyDialogService, SnyDialogTitleDirective, SnyDiffComponent, SnyDividerComponent, SnyDockDirective, SnyDockItemDirective, SnyDrawerContentDirective, SnyDrawerLayoutComponent, SnyDrawerLayoutDirective, SnyDrawerSideDirective, SnyDropdownContentDirective, SnyDropdownDirective, SnyDropdownTriggerDirective, SnyFabActionDirective, SnyFabDirective, SnyFabTriggerDirective, SnyFieldsetContentDirective, SnyFieldsetDirective, SnyFieldsetLegendDirective, SnyFileInputComponent, SnyIndicatorBadgeDirective, SnyIndicatorDirective, SnyInputDirective, SnyKbdDirective, SnyLabelDirective, SnyLinkDirective, SnyListDirective, SnyListItemActionDirective, SnyListItemContentDirective, SnyListItemDirective, SnyListItemIconDirective, SnyLoaderComponent, SnyMenuContentDirective, SnyMenuItemDirective, SnyMenuLabelDirective, SnyMenuSeparatorDirective, SnyNavbarBrandDirective, SnyNavbarContentDirective, SnyNavbarDirective, SnyNavbarEndDirective, SnyPaginationComponent, SnyProgressComponent, SnyRadialProgressComponent, SnyRadioDirective, SnyRatingComponent, SnySelectComponent, SnySheetCloseDirective, SnySheetContentDirective, SnySheetDescriptionDirective, SnySheetHeaderDirective, SnySheetRef, SnySheetService, SnySheetTitleDirective, SnySkeletonDirective, SnySliderComponent, SnyStatDescriptionDirective, SnyStatDirective, SnyStatFigureDirective, SnyStatTitleDirective, SnyStatValueDirective, SnyStatusDirective, SnyStepDirective, SnyStepsDirective, SnySwitchComponent, SnyTableBodyDirective, SnyTableCaptionDirective, SnyTableCellDirective, SnyTableDirective, SnyTableFooterDirective, SnyTableHeadDirective, SnyTableHeaderDirective, SnyTableRowDirective, SnyTabsContentDirective, SnyTabsDirective, SnyTabsListDirective, SnyTabsTriggerDirective, SnyTextareaDirective, SnyTimelineDirective, SnyTimelineEndDirective, SnyTimelineItemDirective, SnyTimelineMiddleDirective, SnyTimelineStartDirective, SnyToastService, SnyToasterComponent, SnyToggleDirective, SnyTooltipDirective, SnyValidatorDirective, SnyValidatorHintDirective, ThemeService, alertVariants, avatarVariants, badgeVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxVariants, cn, comboboxTriggerVariants, dividerVariants, dropdownContentVariants, dropdownItemVariants, fieldsetVariants, fileInputVariants, inputVariants, kbdVariants, labelVariants, linkVariants, loaderVariants, paginationItemVariants, progressBarVariants, progressTrackVariants, provideSonnyUI, radioVariants, ratingVariants, selectTriggerVariants, skeletonVariants, sliderTrackVariants, statusVariants, switchTrackVariants, tableCellVariants, tableVariants, tabsListVariants, tabsTriggerVariants, textareaVariants, toastVariants, toggleVariants, tooltipVariants };
|
|
2365
5354
|
//# sourceMappingURL=sonny-ui-core.mjs.map
|