ng-blatui 1.8.0 → 1.10.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.
- package/fesm2022/ng-blatui.mjs +303 -5
- package/fesm2022/ng-blatui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ng-blatui.d.ts +79 -1
package/fesm2022/ng-blatui.mjs
CHANGED
|
@@ -81,7 +81,7 @@ const VARIANTS = {
|
|
|
81
81
|
destructive: 'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
82
82
|
outline: 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
|
|
83
83
|
};
|
|
84
|
-
const TONES$
|
|
84
|
+
const TONES$2 = {
|
|
85
85
|
success: {
|
|
86
86
|
soft: 'border-transparent bg-success/10 text-success dark:bg-success/15',
|
|
87
87
|
solid: 'border-transparent bg-success text-success-foreground',
|
|
@@ -143,7 +143,7 @@ class BuiBadge {
|
|
|
143
143
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
144
144
|
computedClass = computed(() => {
|
|
145
145
|
const tone = this.tone();
|
|
146
|
-
const toneOrVariant = tone === null ? brandClass(this.variant()) : TONES$
|
|
146
|
+
const toneOrVariant = tone === null ? brandClass(this.variant()) : TONES$2[tone][intensityFor(this.variant())];
|
|
147
147
|
return cn(BASE, SIZES$2[this.size()], toneOrVariant, this.userClass());
|
|
148
148
|
}, /* @ts-ignore */
|
|
149
149
|
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
@@ -2801,7 +2801,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
2801
2801
|
}]
|
|
2802
2802
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2803
2803
|
|
|
2804
|
-
const TONES = {
|
|
2804
|
+
const TONES$1 = {
|
|
2805
2805
|
default: 'bg-muted text-foreground border-border',
|
|
2806
2806
|
primary: 'bg-primary text-primary-foreground border-transparent',
|
|
2807
2807
|
info: 'bg-info/10 text-info border-info/25',
|
|
@@ -2824,7 +2824,7 @@ class BuiBanner {
|
|
|
2824
2824
|
show = signal(true, /* @ts-ignore */
|
|
2825
2825
|
...(ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []));
|
|
2826
2826
|
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
2827
|
-
computedClass = computed(() => cn('relative flex w-full items-center gap-3 border-b px-4 py-2.5 text-sm', TONES[this.tone()], this.userClass()), /* @ts-ignore */
|
|
2827
|
+
computedClass = computed(() => cn('relative flex w-full items-center gap-3 border-b px-4 py-2.5 text-sm', TONES$1[this.tone()], this.userClass()), /* @ts-ignore */
|
|
2828
2828
|
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2829
2829
|
ngOnInit() {
|
|
2830
2830
|
const key = this.persistKey();
|
|
@@ -3513,6 +3513,304 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
3513
3513
|
}]
|
|
3514
3514
|
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3515
3515
|
|
|
3516
|
+
/** A bordered group that composes inputs with addons (icons, text, buttons). */
|
|
3517
|
+
class BuiInputGroup {
|
|
3518
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3519
|
+
computedClass = computed(() => cn('group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[>textarea]:h-auto dark:bg-input/30', this.userClass()), /* @ts-ignore */
|
|
3520
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3521
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3522
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiInputGroup, isStandalone: true, selector: "[buiInputGroup]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input-group", "role": "group" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3523
|
+
}
|
|
3524
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroup, decorators: [{
|
|
3525
|
+
type: Directive,
|
|
3526
|
+
args: [{
|
|
3527
|
+
selector: '[buiInputGroup]',
|
|
3528
|
+
host: { 'data-slot': 'input-group', role: 'group', '[class]': 'computedClass()' },
|
|
3529
|
+
}]
|
|
3530
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3531
|
+
const ADDON_ALIGN = {
|
|
3532
|
+
'inline-start': 'order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]',
|
|
3533
|
+
'inline-end': 'order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]',
|
|
3534
|
+
'block-start': 'order-first w-full justify-start px-3 pt-3',
|
|
3535
|
+
'block-end': 'order-last w-full justify-start px-3 pb-3',
|
|
3536
|
+
};
|
|
3537
|
+
class BuiInputGroupAddon {
|
|
3538
|
+
align = input('inline-start', /* @ts-ignore */
|
|
3539
|
+
...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
3540
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3541
|
+
computedClass = computed(() => cn("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", ADDON_ALIGN[this.align()], this.userClass()), /* @ts-ignore */
|
|
3542
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3543
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroupAddon, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3544
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiInputGroupAddon, isStandalone: true, selector: "[buiInputGroupAddon]", inputs: { align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input-group-addon" }, properties: { "attr.data-align": "align()", "class": "computedClass()" } }, ngImport: i0 });
|
|
3545
|
+
}
|
|
3546
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroupAddon, decorators: [{
|
|
3547
|
+
type: Directive,
|
|
3548
|
+
args: [{
|
|
3549
|
+
selector: '[buiInputGroupAddon]',
|
|
3550
|
+
host: {
|
|
3551
|
+
'data-slot': 'input-group-addon',
|
|
3552
|
+
'[attr.data-align]': 'align()',
|
|
3553
|
+
'[class]': 'computedClass()',
|
|
3554
|
+
},
|
|
3555
|
+
}]
|
|
3556
|
+
}], propDecorators: { align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3557
|
+
class BuiInputGroupInput {
|
|
3558
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3559
|
+
computedClass = computed(() => cn('w-full min-w-0 flex-1 rounded-none border-0 bg-transparent px-3 py-1 text-base shadow-none outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 md:text-sm', this.userClass()), /* @ts-ignore */
|
|
3560
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3561
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroupInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3562
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiInputGroupInput, isStandalone: true, selector: "input[buiInputGroupInput], textarea[buiInputGroupInput]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input-group-control" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3563
|
+
}
|
|
3564
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroupInput, decorators: [{
|
|
3565
|
+
type: Directive,
|
|
3566
|
+
args: [{
|
|
3567
|
+
selector: 'input[buiInputGroupInput], textarea[buiInputGroupInput]',
|
|
3568
|
+
host: { 'data-slot': 'input-group-control', '[class]': 'computedClass()' },
|
|
3569
|
+
}]
|
|
3570
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3571
|
+
class BuiInputGroupText {
|
|
3572
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3573
|
+
computedClass = computed(() => cn("flex items-center gap-2 text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4", this.userClass()), /* @ts-ignore */
|
|
3574
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3575
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroupText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3576
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiInputGroupText, isStandalone: true, selector: "[buiInputGroupText]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input-group-text" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3577
|
+
}
|
|
3578
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroupText, decorators: [{
|
|
3579
|
+
type: Directive,
|
|
3580
|
+
args: [{
|
|
3581
|
+
selector: '[buiInputGroupText]',
|
|
3582
|
+
host: { 'data-slot': 'input-group-text', '[class]': 'computedClass()' },
|
|
3583
|
+
}]
|
|
3584
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3585
|
+
const IG_BUTTON_BASE = "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
|
|
3586
|
+
const IG_BUTTON_VARIANTS = {
|
|
3587
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
3588
|
+
outline: 'bg-background hover:bg-accent hover:text-accent-foreground border shadow-xs',
|
|
3589
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/90 shadow-xs',
|
|
3590
|
+
};
|
|
3591
|
+
const IG_BUTTON_SIZES = {
|
|
3592
|
+
xs: 'h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 text-xs',
|
|
3593
|
+
sm: 'h-8 gap-1.5 px-2.5',
|
|
3594
|
+
'icon-xs': 'size-6 rounded-[calc(var(--radius)-5px)] p-0',
|
|
3595
|
+
'icon-sm': 'size-8 p-0',
|
|
3596
|
+
};
|
|
3597
|
+
class BuiInputGroupButton {
|
|
3598
|
+
variant = input('ghost', /* @ts-ignore */
|
|
3599
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3600
|
+
size = input('xs', /* @ts-ignore */
|
|
3601
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3602
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3603
|
+
computedClass = computed(() => cn(IG_BUTTON_BASE, IG_BUTTON_VARIANTS[this.variant()], IG_BUTTON_SIZES[this.size()], this.userClass()), /* @ts-ignore */
|
|
3604
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3605
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroupButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3606
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiInputGroupButton, isStandalone: true, selector: "button[buiInputGroupButton]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button", "data-slot": "input-group-button" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3607
|
+
}
|
|
3608
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiInputGroupButton, decorators: [{
|
|
3609
|
+
type: Directive,
|
|
3610
|
+
args: [{
|
|
3611
|
+
selector: 'button[buiInputGroupButton]',
|
|
3612
|
+
host: { type: 'button', 'data-slot': 'input-group-button', '[class]': 'computedClass()' },
|
|
3613
|
+
}]
|
|
3614
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3615
|
+
|
|
3616
|
+
/** Visually hides content while keeping it available to assistive tech (sr-only). */
|
|
3617
|
+
class BuiVisuallyHidden {
|
|
3618
|
+
focusable = input(false, /* @ts-ignore */
|
|
3619
|
+
...(ngDevMode ? [{ debugName: "focusable" }] : /* istanbul ignore next */ []));
|
|
3620
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3621
|
+
computedClass = computed(() => cn('sr-only', this.focusable() &&
|
|
3622
|
+
'focus:not-sr-only focus:fixed focus:start-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-primary focus:px-4 focus:py-2 focus:text-primary-foreground focus:shadow-md', this.userClass()), /* @ts-ignore */
|
|
3623
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3624
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiVisuallyHidden, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3625
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiVisuallyHidden, isStandalone: true, selector: "[buiVisuallyHidden]", inputs: { focusable: { classPropertyName: "focusable", publicName: "focusable", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "visually-hidden" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3626
|
+
}
|
|
3627
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiVisuallyHidden, decorators: [{
|
|
3628
|
+
type: Directive,
|
|
3629
|
+
args: [{
|
|
3630
|
+
selector: '[buiVisuallyHidden]',
|
|
3631
|
+
host: { 'data-slot': 'visually-hidden', '[class]': 'computedClass()' },
|
|
3632
|
+
}]
|
|
3633
|
+
}], propDecorators: { focusable: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusable", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3634
|
+
|
|
3635
|
+
const TONES = {
|
|
3636
|
+
good: 'bg-emerald-600',
|
|
3637
|
+
warning: 'bg-amber-500',
|
|
3638
|
+
danger: 'bg-destructive',
|
|
3639
|
+
default: 'bg-primary',
|
|
3640
|
+
};
|
|
3641
|
+
/** A labelled meter (`role="meter"`) for a measurement within a known range. */
|
|
3642
|
+
class BuiMeter {
|
|
3643
|
+
value = input(0, /* @ts-ignore */
|
|
3644
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
3645
|
+
min = input(0, /* @ts-ignore */
|
|
3646
|
+
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
3647
|
+
max = input(100, /* @ts-ignore */
|
|
3648
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
3649
|
+
label = input(null, /* @ts-ignore */
|
|
3650
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
3651
|
+
tone = input('default', /* @ts-ignore */
|
|
3652
|
+
...(ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []));
|
|
3653
|
+
showValue = input(true, /* @ts-ignore */
|
|
3654
|
+
...(ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []));
|
|
3655
|
+
unit = input('%', /* @ts-ignore */
|
|
3656
|
+
...(ngDevMode ? [{ debugName: "unit" }] : /* istanbul ignore next */ []));
|
|
3657
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3658
|
+
clamped = computed(() => Math.max(this.min(), Math.min(this.max(), this.value())), /* @ts-ignore */
|
|
3659
|
+
...(ngDevMode ? [{ debugName: "clamped" }] : /* istanbul ignore next */ []));
|
|
3660
|
+
pct = computed(() => {
|
|
3661
|
+
const range = this.max() - this.min() || 1;
|
|
3662
|
+
return ((this.clamped() - this.min()) / range) * 100;
|
|
3663
|
+
}, /* @ts-ignore */
|
|
3664
|
+
...(ngDevMode ? [{ debugName: "pct" }] : /* istanbul ignore next */ []));
|
|
3665
|
+
valueText = computed(() => `${this.value()}${this.unit()}`, /* @ts-ignore */
|
|
3666
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
3667
|
+
fillClass = computed(() => TONES[this.tone()], /* @ts-ignore */
|
|
3668
|
+
...(ngDevMode ? [{ debugName: "fillClass" }] : /* istanbul ignore next */ []));
|
|
3669
|
+
computedClass = computed(() => cn('grid w-full gap-1.5', this.userClass()), /* @ts-ignore */
|
|
3670
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3671
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiMeter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3672
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: BuiMeter, isStandalone: true, selector: "bui-meter", 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 }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, unit: { classPropertyName: "unit", publicName: "unit", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "meter" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
|
|
3673
|
+
@if (label() || showValue()) {
|
|
3674
|
+
<div class="flex items-center justify-between gap-2 text-sm">
|
|
3675
|
+
@if (label()) {
|
|
3676
|
+
<span class="font-medium text-foreground">{{ label() }}</span>
|
|
3677
|
+
} @else {
|
|
3678
|
+
<span aria-hidden="true"></span>
|
|
3679
|
+
}
|
|
3680
|
+
@if (showValue()) {
|
|
3681
|
+
<span class="text-muted-foreground tabular-nums">{{ valueText() }}</span>
|
|
3682
|
+
}
|
|
3683
|
+
</div>
|
|
3684
|
+
}
|
|
3685
|
+
<div
|
|
3686
|
+
role="meter"
|
|
3687
|
+
[attr.aria-label]="label() ?? 'Meter'"
|
|
3688
|
+
[attr.aria-valuenow]="clamped()"
|
|
3689
|
+
[attr.aria-valuemin]="min()"
|
|
3690
|
+
[attr.aria-valuemax]="max()"
|
|
3691
|
+
[attr.aria-valuetext]="valueText()"
|
|
3692
|
+
class="relative h-2 w-full overflow-hidden rounded-full bg-muted"
|
|
3693
|
+
>
|
|
3694
|
+
<div
|
|
3695
|
+
class="absolute inset-y-0 start-0 rounded-full transition-[width] duration-500 ease-out"
|
|
3696
|
+
[class]="fillClass()"
|
|
3697
|
+
[style.width.%]="pct()"
|
|
3698
|
+
></div>
|
|
3699
|
+
</div>
|
|
3700
|
+
`, isInline: true });
|
|
3701
|
+
}
|
|
3702
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiMeter, decorators: [{
|
|
3703
|
+
type: Component,
|
|
3704
|
+
args: [{
|
|
3705
|
+
selector: 'bui-meter',
|
|
3706
|
+
host: { 'data-slot': 'meter', '[class]': 'computedClass()' },
|
|
3707
|
+
template: `
|
|
3708
|
+
@if (label() || showValue()) {
|
|
3709
|
+
<div class="flex items-center justify-between gap-2 text-sm">
|
|
3710
|
+
@if (label()) {
|
|
3711
|
+
<span class="font-medium text-foreground">{{ label() }}</span>
|
|
3712
|
+
} @else {
|
|
3713
|
+
<span aria-hidden="true"></span>
|
|
3714
|
+
}
|
|
3715
|
+
@if (showValue()) {
|
|
3716
|
+
<span class="text-muted-foreground tabular-nums">{{ valueText() }}</span>
|
|
3717
|
+
}
|
|
3718
|
+
</div>
|
|
3719
|
+
}
|
|
3720
|
+
<div
|
|
3721
|
+
role="meter"
|
|
3722
|
+
[attr.aria-label]="label() ?? 'Meter'"
|
|
3723
|
+
[attr.aria-valuenow]="clamped()"
|
|
3724
|
+
[attr.aria-valuemin]="min()"
|
|
3725
|
+
[attr.aria-valuemax]="max()"
|
|
3726
|
+
[attr.aria-valuetext]="valueText()"
|
|
3727
|
+
class="relative h-2 w-full overflow-hidden rounded-full bg-muted"
|
|
3728
|
+
>
|
|
3729
|
+
<div
|
|
3730
|
+
class="absolute inset-y-0 start-0 rounded-full transition-[width] duration-500 ease-out"
|
|
3731
|
+
[class]="fillClass()"
|
|
3732
|
+
[style.width.%]="pct()"
|
|
3733
|
+
></div>
|
|
3734
|
+
</div>
|
|
3735
|
+
`,
|
|
3736
|
+
}]
|
|
3737
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], unit: [{ type: i0.Input, args: [{ isSignal: true, alias: "unit", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3738
|
+
|
|
3739
|
+
const TREND_CLASS = {
|
|
3740
|
+
up: 'text-emerald-600 font-medium',
|
|
3741
|
+
down: 'text-destructive font-medium',
|
|
3742
|
+
neutral: 'text-muted-foreground font-medium',
|
|
3743
|
+
};
|
|
3744
|
+
/** A KPI / statistic card: label, big value, and a trend-coloured change. */
|
|
3745
|
+
class BuiStat {
|
|
3746
|
+
label = input(null, /* @ts-ignore */
|
|
3747
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
3748
|
+
value = input('', /* @ts-ignore */
|
|
3749
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
3750
|
+
change = input(null, /* @ts-ignore */
|
|
3751
|
+
...(ngDevMode ? [{ debugName: "change" }] : /* istanbul ignore next */ []));
|
|
3752
|
+
trend = input(null, /* @ts-ignore */
|
|
3753
|
+
...(ngDevMode ? [{ debugName: "trend" }] : /* istanbul ignore next */ []));
|
|
3754
|
+
caption = input(null, /* @ts-ignore */
|
|
3755
|
+
...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
3756
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3757
|
+
resolvedTrend = computed(() => {
|
|
3758
|
+
const explicit = this.trend();
|
|
3759
|
+
if (explicit) {
|
|
3760
|
+
return explicit;
|
|
3761
|
+
}
|
|
3762
|
+
const change = (this.change() ?? '').trim();
|
|
3763
|
+
if (change.startsWith('+')) {
|
|
3764
|
+
return 'up';
|
|
3765
|
+
}
|
|
3766
|
+
if (change.startsWith('-') || change.startsWith('−')) {
|
|
3767
|
+
return 'down';
|
|
3768
|
+
}
|
|
3769
|
+
return 'neutral';
|
|
3770
|
+
}, /* @ts-ignore */
|
|
3771
|
+
...(ngDevMode ? [{ debugName: "resolvedTrend" }] : /* istanbul ignore next */ []));
|
|
3772
|
+
trendClass = computed(() => TREND_CLASS[this.resolvedTrend()], /* @ts-ignore */
|
|
3773
|
+
...(ngDevMode ? [{ debugName: "trendClass" }] : /* istanbul ignore next */ []));
|
|
3774
|
+
computedClass = computed(() => cn('flex flex-col gap-1 rounded-lg border bg-card p-4', this.userClass()), /* @ts-ignore */
|
|
3775
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3776
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiStat, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3777
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: BuiStat, isStandalone: true, selector: "bui-stat", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, change: { classPropertyName: "change", publicName: "change", isSignal: true, isRequired: false, transformFunction: null }, trend: { classPropertyName: "trend", publicName: "trend", isSignal: true, isRequired: false, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "stat" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
|
|
3778
|
+
@if (label()) {
|
|
3779
|
+
<span class="text-sm font-medium text-muted-foreground">{{ label() }}</span>
|
|
3780
|
+
}
|
|
3781
|
+
<span class="text-2xl font-semibold tabular-nums">{{ value() }}</span>
|
|
3782
|
+
@if (change()) {
|
|
3783
|
+
<span class="flex items-center gap-1.5 text-sm">
|
|
3784
|
+
<span [class]="trendClass()">{{ change() }}</span>
|
|
3785
|
+
@if (caption()) {
|
|
3786
|
+
<span class="text-muted-foreground">{{ caption() }}</span>
|
|
3787
|
+
}
|
|
3788
|
+
</span>
|
|
3789
|
+
}
|
|
3790
|
+
`, isInline: true });
|
|
3791
|
+
}
|
|
3792
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiStat, decorators: [{
|
|
3793
|
+
type: Component,
|
|
3794
|
+
args: [{
|
|
3795
|
+
selector: 'bui-stat',
|
|
3796
|
+
host: { 'data-slot': 'stat', '[class]': 'computedClass()' },
|
|
3797
|
+
template: `
|
|
3798
|
+
@if (label()) {
|
|
3799
|
+
<span class="text-sm font-medium text-muted-foreground">{{ label() }}</span>
|
|
3800
|
+
}
|
|
3801
|
+
<span class="text-2xl font-semibold tabular-nums">{{ value() }}</span>
|
|
3802
|
+
@if (change()) {
|
|
3803
|
+
<span class="flex items-center gap-1.5 text-sm">
|
|
3804
|
+
<span [class]="trendClass()">{{ change() }}</span>
|
|
3805
|
+
@if (caption()) {
|
|
3806
|
+
<span class="text-muted-foreground">{{ caption() }}</span>
|
|
3807
|
+
}
|
|
3808
|
+
</span>
|
|
3809
|
+
}
|
|
3810
|
+
`,
|
|
3811
|
+
}]
|
|
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
|
+
|
|
3516
3814
|
/*
|
|
3517
3815
|
* Public API Surface of ng-blatui
|
|
3518
3816
|
*/
|
|
@@ -3521,5 +3819,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
3521
3819
|
* Generated bundle index. Do not edit.
|
|
3522
3820
|
*/
|
|
3523
3821
|
|
|
3524
|
-
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, BuiItem, BuiItemActions, BuiItemContent, BuiItemDescription, BuiItemGroup, BuiItemMedia, BuiItemTitle, BuiKbd, BuiLabel, BuiPagination, BuiPaginationContent, BuiPaginationEllipsis, BuiPaginationItem, BuiPaginationLink, BuiPopover, BuiPopoverContent, BuiProgress, BuiRadioGroup, BuiRadioGroupItem, BuiScrollArea, BuiSeparator, BuiSkeleton, BuiSpinner, BuiSwitch, BuiTabList, BuiTabPanel, BuiTabTrigger, BuiTable, BuiTableBody, BuiTableCaption, BuiTableCell, BuiTableContainer, BuiTableFooter, BuiTableHead, BuiTableHeader, BuiTableRow, BuiTabs, BuiTextarea, BuiThemeCustomizer, BuiToggle, BuiTooltip, BuiTooltipContent, THEME_TOKENS, ThemeStore, buttonVariants, cn, toggleVariants };
|
|
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 };
|
|
3525
3823
|
//# sourceMappingURL=ng-blatui.mjs.map
|