ng-blatui 1.10.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3811,6 +3811,190 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
3811
3811
  }]
3812
3812
  }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], change: [{ type: i0.Input, args: [{ isSignal: true, alias: "change", required: false }] }], trend: [{ type: i0.Input, args: [{ isSignal: true, alias: "trend", required: false }] }], caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "caption", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
3813
3813
 
3814
+ /**
3815
+ * Hover-triggered card on the Angular CDK overlay. Opens on hover/focus after a delay
3816
+ * and stays open while the pointer is over the card. SSR-safe (browser-only, on hover).
3817
+ */
3818
+ class BuiHoverCard {
3819
+ content = input.required({ ...(ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {}), alias: 'buiHoverCard' });
3820
+ openDelay = input(400, /* @ts-ignore */
3821
+ ...(ngDevMode ? [{ debugName: "openDelay" }] : /* istanbul ignore next */ []));
3822
+ closeDelay = input(100, /* @ts-ignore */
3823
+ ...(ngDevMode ? [{ debugName: "closeDelay" }] : /* istanbul ignore next */ []));
3824
+ overlay = inject(Overlay);
3825
+ host = inject(ElementRef);
3826
+ viewContainerRef = inject(ViewContainerRef);
3827
+ overlayRef = null;
3828
+ timer;
3829
+ scheduleOpen() {
3830
+ this.clearTimer();
3831
+ this.timer = setTimeout(() => {
3832
+ this.open();
3833
+ }, this.openDelay());
3834
+ }
3835
+ scheduleClose() {
3836
+ this.clearTimer();
3837
+ this.timer = setTimeout(() => {
3838
+ this.close();
3839
+ }, this.closeDelay());
3840
+ }
3841
+ clearTimer() {
3842
+ if (this.timer === undefined) {
3843
+ return;
3844
+ }
3845
+ clearTimeout(this.timer);
3846
+ this.timer = undefined;
3847
+ }
3848
+ open() {
3849
+ if (this.overlayRef) {
3850
+ return;
3851
+ }
3852
+ const positionStrategy = this.overlay
3853
+ .position()
3854
+ .flexibleConnectedTo(this.host)
3855
+ .withPositions([
3856
+ { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: 4 },
3857
+ { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -4 },
3858
+ ]);
3859
+ const overlayReference = this.overlay.create({
3860
+ positionStrategy,
3861
+ scrollStrategy: this.overlay.scrollStrategies.reposition(),
3862
+ });
3863
+ overlayReference.attach(new TemplatePortal(this.content(), this.viewContainerRef));
3864
+ overlayReference.overlayElement.addEventListener('mouseenter', () => {
3865
+ this.clearTimer();
3866
+ });
3867
+ overlayReference.overlayElement.addEventListener('mouseleave', () => {
3868
+ this.scheduleClose();
3869
+ });
3870
+ this.overlayRef = overlayReference;
3871
+ }
3872
+ close() {
3873
+ this.overlayRef?.dispose();
3874
+ this.overlayRef = null;
3875
+ }
3876
+ ngOnDestroy() {
3877
+ this.clearTimer();
3878
+ this.close();
3879
+ }
3880
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiHoverCard, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3881
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiHoverCard, isStandalone: true, selector: "[buiHoverCard]", inputs: { content: { classPropertyName: "content", publicName: "buiHoverCard", isSignal: true, isRequired: true, transformFunction: null }, openDelay: { classPropertyName: "openDelay", publicName: "openDelay", isSignal: true, isRequired: false, transformFunction: null }, closeDelay: { classPropertyName: "closeDelay", publicName: "closeDelay", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "scheduleOpen()", "mouseleave": "scheduleClose()", "focusin": "scheduleOpen()", "focusout": "scheduleClose()" } }, ngImport: i0 });
3882
+ }
3883
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiHoverCard, decorators: [{
3884
+ type: Directive,
3885
+ args: [{
3886
+ selector: '[buiHoverCard]',
3887
+ host: {
3888
+ '(mouseenter)': 'scheduleOpen()',
3889
+ '(mouseleave)': 'scheduleClose()',
3890
+ '(focusin)': 'scheduleOpen()',
3891
+ '(focusout)': 'scheduleClose()',
3892
+ },
3893
+ }]
3894
+ }], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "buiHoverCard", required: true }] }], openDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "openDelay", required: false }] }], closeDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeDelay", required: false }] }] } });
3895
+ /** Styling for the hover-card content root (inside the bound template). */
3896
+ class BuiHoverCardContent {
3897
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
3898
+ computedClass = computed(() => cn('z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none', this.userClass()), /* @ts-ignore */
3899
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
3900
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiHoverCardContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3901
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiHoverCardContent, isStandalone: true, selector: "[buiHoverCardContent]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "hover-card-content", "tabindex": "-1" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
3902
+ }
3903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiHoverCardContent, decorators: [{
3904
+ type: Directive,
3905
+ args: [{
3906
+ selector: '[buiHoverCardContent]',
3907
+ host: { 'data-slot': 'hover-card-content', tabindex: '-1', '[class]': 'computedClass()' },
3908
+ }]
3909
+ }], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
3910
+
3911
+ /** A dark code panel with an optional filename header and a copy button. */
3912
+ class BuiCodeBlock {
3913
+ code = input('', /* @ts-ignore */
3914
+ ...(ngDevMode ? [{ debugName: "code" }] : /* istanbul ignore next */ []));
3915
+ filename = input(null, /* @ts-ignore */
3916
+ ...(ngDevMode ? [{ debugName: "filename" }] : /* istanbul ignore next */ []));
3917
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
3918
+ copied = signal(false, /* @ts-ignore */
3919
+ ...(ngDevMode ? [{ debugName: "copied" }] : /* istanbul ignore next */ []));
3920
+ computedClass = computed(() => cn('group/code-block relative block overflow-hidden rounded-lg border border-zinc-800 bg-zinc-950 text-zinc-100', this.userClass()), /* @ts-ignore */
3921
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
3922
+ async copy() {
3923
+ try {
3924
+ await navigator.clipboard.writeText(this.code());
3925
+ this.copied.set(true);
3926
+ setTimeout(() => {
3927
+ this.copied.set(false);
3928
+ }, 1600);
3929
+ }
3930
+ catch {
3931
+ // Clipboard unavailable — ignore.
3932
+ }
3933
+ }
3934
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiCodeBlock, deps: [], target: i0.ɵɵFactoryTarget.Component });
3935
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: BuiCodeBlock, isStandalone: true, selector: "bui-code-block", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: false, transformFunction: null }, filename: { classPropertyName: "filename", publicName: "filename", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "code-block" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
3936
+ @if (filename()) {
3937
+ <div class="flex items-center justify-between border-b border-white/10 px-4 py-2">
3938
+ <span class="font-mono text-xs text-zinc-400">{{ filename() }}</span>
3939
+ <button
3940
+ type="button"
3941
+ aria-label="Copy code"
3942
+ class="text-xs text-zinc-400 transition-colors hover:text-zinc-100"
3943
+ (click)="copy()"
3944
+ >
3945
+ {{ copied() ? 'Copied' : 'Copy' }}
3946
+ </button>
3947
+ </div>
3948
+ } @else {
3949
+ <button
3950
+ type="button"
3951
+ aria-label="Copy code"
3952
+ class="absolute end-2 top-2 z-10 rounded-md px-1.5 py-1 text-xs text-zinc-400 opacity-0 transition-all group-hover/code-block:opacity-100 hover:bg-white/10 hover:text-zinc-100 focus-visible:opacity-100"
3953
+ (click)="copy()"
3954
+ >
3955
+ {{ copied() ? 'Copied' : 'Copy' }}
3956
+ </button>
3957
+ }
3958
+ <pre
3959
+ class="overflow-x-auto p-4 text-[13px] leading-relaxed"
3960
+ ><code class="font-mono">{{ code() }}</code></pre>
3961
+ `, isInline: true });
3962
+ }
3963
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiCodeBlock, decorators: [{
3964
+ type: Component,
3965
+ args: [{
3966
+ selector: 'bui-code-block',
3967
+ host: { 'data-slot': 'code-block', '[class]': 'computedClass()' },
3968
+ template: `
3969
+ @if (filename()) {
3970
+ <div class="flex items-center justify-between border-b border-white/10 px-4 py-2">
3971
+ <span class="font-mono text-xs text-zinc-400">{{ filename() }}</span>
3972
+ <button
3973
+ type="button"
3974
+ aria-label="Copy code"
3975
+ class="text-xs text-zinc-400 transition-colors hover:text-zinc-100"
3976
+ (click)="copy()"
3977
+ >
3978
+ {{ copied() ? 'Copied' : 'Copy' }}
3979
+ </button>
3980
+ </div>
3981
+ } @else {
3982
+ <button
3983
+ type="button"
3984
+ aria-label="Copy code"
3985
+ class="absolute end-2 top-2 z-10 rounded-md px-1.5 py-1 text-xs text-zinc-400 opacity-0 transition-all group-hover/code-block:opacity-100 hover:bg-white/10 hover:text-zinc-100 focus-visible:opacity-100"
3986
+ (click)="copy()"
3987
+ >
3988
+ {{ copied() ? 'Copied' : 'Copy' }}
3989
+ </button>
3990
+ }
3991
+ <pre
3992
+ class="overflow-x-auto p-4 text-[13px] leading-relaxed"
3993
+ ><code class="font-mono">{{ code() }}</code></pre>
3994
+ `,
3995
+ }]
3996
+ }], propDecorators: { code: [{ type: i0.Input, args: [{ isSignal: true, alias: "code", required: false }] }], filename: [{ type: i0.Input, args: [{ isSignal: true, alias: "filename", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
3997
+
3814
3998
  /*
3815
3999
  * Public API Surface of ng-blatui
3816
4000
  */
@@ -3819,5 +4003,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
3819
4003
  * Generated bundle index. Do not edit.
3820
4004
  */
3821
4005
 
3822
- export { BuiAccordion, BuiAccordionContent, BuiAccordionItem, BuiAccordionTrigger, BuiAlert, BuiAlertDescription, BuiAlertTitle, BuiAspectRatio, BuiAvatar, BuiAvatarGroup, BuiBadge, BuiBanner, BuiBreadcrumb, BuiBreadcrumbEllipsis, BuiBreadcrumbItem, BuiBreadcrumbLink, BuiBreadcrumbList, BuiBreadcrumbPage, BuiBreadcrumbSeparator, BuiButton, BuiButtonGroup, BuiButtonGroupText, BuiCard, BuiCardAction, BuiCardContent, BuiCardDescription, BuiCardFooter, BuiCardHeader, BuiCardTitle, BuiCheckbox, BuiCollapsible, BuiCollapsibleContent, BuiCollapsibleTrigger, BuiContainer, BuiCopyButton, BuiDialogContent, BuiDialogDescription, BuiDialogFooter, BuiDialogHeader, BuiDialogTitle, BuiEmpty, BuiEmptyContent, BuiEmptyDescription, BuiEmptyHeader, BuiEmptyMedia, BuiEmptyTitle, BuiField, BuiFieldContent, BuiFieldDescription, BuiFieldError, BuiFieldGroup, BuiFieldLabel, BuiFieldLegend, BuiFieldSeparator, BuiFieldSet, BuiFieldTitle, BuiInput, BuiInputGroup, BuiInputGroupAddon, BuiInputGroupButton, BuiInputGroupInput, BuiInputGroupText, BuiItem, BuiItemActions, BuiItemContent, BuiItemDescription, BuiItemGroup, BuiItemMedia, BuiItemTitle, BuiKbd, BuiLabel, BuiMeter, BuiPagination, BuiPaginationContent, BuiPaginationEllipsis, BuiPaginationItem, BuiPaginationLink, BuiPopover, BuiPopoverContent, BuiProgress, BuiRadioGroup, BuiRadioGroupItem, BuiScrollArea, BuiSeparator, BuiSkeleton, BuiSpinner, BuiStat, BuiSwitch, BuiTabList, BuiTabPanel, BuiTabTrigger, BuiTable, BuiTableBody, BuiTableCaption, BuiTableCell, BuiTableContainer, BuiTableFooter, BuiTableHead, BuiTableHeader, BuiTableRow, BuiTabs, BuiTextarea, BuiThemeCustomizer, BuiToggle, BuiTooltip, BuiTooltipContent, BuiVisuallyHidden, THEME_TOKENS, ThemeStore, buttonVariants, cn, toggleVariants };
4006
+ export { BuiAccordion, BuiAccordionContent, BuiAccordionItem, BuiAccordionTrigger, BuiAlert, BuiAlertDescription, BuiAlertTitle, BuiAspectRatio, BuiAvatar, BuiAvatarGroup, BuiBadge, BuiBanner, BuiBreadcrumb, BuiBreadcrumbEllipsis, BuiBreadcrumbItem, BuiBreadcrumbLink, BuiBreadcrumbList, BuiBreadcrumbPage, BuiBreadcrumbSeparator, BuiButton, BuiButtonGroup, BuiButtonGroupText, BuiCard, BuiCardAction, BuiCardContent, BuiCardDescription, BuiCardFooter, BuiCardHeader, BuiCardTitle, BuiCheckbox, BuiCodeBlock, BuiCollapsible, BuiCollapsibleContent, BuiCollapsibleTrigger, BuiContainer, BuiCopyButton, BuiDialogContent, BuiDialogDescription, BuiDialogFooter, BuiDialogHeader, BuiDialogTitle, BuiEmpty, BuiEmptyContent, BuiEmptyDescription, BuiEmptyHeader, BuiEmptyMedia, BuiEmptyTitle, BuiField, BuiFieldContent, BuiFieldDescription, BuiFieldError, BuiFieldGroup, BuiFieldLabel, BuiFieldLegend, BuiFieldSeparator, BuiFieldSet, BuiFieldTitle, BuiHoverCard, BuiHoverCardContent, BuiInput, BuiInputGroup, BuiInputGroupAddon, BuiInputGroupButton, BuiInputGroupInput, BuiInputGroupText, BuiItem, BuiItemActions, BuiItemContent, BuiItemDescription, BuiItemGroup, BuiItemMedia, BuiItemTitle, BuiKbd, BuiLabel, BuiMeter, BuiPagination, BuiPaginationContent, BuiPaginationEllipsis, BuiPaginationItem, BuiPaginationLink, BuiPopover, BuiPopoverContent, BuiProgress, BuiRadioGroup, BuiRadioGroupItem, BuiScrollArea, BuiSeparator, BuiSkeleton, BuiSpinner, BuiStat, BuiSwitch, BuiTabList, BuiTabPanel, BuiTabTrigger, BuiTable, BuiTableBody, BuiTableCaption, BuiTableCell, BuiTableContainer, BuiTableFooter, BuiTableHead, BuiTableHeader, BuiTableRow, BuiTabs, BuiTextarea, BuiThemeCustomizer, BuiToggle, BuiTooltip, BuiTooltipContent, BuiVisuallyHidden, THEME_TOKENS, ThemeStore, buttonVariants, cn, toggleVariants };
3823
4007
  //# sourceMappingURL=ng-blatui.mjs.map