ng-blatui 1.21.0 → 1.22.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.
@@ -5949,6 +5949,181 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
5949
5949
  }]
5950
5950
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
5951
5951
 
5952
+ /** A live countdown to a target time (`role="timer"`). SSR-safe — ticks only in the browser. */
5953
+ class BuiCountdown {
5954
+ to = input.required(/* @ts-ignore */
5955
+ ...(ngDevMode ? [{ debugName: "to" }] : /* istanbul ignore next */ []));
5956
+ expired = input('Expired', /* @ts-ignore */
5957
+ ...(ngDevMode ? [{ debugName: "expired" }] : /* istanbul ignore next */ []));
5958
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
5959
+ now = signal(Date.now(), /* @ts-ignore */
5960
+ ...(ngDevMode ? [{ debugName: "now" }] : /* istanbul ignore next */ []));
5961
+ timer;
5962
+ targetMs = computed(() => new Date(this.to()).getTime(), /* @ts-ignore */
5963
+ ...(ngDevMode ? [{ debugName: "targetMs" }] : /* istanbul ignore next */ []));
5964
+ diff = computed(() => Math.max(0, this.targetMs() - this.now()), /* @ts-ignore */
5965
+ ...(ngDevMode ? [{ debugName: "diff" }] : /* istanbul ignore next */ []));
5966
+ done = computed(() => this.diff() <= 0, /* @ts-ignore */
5967
+ ...(ngDevMode ? [{ debugName: "done" }] : /* istanbul ignore next */ []));
5968
+ units = computed(() => {
5969
+ const diff = this.diff();
5970
+ const pad = (value) => String(value).padStart(2, '0');
5971
+ return [
5972
+ { key: 'days', label: 'Days', value: pad(Math.floor(diff / 86_400_000)) },
5973
+ { key: 'hours', label: 'Hrs', value: pad(Math.floor(diff / 3_600_000) % 24) },
5974
+ { key: 'minutes', label: 'Min', value: pad(Math.floor(diff / 60_000) % 60) },
5975
+ { key: 'seconds', label: 'Sec', value: pad(Math.floor(diff / 1000) % 60) },
5976
+ ];
5977
+ }, /* @ts-ignore */
5978
+ ...(ngDevMode ? [{ debugName: "units" }] : /* istanbul ignore next */ []));
5979
+ computedClass = computed(() => cn('inline-flex items-center gap-2', this.userClass()), /* @ts-ignore */
5980
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
5981
+ constructor() {
5982
+ afterNextRender(() => {
5983
+ this.timer = setInterval(() => {
5984
+ this.now.set(Date.now());
5985
+ }, 1000);
5986
+ });
5987
+ }
5988
+ ngOnDestroy() {
5989
+ if (this.timer !== undefined) {
5990
+ clearInterval(this.timer);
5991
+ }
5992
+ }
5993
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiCountdown, deps: [], target: i0.ɵɵFactoryTarget.Component });
5994
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: BuiCountdown, isStandalone: true, selector: "bui-countdown", inputs: { to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: true, transformFunction: null }, expired: { classPropertyName: "expired", publicName: "expired", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "countdown", "role": "timer", "aria-live": "off" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
5995
+ @if (done()) {
5996
+ <span data-slot="countdown-expired" class="text-sm font-medium text-muted-foreground">
5997
+ {{ expired() }}
5998
+ </span>
5999
+ } @else {
6000
+ <div class="flex items-center gap-2">
6001
+ @for (unit of units(); track unit.key) {
6002
+ <div
6003
+ data-slot="countdown-unit"
6004
+ class="flex min-w-[3.25rem] flex-col items-center rounded-lg border bg-card px-2 py-1.5 shadow-xs"
6005
+ >
6006
+ <span class="text-xl font-bold tabular-nums">{{ unit.value }}</span>
6007
+ <span class="text-[10px] font-medium tracking-wide text-muted-foreground uppercase">
6008
+ {{ unit.label }}
6009
+ </span>
6010
+ </div>
6011
+ }
6012
+ </div>
6013
+ }
6014
+ `, isInline: true });
6015
+ }
6016
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiCountdown, decorators: [{
6017
+ type: Component,
6018
+ args: [{
6019
+ selector: 'bui-countdown',
6020
+ host: {
6021
+ 'data-slot': 'countdown',
6022
+ role: 'timer',
6023
+ 'aria-live': 'off',
6024
+ '[class]': 'computedClass()',
6025
+ },
6026
+ template: `
6027
+ @if (done()) {
6028
+ <span data-slot="countdown-expired" class="text-sm font-medium text-muted-foreground">
6029
+ {{ expired() }}
6030
+ </span>
6031
+ } @else {
6032
+ <div class="flex items-center gap-2">
6033
+ @for (unit of units(); track unit.key) {
6034
+ <div
6035
+ data-slot="countdown-unit"
6036
+ class="flex min-w-[3.25rem] flex-col items-center rounded-lg border bg-card px-2 py-1.5 shadow-xs"
6037
+ >
6038
+ <span class="text-xl font-bold tabular-nums">{{ unit.value }}</span>
6039
+ <span class="text-[10px] font-medium tracking-wide text-muted-foreground uppercase">
6040
+ {{ unit.label }}
6041
+ </span>
6042
+ </div>
6043
+ }
6044
+ </div>
6045
+ }
6046
+ `,
6047
+ }]
6048
+ }], ctorParameters: () => [], propDecorators: { to: [{ type: i0.Input, args: [{ isSignal: true, alias: "to", required: true }] }], expired: [{ type: i0.Input, args: [{ isSignal: true, alias: "expired", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
6049
+
6050
+ /**
6051
+ * Animates a number counting up to its target on first render. The animated digits are
6052
+ * `aria-hidden`; an sr-only span carries the final value (SSR/no-JS read the real number).
6053
+ */
6054
+ class BuiNumberTicker {
6055
+ value = input(0, /* @ts-ignore */
6056
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
6057
+ from = input(0, /* @ts-ignore */
6058
+ ...(ngDevMode ? [{ debugName: "from" }] : /* istanbul ignore next */ []));
6059
+ duration = input(1500, /* @ts-ignore */
6060
+ ...(ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []));
6061
+ decimals = input(0, /* @ts-ignore */
6062
+ ...(ngDevMode ? [{ debugName: "decimals" }] : /* istanbul ignore next */ []));
6063
+ prefix = input('', /* @ts-ignore */
6064
+ ...(ngDevMode ? [{ debugName: "prefix" }] : /* istanbul ignore next */ []));
6065
+ suffix = input('', /* @ts-ignore */
6066
+ ...(ngDevMode ? [{ debugName: "suffix" }] : /* istanbul ignore next */ []));
6067
+ separator = input(',', /* @ts-ignore */
6068
+ ...(ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []));
6069
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
6070
+ current = signal(0, /* @ts-ignore */
6071
+ ...(ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []));
6072
+ computedClass = computed(() => cn('tabular-nums', this.userClass()), /* @ts-ignore */
6073
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
6074
+ constructor() {
6075
+ afterNextRender(() => {
6076
+ this.animate();
6077
+ });
6078
+ }
6079
+ format(value) {
6080
+ const fixed = value.toFixed(Math.max(0, this.decimals()));
6081
+ const [integer, decimal] = fixed.split('.');
6082
+ const decimalPart = decimal ? `.${decimal}` : '';
6083
+ return this.prefix() + this.group(integer) + decimalPart + this.suffix();
6084
+ }
6085
+ group(value) {
6086
+ return value.length <= 3
6087
+ ? value
6088
+ : this.group(value.slice(0, -3)) + this.separator() + value.slice(-3);
6089
+ }
6090
+ animate() {
6091
+ const start = this.from();
6092
+ const end = this.value();
6093
+ const duration = this.duration();
6094
+ if (duration <= 0) {
6095
+ this.current.set(end);
6096
+ return;
6097
+ }
6098
+ this.current.set(start);
6099
+ const startTime = performance.now();
6100
+ const step = (time) => {
6101
+ const progress = Math.min(1, (time - startTime) / duration);
6102
+ this.current.set(start + (end - start) * progress);
6103
+ if (progress < 1) {
6104
+ requestAnimationFrame(step);
6105
+ }
6106
+ };
6107
+ requestAnimationFrame(step);
6108
+ }
6109
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiNumberTicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
6110
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: BuiNumberTicker, isStandalone: true, selector: "bui-number-ticker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, decimals: { classPropertyName: "decimals", publicName: "decimals", isSignal: true, isRequired: false, transformFunction: null }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, suffix: { classPropertyName: "suffix", publicName: "suffix", isSignal: true, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "number-ticker" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
6111
+ <span aria-hidden="true">{{ format(current()) }}</span>
6112
+ <span class="sr-only">{{ format(value()) }}</span>
6113
+ `, isInline: true });
6114
+ }
6115
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiNumberTicker, decorators: [{
6116
+ type: Component,
6117
+ args: [{
6118
+ selector: 'bui-number-ticker',
6119
+ host: { 'data-slot': 'number-ticker', '[class]': 'computedClass()' },
6120
+ template: `
6121
+ <span aria-hidden="true">{{ format(current()) }}</span>
6122
+ <span class="sr-only">{{ format(value()) }}</span>
6123
+ `,
6124
+ }]
6125
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], from: [{ type: i0.Input, args: [{ isSignal: true, alias: "from", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], decimals: [{ type: i0.Input, args: [{ isSignal: true, alias: "decimals", required: false }] }], prefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "prefix", required: false }] }], suffix: [{ type: i0.Input, args: [{ isSignal: true, alias: "suffix", required: false }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
6126
+
5952
6127
  /*
5953
6128
  * Public API Surface of ng-blatui
5954
6129
  */
@@ -5957,5 +6132,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
5957
6132
  * Generated bundle index. Do not edit.
5958
6133
  */
5959
6134
 
5960
- export { BuiAccordion, BuiAccordionContent, BuiAccordionItem, BuiAccordionTrigger, BuiAlert, BuiAlertDescription, BuiAlertDialogAction, BuiAlertDialogCancel, BuiAlertDialogContent, BuiAlertDialogDescription, BuiAlertDialogFooter, BuiAlertDialogHeader, BuiAlertDialogTitle, BuiAlertTitle, BuiAspectRatio, BuiAutosizeTextarea, BuiAvatar, BuiAvatarGroup, BuiBackToTop, BuiBadge, BuiBanner, BuiBreadcrumb, BuiBreadcrumbEllipsis, BuiBreadcrumbItem, BuiBreadcrumbLink, BuiBreadcrumbList, BuiBreadcrumbPage, BuiBreadcrumbSeparator, BuiButton, BuiButtonGroup, BuiButtonGroupText, BuiCard, BuiCardAction, BuiCardContent, BuiCardDescription, BuiCardFooter, BuiCardHeader, BuiCardTitle, BuiCheckbox, BuiCodeBlock, BuiCollapsible, BuiCollapsibleContent, BuiCollapsibleTrigger, BuiCombobox, BuiComparisonTable, BuiContainer, BuiCopyButton, BuiDialogContent, BuiDialogDescription, BuiDialogFooter, BuiDialogHeader, BuiDialogTitle, BuiDotPattern, BuiDropdownMenu, BuiDropdownMenuItem, BuiDropdownMenuLabel, BuiDropdownMenuSeparator, BuiEmpty, BuiEmptyContent, BuiEmptyDescription, BuiEmptyHeader, BuiEmptyMedia, BuiEmptyTitle, BuiField, BuiFieldContent, BuiFieldDescription, BuiFieldError, BuiFieldGroup, BuiFieldLabel, BuiFieldLegend, BuiFieldSeparator, BuiFieldSet, BuiFieldTitle, BuiFlipCard, BuiGridPattern, BuiHoverCard, BuiHoverCardContent, BuiInput, BuiInputGroup, BuiInputGroupAddon, BuiInputGroupButton, BuiInputGroupInput, BuiInputGroupText, BuiItem, BuiItemActions, BuiItemContent, BuiItemDescription, BuiItemGroup, BuiItemMedia, BuiItemTitle, BuiKbd, BuiLabel, BuiMenubar, BuiMenubarTrigger, BuiMeter, BuiPagination, BuiPaginationContent, BuiPaginationEllipsis, BuiPaginationItem, BuiPaginationLink, BuiPopover, BuiPopoverContent, BuiProgress, BuiQuantitySelector, BuiRadioGroup, BuiRadioGroupItem, BuiRating, BuiScrollArea, BuiSegmentedControl, BuiSelect, BuiSeparator, BuiSkeleton, BuiSlider, BuiSpinner, BuiSpotlightCard, BuiStat, BuiSwitch, BuiTabList, BuiTabPanel, BuiTabTrigger, BuiTable, BuiTableBody, BuiTableCaption, BuiTableCell, BuiTableContainer, BuiTableFooter, BuiTableHead, BuiTableHeader, BuiTableRow, BuiTabs, BuiTerminal, BuiTextarea, BuiThemeCustomizer, BuiTiltCard, BuiToggle, BuiTooltip, BuiTooltipContent, BuiTypography, BuiVisuallyHidden, THEME_TOKENS, ThemeStore, buttonVariants, cn, toggleVariants };
6135
+ export { BuiAccordion, BuiAccordionContent, BuiAccordionItem, BuiAccordionTrigger, BuiAlert, BuiAlertDescription, BuiAlertDialogAction, BuiAlertDialogCancel, BuiAlertDialogContent, BuiAlertDialogDescription, BuiAlertDialogFooter, BuiAlertDialogHeader, BuiAlertDialogTitle, BuiAlertTitle, BuiAspectRatio, BuiAutosizeTextarea, BuiAvatar, BuiAvatarGroup, BuiBackToTop, BuiBadge, BuiBanner, BuiBreadcrumb, BuiBreadcrumbEllipsis, BuiBreadcrumbItem, BuiBreadcrumbLink, BuiBreadcrumbList, BuiBreadcrumbPage, BuiBreadcrumbSeparator, BuiButton, BuiButtonGroup, BuiButtonGroupText, BuiCard, BuiCardAction, BuiCardContent, BuiCardDescription, BuiCardFooter, BuiCardHeader, BuiCardTitle, BuiCheckbox, BuiCodeBlock, BuiCollapsible, BuiCollapsibleContent, BuiCollapsibleTrigger, BuiCombobox, BuiComparisonTable, BuiContainer, BuiCopyButton, BuiCountdown, BuiDialogContent, BuiDialogDescription, BuiDialogFooter, BuiDialogHeader, BuiDialogTitle, BuiDotPattern, BuiDropdownMenu, BuiDropdownMenuItem, BuiDropdownMenuLabel, BuiDropdownMenuSeparator, BuiEmpty, BuiEmptyContent, BuiEmptyDescription, BuiEmptyHeader, BuiEmptyMedia, BuiEmptyTitle, BuiField, BuiFieldContent, BuiFieldDescription, BuiFieldError, BuiFieldGroup, BuiFieldLabel, BuiFieldLegend, BuiFieldSeparator, BuiFieldSet, BuiFieldTitle, BuiFlipCard, BuiGridPattern, BuiHoverCard, BuiHoverCardContent, BuiInput, BuiInputGroup, BuiInputGroupAddon, BuiInputGroupButton, BuiInputGroupInput, BuiInputGroupText, BuiItem, BuiItemActions, BuiItemContent, BuiItemDescription, BuiItemGroup, BuiItemMedia, BuiItemTitle, BuiKbd, BuiLabel, BuiMenubar, BuiMenubarTrigger, BuiMeter, BuiNumberTicker, BuiPagination, BuiPaginationContent, BuiPaginationEllipsis, BuiPaginationItem, BuiPaginationLink, BuiPopover, BuiPopoverContent, BuiProgress, BuiQuantitySelector, BuiRadioGroup, BuiRadioGroupItem, BuiRating, BuiScrollArea, BuiSegmentedControl, BuiSelect, BuiSeparator, BuiSkeleton, BuiSlider, BuiSpinner, BuiSpotlightCard, BuiStat, BuiSwitch, BuiTabList, BuiTabPanel, BuiTabTrigger, BuiTable, BuiTableBody, BuiTableCaption, BuiTableCell, BuiTableContainer, BuiTableFooter, BuiTableHead, BuiTableHeader, BuiTableRow, BuiTabs, BuiTerminal, BuiTextarea, BuiThemeCustomizer, BuiTiltCard, BuiToggle, BuiTooltip, BuiTooltipContent, BuiTypography, BuiVisuallyHidden, THEME_TOKENS, ThemeStore, buttonVariants, cn, toggleVariants };
5961
6136
  //# sourceMappingURL=ng-blatui.mjs.map