shirkasoft-ui-components 1.0.1 → 1.0.5
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.
|
@@ -2681,11 +2681,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImpo
|
|
|
2681
2681
|
class TooltipComponent {
|
|
2682
2682
|
text = input('', ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
2683
2683
|
position = input('bottom', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
2684
|
+
mode = input('hover', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
2685
|
+
offset = input(8, ...(ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []));
|
|
2686
|
+
elementRef = inject(ElementRef);
|
|
2687
|
+
tooltipX = signal(0, ...(ngDevMode ? [{ debugName: "tooltipX" }] : /* istanbul ignore next */ []));
|
|
2688
|
+
tooltipY = signal(0, ...(ngDevMode ? [{ debugName: "tooltipY" }] : /* istanbul ignore next */ []));
|
|
2689
|
+
onMouseEnter() {
|
|
2690
|
+
if (this.mode() !== 'fixed')
|
|
2691
|
+
return;
|
|
2692
|
+
const host = this.elementRef.nativeElement;
|
|
2693
|
+
const container = host.querySelector('.group');
|
|
2694
|
+
if (!container)
|
|
2695
|
+
return;
|
|
2696
|
+
const rect = container.getBoundingClientRect();
|
|
2697
|
+
const off = this.offset();
|
|
2698
|
+
if (this.position() === 'right') {
|
|
2699
|
+
this.tooltipX.set(rect.right + off);
|
|
2700
|
+
this.tooltipY.set(rect.top + rect.height / 2);
|
|
2701
|
+
}
|
|
2702
|
+
else if (this.position() === 'bottom') {
|
|
2703
|
+
this.tooltipX.set(rect.left + rect.width / 2);
|
|
2704
|
+
this.tooltipY.set(rect.bottom + off);
|
|
2705
|
+
}
|
|
2706
|
+
else {
|
|
2707
|
+
this.tooltipX.set(rect.left + rect.width / 2);
|
|
2708
|
+
this.tooltipY.set(rect.top - off);
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2684
2711
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2685
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.18", type: TooltipComponent, isStandalone: true, selector: "shk-tooltip", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
2712
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.18", type: TooltipComponent, isStandalone: true, selector: "shk-tooltip", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()" } }, ngImport: i0, template: `
|
|
2686
2713
|
<div class="relative group inline-flex">
|
|
2687
2714
|
<ng-content></ng-content>
|
|
2688
|
-
@if (text()) {
|
|
2715
|
+
@if (text() && mode() === 'hover') {
|
|
2689
2716
|
<span
|
|
2690
2717
|
class="absolute px-2 py-1 text-xs _shk-bg-tooltip _shk-text-tooltip rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition pointer-events-none z-[9999] shadow-lg"
|
|
2691
2718
|
[class.top-full]="position() === 'bottom'"
|
|
@@ -2702,6 +2729,16 @@ class TooltipComponent {
|
|
|
2702
2729
|
{{ text() }}
|
|
2703
2730
|
</span>
|
|
2704
2731
|
}
|
|
2732
|
+
@if (text() && mode() === 'fixed') {
|
|
2733
|
+
<span
|
|
2734
|
+
class="fixed px-2 py-1 text-xs _shk-bg-tooltip _shk-text-tooltip rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition pointer-events-none z-[9999] shadow-lg"
|
|
2735
|
+
[style.top.px]="tooltipY()"
|
|
2736
|
+
[style.left.px]="tooltipX()"
|
|
2737
|
+
[style.transform]="position() === 'right' ? 'translateY(-50%)' : ''"
|
|
2738
|
+
>
|
|
2739
|
+
{{ text() }}
|
|
2740
|
+
</span>
|
|
2741
|
+
}
|
|
2705
2742
|
</div>
|
|
2706
2743
|
`, isInline: true });
|
|
2707
2744
|
}
|
|
@@ -2713,7 +2750,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImpo
|
|
|
2713
2750
|
template: `
|
|
2714
2751
|
<div class="relative group inline-flex">
|
|
2715
2752
|
<ng-content></ng-content>
|
|
2716
|
-
@if (text()) {
|
|
2753
|
+
@if (text() && mode() === 'hover') {
|
|
2717
2754
|
<span
|
|
2718
2755
|
class="absolute px-2 py-1 text-xs _shk-bg-tooltip _shk-text-tooltip rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition pointer-events-none z-[9999] shadow-lg"
|
|
2719
2756
|
[class.top-full]="position() === 'bottom'"
|
|
@@ -2730,10 +2767,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImpo
|
|
|
2730
2767
|
{{ text() }}
|
|
2731
2768
|
</span>
|
|
2732
2769
|
}
|
|
2770
|
+
@if (text() && mode() === 'fixed') {
|
|
2771
|
+
<span
|
|
2772
|
+
class="fixed px-2 py-1 text-xs _shk-bg-tooltip _shk-text-tooltip rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition pointer-events-none z-[9999] shadow-lg"
|
|
2773
|
+
[style.top.px]="tooltipY()"
|
|
2774
|
+
[style.left.px]="tooltipX()"
|
|
2775
|
+
[style.transform]="position() === 'right' ? 'translateY(-50%)' : ''"
|
|
2776
|
+
>
|
|
2777
|
+
{{ text() }}
|
|
2778
|
+
</span>
|
|
2779
|
+
}
|
|
2733
2780
|
</div>
|
|
2734
2781
|
`,
|
|
2735
2782
|
}]
|
|
2736
|
-
}], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }] } }
|
|
2783
|
+
}], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], onMouseEnter: [{
|
|
2784
|
+
type: HostListener,
|
|
2785
|
+
args: ['mouseenter']
|
|
2786
|
+
}] } });
|
|
2737
2787
|
|
|
2738
2788
|
/* Theme — import theme.css in your global styles.css:
|
|
2739
2789
|
@import '@shirkasoft/ui-components/theme.css';
|