ng-blatui 1.4.0 → 1.6.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 +541 -7
- package/fesm2022/ng-blatui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ng-blatui.d.ts +135 -2
package/fesm2022/ng-blatui.mjs
CHANGED
|
@@ -70,7 +70,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
70
70
|
}], 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 }] }] } });
|
|
71
71
|
|
|
72
72
|
const BASE = 'inline-flex items-center justify-center rounded-md border font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden';
|
|
73
|
-
const SIZES$
|
|
73
|
+
const SIZES$2 = {
|
|
74
74
|
sm: 'px-1.5 py-px text-[0.625rem]',
|
|
75
75
|
default: 'px-2 py-0.5 text-xs',
|
|
76
76
|
lg: 'px-3 py-1 text-sm [&>svg]:size-3.5',
|
|
@@ -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$1 = {
|
|
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,8 +143,8 @@ 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[tone][intensityFor(this.variant())];
|
|
147
|
-
return cn(BASE, SIZES$
|
|
146
|
+
const toneOrVariant = tone === null ? brandClass(this.variant()) : TONES$1[tone][intensityFor(this.variant())];
|
|
147
|
+
return cn(BASE, SIZES$2[this.size()], toneOrVariant, this.userClass());
|
|
148
148
|
}, /* @ts-ignore */
|
|
149
149
|
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
150
150
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiBadge, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -2343,7 +2343,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
2343
2343
|
}]
|
|
2344
2344
|
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2345
2345
|
|
|
2346
|
-
const SIZES = {
|
|
2346
|
+
const SIZES$1 = {
|
|
2347
2347
|
sm: 'max-w-3xl',
|
|
2348
2348
|
md: 'max-w-5xl',
|
|
2349
2349
|
lg: 'max-w-6xl',
|
|
@@ -2356,7 +2356,7 @@ class BuiContainer {
|
|
|
2356
2356
|
size = input('lg', /* @ts-ignore */
|
|
2357
2357
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2358
2358
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2359
|
-
computedClass = computed(() => cn('mx-auto w-full px-4 sm:px-6 lg:px-8', SIZES[this.size()], this.userClass()), /* @ts-ignore */
|
|
2359
|
+
computedClass = computed(() => cn('mx-auto w-full px-4 sm:px-6 lg:px-8', SIZES$1[this.size()], this.userClass()), /* @ts-ignore */
|
|
2360
2360
|
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2361
2361
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiContainer, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2362
2362
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiContainer, isStandalone: true, selector: "[buiContainer]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "container" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
@@ -2599,6 +2599,540 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
2599
2599
|
}]
|
|
2600
2600
|
}] });
|
|
2601
2601
|
|
|
2602
|
+
const toggleVariants = cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
2603
|
+
variants: {
|
|
2604
|
+
variant: {
|
|
2605
|
+
default: 'bg-transparent',
|
|
2606
|
+
outline: 'border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground',
|
|
2607
|
+
},
|
|
2608
|
+
size: {
|
|
2609
|
+
default: 'h-9 min-w-9 px-2',
|
|
2610
|
+
sm: 'h-8 min-w-8 px-1.5',
|
|
2611
|
+
lg: 'h-10 min-w-10 px-2.5',
|
|
2612
|
+
},
|
|
2613
|
+
},
|
|
2614
|
+
defaultVariants: { variant: 'default', size: 'default' },
|
|
2615
|
+
});
|
|
2616
|
+
/** A two-state toggle button (`aria-pressed`). */
|
|
2617
|
+
class BuiToggle {
|
|
2618
|
+
pressed = model(false, /* @ts-ignore */
|
|
2619
|
+
...(ngDevMode ? [{ debugName: "pressed" }] : /* istanbul ignore next */ []));
|
|
2620
|
+
variant = input('default', /* @ts-ignore */
|
|
2621
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
2622
|
+
size = input('default', /* @ts-ignore */
|
|
2623
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2624
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2625
|
+
computedClass = computed(() => cn(toggleVariants({ variant: this.variant(), size: this.size() }), this.userClass()), /* @ts-ignore */
|
|
2626
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2627
|
+
toggle() {
|
|
2628
|
+
this.pressed.update((value) => !value);
|
|
2629
|
+
}
|
|
2630
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiToggle, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2631
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: BuiToggle, isStandalone: true, selector: "button[buiToggle]", inputs: { pressed: { classPropertyName: "pressed", publicName: "pressed", 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 }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pressed: "pressedChange" }, host: { attributes: { "type": "button", "data-slot": "toggle" }, listeners: { "click": "toggle()" }, properties: { "attr.aria-pressed": "pressed()", "attr.data-state": "pressed() ? 'on' : 'off'", "class": "computedClass()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
2632
|
+
}
|
|
2633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiToggle, decorators: [{
|
|
2634
|
+
type: Component,
|
|
2635
|
+
args: [{
|
|
2636
|
+
selector: 'button[buiToggle]',
|
|
2637
|
+
host: {
|
|
2638
|
+
type: 'button',
|
|
2639
|
+
'data-slot': 'toggle',
|
|
2640
|
+
'[attr.aria-pressed]': 'pressed()',
|
|
2641
|
+
'[attr.data-state]': "pressed() ? 'on' : 'off'",
|
|
2642
|
+
'[class]': 'computedClass()',
|
|
2643
|
+
'(click)': 'toggle()',
|
|
2644
|
+
},
|
|
2645
|
+
template: `<ng-content />`,
|
|
2646
|
+
}]
|
|
2647
|
+
}], propDecorators: { pressed: [{ type: i0.Input, args: [{ isSignal: true, alias: "pressed", required: false }] }, { type: i0.Output, args: ["pressedChange"] }], 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 }] }] } });
|
|
2648
|
+
|
|
2649
|
+
/** A spinning loading indicator (`role="status"`). */
|
|
2650
|
+
class BuiSpinner {
|
|
2651
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2652
|
+
computedClass = computed(() => cn('inline-block size-4 animate-spin', this.userClass()), /* @ts-ignore */
|
|
2653
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2654
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiSpinner, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2655
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: BuiSpinner, isStandalone: true, selector: "bui-spinner", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "spinner", "role": "status", "aria-label": "Loading" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
|
|
2656
|
+
<svg
|
|
2657
|
+
viewBox="0 0 24 24"
|
|
2658
|
+
fill="none"
|
|
2659
|
+
stroke="currentColor"
|
|
2660
|
+
stroke-width="2"
|
|
2661
|
+
stroke-linecap="round"
|
|
2662
|
+
stroke-linejoin="round"
|
|
2663
|
+
aria-hidden="true"
|
|
2664
|
+
class="size-full"
|
|
2665
|
+
>
|
|
2666
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
2667
|
+
</svg>
|
|
2668
|
+
`, isInline: true });
|
|
2669
|
+
}
|
|
2670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiSpinner, decorators: [{
|
|
2671
|
+
type: Component,
|
|
2672
|
+
args: [{
|
|
2673
|
+
selector: 'bui-spinner',
|
|
2674
|
+
host: {
|
|
2675
|
+
'data-slot': 'spinner',
|
|
2676
|
+
role: 'status',
|
|
2677
|
+
'aria-label': 'Loading',
|
|
2678
|
+
'[class]': 'computedClass()',
|
|
2679
|
+
},
|
|
2680
|
+
template: `
|
|
2681
|
+
<svg
|
|
2682
|
+
viewBox="0 0 24 24"
|
|
2683
|
+
fill="none"
|
|
2684
|
+
stroke="currentColor"
|
|
2685
|
+
stroke-width="2"
|
|
2686
|
+
stroke-linecap="round"
|
|
2687
|
+
stroke-linejoin="round"
|
|
2688
|
+
aria-hidden="true"
|
|
2689
|
+
class="size-full"
|
|
2690
|
+
>
|
|
2691
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
2692
|
+
</svg>
|
|
2693
|
+
`,
|
|
2694
|
+
}]
|
|
2695
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2696
|
+
|
|
2697
|
+
/** Copy-to-clipboard button: copies `value`, flips to a check, announces "Copied". */
|
|
2698
|
+
class BuiCopyButton {
|
|
2699
|
+
value = input('', /* @ts-ignore */
|
|
2700
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2701
|
+
label = input('Copy', /* @ts-ignore */
|
|
2702
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2703
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2704
|
+
copied = signal(false, /* @ts-ignore */
|
|
2705
|
+
...(ngDevMode ? [{ debugName: "copied" }] : /* istanbul ignore next */ []));
|
|
2706
|
+
computedClass = computed(() => cn('inline-flex h-8 items-center justify-center gap-1.5 rounded-md px-2 text-sm font-medium text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50', this.userClass()), /* @ts-ignore */
|
|
2707
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2708
|
+
async copy() {
|
|
2709
|
+
try {
|
|
2710
|
+
await navigator.clipboard.writeText(this.value());
|
|
2711
|
+
this.copied.set(true);
|
|
2712
|
+
setTimeout(() => {
|
|
2713
|
+
this.copied.set(false);
|
|
2714
|
+
}, 1500);
|
|
2715
|
+
}
|
|
2716
|
+
catch {
|
|
2717
|
+
// Clipboard unavailable — ignore.
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiCopyButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2721
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: BuiCopyButton, isStandalone: true, selector: "button[buiCopyButton]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button", "data-slot": "copy-button" }, listeners: { "click": "copy()" }, properties: { "attr.aria-label": "copied() ? 'Copied' : label()", "class": "computedClass()" } }, ngImport: i0, template: `
|
|
2722
|
+
<span class="grid size-4 place-items-center *:col-start-1 *:row-start-1">
|
|
2723
|
+
@if (copied()) {
|
|
2724
|
+
<svg
|
|
2725
|
+
viewBox="0 0 24 24"
|
|
2726
|
+
fill="none"
|
|
2727
|
+
stroke="currentColor"
|
|
2728
|
+
stroke-width="2"
|
|
2729
|
+
stroke-linecap="round"
|
|
2730
|
+
stroke-linejoin="round"
|
|
2731
|
+
aria-hidden="true"
|
|
2732
|
+
class="size-4 text-success"
|
|
2733
|
+
>
|
|
2734
|
+
<path d="M20 6 9 17l-5-5" />
|
|
2735
|
+
</svg>
|
|
2736
|
+
} @else {
|
|
2737
|
+
<svg
|
|
2738
|
+
viewBox="0 0 24 24"
|
|
2739
|
+
fill="none"
|
|
2740
|
+
stroke="currentColor"
|
|
2741
|
+
stroke-width="2"
|
|
2742
|
+
stroke-linecap="round"
|
|
2743
|
+
stroke-linejoin="round"
|
|
2744
|
+
aria-hidden="true"
|
|
2745
|
+
class="size-4"
|
|
2746
|
+
>
|
|
2747
|
+
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
|
|
2748
|
+
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
|
|
2749
|
+
</svg>
|
|
2750
|
+
}
|
|
2751
|
+
</span>
|
|
2752
|
+
<ng-content />
|
|
2753
|
+
<span class="sr-only" aria-live="polite">{{ copied() ? 'Copied' : '' }}</span>
|
|
2754
|
+
`, isInline: true });
|
|
2755
|
+
}
|
|
2756
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiCopyButton, decorators: [{
|
|
2757
|
+
type: Component,
|
|
2758
|
+
args: [{
|
|
2759
|
+
selector: 'button[buiCopyButton]',
|
|
2760
|
+
host: {
|
|
2761
|
+
type: 'button',
|
|
2762
|
+
'data-slot': 'copy-button',
|
|
2763
|
+
'[attr.aria-label]': "copied() ? 'Copied' : label()",
|
|
2764
|
+
'[class]': 'computedClass()',
|
|
2765
|
+
'(click)': 'copy()',
|
|
2766
|
+
},
|
|
2767
|
+
template: `
|
|
2768
|
+
<span class="grid size-4 place-items-center *:col-start-1 *:row-start-1">
|
|
2769
|
+
@if (copied()) {
|
|
2770
|
+
<svg
|
|
2771
|
+
viewBox="0 0 24 24"
|
|
2772
|
+
fill="none"
|
|
2773
|
+
stroke="currentColor"
|
|
2774
|
+
stroke-width="2"
|
|
2775
|
+
stroke-linecap="round"
|
|
2776
|
+
stroke-linejoin="round"
|
|
2777
|
+
aria-hidden="true"
|
|
2778
|
+
class="size-4 text-success"
|
|
2779
|
+
>
|
|
2780
|
+
<path d="M20 6 9 17l-5-5" />
|
|
2781
|
+
</svg>
|
|
2782
|
+
} @else {
|
|
2783
|
+
<svg
|
|
2784
|
+
viewBox="0 0 24 24"
|
|
2785
|
+
fill="none"
|
|
2786
|
+
stroke="currentColor"
|
|
2787
|
+
stroke-width="2"
|
|
2788
|
+
stroke-linecap="round"
|
|
2789
|
+
stroke-linejoin="round"
|
|
2790
|
+
aria-hidden="true"
|
|
2791
|
+
class="size-4"
|
|
2792
|
+
>
|
|
2793
|
+
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
|
|
2794
|
+
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
|
|
2795
|
+
</svg>
|
|
2796
|
+
}
|
|
2797
|
+
</span>
|
|
2798
|
+
<ng-content />
|
|
2799
|
+
<span class="sr-only" aria-live="polite">{{ copied() ? 'Copied' : '' }}</span>
|
|
2800
|
+
`,
|
|
2801
|
+
}]
|
|
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
|
+
|
|
2804
|
+
const TONES = {
|
|
2805
|
+
default: 'bg-muted text-foreground border-border',
|
|
2806
|
+
primary: 'bg-primary text-primary-foreground border-transparent',
|
|
2807
|
+
info: 'bg-info/10 text-info border-info/25',
|
|
2808
|
+
success: 'bg-success/10 text-success border-success/25',
|
|
2809
|
+
warning: 'bg-warning/10 text-warning border-warning/25',
|
|
2810
|
+
danger: 'bg-destructive/10 text-destructive border-destructive/25',
|
|
2811
|
+
};
|
|
2812
|
+
/**
|
|
2813
|
+
* Full-width announcement bar. Optionally dismissible and (with `persistKey`) remembers
|
|
2814
|
+
* the dismissal in localStorage. SSR-safe — localStorage is only touched in the browser.
|
|
2815
|
+
*/
|
|
2816
|
+
class BuiBanner {
|
|
2817
|
+
tone = input('default', /* @ts-ignore */
|
|
2818
|
+
...(ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []));
|
|
2819
|
+
dismissible = input(true, /* @ts-ignore */
|
|
2820
|
+
...(ngDevMode ? [{ debugName: "dismissible" }] : /* istanbul ignore next */ []));
|
|
2821
|
+
persistKey = input(undefined, /* @ts-ignore */
|
|
2822
|
+
...(ngDevMode ? [{ debugName: "persistKey" }] : /* istanbul ignore next */ []));
|
|
2823
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2824
|
+
show = signal(true, /* @ts-ignore */
|
|
2825
|
+
...(ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []));
|
|
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 */
|
|
2828
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2829
|
+
ngOnInit() {
|
|
2830
|
+
const key = this.persistKey();
|
|
2831
|
+
if (this.isBrowser && key && localStorage.getItem(`bui-banner-${key}`) === '1') {
|
|
2832
|
+
this.show.set(false);
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
dismiss() {
|
|
2836
|
+
this.show.set(false);
|
|
2837
|
+
const key = this.persistKey();
|
|
2838
|
+
if (this.isBrowser && key) {
|
|
2839
|
+
localStorage.setItem(`bui-banner-${key}`, '1');
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiBanner, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2843
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: BuiBanner, isStandalone: true, selector: "bui-banner", inputs: { tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, persistKey: { classPropertyName: "persistKey", publicName: "persistKey", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "banner", "role": "region", "aria-label": "Announcement" }, properties: { "hidden": "!show()", "class": "computedClass()" } }, ngImport: i0, template: `
|
|
2844
|
+
<div class="flex flex-1 flex-wrap items-center justify-center gap-x-3 gap-y-1">
|
|
2845
|
+
<ng-content />
|
|
2846
|
+
</div>
|
|
2847
|
+
@if (dismissible()) {
|
|
2848
|
+
<button
|
|
2849
|
+
type="button"
|
|
2850
|
+
aria-label="Dismiss"
|
|
2851
|
+
class="shrink-0 rounded-md p-1 opacity-70 transition-opacity outline-none hover:opacity-100 focus-visible:ring-2 focus-visible:ring-current/40"
|
|
2852
|
+
(click)="dismiss()"
|
|
2853
|
+
>
|
|
2854
|
+
<svg
|
|
2855
|
+
viewBox="0 0 24 24"
|
|
2856
|
+
fill="none"
|
|
2857
|
+
stroke="currentColor"
|
|
2858
|
+
stroke-width="2"
|
|
2859
|
+
stroke-linecap="round"
|
|
2860
|
+
stroke-linejoin="round"
|
|
2861
|
+
aria-hidden="true"
|
|
2862
|
+
class="size-4"
|
|
2863
|
+
>
|
|
2864
|
+
<path d="M18 6 6 18" />
|
|
2865
|
+
<path d="m6 6 12 12" />
|
|
2866
|
+
</svg>
|
|
2867
|
+
</button>
|
|
2868
|
+
}
|
|
2869
|
+
`, isInline: true });
|
|
2870
|
+
}
|
|
2871
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiBanner, decorators: [{
|
|
2872
|
+
type: Component,
|
|
2873
|
+
args: [{
|
|
2874
|
+
selector: 'bui-banner',
|
|
2875
|
+
host: {
|
|
2876
|
+
'data-slot': 'banner',
|
|
2877
|
+
role: 'region',
|
|
2878
|
+
'aria-label': 'Announcement',
|
|
2879
|
+
'[hidden]': '!show()',
|
|
2880
|
+
'[class]': 'computedClass()',
|
|
2881
|
+
},
|
|
2882
|
+
template: `
|
|
2883
|
+
<div class="flex flex-1 flex-wrap items-center justify-center gap-x-3 gap-y-1">
|
|
2884
|
+
<ng-content />
|
|
2885
|
+
</div>
|
|
2886
|
+
@if (dismissible()) {
|
|
2887
|
+
<button
|
|
2888
|
+
type="button"
|
|
2889
|
+
aria-label="Dismiss"
|
|
2890
|
+
class="shrink-0 rounded-md p-1 opacity-70 transition-opacity outline-none hover:opacity-100 focus-visible:ring-2 focus-visible:ring-current/40"
|
|
2891
|
+
(click)="dismiss()"
|
|
2892
|
+
>
|
|
2893
|
+
<svg
|
|
2894
|
+
viewBox="0 0 24 24"
|
|
2895
|
+
fill="none"
|
|
2896
|
+
stroke="currentColor"
|
|
2897
|
+
stroke-width="2"
|
|
2898
|
+
stroke-linecap="round"
|
|
2899
|
+
stroke-linejoin="round"
|
|
2900
|
+
aria-hidden="true"
|
|
2901
|
+
class="size-4"
|
|
2902
|
+
>
|
|
2903
|
+
<path d="M18 6 6 18" />
|
|
2904
|
+
<path d="m6 6 12 12" />
|
|
2905
|
+
</svg>
|
|
2906
|
+
</button>
|
|
2907
|
+
}
|
|
2908
|
+
`,
|
|
2909
|
+
}]
|
|
2910
|
+
}], propDecorators: { tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], dismissible: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissible", required: false }] }], persistKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "persistKey", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2911
|
+
|
|
2912
|
+
/** Scroll/border wrapper around a table. `variant="card"` adds a bordered card. */
|
|
2913
|
+
class BuiTableContainer {
|
|
2914
|
+
variant = input('default', /* @ts-ignore */
|
|
2915
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
2916
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2917
|
+
computedClass = computed(() => cn('relative w-full overflow-x-auto', this.variant() === 'card' && 'rounded-lg border bg-card shadow-xs', this.userClass()), /* @ts-ignore */
|
|
2918
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2919
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableContainer, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2920
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTableContainer, isStandalone: true, selector: "[buiTableContainer]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-container" }, properties: { "attr.data-variant": "variant()", "class": "computedClass()" } }, ngImport: i0 });
|
|
2921
|
+
}
|
|
2922
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableContainer, decorators: [{
|
|
2923
|
+
type: Directive,
|
|
2924
|
+
args: [{
|
|
2925
|
+
selector: '[buiTableContainer]',
|
|
2926
|
+
host: {
|
|
2927
|
+
'data-slot': 'table-container',
|
|
2928
|
+
'[attr.data-variant]': 'variant()',
|
|
2929
|
+
'[class]': 'computedClass()',
|
|
2930
|
+
},
|
|
2931
|
+
}]
|
|
2932
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2933
|
+
class BuiTable {
|
|
2934
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2935
|
+
computedClass = computed(() => cn('w-full caption-bottom text-sm', this.userClass()), /* @ts-ignore */
|
|
2936
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2937
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTable, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2938
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTable, isStandalone: true, selector: "table[buiTable]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
2939
|
+
}
|
|
2940
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTable, decorators: [{
|
|
2941
|
+
type: Directive,
|
|
2942
|
+
args: [{
|
|
2943
|
+
selector: 'table[buiTable]',
|
|
2944
|
+
host: { 'data-slot': 'table', '[class]': 'computedClass()' },
|
|
2945
|
+
}]
|
|
2946
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2947
|
+
class BuiTableHeader {
|
|
2948
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2949
|
+
computedClass = computed(() => cn('[&_tr]:border-b', this.userClass()), /* @ts-ignore */
|
|
2950
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2951
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2952
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTableHeader, isStandalone: true, selector: "thead[buiTableHeader]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-header" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
2953
|
+
}
|
|
2954
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableHeader, decorators: [{
|
|
2955
|
+
type: Directive,
|
|
2956
|
+
args: [{
|
|
2957
|
+
selector: 'thead[buiTableHeader]',
|
|
2958
|
+
host: { 'data-slot': 'table-header', '[class]': 'computedClass()' },
|
|
2959
|
+
}]
|
|
2960
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2961
|
+
class BuiTableBody {
|
|
2962
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2963
|
+
computedClass = computed(() => cn('[&_tr:last-child]:border-0', this.userClass()), /* @ts-ignore */
|
|
2964
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2965
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableBody, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2966
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTableBody, isStandalone: true, selector: "tbody[buiTableBody]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-body" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
2967
|
+
}
|
|
2968
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableBody, decorators: [{
|
|
2969
|
+
type: Directive,
|
|
2970
|
+
args: [{
|
|
2971
|
+
selector: 'tbody[buiTableBody]',
|
|
2972
|
+
host: { 'data-slot': 'table-body', '[class]': 'computedClass()' },
|
|
2973
|
+
}]
|
|
2974
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2975
|
+
class BuiTableFooter {
|
|
2976
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2977
|
+
computedClass = computed(() => cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', this.userClass()), /* @ts-ignore */
|
|
2978
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2979
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2980
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTableFooter, isStandalone: true, selector: "tfoot[buiTableFooter]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-footer" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
2981
|
+
}
|
|
2982
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableFooter, decorators: [{
|
|
2983
|
+
type: Directive,
|
|
2984
|
+
args: [{
|
|
2985
|
+
selector: 'tfoot[buiTableFooter]',
|
|
2986
|
+
host: { 'data-slot': 'table-footer', '[class]': 'computedClass()' },
|
|
2987
|
+
}]
|
|
2988
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
2989
|
+
class BuiTableRow {
|
|
2990
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
2991
|
+
computedClass = computed(() => cn('border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', this.userClass()), /* @ts-ignore */
|
|
2992
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
2993
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableRow, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2994
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTableRow, isStandalone: true, selector: "tr[buiTableRow]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-row" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
2995
|
+
}
|
|
2996
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableRow, decorators: [{
|
|
2997
|
+
type: Directive,
|
|
2998
|
+
args: [{
|
|
2999
|
+
selector: 'tr[buiTableRow]',
|
|
3000
|
+
host: { 'data-slot': 'table-row', '[class]': 'computedClass()' },
|
|
3001
|
+
}]
|
|
3002
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3003
|
+
class BuiTableHead {
|
|
3004
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3005
|
+
computedClass = computed(() => cn('h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0', this.userClass()), /* @ts-ignore */
|
|
3006
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3007
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableHead, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3008
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTableHead, isStandalone: true, selector: "th[buiTableHead]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-head", "scope": "col" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3009
|
+
}
|
|
3010
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableHead, decorators: [{
|
|
3011
|
+
type: Directive,
|
|
3012
|
+
args: [{
|
|
3013
|
+
selector: 'th[buiTableHead]',
|
|
3014
|
+
host: { 'data-slot': 'table-head', scope: 'col', '[class]': 'computedClass()' },
|
|
3015
|
+
}]
|
|
3016
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3017
|
+
class BuiTableCell {
|
|
3018
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3019
|
+
computedClass = computed(() => cn('p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0', this.userClass()), /* @ts-ignore */
|
|
3020
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3021
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableCell, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3022
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTableCell, isStandalone: true, selector: "td[buiTableCell]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-cell" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3023
|
+
}
|
|
3024
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableCell, decorators: [{
|
|
3025
|
+
type: Directive,
|
|
3026
|
+
args: [{
|
|
3027
|
+
selector: 'td[buiTableCell]',
|
|
3028
|
+
host: { 'data-slot': 'table-cell', '[class]': 'computedClass()' },
|
|
3029
|
+
}]
|
|
3030
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3031
|
+
class BuiTableCaption {
|
|
3032
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3033
|
+
computedClass = computed(() => cn('mt-4 text-sm text-muted-foreground', this.userClass()), /* @ts-ignore */
|
|
3034
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3035
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableCaption, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3036
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: BuiTableCaption, isStandalone: true, selector: "caption[buiTableCaption]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-caption" }, properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
3037
|
+
}
|
|
3038
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTableCaption, decorators: [{
|
|
3039
|
+
type: Directive,
|
|
3040
|
+
args: [{
|
|
3041
|
+
selector: 'caption[buiTableCaption]',
|
|
3042
|
+
host: { 'data-slot': 'table-caption', '[class]': 'computedClass()' },
|
|
3043
|
+
}]
|
|
3044
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3045
|
+
|
|
3046
|
+
const SIZES = {
|
|
3047
|
+
sm: { box: 'size-6', overlap: '-ms-2', ring: 'ring-1', text: 'text-xs' },
|
|
3048
|
+
default: { box: 'size-8', overlap: '-ms-2.5', ring: 'ring-2', text: 'text-sm' },
|
|
3049
|
+
lg: { box: 'size-12', overlap: '-ms-3', ring: 'ring-2', text: 'text-base' },
|
|
3050
|
+
};
|
|
3051
|
+
function initials(name) {
|
|
3052
|
+
const trimmed = (name ?? '').trim();
|
|
3053
|
+
if (trimmed === '') {
|
|
3054
|
+
return '?';
|
|
3055
|
+
}
|
|
3056
|
+
const parts = trimmed.split(/\s+/);
|
|
3057
|
+
const first = parts[0].charAt(0);
|
|
3058
|
+
const last = parts.length > 1 ? (parts.at(-1)?.charAt(0) ?? '') : '';
|
|
3059
|
+
return (first + last).toUpperCase();
|
|
3060
|
+
}
|
|
3061
|
+
/** Overlapping stack of avatars with an optional "+N" overflow counter. */
|
|
3062
|
+
class BuiAvatarGroup {
|
|
3063
|
+
avatars = input([], /* @ts-ignore */
|
|
3064
|
+
...(ngDevMode ? [{ debugName: "avatars" }] : /* istanbul ignore next */ []));
|
|
3065
|
+
max = input(4, /* @ts-ignore */
|
|
3066
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
3067
|
+
size = input('default', /* @ts-ignore */
|
|
3068
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3069
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
3070
|
+
shown = computed(() => this.avatars().slice(0, Math.max(0, this.max())), /* @ts-ignore */
|
|
3071
|
+
...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
|
|
3072
|
+
remaining = computed(() => Math.max(0, this.avatars().length - this.shown().length), /* @ts-ignore */
|
|
3073
|
+
...(ngDevMode ? [{ debugName: "remaining" }] : /* istanbul ignore next */ []));
|
|
3074
|
+
computedClass = computed(() => cn('flex items-center', this.userClass()), /* @ts-ignore */
|
|
3075
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
3076
|
+
toInitials = initials;
|
|
3077
|
+
itemClass(index) {
|
|
3078
|
+
const size = SIZES[this.size()];
|
|
3079
|
+
return cn(size.box, size.ring, 'ring-background', index > 0 && size.overlap);
|
|
3080
|
+
}
|
|
3081
|
+
moreClass() {
|
|
3082
|
+
const size = SIZES[this.size()];
|
|
3083
|
+
return cn('relative z-10 flex shrink-0 items-center justify-center rounded-full bg-muted font-medium text-foreground', size.box, size.ring, 'ring-background', size.text, this.shown().length > 0 && size.overlap);
|
|
3084
|
+
}
|
|
3085
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiAvatarGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3086
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: BuiAvatarGroup, isStandalone: true, selector: "bui-avatar-group", inputs: { avatars: { classPropertyName: "avatars", publicName: "avatars", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", 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: { "data-slot": "avatar-group", "role": "list" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
|
|
3087
|
+
@for (avatar of shown(); track $index) {
|
|
3088
|
+
<bui-avatar
|
|
3089
|
+
role="listitem"
|
|
3090
|
+
[src]="avatar.src ?? null"
|
|
3091
|
+
[alt]="avatar.name ?? 'User avatar'"
|
|
3092
|
+
[class]="itemClass($index)"
|
|
3093
|
+
>{{ toInitials(avatar.name) }}</bui-avatar
|
|
3094
|
+
>
|
|
3095
|
+
}
|
|
3096
|
+
@if (remaining() > 0) {
|
|
3097
|
+
<span
|
|
3098
|
+
role="listitem"
|
|
3099
|
+
[attr.aria-label]="'and ' + remaining() + ' more'"
|
|
3100
|
+
[class]="moreClass()"
|
|
3101
|
+
>
|
|
3102
|
+
<span aria-hidden="true">+{{ remaining() }}</span>
|
|
3103
|
+
</span>
|
|
3104
|
+
}
|
|
3105
|
+
`, isInline: true, dependencies: [{ kind: "component", type: BuiAvatar, selector: "bui-avatar", inputs: ["src", "alt", "class"] }] });
|
|
3106
|
+
}
|
|
3107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiAvatarGroup, decorators: [{
|
|
3108
|
+
type: Component,
|
|
3109
|
+
args: [{
|
|
3110
|
+
selector: 'bui-avatar-group',
|
|
3111
|
+
imports: [BuiAvatar],
|
|
3112
|
+
host: { 'data-slot': 'avatar-group', role: 'list', '[class]': 'computedClass()' },
|
|
3113
|
+
template: `
|
|
3114
|
+
@for (avatar of shown(); track $index) {
|
|
3115
|
+
<bui-avatar
|
|
3116
|
+
role="listitem"
|
|
3117
|
+
[src]="avatar.src ?? null"
|
|
3118
|
+
[alt]="avatar.name ?? 'User avatar'"
|
|
3119
|
+
[class]="itemClass($index)"
|
|
3120
|
+
>{{ toInitials(avatar.name) }}</bui-avatar
|
|
3121
|
+
>
|
|
3122
|
+
}
|
|
3123
|
+
@if (remaining() > 0) {
|
|
3124
|
+
<span
|
|
3125
|
+
role="listitem"
|
|
3126
|
+
[attr.aria-label]="'and ' + remaining() + ' more'"
|
|
3127
|
+
[class]="moreClass()"
|
|
3128
|
+
>
|
|
3129
|
+
<span aria-hidden="true">+{{ remaining() }}</span>
|
|
3130
|
+
</span>
|
|
3131
|
+
}
|
|
3132
|
+
`,
|
|
3133
|
+
}]
|
|
3134
|
+
}], propDecorators: { avatars: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatars", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3135
|
+
|
|
2602
3136
|
/*
|
|
2603
3137
|
* Public API Surface of ng-blatui
|
|
2604
3138
|
*/
|
|
@@ -2607,5 +3141,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
2607
3141
|
* Generated bundle index. Do not edit.
|
|
2608
3142
|
*/
|
|
2609
3143
|
|
|
2610
|
-
export { BuiAccordion, BuiAccordionContent, BuiAccordionItem, BuiAccordionTrigger, BuiAlert, BuiAlertDescription, BuiAlertTitle, BuiAspectRatio, BuiAvatar, BuiBadge, BuiBreadcrumb, BuiBreadcrumbEllipsis, BuiBreadcrumbItem, BuiBreadcrumbLink, BuiBreadcrumbList, BuiBreadcrumbPage, BuiBreadcrumbSeparator, BuiButton, BuiButtonGroup, BuiButtonGroupText, BuiCard, BuiCardAction, BuiCardContent, BuiCardDescription, BuiCardFooter, BuiCardHeader, BuiCardTitle, BuiCheckbox, BuiCollapsible, BuiCollapsibleContent, BuiCollapsibleTrigger, BuiContainer, BuiDialogContent, BuiDialogDescription, BuiDialogFooter, BuiDialogHeader, BuiDialogTitle, BuiEmpty, BuiEmptyContent, BuiEmptyDescription, BuiEmptyHeader, BuiEmptyMedia, BuiEmptyTitle, BuiField, BuiFieldContent, BuiFieldDescription, BuiFieldError, BuiFieldGroup, BuiFieldLabel, BuiFieldLegend, BuiFieldSeparator, BuiFieldSet, BuiFieldTitle, BuiInput, BuiKbd, BuiLabel, BuiProgress, BuiRadioGroup, BuiRadioGroupItem, BuiSeparator, BuiSkeleton, BuiSwitch, BuiTabList, BuiTabPanel, BuiTabTrigger, BuiTabs, BuiTextarea, BuiThemeCustomizer, BuiTooltip, BuiTooltipContent, THEME_TOKENS, ThemeStore, buttonVariants, cn };
|
|
3144
|
+
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, BuiKbd, BuiLabel, BuiProgress, BuiRadioGroup, BuiRadioGroupItem, 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 };
|
|
2611
3145
|
//# sourceMappingURL=ng-blatui.mjs.map
|